/* ============================================================
   PhoenixGold Game Studios — shared design system
   ------------------------------------------------------------
   ONE source of truth for colour, type, rhythm and the shared
   chrome. Page stylesheets (megablast-mayhem.css,
   eucalyptus-edge.css) layer on top and must not redefine
   anything declared here.

   DIRECTION — "the festival at night"
   Verdantia's world is a warm night festival in a eucalyptus
   forest: lanterns, bunting, handmade signage. Most studio sites
   reach for cold chrome and blue-black cinematic gloom. This one
   goes the other way: deep green-black, lit from within by gold.
   Warmth is the differentiator, and it is also just true to the
   game.
   ============================================================ */

:root {
  /* ---- palette -------------------------------------------------
     Six values. Night and canopy are green-black, not neutral
     black — the whole site sits inside a forest at dusk. Lantern
     is the light SOURCE and is used sparingly so it reads as
     light rather than as a brand colour smeared everywhere. */
  --pg-night:      #04100b;
  --pg-canopy:     #0b1d13;
  --pg-bark:       #16281c;
  --pg-lantern:    #f2d27c;
  --pg-gold:       #d8b35a;
  --pg-leaf:       #9acb3d;
  --pg-ember:      #ff8a3d;

  --pg-text:       #f4f0e6;
  --pg-muted:      #b9b3a2;
  --pg-line:       rgba(216, 179, 90, .22);
  --pg-line-lit:   rgba(216, 179, 90, .5);

  /* ---- type ----------------------------------------------------
     Fraunces for display: a variable serif with optical sizing and
     a genuine "wonk" axis. It looks hand-cut rather than
     machine-perfect, which is what a hand-made festival should
     feel like — and it is not the Cinzel every fantasy game site
     reaches for.
     Archivo for body: a sturdy grotesque that holds up at 14px
     better than Inter and is far less ubiquitous. */
  --pg-display: "Fraunces", "Cinzel", Georgia, serif;
  --pg-body:    "Archivo", "Inter", system-ui, sans-serif;

  /* Type scale, 1.25 minor third, fluid between 380px and 1400px */
  --pg-t-xs:  clamp(.72rem, .68rem + .18vw, .8rem);
  --pg-t-sm:  clamp(.85rem, .8rem + .22vw, .95rem);
  --pg-t-md:  clamp(1rem, .95rem + .3vw, 1.12rem);
  --pg-t-lg:  clamp(1.3rem, 1.1rem + .8vw, 1.7rem);
  --pg-t-xl:  clamp(1.9rem, 1.4rem + 2vw, 3rem);
  --pg-t-2xl: clamp(2.6rem, 1.6rem + 4.4vw, 5.4rem);

  /* ---- rhythm --------------------------------------------------
     One spacing scale. Sections use --pg-gap-section so vertical
     rhythm cannot drift between pages. */
  --pg-gap-xs: .5rem;
  --pg-gap-sm: 1rem;
  --pg-gap-md: 1.75rem;
  --pg-gap-lg: 3rem;
  --pg-gap-section: clamp(4.5rem, 3rem + 7vw, 9rem);

  --pg-radius: 14px;
  --pg-radius-lg: 22px;
  --pg-maxw: 1240px;

  /* The lantern. One warm light source, reused. */
  --pg-glow: 0 0 60px rgba(242, 210, 124, .16);
  --pg-shadow: 0 26px 70px rgba(0, 0, 0, .6);
}

/* ---- reset ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--pg-night);
  color: var(--pg-text);
  font-family: var(--pg-body);
  font-size: var(--pg-t-md);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* Quality floor: keyboard users must always see where they are. */
:focus-visible {
  outline: 2px solid var(--pg-lantern);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Quality floor: motion is decoration, never the only signal. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ---- layout --------------------------------------------------- */
.pg-wrap { width: min(100% - 2.5rem, var(--pg-maxw)); margin-inline: auto; }
.pg-section { padding-block: var(--pg-gap-section); position: relative; }

/* ---- type ----------------------------------------------------- */
.pg-display {
  font-family: var(--pg-display);
  font-weight: 600;
  font-variation-settings: "SOFT" 30, "WONK" 1, "opsz" 100;
  line-height: 1.02;
  letter-spacing: -.015em;
}
h1.pg-display { font-size: var(--pg-t-2xl); }
h2.pg-display { font-size: var(--pg-t-xl); }
h3.pg-display { font-size: var(--pg-t-lg); }

/* Eyebrow. Used ONLY where it names a real category — never as
   decoration above every heading. */
.pg-eyebrow {
  display: inline-block;
  font-family: var(--pg-body);
  font-size: var(--pg-t-xs);
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--pg-gold);
}
.pg-lede { color: var(--pg-muted); font-size: var(--pg-t-lg); max-width: 62ch; line-height: 1.45; }
.pg-body { color: var(--pg-muted); max-width: 68ch; }

/* ============================================================
   SIGNATURE — festival bunting
   A row of pennants strung between sections, drawn in CSS from
   the palette. It is the one decorative element on the site, and
   it earns its place: the whole game is a festival, and bunting
   is the most recognisable object in that world. Everything else
   stays quiet so this reads as intentional rather than busy.
   ============================================================ */
.pg-bunting {
  --pennant: 26px;
  height: var(--pennant);
  border: 0;
  margin: 0;
  background:
    linear-gradient(to bottom, var(--pg-line-lit) 0 2px, transparent 2px),
    repeating-linear-gradient(90deg,
      var(--pg-gold)   0 18px,
      var(--pg-leaf)  18px 36px,
      var(--pg-ember) 36px 54px);
  -webkit-mask: linear-gradient(#000 0 2px, transparent 2px),
    repeating-conic-gradient(from -45deg at 50% 0,
      #000 0 90deg, transparent 90deg 360deg) 0 0 / 18px var(--pennant);
  mask: linear-gradient(#000 0 2px, transparent 2px),
    repeating-conic-gradient(from -45deg at 50% 0,
      #000 0 90deg, transparent 90deg 360deg) 0 0 / 18px var(--pennant);
  -webkit-mask-composite: source-over;
  mask-composite: add;
  opacity: .55;
}

/* ---- buttons -------------------------------------------------- */
.pg-btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .85rem 1.5rem;
  border-radius: 999px;
  border: 1px solid var(--pg-line-lit);
  font-family: var(--pg-body);
  font-weight: 700;
  font-size: var(--pg-t-sm);
  letter-spacing: .04em;
  text-transform: uppercase;
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease;
}
.pg-btn:hover { transform: translateY(-2px); }
.pg-btn-primary {
  background: linear-gradient(180deg, var(--pg-lantern), var(--pg-gold));
  color: #21160a; border-color: transparent;
  box-shadow: var(--pg-glow);
}
.pg-btn-primary:hover { background: linear-gradient(180deg, #fbe4a2, var(--pg-lantern)); }
.pg-btn-ghost { color: var(--pg-text); background: rgba(255,255,255,.03); }
.pg-btn-ghost:hover { border-color: var(--pg-lantern); background: rgba(242,210,124,.08); }

/* ---- shared chrome: header ------------------------------------ */
.pg-header {
  position: fixed; inset: 0 0 auto 0; z-index: 900;
  background: color-mix(in srgb, var(--pg-night) 86%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, background-color .25s ease;
}
.pg-header[data-scrolled="true"] {
  border-bottom-color: var(--pg-line);
  background: color-mix(in srgb, var(--pg-night) 96%, transparent);
}
.pg-header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--pg-gap-md); min-height: 76px; }
.pg-brand { display: inline-flex; align-items: center; gap: .7rem; font-family: var(--pg-display); font-size: 1.15rem; font-weight: 600; }
.pg-brand img { width: 40px; height: 40px; object-fit: contain; }
.pg-nav { display: flex; align-items: center; gap: 1.6rem; }
.pg-nav a {
  font-size: var(--pg-t-sm); font-weight: 600; color: var(--pg-muted);
  padding-block: .3rem; border-bottom: 1px solid transparent;
  transition: color .18s ease, border-color .18s ease;
}
.pg-nav a:hover, .pg-nav a[aria-current="page"] { color: var(--pg-lantern); border-bottom-color: var(--pg-gold); }
.pg-menu-btn { display: none; background: none; border: 1px solid var(--pg-line); border-radius: 10px; color: var(--pg-text); padding: .5rem .8rem; font: inherit; cursor: pointer; }

@media (max-width: 860px) {
  .pg-nav { display: none; }
  .pg-menu-btn { display: block; }
  .pg-header[data-open="true"] .pg-nav {
    display: flex; position: absolute; inset: 76px 0 auto 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    padding: var(--pg-gap-sm) 1.25rem var(--pg-gap-md);
    background: var(--pg-canopy); border-bottom: 1px solid var(--pg-line);
  }
  .pg-header[data-open="true"] .pg-nav a { width: 100%; padding-block: .8rem; border-bottom: 1px solid var(--pg-line); }
}

/* ---- shared chrome: footer ------------------------------------ */
.pg-footer { background: var(--pg-canopy); border-top: 1px solid var(--pg-line); padding-block: var(--pg-gap-lg); }
.pg-footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: var(--pg-gap-lg); }
.pg-footer h4 { font-family: var(--pg-body); font-size: var(--pg-t-xs); letter-spacing: .16em; text-transform: uppercase; color: var(--pg-gold); margin: 0 0 .8rem; }
.pg-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.pg-footer a { color: var(--pg-muted); font-size: var(--pg-t-sm); }
.pg-footer a:hover { color: var(--pg-lantern); }
.pg-colophon { margin-top: var(--pg-gap-lg); padding-top: var(--pg-gap-md); border-top: 1px solid var(--pg-line); display: flex; flex-wrap: wrap; gap: var(--pg-gap-sm); justify-content: space-between; color: var(--pg-muted); font-size: var(--pg-t-xs); }
@media (max-width: 760px) { .pg-footer-grid { grid-template-columns: 1fr; } }

/* ---- scroll reveal --------------------------------------------
   Progressive: content is visible by default and only hidden once
   JS confirms it can reveal it. No JS, no blank page. */
.js .pg-reveal { opacity: 0; transform: translateY(14px); }
.js .pg-reveal.is-in { opacity: 1; transform: none; transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.3,1); }

/* ---- cross-document view transitions --------------------------
   Page-to-page navigation crossfades instead of flashing white.
   Supported browsers only; everything else just navigates. */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: pg-fade-out .22s ease both; }
::view-transition-new(root) { animation: pg-fade-in .3s ease both; }
@keyframes pg-fade-out { to { opacity: 0; } }
@keyframes pg-fade-in { from { opacity: 0; } }

/* ============================================================
   PAGE THEME OVERRIDES
   Shared structure stays consistent, but each part of the site
   gets its own atmosphere. The studio home keeps the forest/gold
   PhoenixGold palette; legal/support pages no longer inherit it.
   Game pages provide their own stronger palettes in their game CSS.
   ============================================================ */
body[data-page="legal"] {
  --pg-night: #0b0e16;
  --pg-canopy: #141927;
  --pg-bark: #20283a;
  --pg-lantern: #f1d8a3;
  --pg-gold: #c9a96b;
  --pg-leaf: #8faac7;
  --pg-ember: #d37d72;
  --pg-text: #f4f1eb;
  --pg-muted: #c3c8d4;
  --pg-line: rgba(201, 169, 107, .2);
  --pg-line-lit: rgba(201, 169, 107, .48);
  background:
    radial-gradient(circle at 15% 0, rgba(87, 113, 164, .16), transparent 30rem),
    linear-gradient(180deg, #0b0e16 0%, #101521 55%, #0b0e16 100%);
}

body[data-page="health"] {
  --pg-night: #08131d;
  --pg-canopy: #0e2130;
  --pg-bark: #173143;
  --pg-lantern: #ffd486;
  --pg-gold: #f0a85e;
  --pg-leaf: #79cfe3;
  --pg-ember: #ff7f5f;
  --pg-text: #f8f5ef;
  --pg-muted: #bed0dc;
  --pg-line: rgba(121, 207, 227, .18);
  --pg-line-lit: rgba(255, 212, 134, .5);
  background:
    radial-gradient(circle at 18% 12%, rgba(121, 207, 227, .14), transparent 28rem),
    radial-gradient(circle at 86% 8%, rgba(255, 127, 95, .12), transparent 24rem),
    linear-gradient(180deg, #07121c 0%, #0b1b29 58%, #08131d 100%);
}

body[data-page="support"] {
  --pg-night: #07131a;
  --pg-canopy: #0d2027;
  --pg-bark: #15313a;
  --pg-lantern: #f5d783;
  --pg-gold: #d5b15a;
  --pg-leaf: #67d4bf;
  --pg-ember: #f09a62;
  --pg-text: #f4f5ef;
  --pg-muted: #b9d1cf;
  --pg-line: rgba(103, 212, 191, .17);
  --pg-line-lit: rgba(245, 215, 131, .48);
  background:
    radial-gradient(circle at 50% 0, rgba(103, 212, 191, .12), transparent 32rem),
    linear-gradient(180deg, #07131a, #0d2027 60%, #07131a);
}
