/* ============================================================
   Iskra Worlds — design tokens & components
   Mirrors the design system from the compiled landing export.
   ============================================================ */

:root {
  /* Brand */
  --primary: #FB4D3D;
  --primary-press: #E23D2E;
  --secondary: #2D5BFF;
  --secondary-press: #1E47E0;
  --accent: #FFC02E;
  --accent-press: #F0AE12;

  --on-primary: #FFFFFF;
  --on-secondary: #FFFFFF;
  --on-accent: #15171C;

  /* Surfaces & ink */
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #ECEEF2;
  --ink: #15171C;
  --ink-soft: #6C707A;
  --ink-softer: #9498A1;
  --line: #E2E5EA;

  /* World palettes */
  --jungle-a: #2E8B6F;  --jungle-b: #F0AE12;
  --galaxy-a: #3F4FC4;  --galaxy-b: #6F86F5;
  --pirate-a: #E8743B;  --pirate-b: #2E8B6F;
  --fairy-a:  #B566D6;  --fairy-b:  #FF9CC4;

  /* Companion colors */
  --fox: #E8743B;
  --owl: #5E7CE0;
  --bear: #B07A4A;

  /* Radii */
  --r-sm: 12px;
  --r-md: 20px;
  --r-lg: 30px;
  --r-xl: 38px;
  --r-pill: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(21,23,28,.06);
  --shadow-md: 0 8px 18px -10px rgba(21,23,28,.14);
  --shadow-lg: 0 18px 36px -16px rgba(21,23,28,.18);
  --shadow-xl: 0 40px 80px -32px rgba(21,23,28,.28);
  --primary-shadow: 0 10px 22px -10px color-mix(in srgb, var(--primary) 50%, transparent);

  /* Fonts */
  --font-display: 'Nunito', system-ui, sans-serif;
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, .font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }

a { color: inherit; text-decoration: none; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

/* Language switcher: custom dropdown arrow with breathing room, and a stable
   min-width so the header doesn't jump when switching between locales. */
.lang-select {
  font-family: var(--font-ui); font-weight: 600; font-size: 14px;
  min-width: 116px;
  padding: 8px 38px 8px 14px;
  border-radius: 999px; border: 1.5px solid var(--line);
  background-color: var(--surface); color: var(--ink); cursor: pointer;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23475569' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.lang-select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---- Buttons -------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-ui); font-weight: 700; font-size: 15px;
  padding: 13px 22px; border-radius: var(--r-pill); border: 0; cursor: pointer;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
  text-align: center;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--primary-shadow); }
.btn-primary:hover { background: var(--primary-press); }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }

/* ---- Store badges (official Apple / Google artwork) ---------- */
/* Apple's SVG is the badge itself; Google's PNG carries ~16% transparent padding
   top/bottom, so it's rendered taller (40 vs 60) to make the visible buttons match,
   and centered so they sit on the same line. Don't restyle the artwork itself. */
.store-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.store-badge { display: inline-flex; transition: transform .15s ease, opacity .15s ease; }
.store-badge:hover { transform: translateY(-1px); opacity: .9; }
.store-badge img { display: block; width: auto; }
.store-badge--apple img { height: 40px; }
.store-badge--google img { height: 60px; }

/* ---- Pills / eyebrows ---------------------------------------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-soft);
}
.kicker {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--primary); font-weight: 600;
}

/* ---- Cards --------------------------------------------------- */
.card {
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-md);
}

/* ---- Hero ---------------------------------------------------- */
.hero-card { padding: 22px; }
.hero-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; margin-bottom: 16px; }
.hero-card-art {
  border-radius: var(--r-md); min-height: 230px;
  display: flex; align-items: flex-end; padding: 18px; margin-bottom: 18px;
  position: relative; overflow: hidden;
  background-color: var(--jungle-a);
  background-size: cover; background-position: center;
}
.hero-card-art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,.6), rgba(0,0,0,.1) 60%, rgba(0,0,0,0) 85%);
}
.hero-card-art > div { position: relative; z-index: 1; text-shadow: 0 1px 4px rgba(0,0,0,.4); }
.hero-cast-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px;
}
.hero-cast-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.hero-cast-row {
  padding: 10px 12px; border-radius: var(--r-md);
  border: 1.5px solid transparent; background: var(--bg);
}
.hero-cast-row.is-hero {
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 35%, transparent);
}
.hero-cast-meta { min-width: 0; }
.hero-cast-meta > div:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-cast-star { margin-left: auto; color: var(--accent); font-size: 16px; line-height: 1; }
.hero-footnote {
  display: flex; flex-wrap: wrap; gap: 4px 6px;
  margin-top: 18px; font-size: 13px; font-weight: 500;
}

@media (max-width: 820px) {
  .hero-copy { order: -1; }
  .hero-card { max-width: 520px; }
}
@media (max-width: 420px) {
  .hero-cast-grid { grid-template-columns: 1fr; }
}

/* ---- Cast chips --------------------------------------------- */
.cast-row { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 40px; height: 40px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-family: var(--font-display); flex: 0 0 auto;
}
.avatar-img {
  background-size: cover; background-position: center;
  background-color: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line);
}

/* ---- Companion gallery -------------------------------------- */
.companions-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.companion-card { text-align: center; }
.companion-img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
  border-radius: var(--r-md); background: var(--surface);
  box-shadow: var(--shadow-sm); margin-bottom: 10px; display: block;
}
@media (max-width: 820px) { .companions-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---- World tiles -------------------------------------------- */
.world-tile {
  border-radius: var(--r-md); padding: 16px; color: #fff;
  display: flex; flex-direction: column; justify-content: flex-end;
  box-shadow: var(--shadow-md); position: relative; overflow: hidden;
  aspect-ratio: 16 / 9;
  /* fallback shown while the art loads or if it 404s */
  background-color: var(--jungle-a);
  background-size: cover; background-position: center;
}
/* legibility scrim so the white label stays readable over any art */
.world-tile::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,.6), rgba(0,0,0,.08) 55%, rgba(0,0,0,0) 80%);
}
.world-tile-meta { position: relative; z-index: 1; text-shadow: 0 1px 3px rgba(0,0,0,.35); }

/* ---- Chips -------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; padding: 8px 14px; border-radius: var(--r-pill);
  background: var(--surface); border: 1.5px solid var(--line); font-weight: 600; font-size: 14px;
}
.chip-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---- Prose (legal / help) ----------------------------------- */
.prose { max-width: 70ch; margin: 0 auto; color: var(--ink-soft); line-height: 1.7; }
.prose h1 { color: var(--ink); font-size: clamp(30px,4vw,42px); font-weight: 800; margin-bottom: 8px; }
.prose h2 { color: var(--ink); font-size: 22px; font-weight: 700; margin: 32px 0 10px; font-family: var(--font-display); }
.prose p { margin-bottom: 14px; }
.prose ul { margin: 0 0 14px 20px; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--primary); text-decoration: underline; }
.prose a.btn { text-decoration: none; }
.prose a.btn-primary { color: var(--on-primary); }
.prose a.btn-ghost { color: var(--ink); }
.notice {
  background: #FFF7E6; border: 1px solid var(--accent); color: #6b5200;
  border-radius: var(--r-sm); padding: 12px 16px; font-size: 14px; margin: 18px 0 28px;
}

/* ---- Sections ----------------------------------------------- */
.section { padding: 84px 0; }
.section-tight { padding: 56px 0; }

/* ---- Dark section (For grown-ups) --------------------------- */
.dark-panel {
  background: #15171C; color: #fff; border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl); position: relative; overflow: hidden;
}
.dark-panel .muted { color: rgba(255,255,255,.66); }

/* ---- Layout grids ------------------------------------------ */
.hero-grid { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: 56px; align-items: center; }
.split { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.worlds-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grown-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.bullets { list-style: none; display: grid; gap: 12px; }
.bullets li { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-soft); }
.bullets .tick { color: var(--primary); font-weight: 800; flex: 0 0 auto; }

@media (max-width: 960px) {
  .grown-grid { grid-template-columns: repeat(2, 1fr); }
  .worlds-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .hero-grid, .split { grid-template-columns: 1fr; gap: 36px; }
  .steps-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .grown-grid { grid-template-columns: 1fr; }
  .worlds-grid { grid-template-columns: 1fr; }
  .companions-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Utility ------------------------------------------------ */
.text-soft { color: var(--ink-soft); }
.text-softer { color: var(--ink-softer); }
.text-primary { color: var(--primary); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600;
}
.skip-link:focus { left: 16px; }

@media (max-width: 720px) {
  .section { padding: 56px 0; }
}

/* ============================================================
   Header nav + footer layout
   These live in CSS (not inline style=) so the responsive overrides
   below can actually win — inline styles outrank media queries.
   ============================================================ */
.site-nav { display: flex; align-items: center; gap: 22px; font-weight: 600; font-size: 15px; }

.site-footer-main {
  padding: 40px 24px;
  display: flex; flex-wrap: wrap; gap: 20px;
  justify-content: space-between; align-items: center;
}
.site-footer-nav { display: flex; flex-wrap: wrap; gap: 14px 22px; font-size: 14px; }

/* ============================================================
   Mobile refinements
   ============================================================ */

/* Guard against accidental horizontal scroll from any single wide element.
   `clip` (not `hidden`) so it doesn't create a scroll container that would
   break the sticky header. */
html, body { overflow-x: clip; }
img { max-width: 100%; }

/* Collapse the header to its compact form at the same 820px breakpoint where
   the hero/split layouts go single-column. The inline nav links are long
   (much longer in mk/sr) and otherwise wrap to two cramped lines in the tablet
   band, so we hide them and keep just the logo + a comfortably sized language
   switcher. The hero and final sections carry the prominent store badges. */
@media (max-width: 820px) {
  .hide-mobile { display: none; }
  .site-nav { gap: 14px; }

  .lang-select {
    min-width: 0;          /* let it size to its content instead of a fixed 116px */
    min-height: 40px;      /* a proper tap target */
    padding: 8px 36px 8px 14px;
  }

  /* Centre the hero store badges + footnote once the hero stacks into one column. */
  .hero-copy .store-badges { justify-content: center; }
  .hero-footnote { justify-content: center; text-align: center; }
}

@media (max-width: 720px) {
  /* Footer: stop justify-content:space-between from creating odd gaps once the
     row wraps — keep everything left-aligned with even spacing. */
  .site-footer-main { justify-content: flex-start; gap: 16px 24px; }
}

@media (max-width: 520px) {
  /* Stack the footer so the logo sits above the links, all left-aligned. */
  .site-footer-main { flex-direction: column; align-items: flex-start; }
}
