/* ============================================================================
   Playfyn — landing page (focused split: screenshot carousel + signup)
   Cinematic minimal. Warm-neutral identity, adaptive accent.
   ========================================================================== */

/* ----- Tokens ------------------------------------------------------------- */
:root {
  --bg:          #0F0E0D;
  --bg-deep:     #0A0908;
  --surface:     #1A1815;
  --surface-2:   #232019;
  --ink:         #EFEAE2;
  --ink-muted:   #A39C92;
  --ink-faint:   #857E74;
  --line:        rgba(239, 234, 226, 0.10);
  --line-strong: rgba(239, 234, 226, 0.17);
  --accent:      #4DA3FF;
  --accent-press:#3D93F0;
  --accent-ink:  #08121E;
  --accent-glow: rgba(77, 163, 255, 0.34);
  --accent-soft: rgba(77, 163, 255, 0.12);
  --shadow:      0 30px 80px -28px rgba(0, 0, 0, 0.75);
  --shadow-sm:   0 2px 10px -2px rgba(0, 0, 0, 0.5);
  --grain:       0.035;

  --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
          Roboto, Helvetica, Arial, sans-serif;
  --step-body:    clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-lead:    clamp(1.05rem, 1rem + 0.4vw, 1.2rem);
  --step-h1:      clamp(1.9rem, 1.4rem + 2vw, 2.9rem);

  --gutter:       clamp(1.25rem, 4vw, 2.5rem);
  --maxw:         1200px;
  --radius:       16px;
  --radius-lg:    24px;

  --z-base: 2;
  --z-controls: 20;
  --z-float: 60;

  color-scheme: dark;
}

[data-theme="light"] {
  --bg:          #F6F2EB;
  --bg-deep:     #EFE9DF;
  --surface:     #FFFFFF;
  --surface-2:   #F0EADF;
  --ink:         #1B1714;
  --ink-muted:   #5E574E;
  --ink-faint:   #6E665B;
  --line:        rgba(27, 23, 20, 0.11);
  --line-strong: rgba(27, 23, 20, 0.18);
  --accent:      #B0492B;
  --accent-press:#9C3F24;
  --accent-ink:  #FFFFFF;
  --accent-glow: rgba(176, 73, 43, 0.24);
  --accent-soft: rgba(176, 73, 43, 0.09);
  --shadow:      0 30px 70px -30px rgba(73, 47, 30, 0.34);
  --shadow-sm:   0 2px 10px -3px rgba(73, 47, 30, 0.18);
  --grain:       0.022;
  color-scheme: light;
}

/* ----- Reset / base ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

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

body {
  font-family: var(--font);
  font-size: var(--step-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  transition: background-color 0.5s var(--ease-out), color 0.5s var(--ease-out);
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 5px; }
::selection { background: var(--accent); color: var(--accent-ink); }

h1, h2, h3 { font-weight: 700; line-height: 1.06; letter-spacing: -0.03em; text-wrap: balance; }
p { text-wrap: pretty; }

/* Film grain */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: var(--grain); mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

/* ----- Load reveal (enhances an already-visible default) ------------------ */
.js .reveal {
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ============================================================================
   PAGE SHELL — centered split, slim footer pinned below
   ========================================================================== */
.page { display: flex; flex-direction: column; min-height: 100dvh; }

.stage {
  flex: 1;
  display: flex;
  align-items: center;
  padding-block: clamp(3.5rem, 8vh, 6rem);
  position: relative;
  z-index: var(--z-base);
}

/* ambient theatre light */
.stage::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  top: 20%; left: 8%; width: min(50vw, 560px); aspect-ratio: 1;
  background: radial-gradient(circle, var(--accent-glow), transparent 65%);
  filter: blur(30px); opacity: 0.75;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: clamp(2.5rem, 6vw, 5.5rem);
  align-items: center;
  width: 100%;
}
@media (max-width: 940px) {
  .split { grid-template-columns: 1fr; gap: clamp(2.5rem, 7vw, 3.5rem); max-width: 33rem; margin-inline: auto; }
}

/* ----- floating theme toggle --------------------------------------------- */
.toggle-float { position: fixed; top: 1.1rem; right: 1.1rem; z-index: var(--z-float); }
.theme-toggle {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink-muted);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: color 0.2s var(--ease-out), background-color 0.2s var(--ease-out), transform 0.16s var(--ease-out);
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle:active { transform: scale(0.92); }
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ============================================================================
   SHOWCASE — screenshot carousel
   ========================================================================== */
.carousel { position: relative; }

.viewport {
  position: relative;
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, #2c2a27, #121110);
  padding: 11px;
  box-shadow: var(--shadow);
}
[data-theme="light"] .viewport { background: linear-gradient(160deg, #3a352f, #1a1815); }

.screen-window {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #0b0a09;
  /* clip the outer hairline so an adjacent slide can't bleed through the
     sub-pixel seam in the flex track (showed as a thin light line at the edges) */
  clip-path: inset(1px round 13px);
}
/* very subtle corner vignette so real screenshots still read as "on a screen" */
.screen-window::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background: radial-gradient(135% 100% at 50% 0%, transparent 72%, rgba(0,0,0,0.22));
}

.track {
  display: flex;
  height: 100%;
  transition: transform 0.6s var(--ease-out);
  will-change: transform;
}
@media (prefers-reduced-motion: reduce) { .track { transition: none; } }

.slide {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0a09;
}

/* real app screenshots fill the 16:9 frame */
.slide .shot { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ----- carousel controls -------------------------------------------------- */
.caret {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: var(--z-controls);
  width: clamp(38px, 4vw, 46px); height: clamp(38px, 4vw, 46px); border-radius: 50%;
  display: grid; place-items: center; color: var(--ink);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: transform 0.18s var(--ease-out), background-color 0.18s var(--ease-out), color 0.18s var(--ease-out);
}
.caret:hover { color: var(--accent); }
.caret:active { transform: translateY(-50%) scale(0.9); }
.caret svg { width: 20px; height: 20px; }
.caret.prev { left: clamp(-14px, -1.4vw, -8px); }
.caret.next { right: clamp(-14px, -1.4vw, -8px); }
@media (max-width: 480px) { .caret.prev { left: 6px; } .caret.next { right: 6px; } }

.carousel__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-top: 1.1rem; padding-inline: 0.2rem;
}
.dots { display: flex; gap: 0.5rem; }
.dot {
  width: 8px; height: 8px; border-radius: 999px; padding: 0;
  background: var(--line-strong);
  transition: width 0.25s var(--ease-out), background-color 0.25s var(--ease-out);
}
.dot[aria-current="true"] { width: 22px; background: var(--accent); }
.caption { font-size: 0.84rem; color: var(--ink-muted); font-weight: 500; }
.caption b { color: var(--ink); font-weight: 600; }

/* ============================================================================
   PITCH — logo, paragraph, email capture
   ========================================================================== */
.pitch { max-width: 30rem; }
@media (max-width: 940px) { .pitch { max-width: none; } }

.logo { display: block; }
.wordmark { height: 34px; width: auto; }
.wordmark--light { display: none; }
[data-theme="light"] .wordmark--dark { display: none; }
[data-theme="light"] .wordmark--light { display: block; }

.pitch h1 { font-size: var(--step-h1); font-weight: 800; margin-top: 1.6rem; }
.pitch h1 .accent { color: var(--accent); }
.pitch__lead { font-size: var(--step-lead); color: var(--ink-muted); margin-top: 1rem; line-height: 1.55; max-width: 34ch; }

/* ----- Email capture (reused) -------------------------------------------- */
.capture { margin-top: 1.9rem; max-width: 28rem; }
.field { display: flex; flex-direction: column; gap: 0.5rem; }
.field__label { font-size: 0.82rem; font-weight: 600; color: var(--ink-muted); }

.capture__row {
  display: flex; gap: 0.6rem;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 0.4rem;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
.capture__row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.capture__input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none;
  color: var(--ink); font-size: 1rem; padding: 0.6rem 0.4rem 0.6rem 1.1rem;
}
.capture__input::placeholder { color: var(--ink-faint); }

.btn-primary {
  position: relative; flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 700; font-size: 0.98rem; letter-spacing: -0.01em;
  color: var(--accent-ink); background: var(--accent); border-radius: 999px;
  padding: 0.72rem 1.4rem; white-space: nowrap;
  box-shadow: 0 6px 18px -8px var(--accent-glow);
  transition: background-color 0.2s var(--ease-out), transform 0.14s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
.btn-primary:hover { background: var(--accent-press); box-shadow: 0 8px 24px -8px var(--accent-glow); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary[data-busy="true"] { pointer-events: none; }
.btn-primary[data-busy="true"] .btn-primary__label { opacity: 0; }
.spinner {
  position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent-ink) 35%, transparent);
  border-top-color: var(--accent-ink); opacity: 0; animation: spin 0.6s linear infinite;
}
.btn-primary[data-busy="true"] .spinner { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

.capture__status { font-size: 0.88rem; margin-top: 0.7rem; min-height: 1.2em; }
.capture__status[data-state="error"] { color: #e5736b; }
[data-theme="light"] .capture__status[data-state="error"] { color: #c0392b; }

.capture__success {
  display: none; align-items: flex-start; gap: 0.85rem;
  padding: 1.1rem 1.25rem; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); max-width: 28rem; margin-top: 1.9rem;
}
.capture.is-done .capture__form { display: none; }
.capture.is-done .capture__success { display: flex; }
.capture__success-icon { flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.capture__success-icon svg { width: 17px; height: 17px; }
.capture__success h3 { font-size: 1.02rem; font-weight: 700; letter-spacing: -0.01em; }
.capture__success p { font-size: 0.9rem; color: var(--ink-muted); margin-top: 0.2rem; }

@media (max-width: 440px) {
  .capture__row { flex-direction: column; border-radius: var(--radius); padding: 0.55rem; }
  .capture__input { padding: 0.7rem 0.9rem; }
  .btn-primary { justify-content: center; padding: 0.85rem 1.4rem; }
}

/* ============================================================================
   FOOTER (slim — shared with legal pages)
   ========================================================================== */
.footer {
  position: relative; z-index: var(--z-base);
  border-top: 1px solid var(--line);
}
.footer__bottom {
  display: flex; flex-wrap: wrap; gap: 0.6rem 1.5rem; justify-content: space-between; align-items: center;
  padding-block: 1.5rem; font-size: 0.82rem; color: var(--ink-faint);
}
.footer__bottom nav { display: flex; gap: 1.4rem; }
.footer__bottom a { transition: color 0.18s var(--ease-out); }
.footer__bottom a:hover { color: var(--ink); }

/* ----- nav (legal pages only) -------------------------------------------- */
.nav { border-bottom: 1px solid var(--line); }
.nav__inner { display: flex; align-items: center; height: 66px; }
.brand { display: inline-flex; align-items: center; }
.nav .wordmark { height: 22px; }

/* ----- legal pages -------------------------------------------------------- */
.legal { padding-block: clamp(4rem, 8vw, 7rem); position: relative; z-index: var(--z-base); }
.legal__inner { max-width: 44rem; }
.legal a.back { color: var(--accent); font-weight: 600; font-size: 0.9rem; }
.legal h1 { font-size: clamp(2rem, 1.5rem + 2.4vw, 3rem); margin-top: 1.4rem; }
.legal__meta { color: var(--ink-faint); font-size: 0.85rem; margin-top: 0.6rem; }
.legal h2 { font-size: clamp(1.35rem, 1.2rem + 0.9vw, 1.7rem); margin-top: 2.5rem; }
.legal p, .legal li { color: var(--ink-muted); margin-top: 0.9rem; max-width: 70ch; }
.legal ul { padding-left: 1.2rem; }
.legal li { margin-top: 0.4rem; }
.legal strong { color: var(--ink); }
