/* Kubb Toss site — one design system for all pages.
   Warm wooden board-game on a summer lawn. Fredoka (self-hosted, OFL) site-wide to match the app;
   system stack only as a fallback while the webfont loads. No frameworks, no third-party CDNs.
   Contrast rules (WCAG AA, measured):
     --ink on --cream  10.9:1   --ink on --surface 8.7:1   (body text lives here)
     --ink-2 on --cream 6.1:1   --ink-2 on --surface 4.9:1  (secondary text ONLY on cream/surface)
     --ink-2 on --sky-top 3.25:1 -> FAILS, so any text over the sky band uses --ink.
     download CTA chip = --surface fill + --oak border + --ink text (8.7:1), never cream-on-oak. */

:root {
  /* palette (from the app's Palette.swift) */
  --cream: #f7ebcc;
  --cream-deep: #f1e0b8;
  --sky-top: #8cb3cc;
  --surface: #e6d1ae;
  --surface-hi: #efdcbb;
  --border: #9e7a52;
  --oak: #cc7347;
  --oak-fill: #eb934d;
  --oak-track: #854d33;
  --ink: #402e1f;
  --ink-2: #6b523d;
  --on-oak: #fcf2e0;
  /* pitch */
  --turf: #6f9c4a;
  --turf-dark: #5f8a3f;
  --line: #f4f7ee;
  --gold: #e7b94c;
  --gold-deep: #c9982f;

  /* type scale (~1.25) */
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0: 1.0625rem;
  --step-1: clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  --step-2: clamp(1.45rem, 1.25rem + 1vw, 1.95rem);
  --step-3: clamp(1.8rem, 1.4rem + 2vw, 2.6rem);
  --display: clamp(2.3rem, 1.6rem + 3.6vw, 4.6rem);

  --maxw: 64rem;
  --readw: 40rem; /* ~66ch */
  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 10px 30px -14px rgba(40, 30, 20, 0.45);
  --shadow-sm: 0 4px 14px -8px rgba(40, 30, 20, 0.5);

  /* Fredoka (self-hosted, OFL) site-wide to match the app; system stack is the fallback. */
  --font: "Fredoka", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Fredoka", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@font-face {
  font-family: "Fredoka";
  src: url("assets/fonts/fredoka.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* z-index scale */
:root {
  --z-skip: 100;
  --z-nav: 50;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.62;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

/* ---- typography ---- */
h1,
h2,
h3 {
  margin: 0 0 0.4em;
  font-family: var(--font-display);
  line-height: 1.08;
  text-wrap: balance;
  letter-spacing: -0.01em;
}

.display {
  font-family: var(--font-display);
  font-size: var(--display);
  font-weight: 700;
  line-height: 1.0;
  letter-spacing: -0.015em;
}

h2 {
  font-size: var(--step-2);
  font-weight: 750;
}

h3 {
  font-size: var(--step-1);
  font-weight: 700;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 1rem;
  max-width: var(--readw);
  text-wrap: pretty;
}

.lede {
  font-size: var(--step-1);
  color: var(--ink);
  max-width: 46rem;
}

a {
  color: var(--oak-track);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
a:hover {
  color: var(--oak);
}

strong {
  font-weight: 700;
}

/* ---- layout ---- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2.5rem);
}

main {
  display: block;
}

.section {
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
}

/* ---- skip link ---- */
.skip {
  position: absolute;
  left: 0.5rem;
  top: 0.5rem;
  z-index: var(--z-skip);
  transform: translateY(-150%);
  background: var(--ink);
  color: var(--on-oak);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 650;
  text-decoration: none;
  transition: transform 0.15s ease-out;
}
.skip:focus {
  transform: translateY(0);
}

/* ---- nav ---- */
.nav {
  position: relative;
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.1rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-1);
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.wordmark .mark {
  width: 1.7em;
  height: 1.7em;
  flex: 0 0 auto;
  border-radius: 23%;
  box-shadow: 0 1px 3px rgba(40, 30, 20, 0.32);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 3vw, 1.9rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-links a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--step--1);
  white-space: nowrap;
}
.nav-links a:hover {
  color: var(--oak-track);
  text-decoration: underline;
}

/* ---- hero (landing) ---- */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top) 0%, #bcc9b4 46%, var(--cream) 92%);
}
.hero-grid {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  padding-block: clamp(1.5rem, 4vw, 3rem) clamp(0, 0, 0);
}
.hero-copy {
  max-width: 34rem;
}
.eyebrow {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step--1);
  color: var(--ink); /* over the sky band: --ink is 5.9:1, --oak-track would be 3.0:1 (F-AR-001) */
  letter-spacing: 0.01em;
  margin: 0 0 0.8rem;
}
.hero h1 {
  margin-bottom: 0.5rem;
}
.hero .sub {
  font-size: var(--step-1);
  color: var(--ink);
  max-width: 26rem;
  margin-bottom: 1.6rem;
}

/* a real app screenshot, framed in a phone bezel */
.hero-art {
  display: flex;
  justify-content: center;
}
/* Realistic device mockup (same frame as the App Store screenshots). The PNG is the bezel; the
   screenshot is overlaid in the measured screen window (mockup is 1022x2082, screen 52,46 / 918x1990). */
.phone-frame {
  position: relative;
  width: min(78%, 300px);
  aspect-ratio: 1022 / 2082;
  filter: drop-shadow(0 26px 48px rgba(40, 30, 20, 0.55));
}
.phone-frame .mk {
  width: 100%;
  height: 100%;
  display: block;
}
.phone-frame .screen {
  position: absolute;
  left: 5.088%;
  top: 2.209%;
  width: 89.824%;
  height: 95.581%;
  overflow: hidden;
  border-radius: 13.7% / 6.33%;
}
.phone-frame .screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
}

/* ---- App Store official badge (Apple-provided artwork; left unmodified per the badge guidelines:
       no recolouring, effects, or distortion. Only an a11y focus ring outside the artwork). ---- */
.appstore-badge {
  display: inline-block;
}
.appstore-badge img {
  height: 52px;
  width: auto;
  display: block;
}
.appstore-badge:focus-visible {
  outline: 3px solid var(--oak);
  outline-offset: 3px;
  border-radius: 8px;
}

/* The selling points that used to sit on the chip ("free"), now a small line under the badge. */
.hero-note {
  margin: 0.7rem 0 0;
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--ink);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.4rem;
  margin-top: 1.5rem;
  font-weight: 600;
  font-size: var(--step--1);
}
.hero-links a {
  color: var(--oak-track);
}

/* ---- "what it is" row ---- */
.points {
  display: grid;
  gap: 1.1rem 2rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}
.points li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: start;
}
.points .ico {
  width: 2.2rem;
  height: 2.2rem;
  flex: 0 0 auto;
  margin-top: 0.1rem;
}
.points b {
  display: block;
  font-weight: 750;
  margin-bottom: 0.1rem;
}
.points span {
  color: var(--ink-2);
  font-size: var(--step--1);
  line-height: 1.5;
}

/* ---- inner page header band ---- */
.pagehead {
  position: relative;
  /* resolves to cream behind the title text so kicker/h1/updated stay AA; the green lawn accent is
     the separate .turf-strip below, not the text background (F-AR-001). */
  background: linear-gradient(180deg, var(--sky-top) 0%, #cdd8c6 42%, var(--cream) 82%);
  padding-bottom: 0;
}
.pagehead .nav .wordmark,
.pagehead .nav-links a {
  color: var(--ink);
}
.pagehead-inner {
  padding-block: clamp(1rem, 3vw, 2rem) clamp(2.2rem, 5vw, 3.4rem);
}
.pagehead h1 {
  font-size: var(--step-3);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin: 0;
}
.pagehead .kicker {
  font-weight: 700;
  font-size: var(--step--1);
  color: var(--ink); /* sits over the header band: --ink stays AA, --oak-track would not (F-AR-001) */
  letter-spacing: 0.01em;
  margin: 0 0 0.5rem;
}
/* turf strip with boundary line at the foot of the band */
.pagehead .turf-strip {
  height: 26px;
  background: repeating-linear-gradient(
      90deg,
      var(--turf) 0 28px,
      var(--turf-dark) 28px 56px
    );
  border-top: 3px solid var(--line);
}

/* ---- content panel (wood) ---- */
.panel {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.4rem, 4vw, 2.6rem);
}
.panel + .panel {
  margin-top: 1.4rem;
}

.prose {
  max-width: var(--readw);
}
.prose h2 {
  margin-top: 2rem;
  font-size: var(--step-1);
  font-weight: 750;
}
.prose h2:first-child {
  margin-top: 0;
}
.prose ul {
  margin: 0.6rem 0 1.1rem;
  padding-left: 1.25rem;
}
.prose li {
  margin: 0.35rem 0;
  max-width: var(--readw);
}
.prose .muted {
  color: var(--ink-2);
  font-size: var(--step--1);
}

.updated {
  color: var(--ink-2);
  font-size: var(--step--1);
  margin-top: 0.2rem;
}

/* ---- reading column (prose on cream, no card) ---- */
.reading {
  max-width: 42rem;
}
.reading > h2 {
  margin-top: clamp(2rem, 4vw, 2.8rem);
  font-size: var(--step-2);
  font-weight: 750;
}
.reading > h2:first-of-type {
  margin-top: 0;
}
.reading .intro {
  font-size: var(--step-1);
  color: var(--ink);
  max-width: 40rem;
}

/* ---- how-to-play steps (numbered, not cards) ---- */
.steps {
  list-style: none;
  margin: 1.4rem 0 0;
  padding: 0;
  display: grid;
  gap: clamp(1.1rem, 3vw, 1.6rem);
  counter-reset: step;
}
.steps > li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
}
.steps > li::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  background: var(--oak);
  color: var(--on-oak);
  font-weight: 800;
  font-size: 1.05rem; /* large + bold -> AA-large (3:1) over oak */
  box-shadow: var(--shadow-sm);
}
.steps b {
  display: block;
  font-weight: 750;
  font-size: var(--step-1);
  margin-bottom: 0.15rem;
}
.steps p {
  margin: 0;
  color: var(--ink);
}

/* ---- contact callout (the one legit card) ---- */
.callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.1rem, 3vw, 1.6rem) clamp(1.2rem, 3vw, 1.8rem);
  margin-top: clamp(2rem, 5vw, 3rem);
}
.callout .label {
  font-weight: 750;
}
.callout .muted {
  color: var(--ink-2);
  font-size: var(--step--1);
}

/* ---- FAQ ---- */
.faq {
  display: grid;
  gap: 1.3rem;
  margin: 0;
}
.faq .q {
  font-weight: 750;
  font-size: var(--step-1);
  margin: 0 0 0.25rem;
}
.faq .a {
  margin: 0;
  color: var(--ink);
}

/* ---- contact card ---- */
.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  background: var(--surface-hi);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
}
.contact .label {
  font-weight: 750;
}

/* ---- footer ---- */
.footer {
  background: var(--cream-deep);
  border-top: 2px solid var(--border);
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.5rem;
  padding-block: 1.6rem;
}
.footer .wm {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  color: var(--ink);
}
.footer .wm .mark {
  width: 1.5em;
  height: 1.5em;
  border-radius: 23%;
}
.footer .meta {
  color: var(--ink-2);
  font-size: var(--step--1);
}
.footer a {
  color: var(--oak-track);
}

/* ---- 404 ---- */
.notfound {
  text-align: center;
  padding-block: clamp(3rem, 9vw, 6rem);
}
.notfound .display {
  margin-bottom: 0.5rem;
}
.notfound p {
  margin-inline: auto;
}

/* ---- focus ---- */
:focus-visible {
  outline: 2px solid var(--oak);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- motion: entrance enhances an already-visible default ---- */
@media (prefers-reduced-motion: no-preference) {
  .anim-rise {
    animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  .phone-frame.anim-rise {
    animation-duration: 0.85s;
    animation-delay: 0.1s;
  }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---- responsive ---- */
@media (min-width: 56rem) {
  .hero-grid {
    grid-template-columns: 1.05fr 1fr;
    padding-block: clamp(2rem, 4vw, 3.4rem) 0;
  }
  .hero-copy {
    padding-bottom: clamp(2rem, 5vw, 3.5rem);
  }
}

@media (max-width: 30rem) {
  .nav-links {
    gap: 0.9rem;
  }
  .nav {
    flex-wrap: wrap;
  }
}
