/* =========================================================
   applepaycasino.se — huvudstilmall
   ========================================================= */

:root {
  --bg: #f2f2f4;
  --surface: #ffffff;
  --black: #000000;
  --text: #000000;
  --muted: #55555c;
  --line: #d9d9de;
  --white: #ffffff;

  --radius-s: 8px;
  --radius-m: 14px;
  --radius-pill: 999px;

  --container: 1100px;
  --content: 760px;
  --header-h: 68px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Grund ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
}

img, svg, video { max-width: 100%; height: auto; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 3px;
}

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--black);
  color: var(--white);
}

.header__inner {
  max-width: var(--container);
  height: var(--header-h);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header__logo { display: flex; align-items: center; flex-shrink: 0; }
.header__logo img { display: block; height: 36px; width: auto; }

.header__actions { display: flex; align-items: center; gap: 10px; }

.hbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .2s, color .2s, border-color .2s;
}

.hbtn--demo {
  color: var(--white);
  border: 1.5px solid rgba(255, 255, 255, .55);
}
.hbtn--demo:hover { border-color: var(--white); background: rgba(255, 255, 255, .08); }

.hbtn--play {
  color: var(--black);
  background: var(--white);
  border: 1.5px solid var(--white);
}
.hbtn--play:hover { background: #e6e6ea; border-color: #e6e6ea; }

.header .hbtn:focus-visible { outline-color: var(--white); }

/* ---------- Main (allt innehåll stylas här, utan extra div) ---------- */
main {
  flex: 1 0 auto;
  width: 100%;
  max-width: calc(var(--content) + 40px);
  margin: 0 auto;
  padding: 48px 20px 64px;
  overflow-wrap: break-word;
}

/* Rubriker */
main h1, main h2, main h3, main h4, main h5, main h6 {
  font-family: var(--font-display);
  color: var(--black);
  line-height: 1.2;
  margin: 1.8em 0 .6em;
}
main h1 {
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 800;
  letter-spacing: -.025em;
  margin-top: 0;
}
main h2 { font-size: clamp(24px, 3.4vw, 32px); font-weight: 700; letter-spacing: -.015em; }
main h3 { font-size: clamp(20px, 2.6vw, 24px); font-weight: 700; }
main h4 { font-size: 19px; font-weight: 700; }
main h5, main h6 { font-size: 17px; font-weight: 700; }

/* Text */
main p { margin: 0 0 1.15em; }
main strong, main b { font-weight: 700; }
main small { font-size: .85em; color: var(--muted); }
main mark { background: var(--black); color: var(--white); padding: 0 .25em; }

main a:not(.main-btn) {
  color: var(--black);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
main a:not(.main-btn):hover { text-decoration-thickness: 2px; }

/* Listor */
main ul, main ol { margin: 0 0 1.3em; padding-left: 1.4em; }
main li { margin-bottom: .45em; }
main li::marker { color: var(--black); font-weight: 700; }
main li > ul, main li > ol { margin: .45em 0 0; }

/* Citat */
main blockquote {
  margin: 1.8em 0;
  padding: 18px 24px;
  background: var(--surface);
  border-left: 4px solid var(--black);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  font-size: 1.05em;
}
main blockquote p:last-child { margin-bottom: 0; }

main hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }

/* Kod */
main code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
  background: #e4e4e8;
  padding: .1em .35em;
  border-radius: 4px;
}
main pre {
  overflow-x: auto;
  background: var(--black);
  color: var(--white);
  padding: 16px 20px;
  border-radius: var(--radius-s);
}
main pre code { background: none; padding: 0; color: inherit; }

/* Bilder mellan stycken */
main img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.8em auto;
  border-radius: var(--radius-m);
}
main figure { margin: 1.8em 0; }
main figure img { margin: 0 auto; }
main figcaption {
  margin-top: .6em;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

/* Tabeller */
main table {
  width: 100%;
  margin: 1.8em 0;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  overflow: hidden;
  font-size: 15px;
  line-height: 1.45;
}
main caption {
  caption-side: top;
  text-align: left;
  font-weight: 700;
  padding: 0 0 .6em;
}
main th, main td {
  padding: 13px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
main thead th {
  background: var(--black);
  color: var(--white);
  font-weight: 600;
  border-bottom: 0;
}
main tbody tr:nth-child(even) { background: #f7f7f9; }
main tbody tr:last-child td,
main tbody tr:last-child th { border-bottom: 0; }

/* Knappmall i mitten */
main .main-btn {
  display: table;
  margin: 2em auto;
  padding: 16px 44px;
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius-pill);
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: transform .15s, box-shadow .2s;
}
main .main-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .6);
}
main .main-btn:active { transform: translateY(0); }

/* ---------- Författarblock ---------- */
main .author {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-top: 3em;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}
main .author__avatar {
  flex-shrink: 0;
  width: 88px;
  height: 88px;
  margin: 0;
  border-radius: 50%;
  object-fit: cover;
  background: #e4e4e8;
}
main .author__body { min-width: 0; }
main .author__label {
  margin: 0 0 2px;
  font-size: 14px;
  color: var(--muted);
}
main .author__name {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.3;
}
main .author__text { margin: 0; }

/* ---------- Footer ---------- */
.footer {
  background: var(--black);
  color: #c9c9ce;
  font-size: 15px;
  line-height: 1.6;
}
.footer__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 44px 20px 36px;
}
.footer__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid #2a2a2e;
}
.footer__logo img { display: block; height: 34px; width: auto; }

.footer__nav,
.footer__orgs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.footer__heading {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
}
.footer a { color: var(--white); text-decoration: none; }
.footer a:hover { text-decoration: underline; text-underline-offset: 3px; }
.footer a:focus-visible { outline-color: var(--white); }

.footer__text { margin: 24px 0 0; max-width: 900px; }

/* ---------- Till toppen ---------- */
.to-top {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 60;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--black);
  color: var(--white);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .25s, transform .25s, visibility .25s, bottom .3s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top svg { width: 20px; height: 20px; }

/* ---------- Popup ---------- */
.popup {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 70;
  width: calc(100% - 32px);
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 44px 14px 16px;
  background: var(--black);
  color: var(--white);
  border: 1px solid #2a2a2e;
  border-radius: var(--radius-m);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .55);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 130%);
  transition: transform .45s cubic-bezier(.2, .8, .2, 1), opacity .3s, visibility .45s;
}
.popup.is-open { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

.popup__logo { flex-shrink: 0; width: 44px; height: 44px; border-radius: 10px; }
.popup__text { flex: 1; min-width: 0; margin: 0; font-size: 15px; line-height: 1.4; }
.popup__btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 20px;
  background: var(--white);
  color: var(--black);
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.popup__btn:hover { background: #e6e6ea; }
.popup__close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #a1a1a8;
  cursor: pointer;
}
.popup__close:hover { color: var(--white); background: rgba(255, 255, 255, .1); }
.popup__close svg { width: 16px; height: 16px; }
.popup a:focus-visible, .popup button:focus-visible { outline-color: var(--white); }

/* När popupen är öppen flyttas pilen upp så att de inte överlappar */
body.popup-open .to-top { bottom: 120px; }

/* ---------- 404 ---------- */
main.error-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding-top: 72px;
  padding-bottom: 88px;
}
main .error-page__code {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(96px, 22vw, 180px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.05em;
}
main.error-page h1 { margin: .3em 0 .4em; font-size: clamp(26px, 4vw, 36px); }
main.error-page p { color: var(--muted); max-width: 440px; margin-left: auto; margin-right: auto; }

/* ---------- Surfplatta ---------- */
@media (max-width: 900px) {
  main { padding-top: 36px; }
}

/* ---------- Mobil ---------- */
@media (max-width: 768px) {
  :root { --header-h: 60px; }
  body { font-size: 16px; }

  .header__inner { padding: 0 14px; gap: 10px; }
  .header__logo img { height: 30px; }
  .header__actions { gap: 8px; }
  .hbtn { min-height: 38px; padding: 0 14px; font-size: 14px; }

  main { padding: 28px 16px 48px; }

  /* Tabeller scrollas horisontellt i stället för att sträcka ut sidan */
  main table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    font-size: 14px;
  }
  main th, main td { padding: 11px 13px; min-width: 120px; }

  main iframe, main video { display: block; max-width: 100%; }

  main .main-btn { padding: 15px 32px; max-width: 100%; }

  main .author { flex-direction: column; align-items: center; text-align: center; padding: 22px 18px; }
  main .author__avatar { width: 80px; height: 80px; }

  .footer__inner { padding: 36px 16px 30px; }
  .footer__top { flex-direction: column; gap: 22px; }

  .to-top { right: 14px; bottom: 16px; width: 44px; height: 44px; }

  .popup {
    bottom: 12px;
    width: calc(100% - 24px);
    flex-wrap: wrap;
    padding: 14px 40px 14px 14px;
    gap: 12px;
  }
  .popup__logo { width: 38px; height: 38px; }
  .popup__text { font-size: 14px; }
  .popup__btn { width: 100%; justify-content: center; }
  body.popup-open .to-top { bottom: 150px; }
}

@media (max-width: 380px) {
  .header__logo img { height: 26px; }
  .hbtn { padding: 0 11px; font-size: 13px; }
}

/* ---------- Minskad rörelse ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
