/* ==========================================================================
   Cross Word Masters — landing page
   base.css · fonts, design tokens, reset, layout, type, buttons, motion.

   Colours come from the game itself (lib/ui/theme/candy_theme.dart,
   wordiano_tokens.dart) and the Play Store art
   (play_store_marketing/build_v2/gen_v2.js). Type is the store art's pairing:
   Baloo 2 for display and tiles, Nunito for everything else.
   ========================================================================== */

/* Variable fonts: one file per family covers every weight used here. */
@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("../assets/fonts/baloo2-latin-var.woff2") format("woff2");
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 600 900;
  font-display: swap;
  src: url("../assets/fonts/nunito-latin-var.woff2") format("woff2");
}

:root {
  color-scheme: dark;

  /* Stage — the store backdrop: plum sky over amber and chocolate */
  --plum-950: #1b0f1f;
  --plum-900: #251429;
  --plum-800: #33203f;
  --plum-700: #492742;
  --rust-600: #6f3a2e;
  --choc-700: #59321f;
  --choc-800: #3c2414;
  --choc-900: #2a1810;
  --choc-950: #1b0f09;

  /* Wood — in-game cards and raised controls */
  --wood-top: #4d2d1f;
  --wood-bottom: #3d251c;
  --wood-border: #5c3827;
  --wood-rim: #7a4e38;
  --wood-edge: #2b170f;

  /* Candy letters */
  --candy-top: #f6b352;
  --candy-bottom: #e68a3e;
  --candy-edge: #8a4d1a;
  --candy-ink: #4a2a12;

  /* Gold, cream and the gameplay backdrop */
  --gold: #ffb938;
  --gold-light: #ffd873;
  --gold-pale: #ffe9a8;
  --coin: #fcc200;
  --cream: #fff1d6;
  --cream-50: #fff8ec;
  --honey: #f7d9a6;
  --slot-top: #fbe9c6;
  --slot-bottom: #f1d199;
  --stroke: #3a1c0a;

  /* Accents */
  --play-top: #5de875;
  --play-bottom: #27c73c;
  --play-edge: #169927;
  --play-ink: #0a2f10;
  --shuffle: #2563eb;
  --shuffle-light: #60a5fa;
  --leaf: #4e944f;
  --blossom: #f06aa8;
  --violet-top: #9e7bf0;
  --violet-bottom: #6a46c8;

  /* Text */
  --text: #fbe8c6;
  --text-strong: #fff7ea;
  --text-soft: rgb(251 232 198 / 0.8);
  --text-dark: #3a1c0a;
  --text-dark-soft: #6a4428;

  /* Type */
  --font-display: "Baloo 2", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;

  /* Layout */
  --gutter: clamp(16px, 4vw, 40px);
  --content: 1180px;
  --header-h: 68px;
  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 28px;

  /* Depth and motion */
  --shadow-soft: 0 12px 30px rgb(10 4 2 / 0.35);
  --shadow-deep: 0 30px 60px rgb(10 4 2 / 0.5), 0 10px 24px rgb(10 4 2 / 0.4);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- Reset ------------------------------------------------------------- */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  overflow-x: clip;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--choc-950);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

img {
  height: auto;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

a {
  color: inherit;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

h1,
h2,
h3 {
  line-height: 1.1;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

[hidden] {
  display: none !important;
}

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
}

/* ---- Accessibility helpers --------------------------------------------- */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 200;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--gold-light);
  color: var(--stroke);
  font-weight: 900;
  text-decoration: none;
  translate: 0 -200%;
  transition: translate 0.2s var(--ease-out);
}

.skip-link:focus {
  translate: 0 0;
}

:focus-visible {
  outline: 3px solid var(--gold-light);
  outline-offset: 3px;
}

/* ---- Layout ------------------------------------------------------------ */

.container {
  width: min(100% - 2 * var(--gutter), var(--content));
  margin-inline: auto;
}

.section {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(76px, 10vw, 132px);
}

/* Cream sections echo the gameplay screen's warm backdrop. */
.section--light {
  color: var(--text-dark);
  background: linear-gradient(180deg, var(--cream-50), var(--honey));
}

/* ---- Shared type ------------------------------------------------------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75em;
  font-weight: 900;
  font-size: 0.8rem;
  line-height: 1.2;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold-pale);
}

.eyebrow::before,
.eyebrow::after {
  content: "";
  width: 28px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--gold));
}

.eyebrow::after {
  background: linear-gradient(90deg, var(--gold), transparent);
}

.eyebrow--start::before {
  display: none;
}

.section--light .eyebrow {
  color: #9a4a16;
}

.section-head {
  max-width: 760px;
  margin: 0 auto clamp(40px, 6vw, 64px);
  text-align: center;
}

.section-title {
  margin-top: 14px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.05rem, 1.25rem + 3.1vw, 3.45rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
  color: var(--text-strong);
  /* A filter (not text-shadow) so the gold words keep their gradient. */
  filter: drop-shadow(0 3px 0 rgb(58 28 10 / 0.6)) drop-shadow(0 10px 18px rgb(10 4 2 / 0.3));
}

.gold {
  background: linear-gradient(180deg, #fff3be 0%, #ffd264 38%, #f7a72c 68%, #e8871f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.section--light .section-title {
  color: var(--text-dark);
  filter: none;
}

.section--light .gold {
  background: linear-gradient(180deg, #d0731f, #9a4a16);
  -webkit-background-clip: text;
  background-clip: text;
}

.section-lead {
  margin-top: 16px;
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
  color: var(--text-soft);
}

.section-head .section-lead {
  max-width: 60ch;
  margin-inline: auto;
}

.section--light .section-lead {
  color: var(--text-dark-soft);
}

/* Store-style headline: an outline layer (hidden from assistive tech) sits
   under the readable fill, so the letters get the thick bevelled edge of the
   Play Store art without duplicating what screen readers announce. */
.display {
  position: relative;
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.005em;
}

.display__ink,
.display__fill {
  display: block;
}

.display__ink {
  position: absolute;
  inset: 0;
  color: var(--stroke);
  -webkit-text-stroke: 0.12em var(--stroke);
  filter: drop-shadow(0 0.07em 0.05em rgb(14 6 2 / 0.6));
}

.display__fill {
  position: relative;
  color: #fff4dc;
}

/* ---- Buttons ----------------------------------------------------------- */

.btn {
  --btn-h: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  min-height: var(--btn-h);
  padding: 0 1.5em;
  border: 0;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 900;
  font-size: 1.02rem;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: translate 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), filter 0.2s ease;
}

.btn:hover {
  translate: 0 -2px;
}

.btn:active {
  translate: 0 2px;
}

.btn--large {
  --btn-h: 62px;
  padding: 0 1.9em;
  font-size: 1.12rem;
}

.btn--small {
  --btn-h: 48px;
  padding: 0 1.2em;
  font-size: 0.95rem;
}

/* Green Play button from the main menu. */
.btn--play {
  color: var(--play-ink);
  background: linear-gradient(180deg, #9af5a3 0%, var(--play-top) 24%, var(--play-bottom) 100%);
  text-shadow: 0 1px 0 rgb(255 255 255 / 0.35);
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 0.55),
    inset 0 -3px 0 rgb(10 60 20 / 0.22),
    0 5px 0 var(--play-edge),
    0 14px 26px rgb(10 50 20 / 0.42);
}

.btn--play:hover {
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 0.55),
    inset 0 -3px 0 rgb(10 60 20 / 0.22),
    0 7px 0 var(--play-edge),
    0 20px 34px rgb(40 170 70 / 0.4);
}

.btn--play:active {
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 0.45),
    0 2px 0 var(--play-edge),
    0 8px 16px rgb(10 50 20 / 0.4);
}

/* Raised wood, like the in-game back / hint buttons. */
.btn--wood {
  color: var(--gold-pale);
  background: linear-gradient(180deg, #6d4531 0%, var(--wood-border) 45%, var(--wood-top) 100%);
  border: 1.5px solid var(--wood-rim);
  box-shadow:
    inset 0 1px 0 rgb(255 220 170 / 0.25),
    0 4px 0 var(--wood-edge),
    0 12px 22px rgb(10 4 2 / 0.38);
}

.btn--wood:active {
  box-shadow: inset 0 1px 0 rgb(255 220 170 / 0.2), 0 1px 0 var(--wood-edge);
}

/* Gold pill from the store badges. */
.btn--gold {
  color: #5a330e;
  background: linear-gradient(180deg, #ffdd82, #efa02b);
  border: 1.5px solid rgb(255 242 206 / 0.7);
  box-shadow:
    inset 0 2px 2px rgb(255 255 255 / 0.6),
    inset 0 -3px 4px rgb(150 80 16 / 0.45),
    0 4px 0 #a8651c,
    0 12px 22px rgb(20 8 2 / 0.32);
}

.btn--gold:active {
  box-shadow: inset 0 2px 2px rgb(255 255 255 / 0.5), 0 1px 0 #a8651c;
}

/* The in-game shuffle hub is blue. */
.btn--shuffle {
  color: #fff;
  background: linear-gradient(180deg, #5b93f6 0%, var(--shuffle) 70%);
  border: 1.5px solid var(--shuffle-light);
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 0.35),
    0 4px 0 #1d3f99,
    0 12px 22px rgb(10 20 60 / 0.4);
}

.btn--shuffle:active {
  box-shadow: inset 0 2px 0 rgb(255 255 255 / 0.3), 0 1px 0 #1d3f99;
}

/* Two-line store label: "Get it on / Google Play". */
.btn__stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  text-align: left;
}

.btn__kicker {
  font-size: 0.66em;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

.btn__label {
  font-size: 1.12em;
}

/* ---- Badges ------------------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.55em 1.05em;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1.1;
  white-space: nowrap;
}

.badge .icon {
  width: 1.15em;
  height: 1.15em;
  color: var(--gold-light);
}

.badge--dark {
  color: #ffe6b5;
  background: linear-gradient(180deg, rgb(58 33 19 / 0.94), rgb(32 17 8 / 0.94));
  border: 1.5px solid rgb(255 200 120 / 0.38);
  box-shadow: 0 8px 18px rgb(8 4 2 / 0.4), inset 0 1px 1px rgb(255 210 140 / 0.26);
}

/* ---- Reveal on scroll (enabled by js/main.js) --------------------------- */

.js [data-reveal] {
  opacity: 0;
  translate: 0 28px;
  transition:
    opacity 0.8s var(--ease-out),
    translate 0.8s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}

.js [data-reveal].is-revealed {
  opacity: 1;
  translate: 0 0;
}

@keyframes enter-up {
  from {
    opacity: 0;
    translate: 0 26px;
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    scale: 0.4;
  }
}

@keyframes float {
  50% {
    transform: translateY(-10px) rotate(3deg);
  }
}

@keyframes glow-pulse {
  50% {
    opacity: 0.65;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
  }
}

@media print {
  .js [data-reveal] {
    opacity: 1;
    translate: none;
  }
}
