@import url('./tokens.css');

/* ── base ─────────────────────────────────────────────────────────────── */

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

html {
  scroll-behavior: smooth;
  /* Never let a wide child scroll the whole document sideways. */
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: var(--w-medium);
  font-size: clamp(16px, 1.1vw, 18px);
  line-height: 1.75;          /* Arabic needs headroom for diacritics */
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/*
 * The diagonal cross-hatch, preserved from the original styles.css: 1px lines
 * at ±45°, 22px apart, ink at 4%.
 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(45deg, rgba(16, 11, 113, 0.04) 0 1px, transparent 1px 22px),
    repeating-linear-gradient(-45deg, rgba(16, 11, 113, 0.04) 0 1px, transparent 1px 22px);
}

h1, h2, h3 { line-height: 1.35; margin: 0; font-weight: var(--w-black); }
p { margin: 0; }
img { max-width: 100%; display: block; }

a { color: var(--accent-deep); }

:focus-visible {
  outline: 3px solid var(--accent-deep);
  outline-offset: 3px;
  border-radius: 6px;
}

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

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── the slab: the app's pressable button, on the web ─────────────────── */

.slab {
  --slab-fill: var(--accent);
  --slab-depth: var(--accent-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 17px 40px;
  border: none;
  border-radius: var(--radius);
  background: var(--slab-fill);
  /* Ink, not white. White on the sky-blue accent is 2.25:1, and at the size
     this renders (20.5px/900 => WCAG "large") the bar is 3:1, so white failed.
     Ink on the same fill is 7.11:1. The fill and the 3D depth are unchanged;
     only the label colour moved. Same fix as the green lobby pill in
     app/play/lib/features/play/ui/views/lobby_view.dart.
     axe missed this until 2026-09-04: its colour-contrast rule sampled the
     text rect and silently skipped this node, and a four-pixel width change
     from a copy edit was enough to make it start reporting. Do not trust a
     green axe run as proof a colour pair is safe; compute the ratio. */
  color: var(--ink);
  font-family: var(--font);
  font-weight: var(--w-black);
  font-size: clamp(18px, 1.6vw, 22px);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--slab-depth);
  transition: transform 140ms var(--press-ease), box-shadow 140ms var(--press-ease);
}
.slab:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--slab-depth); }
.slab:active { transform: translateY(6px); box-shadow: 0 0 0 var(--slab-depth); }

.slab--ghost {
  --slab-fill: var(--panel-raised);
  --slab-depth: #d9d3e4;
  color: var(--ink);
  padding: 11px 22px;
  font-size: 15px;
  box-shadow: 0 4px 0 var(--slab-depth);
  border: 2px solid var(--line);
}

/* ── header ───────────────────────────────────────────────────────────── */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: clamp(18px, 3vw, 28px);
}
.site-header__logo { height: clamp(32px, 3.2vw, 42px); width: auto; }

/* ── hero ─────────────────────────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(32px, 5vw, 56px);
  align-items: center;
  padding-block: clamp(8px, 2vw, 20px) var(--section-gap);
}
@media (min-width: 900px) {
  .hero { grid-template-columns: 1.05fr 0.95fr; }
  .steps { grid-template-columns: repeat(3, 1fr); }
}

.hero__logo {
  width: clamp(170px, 17vw, 220px);
  margin-block: clamp(-20px, -2vw, -8px) clamp(-4px, 0.4vw, 8px);
}

.hero__pitch {
  font-size: clamp(16px, 1.45vw, 19px);
  color: var(--sand);
  max-width: 46ch;
  margin-block: 12px clamp(18px, 2.2vw, 24px);
}

.hero__cta-note {
  margin-top: 12px;
  font-size: 14px;
  color: var(--sand);
}

/* ── store badges ─────────────────────────────────────────────────────── */

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: clamp(18px, 2.2vw, 24px);
}

.badge {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 172px;
  padding: 10px 18px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
}
.badge[aria-disabled='true'] { opacity: 0.75; cursor: default; }
.badge__glyph { width: 24px; height: 24px; flex: none; color: var(--ink); }
.badge__label { font-size: 11px; color: var(--sand); display: block; }
.badge__store { font-size: 16px; font-weight: var(--w-black); }

/* ── the phone, and the loop inside it ────────────────────────────────── */

.device-stage {
  display: flex;
  justify-content: center;
  position: relative;
}

.device {
  position: relative;
  width: min(268px, 74vw);
  aspect-ratio: 268 / 542;
  border: 9px solid var(--ink);
  border-radius: 40px;
  background: var(--bg);
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(16, 11, 113, 0.28);
}

.device__frame {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 22px 16px;
  opacity: 0;
  text-align: center;
}
/* Without motion, show the first frame only — a blank phone is worse than a
   still one. */
.device__frame:first-child { opacity: 1; }

.device__label { font-size: 12px; color: var(--sand); }
.device__logo { width: 84px; }

.code-row { display: flex; gap: 7px; direction: ltr; }
.code-cell {
  width: 34px; height: 46px;
  border: 2.5px solid var(--line);
  border-radius: 10px;
  background: var(--panel-raised);
  display: grid; place-items: center;
  font-size: 22px; font-weight: var(--w-black);
  color: var(--ink);
}
.code-cell--filled { border-color: var(--ok); }

.avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 100%; }
.avatar-cell {
  aspect-ratio: 1;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--panel-raised);
  display: grid; place-items: center;
  font-size: 17px;
}
.avatar-cell--on {
  background: var(--accent);
  border-color: #fff;
  box-shadow: 0 3px 0 var(--accent-deep);
}

.q-card {
  width: 100%;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 13px 11px;
  font-size: 14px;
  font-weight: var(--w-black);
}
.q-option {
  width: 100%;
  background: var(--panel-raised);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 9px 11px;
  font-size: 13px;
  font-weight: var(--w-bold);
  text-align: start;
}
.q-option--right { background: var(--ok); border-color: #fff; color: #fff; }
.q-option--wrong { background: var(--bad); border-color: #fff; color: #fff; opacity: 0.9; }
.q-stack { display: flex; flex-direction: column; gap: 7px; width: 100%; }

.verdict {
  width: 74px; height: 74px;
  border-radius: 50%;
  /* Solid disc with a green tick, not a white tick on a translucent one:
     white-on-22%-white-over-green measured 2.49:1, under the 3:1 large-text
     floor. This way round is 3.30:1 and reads as the usual success tick. */
  background: #fff;
  display: grid; place-items: center;
  font-size: 38px; color: var(--ok);
}
.device__frame--win { background: var(--ok); color: #fff; }
/* 12px at 85% white over --ok is 2.80:1. Ink on the same green is 4.87:1. */
.device__frame--win .device__label { color: var(--ink); }

/* decorative shapes drifting behind the phone */
.orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  opacity: 0.5;
}
.orb--1 { width: 88px; height: 88px; background: var(--accent); inset-block-start: 4%; inset-inline-start: 2%; }
.orb--2 { width: 54px; height: 54px; background: var(--cat-3); inset-block-end: 12%; inset-inline-end: 4%; }
.orb--3 { width: 34px; height: 34px; background: var(--cat-2); inset-block-start: 46%; inset-inline-end: 0; }

/* ── steps ────────────────────────────────────────────────────────────── */

.section-head { text-align: center; margin-bottom: clamp(28px, 4vw, 44px); }
.section-head h2 { font-size: clamp(26px, 3.4vw, 40px); }
.section-head p { color: var(--sand); margin-top: 10px; }

.rule {
  height: 3px;
  width: 190px;
  margin: 0 auto clamp(24px, 3vw, 34px);
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--accent-dark), var(--accent), var(--accent-dark), transparent);
}

.steps {
  display: grid;
  /* One per row until all three fit. auto-fit gave two columns at tablet
     widths, which orphans the third card next to an empty half-row. */
  grid-template-columns: 1fr;
  gap: clamp(14px, 2vw, 20px);
  padding-bottom: var(--section-gap);
}

.step {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 2.4vw, 28px);
}
.step__n {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: var(--accent);
  color: #fff;
  font-size: 23px; font-weight: var(--w-black);
  box-shadow: 0 4px 0 var(--accent-deep);
  margin-bottom: 14px;
}
.step__t { font-size: clamp(19px, 1.8vw, 23px); margin-bottom: 6px; }
.step__d { color: var(--sand); font-size: 16px; }

/* ── footer ───────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 2px solid var(--line);
  padding-block: clamp(24px, 3vw, 34px);
  display: flex;
  flex-wrap: wrap;
  gap: 14px 26px;
  align-items: center;
  justify-content: space-between;
  color: var(--sand);
  font-size: 14px;
}
.site-footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.site-footer a { color: var(--sand); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }

/* ── legal pages ──────────────────────────────────────────────────────── */

.legal { padding-block: clamp(28px, 4vw, 56px) var(--section-gap); }
.legal__body { max-width: 68ch; }
.legal h1 { font-size: clamp(28px, 3.6vw, 42px); margin-bottom: 8px; }
.legal__updated { color: var(--sand); font-size: 14px; margin-bottom: clamp(24px, 3vw, 36px); }
.legal h2 {
  font-size: clamp(20px, 2vw, 25px);
  margin-block: clamp(28px, 3vw, 38px) 10px;
}
.legal p { color: var(--sand); margin-bottom: 12px; }
.legal ul { color: var(--sand); padding-inline-start: 22px; margin: 0 0 12px; }
.legal li { margin-bottom: 7px; }

/* ── motion ───────────────────────────────────────────────────────────── */

/*
 * Squash and stretch. Replaced the breathing scale on 2026-09-07 after
 * comparing the candidates side by side in prototype/logo-motion.
 *
 * Note it does not preserve area the way the animation principle asks. A
 * wordmark that conserves volume exactly reads as smeared rather than as
 * springy, so legibility wins and the deformation is softened.
 */
@keyframes squash {
  0%   { transform: scale(1, 1); }
  28%  { transform: scale(1.09, 0.90); }
  54%  { transform: scale(0.94, 1.09); }
  76%  { transform: scale(1.03, 0.975); }
  100% { transform: scale(1, 1); }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(0, -22px, 0); }
}

/* Four frames share one 13s cycle; each is visible for about a quarter. */
@keyframes frame-cycle {
  0%   { opacity: 0; transform: scale(0.98); }
  2%   { opacity: 1; transform: none; }
  22%  { opacity: 1; transform: none; }
  25%  { opacity: 0; transform: scale(1.02); }
  100% { opacity: 0; transform: scale(0.98); }
}

@keyframes cell-fill {
  0%, 100% { opacity: 0.25; }
  10%, 90% { opacity: 1; }
}

/* Anchored to the baseline: squash reads as weight against the ground, and
   a centre origin makes it read as a pulse instead. */
.squash {
  transform-origin: bottom center;
  animation: squash var(--squash-duration) var(--squash-ease) infinite;
}

.reveal {
  opacity: 0;
  animation: fade-up 620ms var(--enter-ease) forwards;
}
/* Sections start hidden and are released by the observer adding .in-view. */
.reveal--onscroll { animation-play-state: paused; }
.reveal--onscroll.in-view { animation-play-state: running; }

.orb { animation: drift 5200ms var(--loop-ease) infinite alternate; }
.orb--2 { animation-duration: 6400ms; animation-delay: -1800ms; }
.orb--3 { animation-duration: 4400ms; animation-delay: -900ms; }

.device__frame {
  animation: frame-cycle 13s linear infinite;
}
.device__frame:nth-child(1) { animation-delay: 0s; }
.device__frame:nth-child(2) { animation-delay: 3.25s; }
.device__frame:nth-child(3) { animation-delay: 6.5s; }
.device__frame:nth-child(4) { animation-delay: 9.75s; }

.code-cell--anim { animation: cell-fill 3.25s linear infinite; }
.code-cell--anim:nth-child(1) { animation-delay: 0.15s; }
.code-cell--anim:nth-child(2) { animation-delay: 0.4s; }
.code-cell--anim:nth-child(3) { animation-delay: 0.65s; }
.code-cell--anim:nth-child(4) { animation-delay: 0.9s; }

/*
 * The contract: if the OS says less motion, everything stops. The phone still
 * shows its first frame, because an empty device would be worse than a static
 * one.
 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }

  .reveal, .reveal--onscroll { opacity: 1 !important; transform: none !important; }
  .device__frame { opacity: 0; }
  .device__frame:first-child { opacity: 1; }
}
