/* ============================================================================
   HEXADU — Shared chrome
   Foundation, background animation system, header, footer, and the .prose
   typography used by long-form pages (privacy / terms / support). Every
   page loads tokens.css then this file; page-specific styles (e.g. the
   home hero) live in each page's own <style> block.
   ============================================================================ */

/* Page-level font override — Open Sans throughout. tokens.css declares
   Fredoka + Manrope as defaults; this pins the actual face used. */
:root {
  --hx-font-display: "Open Sans", system-ui, -apple-system, sans-serif;
  --hx-font-ui:      "Open Sans", system-ui, -apple-system, sans-serif;
  --hx-font-num:     "Open Sans", system-ui, sans-serif;
}

/* =========================================================================
   FOUNDATION + BASE BACKGROUND
   The body itself owns the base gradient — a deep magenta-violet
   vignette with a soft pink glow biased toward the top-center. Living
   on the body means it covers the viewport with no seams, ever, on any
   aspect ratio. Prefixed declarations are listed first as fallbacks for
   very old browsers; modern browsers will use the unprefixed version.
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background-color: #1e0b48; }
body {
  font-family: var(--hx-font-ui);
  color: var(--hx-fg-1);
  background-color: #1e0b48;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;

  background:
    -webkit-radial-gradient(50% 42%, circle, rgba(244, 168, 255, 0.22) 0%, rgba(208, 102, 232, 0.10) 22%, transparent 55%),
    -webkit-radial-gradient(50% 50%, ellipse, #4d2a8f 0%, #34176b 30%, #240f50 60%, #1e0b48 100%);
  background:
    -moz-radial-gradient(50% 42%, circle, rgba(244, 168, 255, 0.22) 0%, rgba(208, 102, 232, 0.10) 22%, transparent 55%),
    -moz-radial-gradient(50% 50%, ellipse, #4d2a8f 0%, #34176b 30%, #240f50 60%, #1e0b48 100%);
  background:
    radial-gradient(circle at 50% 42%, rgba(244, 168, 255, 0.22) 0%, rgba(208, 102, 232, 0.10) 22%, transparent 55%),
    radial-gradient(ellipse 90% 70% at 50% 50%, #4d2a8f 0%, #34176b 30%, #240f50 60%, #1e0b48 100%);
  background-attachment: fixed;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* =========================================================================
   BACKGROUND STACK
   Three independently-controllable layers stacked above the body's
   radial gradient:
     .bg-lattice    — tileable SVG hex grid. Scale via background-size.
     .bg-floats     — drifting purple orbs + gold Hexadu coin sprites.
                      Each is a positioned div in the same container so
                      they share parallax + reduced-motion behavior.
     .bg-particles  — small gold sparkle dots, JS-generated.
   ========================================================================= */
.bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  overflow: hidden;
}

/* HEX LATTICE -----------------------------------------------------------
   The SVG ships at 34.64 × 60 user units (one honeycomb tile). CSS
   background-size scales those units to whatever on-screen tile size
   we want — change one number to rescale the whole lattice. */
.bg-lattice {
  position: absolute; inset: 0;
  background-image: url("/assets/bg-hex-pattern.svg");
  background-repeat: repeat;
  background-size: 84px auto;    /* on-screen size of one tile (width) */
  background-position: 50% 50%;
  opacity: 0.35;
  /* Radial fade — the lattice is fully visible at the center and fades
     to transparent toward the edges, so it appears confined to the
     same "lit" area as the body's radial glow underneath. */
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 22%, transparent 78%);
          mask-image: radial-gradient(circle at 50% 50%, #000 22%, transparent 78%);
}

/* SPARKLE PARTICLES ----------------------------------------------------- */
.bg-particles { position: absolute; inset: 0; }
.bg-particles i {
  position: absolute;
  width: var(--s, 3px); height: var(--s, 3px);
  border-radius: 50%;
  background: radial-gradient(circle, #ffe48a 0%, #ffb627 45%, transparent 70%);
  filter: drop-shadow(0 0 6px rgba(255,182,39,0.65));
  left: var(--x); top: var(--y);
  opacity: 0;
  animation: particle var(--d, 7s) var(--delay, 0s) ease-in-out infinite;
}
@keyframes particle {
  0%   { transform: translateY(8px)  scale(0.5); opacity: 0; }
  20%  { opacity: 1; }
  50%  { transform: translateY(-12px) scale(1);   opacity: 0.95; }
  80%  { opacity: 1; }
  100% { transform: translateY(-30px) scale(0.4); opacity: 0; }
}

/* FLOATING DECORATIONS — orbs + coins in one layer ---------------------- */
.bg-floats { position: absolute; inset: 0; }

/* Gold Hexadu coin sprites (the existing piece-gold.png).
   No drop-shadow: Safari renders drop-shadow on a div+background-image
   with the div's box (square) rather than following the PNG's
   hexagonal alpha, producing a visible square halo. */
.bg-floats .piece {
  position: absolute;
  width: var(--w, 56px); aspect-ratio: 556/635;
  background: url("/assets/piece-gold.png") center/contain no-repeat;
  left: var(--x); top: var(--y);
  transform: rotate(var(--r, 0deg));
  animation: float var(--fd, 8s) var(--fdelay, 0s) var(--hx-ease-out) infinite alternate;
  opacity: var(--op, 0.95);
}

/* Drifting purple/pink orbs (CSS-only, no asset). Same float animation
   as the coins so the cursor-parallax in site.js works uniformly. */
.bg-floats .orb {
  position: absolute;
  width: var(--w, 24px); height: var(--w, 24px);
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(244, 168, 255, 0.55) 0%,
    rgba(208, 102, 232, 0.30) 35%,
    rgba(154, 106, 217, 0.12) 65%,
    transparent 80%);
  filter: blur(1.5px);
  left: var(--x); top: var(--y);
  opacity: var(--op, 0.5);
  animation: float var(--fd, 10s) var(--fdelay, 0s) var(--hx-ease-out) infinite alternate;
}

@keyframes float {
  0%   { transform: translate(0, 0)   rotate(var(--r, 0deg)); }
  100% { transform: translate(var(--mx, 0px), var(--my, -14px)) rotate(calc(var(--r, 0deg) + var(--rd, 6deg))); }
}

/* =========================================================================
   PAGE LAYOUT
   ========================================================================= */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* On the home page (no .page--legal modifier), vertically center the
   hero in the main grid row. `safe` falls back to top-alignment when
   the content is taller than the row — prevents the hero from
   overflowing above the visible area on very short viewports. */
.page:not(.page--legal) > main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  justify-content: safe center;
}

/* HEADER ------------------------------------------------------------------
   .nav is the outer full-width slot (so .page--legal can fix it to the
   viewport edge-to-edge with a blurred background); .nav-inner holds
   the 1180px content rail with the logo flush-left and links flush-right.
   width: min(1180px, calc(100% - 56px)) makes the rail extend to the
   full 1180px cap on wide viewports (no internal horizontal padding —
   the viewport itself provides the margin) and shrink to viewport-56px
   on narrower screens (28px breathing room on each side). Vertical
   padding is the only padding now. */
.nav { width: 100%; }
.nav-inner {
  width: min(1180px, calc(100% - 56px));
  margin-left: auto;
  margin-right: auto;
  padding: 28px 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--hx-font-display);
  font-weight: 600; font-size: 20px; letter-spacing: -0.01em;
  color: var(--hx-fg-1);
}
.brand-mark {
  width: 32px; height: 36px;
  background: url("/assets/piece-gold.png") center/contain no-repeat;
  filter: drop-shadow(0 0 10px rgba(255, 182, 39, 0.5));
}
.nav-links {
  display: flex; gap: 28px;
  font-family: var(--hx-font-ui); font-weight: 500; font-size: 14px;
  color: var(--hx-fg-2);
}
.nav-links a {
  position: relative;
  padding: 8px 2px;
  transition: color 180ms var(--hx-ease-out);
}
.nav-links a:hover { color: var(--hx-fg-1); }
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px; background: var(--hx-pink);
  transform: scaleX(0); transform-origin: left;
  transition: transform 240ms var(--hx-ease-out);
}
.nav-links a:hover::after { transform: scaleX(1); }

/* FOOTER -----------------------------------------------------------------
   Same outer/inner split as the header — see comment on .nav above.
   Content is laid out as a single row: copyright, then each link, with
   .footer-sep spans acting as dot dividers between every item. Single
   row, never wraps; left-aligned on desktop, center-aligned on mobile. */
footer { width: 100%; }
.footer-inner {
  width: min(1180px, calc(100% - 56px));
  margin-left: auto;
  margin-right: auto;
  padding: 32px 0 40px;
  display: flex;
  align-items: center;
  gap: 0.6em;
  flex-wrap: nowrap;
  white-space: nowrap;
  color: var(--hx-fg-3);
  font-size: 13px;
}
.footer-sep {
  opacity: 0.55;
  user-select: none;
}
footer a:hover { color: var(--hx-fg-1); }

/* =========================================================================
   LEGAL PAGE LAYOUT (opt-in via .page--legal on the page wrapper)
   The modifier exists primarily so the home-page vertical-centering
   rule (.page:not(.page--legal) > main) can exclude these pages. The
   nav and footer flow in normal document order; the body scrolls
   naturally when the .prose content exceeds the viewport.
   ========================================================================= */

/* =========================================================================
   GLASS CARD (legal-page content container)
   Solid panel — was a semi-transparent surface with backdrop-filter
   blur, but the body's radial gradient bled through and made the card
   read as a gradient itself. Flat #140832 reads as a clean recessed
   panel against the lit-center bg.
   ========================================================================= */
.glass {
  width: 100%;
  /* No max-width — glass fills the .prose content area, edges flush
     with the brand/links above and the © + links below. */
  background: #140832;
  border: 1px solid rgba(154, 106, 217, 0.22);
  border-radius: 20px;
  padding: 40px 52px;
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.50),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* =========================================================================
   PROSE — long-form content typography (privacy / terms / support)
   Constrained measure for readability; clear heading hierarchy; muted body
   copy that lifts to white on emphasis. Lives inside .glass-scroll.
   ========================================================================= */
.prose {
  width: min(1180px, calc(100% - 56px));
  margin-left: auto;
  margin-right: auto;
  padding: 16px 0 24px;
}
.prose-inner {
  /* No max-width — text fills the glass card's padding box edge to edge. */
  font-family: var(--hx-font-ui);
  color: var(--hx-fg-2);
  font-size: 16px;
  line-height: 1.65;
}
/* No extra top/bottom margin on the first / last element inside the
   glass — let the .glass padding handle the gap. */
.glass .prose-inner > :first-child { margin-top: 0; }
.glass .prose-inner > :last-child  { margin-bottom: 0; }
.prose-inner h1 {
  font-family: var(--hx-font-display);
  font-weight: 800;
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--hx-fg-1);
  margin: 16px 0 8px;
}
.prose-inner .meta {
  font-size: 12px;
  color: var(--hx-fg-3);
  margin: 0 0 36px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.prose-inner h2 {
  font-family: var(--hx-font-display);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.25;
  color: var(--hx-fg-1);
  margin: 40px 0 12px;
}
.prose-inner h3 {
  font-family: var(--hx-font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--hx-fg-1);
  margin: 28px 0 8px;
}
.prose-inner p { margin: 0 0 18px; }
.prose-inner ul, .prose-inner ol { margin: 0 0 18px; padding-left: 22px; }
.prose-inner li { margin: 0 0 6px; }
.prose-inner strong { color: var(--hx-fg-1); font-weight: 600; }
.prose-inner a {
  color: var(--hx-fg-1);
  text-decoration: underline;
  text-decoration-color: rgba(208, 102, 232, 0.45);
  text-underline-offset: 3px;
  transition: text-decoration-color 180ms var(--hx-ease-out);
}
.prose-inner a:hover { text-decoration-color: var(--hx-pink); }
.prose-inner hr {
  border: 0;
  border-top: 1px solid rgba(154, 106, 217, 0.2);
  margin: 36px 0;
}

/* Callout — highlighted lead paragraph at the top of a doc. */
.prose-inner .callout {
  background: linear-gradient(135deg, rgba(208, 102, 232, 0.10), rgba(122, 63, 200, 0.08));
  border: 1px solid rgba(208, 102, 232, 0.25);
  border-radius: var(--hx-r-md);
  padding: 18px 22px;
  margin: 24px 0 28px;
  color: var(--hx-fg-1);
}
.prose-inner .callout p { margin: 0; }
.prose-inner .callout p + p { margin-top: 10px; }

/* Contact card — link tile used on the support page. */
.prose-inner .contact-card {
  display: flex; align-items: center; gap: 16px;
  background: rgba(42, 20, 82, 0.55);
  border: 1px solid rgba(208, 102, 232, 0.25);
  border-radius: var(--hx-r-md);
  padding: 18px 22px;
  margin: 8px 0 32px;
  text-decoration: none;
  color: var(--hx-fg-1);
  transition: border-color 180ms var(--hx-ease-out), background 180ms var(--hx-ease-out);
}
.prose-inner .contact-card:hover {
  border-color: rgba(208, 102, 232, 0.55);
  background: rgba(42, 20, 82, 0.75);
}
.prose-inner .contact-card .ico {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 182, 39, 0.18), rgba(208, 102, 232, 0.10));
  border: 1px solid rgba(255, 182, 39, 0.30);
  font-size: 18px;
}
.prose-inner .contact-card .meta { display: flex; flex-direction: column; gap: 2px; }
.prose-inner .contact-card .meta b {
  font-family: var(--hx-font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--hx-fg-1);
}
.prose-inner .contact-card .meta span {
  font-size: 14px;
  color: var(--hx-fg-2);
}

/* =========================================================================
   RESPONSIVE — chrome breakpoints
   Hero-specific responsive lives in index.html.
   ========================================================================= */
@media (max-width: 980px) {
  .nav-inner { padding: 22px 0; }
  .footer-inner { padding: 28px 0; }
  .prose { padding: 12px 0 20px; }
  .glass { padding: 32px 36px; }
}
@media (max-width: 560px) {
  .nav-inner,
  .footer-inner,
  .prose { width: min(1180px, calc(100% - 44px)); }   /* 22px each side */
  .nav-inner { padding: 20px 0; }
  .footer-inner { padding: 18px 0; justify-content: center; gap: 0.5em; }
  .prose { padding: 8px 0 16px; }
  .glass { padding: 26px 24px; border-radius: 16px; }
  .prose-inner { font-size: 15px; }
  .prose-inner h2 { font-size: 20px; margin-top: 32px; }
  .prose-inner h1 { font-size: 32px; }
}

/* reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
}
