/* ==========================================================================
   The home page (index.html): hero, what it is, the hand of modes, how it
   works, the mascots, and the beta on the brick ground. Roles only — every
   colour comes from brand.css.
   ========================================================================== */

.section {
  padding-block: var(--space-section);
}

.section-head {
  display: grid;
  gap: var(--space-3);
  max-width: 760px;
  margin-block-end: var(--space-7);
}

.section-head h2 {
  font-size: var(--text-h2);
}

/* ---- Reveal: IntersectionObserver adds .is-in (main.js). Without JS, or
   with reduced motion, nothing is ever hidden. -------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity var(--dur-reveal) var(--ease-out),
      transform var(--dur-reveal) var(--ease-out);
  }

  .js .reveal.is-in {
    opacity: 1;
    transform: none;
  }
}

/* ==========================================================================
   Hero — the logo on its glow (splash 01-01) over a dealt hand of stills
   ========================================================================== */

.hero {
  position: relative;
  padding-block: var(--space-5) var(--space-section);
  overflow: hidden;
}

.hero__grid {
  display: grid;
  gap: var(--space-5);
  align-items: center;
}

.hero__stage {
  position: relative;
  width: 100%;
  max-width: 540px;
  margin-inline: auto;
  aspect-ratio: 1 / 0.94;
}

.hero__glow {
  position: absolute;
  inset: -12% -18% 10%;
  background: radial-gradient(closest-side, var(--glow) 0%, var(--glow) 38%, transparent 100%);
}

.hero__logo {
  position: absolute;
  z-index: 3;
  top: 3%;
  inset-inline-start: 25%;
  width: 50%;
}

.fan {
  position: absolute;
  inset: 0;
  list-style: none;
  padding: 0;
}

.fan__card {
  --tilt: 0deg;
  --lift: 0%;
  position: absolute;
  bottom: 5%;
  width: 38%;
  border: 4px solid var(--surface);
  border-radius: var(--radius-tile);
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 var(--edge-hero) 0 var(--edge);
  transform: translateY(var(--lift)) rotate(calc(var(--tilt) * var(--push)));
}

.fan__card img {
  width: 100%;
  aspect-ratio: 480 / 419;
  object-fit: cover;
}

.fan__card--1 {
  --tilt: -11deg;
  inset-inline-start: 4%;
}

.fan__card--2 {
  --lift: -12%;
  z-index: 1;
  inset-inline-start: 31%;
}

.fan__card--3 {
  --tilt: 11deg;
  inset-inline-start: 58%;
}

/* The hand is dealt once, on load: a card slides up out of the deck and
   turns into place. transform + opacity only. */
@media (prefers-reduced-motion: no-preference) {
  .fan__card {
    animation: deal 720ms var(--ease-spring) both;
  }

  .fan__card--1 {
    animation-delay: 120ms;
  }

  .fan__card--2 {
    animation-delay: 220ms;
  }

  .fan__card--3 {
    animation-delay: 320ms;
  }
}

@keyframes deal {
  from {
    opacity: 0;
    transform: translateY(40%) rotate(0deg);
  }
}

.hero__copy {
  display: grid;
  gap: var(--space-4);
  justify-items: start;
}

.hero__title {
  font-size: var(--text-h1);
  line-height: 1.02;
}

html[lang="ar"] .hero__title {
  line-height: 1.25;
}

.hero__title > span {
  display: block;
}

/* «أكيد.» set on its own playing card — the wink in the tagline. */
.hero__beat {
  display: inline-block;
  margin-block-start: 0.12em;
  padding: 0 0.32em 0.04em;
  background: var(--surface);
  border-radius: var(--radius-tile);
  box-shadow: inset 0 0 0 2px var(--inset), 0 var(--edge-card) 0 var(--edge);
  transform: rotate(calc(-3deg * var(--push)));
}

.hero__lead strong {
  color: var(--on-bg);
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
  margin-block-start: var(--space-2);
}

.hero__meta {
  font-size: var(--text-sm);
}

@media (min-width: 960px) {
  .hero {
    padding-block-start: var(--space-7);
  }

  .hero__grid {
    grid-template-columns: 1.02fr 0.98fr;
    gap: var(--space-7);
  }

  .hero__copy {
    order: -1;
  }
}

/* ==========================================================================
   What it is
   ========================================================================== */

.facts {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--space-5);
}

.fact {
  display: grid;
  gap: var(--space-3);
  align-content: start;
  padding: var(--space-5);
}

.fact h3 {
  font-size: var(--text-h3);
}

.fact p {
  color: var(--muted);
}

/* Icons: cream on a round, raised chip — orange stays the action's. */
.fact__icon {
  width: 48px;
  height: 48px;
  padding: 11px;
  border-radius: 50%;
  background: var(--elevated);
  color: var(--on-bg);
  box-shadow: 0 4px 0 var(--edge);
}

@media (min-width: 600px) {
  .facts {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1080px) {
  .facts {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ==========================================================================
   Modes — a hand of mode stills (brand pages 28-30, lib/widgets/mode_card.dart)
   Phone: a row you swipe, like fanning a hand. Wider: the hand laid out.
   ========================================================================== */

.hand {
  list-style: none;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(72%, 260px);
  gap: var(--space-5);
  align-items: start;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  /* Bleed to the screen edge inside the shell's own gutter, so the scroller
     never widens the page. */
  margin-inline: calc(-1 * var(--gutter));
  padding: var(--space-4) var(--gutter) var(--space-6);
  scrollbar-width: thin;
  scrollbar-color: var(--moss) transparent;
}

.mode {
  --tilt: 0deg;
  display: grid;
  gap: var(--space-3);
  scroll-snap-align: start;
}

.mode:nth-child(7n + 1) { --tilt: -2.5deg; }
.mode:nth-child(7n + 2) { --tilt: 1.5deg; }
.mode:nth-child(7n + 3) { --tilt: -1deg; }
.mode:nth-child(7n + 4) { --tilt: 2.5deg; }
.mode:nth-child(7n + 5) { --tilt: -1.5deg; }
.mode:nth-child(7n + 6) { --tilt: 1deg; }
.mode:nth-child(7n + 7) { --tilt: -2deg; }

.mode__card {
  overflow: hidden;
  transform: rotate(calc(var(--tilt) * var(--push)));
  transition: transform var(--dur-normal) var(--ease-spring);
}

/* The inset stroke the book draws around every still card sits ON the art. */
.mode__card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 2px var(--inset);
  pointer-events: none;
}

.mode:hover .mode__card,
.mode:focus-within .mode__card {
  transform: translateY(-6px) rotate(0deg);
}

.mode__still {
  width: 100%;
  aspect-ratio: 480 / 419;
  object-fit: cover;
  background: var(--elevated);
}

/* The pine name band: Arabic in Lalezar, English in Grandstander, both
   always — whatever the page language. */
.mode__band {
  display: grid;
  justify-items: center;
  gap: 0.15em;
  padding: 0.55em 0.6em 0.75em;
  background: var(--surface);
  text-align: center;
  line-height: 1.15 !important;
}

.mode__ar {
  font-family: "Lalezar", var(--font-display);
  font-weight: 400;
  font-size: 1.45rem;
  direction: rtl;
}

.mode__en {
  font-family: "Grandstander", var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  direction: ltr;
}

.mode__sub {
  text-align: center;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--muted);
  padding-inline: var(--space-2);
}

/* «How to play» — native <details>, so it works without JS and the
   keyboard gets it for free. */
.mode__guide summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 44px;
  padding: 0.4em 1em;
  border-radius: var(--radius-pill);
  box-shadow: inset 0 0 0 2px var(--border);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  list-style: none;
  transition: box-shadow var(--dur-fast) var(--ease-standard);
}

.mode__guide summary::-webkit-details-marker {
  display: none;
}

.mode__guide summary::after {
  content: "";
  width: 0.5em;
  height: 0.5em;
  /* Physical on purpose: a down-chevron is the same in both directions. */
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-0.12em) rotate(45deg);
  transition: transform var(--dur-fast) var(--ease-standard);
}

.mode__guide[open] summary::after {
  transform: translateY(0.12em) rotate(-135deg);
}

.mode__guide summary:hover {
  box-shadow: inset 0 0 0 2px var(--on-bg);
}

.mode__guide summary:focus-visible {
  outline: 3px solid var(--on-bg);
  outline-offset: 3px;
  border-radius: var(--radius-pill);
}

.mode__rules {
  display: grid;
  gap: var(--space-3);
  margin-block-start: var(--space-3);
  padding: var(--space-4);
  background: var(--surface);
  border-radius: var(--radius-tile);
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.mode__rules ol {
  display: grid;
  gap: var(--space-2);
  padding-inline-start: 1.25em;
  color: var(--muted);
}

.mode__rules ol li::marker {
  font-family: "Grandstander", var(--font-body);
  font-weight: 800;
  color: var(--on-bg);
}

.mode__idea {
  font-weight: 700;
}

@media (min-width: 720px) {
  .hand {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-7) var(--space-5);
    overflow: visible;
    margin-inline: 0;
    padding: 0;
    scroll-snap-type: none;
  }
}

@media (min-width: 1080px) {
  .hand {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .mode__card,
  .mode:hover .mode__card,
  .mode:focus-within .mode__card {
    transition: none;
    transform: rotate(calc(var(--tilt) * var(--push)));
  }
}

/* ==========================================================================
   How it works
   ========================================================================== */

.how {
  background: linear-gradient(to bottom, transparent, var(--glow) 50%, transparent);
}

.steps {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--space-7);
}

.step {
  position: relative;
  display: grid;
  gap: var(--space-3);
  align-content: start;
}

.step h3 {
  font-size: var(--text-h3);
  margin-block-start: var(--space-3);
}

.step p {
  color: var(--muted);
  max-width: 40ch;
}

.step__num {
  position: absolute;
  z-index: 2;
  top: -18px;
  inset-inline-start: -8px;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--on-bg);
  color: var(--bg);
  box-shadow: 0 5px 0 var(--edge);
  font-family: "Grandstander", var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1;
}

.step__art {
  aspect-ratio: 480 / 330;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.step__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.step__label {
  position: absolute;
  z-index: 1;
  top: var(--space-3);
  inset-inline-end: var(--space-3);
  padding: 0.25em 0.8em;
  border-radius: var(--radius-pill);
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--border);
  font-weight: 700;
  font-size: var(--text-sm);
}

.step__art--code {
  align-content: center;
  gap: var(--space-4);
  background: var(--surface);
}

.ticket {
  padding: 0.3em 0.7em 0.22em;
  background: var(--elevated);
  border-radius: var(--radius-tile);
  box-shadow: inset 0 0 0 2px var(--inset), 0 var(--edge-card) 0 var(--edge);
  font-family: "Grandstander", var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 1.5rem + 2.4vw, 2.8rem);
  letter-spacing: 0.08em;
  line-height: 1;
  transform: rotate(calc(-2deg * var(--push)));
}

.step__link {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
}

.how__note {
  margin-block-start: var(--space-7);
  max-width: 760px;
  padding: var(--space-4) var(--space-5);
  color: var(--muted);
}

.how__note strong {
  color: var(--on-bg);
}

@media (min-width: 900px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
  }
}

/* ==========================================================================
   Mascots (brand page 24)
   ========================================================================== */

.mascot-grid {
  list-style: none;
  display: grid;
  grid-template-rows: repeat(2, auto);
  grid-auto-flow: column;
  grid-auto-columns: 84px;
  gap: var(--space-4) var(--space-3);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  margin-inline: calc(-1 * var(--gutter));
  padding: var(--space-2) var(--gutter) var(--space-5);
  scrollbar-width: thin;
  scrollbar-color: var(--moss) transparent;
}

.mascot {
  display: grid;
  gap: var(--space-2);
  justify-items: center;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
}

.mascot img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-tile);
  box-shadow: 0 5px 0 var(--edge);
  background: var(--surface);
}

@media (min-width: 640px) {
  .mascot-grid {
    grid-template-rows: none;
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    overflow: visible;
    margin-inline: 0;
    padding: 0;
    gap: var(--space-5) var(--space-4);
  }
}

@media (min-width: 1024px) {
  .mascot-grid {
    grid-template-columns: repeat(9, minmax(0, 1fr));
  }
}

/* ==========================================================================
   Beta — on the brick ground
   ========================================================================== */

.beta {
  background: var(--bg);
  color: var(--on-bg);
  box-shadow: inset 0 var(--edge-hero) 0 var(--edge);
}

.beta__grid {
  display: grid;
  gap: var(--space-7);
  align-items: center;
}

.beta__copy {
  display: grid;
  gap: var(--space-4);
  max-width: 640px;
}

.beta__copy h2 {
  font-size: var(--text-h2);
}

.beta__form {
  display: grid;
  gap: var(--space-2);
  margin-block-start: var(--space-3);
}

.field__label {
  font-weight: 700;
}

.beta__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.field__input {
  flex: 1 1 220px;
  min-width: 0;
  min-height: 52px;
  padding: 0.6em 1em;
  border: 2px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--elevated);
  color: var(--on-bg);
  font: 500 1.05rem/1.3 var(--font-body);
  transition: border-color var(--dur-fast) var(--ease-standard);
}

.field__input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.field__input:hover {
  border-color: var(--muted);
}

.field__input:focus-visible {
  outline: 3px solid var(--on-bg);
  outline-offset: 2px;
  border-color: var(--on-bg);
}

.field__input[aria-invalid="true"] {
  border-color: var(--on-bg);
  border-style: dashed;
}

.beta__row .btn {
  flex: 0 0 auto;
}

/* Status lines are cream; the state is a SHAPE (DESIGN.md rule 2): a ✓ or
   ✕ badge in front, never red or green type. */
.form-status:empty {
  display: none;
}

.form-status {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-weight: 600;
}

.form-status[data-state]::before {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.5em;
  height: 1.5em;
  border-radius: 50%;
  font-family: "Grandstander", var(--font-body);
  font-weight: 800;
  font-size: 0.9em;
  line-height: 1;
}

.form-status[data-state="done"] {
  padding: var(--space-4);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--inset), 0 var(--edge-card) 0 var(--edge);
  font-size: var(--text-lead);
}

.form-status[data-state="done"]::before {
  content: "\2713";
  background: var(--positive);
  color: var(--on-positive);
}

.form-status[data-state="error"]::before {
  content: "\00D7";
  background: var(--on-bg);
  color: var(--bg);
}

.beta__note {
  font-size: var(--text-sm);
  max-width: 60ch;
}

.beta__note a {
  color: var(--on-bg);
}

.beta__art {
  position: relative;
  height: 180px;
  max-width: 360px;
  width: 100%;
  margin-inline: auto;
}

.beta__mascot {
  --tilt: 0deg;
  position: absolute;
  bottom: 0;
  width: 44%;
  border-radius: var(--radius-card);
  border: 4px solid var(--surface);
  box-shadow: 0 var(--edge-hero) 0 var(--edge);
  transform: rotate(calc(var(--tilt) * var(--push)));
}

.beta__mascot--1 {
  --tilt: -9deg;
  inset-inline-start: 2%;
}

.beta__mascot--2 {
  z-index: 1;
  bottom: 12%;
  inset-inline-start: 28%;
}

.beta__mascot--3 {
  --tilt: 9deg;
  inset-inline-start: 54%;
}

@media (min-width: 900px) {
  .beta__grid {
    grid-template-columns: 1.4fr 0.6fr;
  }

  .beta__art {
    height: 300px;
  }
}
