/* =====================================================================
   Happy Puzzle Quest — shared stylesheet (landing + legal pages)
   Fonts are self-hosted: no requests to third-party services.
   ===================================================================== */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/outfit-latin.woff2") format("woff2");
}

/* =====================================================================
   DESIGN TOKENS — adjust colors and font sizes here
   ===================================================================== */
:root {
  /* ---------- Colors: backgrounds (dark teal) ---------- */
  --color-bg:               #0a1517;
  --color-bg-alt:           #0d1b1e;
  --color-surface:          #112226;
  --color-surface-hover:    #15292e;
  --color-border:           #1f3a3d;
  --color-border-strong:    #2c5052;

  /* ---------- Colors: accents (gold, copper, teal) ---------- */
  --color-gold:             #d6a84e;
  --color-gold-light:       #ecc97a;
  --color-copper:           #c27a4c;
  --color-copper-dark:      #8f5532;
  --color-teal:             #3a8c86;
  --color-teal-light:       #6cbcb4;

  /* ---------- Colors: text ---------- */
  --color-text:             #ece5d8;
  --color-text-muted:       #a3b3b0;
  --color-text-subtle:      #6f8683;
  --color-on-accent:        #1a1208;

  /* ---------- Colors: effects ---------- */
  --color-glow-gold:        rgba(214, 168, 78, 0.16);
  --color-glow-teal:        rgba(58, 140, 134, 0.18);
  --color-grid-line:        rgba(214, 168, 78, 0.05);
  --color-header-bg:        rgba(10, 21, 23, 0.78);
  --gradient-accent:        linear-gradient(135deg, var(--color-gold-light) 0%, var(--color-gold) 45%, var(--color-copper) 100%);

  /* ---------- Font families ---------- */
  --font-heading: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* ---------- Font sizes (fluid: min, preferred, max) ---------- */
  --fs-xs:      0.75rem;                                   /* 12px — tags, labels   */
  --fs-sm:      0.875rem;                                  /* 14px — small text     */
  --fs-base:    1rem;                                      /* 16px — body           */
  --fs-md:      1.125rem;                                  /* 18px — lead text      */
  --fs-lg:      clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);    /* 20–24px — card titles */
  --fs-xl:      clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);    /* 28–40px — section H2  */
  --fs-display: clamp(2.375rem, 1.6rem + 3.6vw, 4.25rem);  /* 38–68px — hero H1     */

  /* ---------- Font weights & line heights ---------- */
  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semibold: 600;
  --fw-bold:    700;
  --lh-tight:   1.1;
  --lh-snug:    1.3;
  --lh-body:    1.65;

  /* ---------- Spacing, radius, layout ---------- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: clamp(4rem, 3rem + 4vw, 7rem);

  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   22px;
  --radius-pill: 999px;

  --container-width: 1120px;
  --reading-width:   760px;   /* legal pages text column */
  --gutter:         clamp(1rem, 0.5rem + 2vw, 2rem);
  --header-height:   68px;

  --transition: 200ms ease;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
}

p { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--color-gold-light);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

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

.skip-link {
  position: absolute; left: var(--space-4); top: -100px; z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--color-gold); color: var(--color-on-accent);
  border-radius: var(--radius-sm); font-weight: var(--fw-semibold);
}
.skip-link:focus { top: var(--space-4); }

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

.section { padding-block: var(--space-8); }
.section--flush-top { padding-top: 0; }
.section--alt {
  background: var(--color-bg-alt);
  border-block: 1px solid var(--color-border);
}

.section__head {
  max-width: 640px;
  margin-bottom: var(--space-7);
}
.section__title { font-size: var(--fs-xl); }
.section__lead {
  margin-top: var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--fs-md);
}

.eyebrow {
  display: inline-block;
  margin-bottom: var(--space-4);
  color: var(--color-gold);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.text-accent {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* =====================================================================
   BUTTONS & BADGES
   ===================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 46px;
  padding: var(--space-3) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}
.btn:hover { transform: translateY(-1px); }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn--primary {
  background: var(--gradient-accent);
  color: var(--color-on-accent);
}
.btn--primary:hover { filter: brightness(1.06); }

.btn--ghost {
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.btn--ghost:hover { border-color: var(--color-gold); color: var(--color-gold-light); }

.badge {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
}
.badge--status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--color-copper);
  box-shadow: 0 0 0 3px rgba(194, 122, 76, 0.2);
}

/* =====================================================================
   HEADER
   ===================================================================== */
.header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-height);
  background: var(--color-header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition);
}
.header.is-scrolled { border-bottom-color: var(--color-border); }

.header__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%;
}

.brand {
  display: inline-flex; align-items: center; gap: var(--space-3);
  font-family: var(--font-heading);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
}
.brand__mark { width: 32px; height: 32px; }
.brand__name span { color: var(--color-gold); }

.nav__list { display: flex; align-items: center; gap: var(--space-6); }
.nav__link {
  position: relative;
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  transition: color var(--transition);
}
.nav__link:hover,
.nav__link[aria-current="true"] { color: var(--color-text); }
.nav__link[aria-current="true"]::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -6px;
  height: 2px; border-radius: 2px;
  background: var(--gradient-accent);
}

.nav__toggle {
  display: none;
  width: 44px; height: 44px;
  padding: 0;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
}
.nav__toggle svg { width: 20px; height: 20px; margin: auto; }
.nav__toggle .icon-close { display: none; }
.nav__toggle[aria-expanded="true"] .icon-open { display: none; }
.nav__toggle[aria-expanded="true"] .icon-close { display: block; }

@media (max-width: 720px) {
  .nav__toggle { display: flex; }
  .nav__list {
    position: absolute; left: 0; right: 0; top: var(--header-height);
    flex-direction: column; align-items: stretch; gap: 0;
    padding: var(--space-2) var(--gutter) var(--space-4);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    display: none;
  }
  .nav__list.is-open { display: flex; }
  .nav__link { display: block; padding: var(--space-3) 0; font-size: var(--fs-base); }
  .nav__link[aria-current="true"]::after { display: none; }
}

/* =====================================================================
   HERO
   ===================================================================== */
.hero {
  position: relative;
  padding-block: calc(var(--space-8) * 1.2) var(--space-8);
  overflow: hidden;
  isolation: isolate;
}
/* Soft glows + faint tile grid, a nod to puzzle boards */
.hero::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 55% at 78% 20%, var(--color-glow-gold), transparent 70%),
    radial-gradient(50% 50% at 10% 90%, var(--color-glow-teal), transparent 70%);
}
.hero::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--color-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(70% 70% at 60% 40%, #000 30%, transparent 80%);
  mask-image: radial-gradient(70% 70% at 60% 40%, #000 30%, transparent 80%);
}

.hero__inner {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  align-items: center;
  gap: var(--space-7);
}

.hero__title { font-size: var(--fs-display); max-width: 14ch; }
.hero__lead {
  max-width: 34rem;
  margin-top: var(--space-5);
  color: var(--color-text-muted);
  font-size: var(--fs-md);
}
.hero__actions {
  display: flex; flex-wrap: wrap; gap: var(--space-3);
  margin-top: var(--space-6);
}

/* Two app icons as tilted "tiles" */
.hero__art {
  position: relative;
  justify-self: center;
  width: min(100%, 360px);
  aspect-ratio: 1;
}
.hero__tile {
  position: absolute;
  width: 58%;
  border-radius: 24%;
  overflow: hidden;
  border: 1px solid var(--color-border-strong);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
  background: var(--color-surface);
}
.hero__tile--a { left: 0; top: 6%; transform: rotate(-8deg); }
.hero__tile--b { right: 0; bottom: 6%; transform: rotate(7deg); }
.hero__tile img { width: 100%; }

@media (max-width: 860px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__art { width: min(78%, 300px); order: -1; }
}

/* =====================================================================
   GAMES
   ===================================================================== */
.games {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
}
@media (max-width: 860px) { .games { grid-template-columns: 1fr; } }

.game {
  position: relative;
  display: flex; flex-direction: column;
  padding: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition), background var(--transition);
}
.game:hover { border-color: var(--color-border-strong); background: var(--color-surface-hover); }
.game:focus-within { border-color: var(--color-gold); }

/* The whole card opens the game page: the title link is stretched over it.
   Links in the card foot (the Google Play button) sit above it. */
.game__link { outline: none; }
.game__link::after {
  content: "";
  position: absolute; inset: 0; z-index: 1;
  border-radius: inherit;
}
.game:hover .game__title,
.game__link:focus-visible { color: var(--color-gold-light); }
.game__foot a { position: relative; z-index: 2; }

.game__head { display: flex; align-items: center; gap: var(--space-4); }
.game__icon {
  width: 76px; height: 76px;
  border-radius: 20px;
  flex-shrink: 0;
  border: 1px solid var(--color-border-strong);
}
.game__title { font-size: var(--fs-lg); }
.game__genre {
  margin-top: var(--space-1);
  color: var(--color-gold);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}

.game__text {
  margin-top: var(--space-5);
  color: var(--color-text-muted);
}

.game__features {
  display: grid; gap: var(--space-3);
  margin-top: var(--space-5);
  font-size: var(--fs-sm);
}
.game__features li {
  position: relative;
  padding-left: var(--space-5);
}
.game__features li::before {
  content: "";
  position: absolute; left: 2px; top: 0.55em;
  width: 7px; height: 7px;
  background: var(--color-copper);
  transform: rotate(45deg);
}

.game__foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3);
  margin-top: auto;
  padding-top: var(--space-6);
}
.game__platform { color: var(--color-text-subtle); font-size: var(--fs-xs); }

/* =====================================================================
   PRINCIPLES
   ===================================================================== */
.principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}
@media (max-width: 860px) { .principles { grid-template-columns: 1fr; gap: var(--space-5); } }

.principle {
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border-strong);
}
.principle__num {
  display: block;
  margin-bottom: var(--space-3);
  color: var(--color-copper);
  font-family: var(--font-heading);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.08em;
}
.principle__title { font-size: var(--fs-lg); }
.principle__text {
  margin-top: var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
}

/* =====================================================================
   CONTACT
   ===================================================================== */
.contact {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-6);
  padding: var(--space-7) var(--space-6);
  background:
    radial-gradient(80% 120% at 100% 0%, var(--color-glow-gold), transparent 60%),
    var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}
.contact .section__head { margin-bottom: 0; }

/* =====================================================================
   FOOTER
   ===================================================================== */
.footer {
  padding-block: var(--space-6);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-subtle);
  font-size: var(--fs-sm);
}
.footer__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4);
}
.footer__links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }
.footer__links a:hover,
.footer__links a[aria-current="page"] { color: var(--color-text); }

/* =====================================================================
   LEGAL PAGES (privacy.html, terms.html, cookies.html)
   ===================================================================== */
.header__back { min-height: 40px; padding-block: var(--space-2); }

.legal { padding-block: var(--space-7) var(--space-8); }
.legal__inner { max-width: var(--reading-width); }

/* Switcher between the three documents */
.legal__docs {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
  margin-bottom: var(--space-6);
}
.legal__docs a {
  padding: var(--space-1) var(--space-4);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  transition: border-color var(--transition), color var(--transition);
}
.legal__docs a:hover { border-color: var(--color-gold); color: var(--color-gold-light); }
.legal__docs a[aria-current="page"] {
  border-color: transparent;
  background: var(--gradient-accent);
  color: var(--color-on-accent);
}

.legal__title { font-size: var(--fs-xl); }
.legal__meta {
  margin-top: var(--space-3);
  color: var(--color-text-subtle);
  font-size: var(--fs-sm);
}

/* Document body: long-form text */
.legal-body {
  margin-top: var(--space-6);
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}
.legal-body h2 {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
}
.legal-body h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.legal-body h3 {
  margin-top: var(--space-5);
  color: var(--color-text);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
}
.legal-body p,
.legal-body ul,
.legal-body ol { margin-top: var(--space-4); }
.legal-body ul { list-style: disc; padding-left: 1.4em; }
.legal-body ol { list-style: decimal; padding-left: 1.6em; }
.legal-body li { margin-top: var(--space-2); padding-left: var(--space-1); }
.legal-body li::marker { color: var(--color-copper); }
.legal-body li > ul,
.legal-body li > ol { margin-top: var(--space-2); }
.legal-body strong { color: var(--color-text); font-weight: var(--fw-semibold); }
.legal-body a {
  color: var(--color-gold-light);
  text-decoration: underline;
  text-decoration-color: rgba(236, 201, 122, 0.4);
  text-underline-offset: 3px;
}
.legal-body a:hover { text-decoration-color: currentColor; }

/* Highlighted notice block (e.g. "Entertainment only") */
.legal-notice {
  margin-top: var(--space-5);
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-gold);
  border-radius: var(--radius-md);
}
.legal-notice > :first-child { margin-top: 0; }

/* =====================================================================
   SCROLL REVEAL (enabled by JS; content stays visible without it)
   ===================================================================== */
.reveal-enabled [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 600ms ease, transform 600ms ease;
}
.reveal-enabled [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
