/* Megafort Games LLC shared styles. Palette mirrors BuzzCard's
   "Obsidian Night" tokens in lib/theme/bz_tokens.dart; the cream and navy
   accents are sampled from the studio logo so the mark sits in the page
   rather than on top of it. */

/* Space Grotesk is the same variable font the app bundles
   (assets/fonts/SpaceGrotesk-Variable.ttf), subset to Latin and converted to
   WOFF2 for the web: 136KB -> 26KB, with the wght axis intact. Self-hosted, so
   the strict CSP only needs font-src 'self'. The axis tops out at 700; never
   ask for more, or the browser synthesises a fake bold. */
@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/SpaceGrotesk-Variable.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #0B0E14;
  --surface: #161B26;
  --surface-alt: #1E2433;
  --line: #2A3244;
  /* Boundary colour for anything that is a real component edge rather than a
     decorative rule. Clears the WCAG 1.4.11 non-text minimum of 3:1 against
     every surface it is used on: 3.81:1 on --ink, 3.40:1 on --surface,
     3.06:1 on --surface-alt. */
  --line-strong: #626F87;
  --text: #FFFFFF;
  --text-soft: #E2F1FF;
  --muted: #94A3B8;
  --gold: #FFC814;
  --gold-dark: #D49E00;
  --on-gold: #0B0E14;
  /* sampled from assets/logo.png */
  --logo-navy: #0B1740;
  --logo-cream: #F8F8F0;
  /* Light-theme values lifted from bz_tokens.dart, used by the cream About
     section so the site uses both halves of the brand rather than only the
     dark one. Contrast on --cream-bg: text 18.68:1, body 11.01:1,
     muted 5.73:1, link 5.93:1, rule 3.56:1. */
  --cream-bg: #FFFBF2;
  --cream-surface: #F0EBE1;
  --cream-line: #8A8578;
  --cream-text: #120826;
  --cream-body: #3A3A3A;
  --cream-muted: #646464;
  --cream-link: #7A5E00;
  --maxw: 68rem;
  --head-h: 4.5rem;

  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI",
                  Roboto, Helvetica, Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter,
               Roboto, Helvetica, Arial, sans-serif;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* 1.5KB tiling grain, served from /assets so img-src 'self' covers it and the
     CSP does not have to allow data: URIs. Ties the flat chrome to the
     pencil-textured logo. */
  background-color: var(--ink);
  background-image: url("/assets/grain.png");
  color: var(--text-soft);
  font: 400 17px/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; }

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Anchor targets must clear the sticky header, otherwise /#buzzcard parks the
   heading underneath it. */
section, main[id], h2[id] { scroll-margin-top: calc(var(--head-h) + 1rem); }

/* ---------- header ---------- */

.site-head {
  border-bottom: 1px solid var(--line);
  background: rgba(11, 14, 20, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  min-height: var(--head-h);
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 1.05rem;
  min-height: 44px;
}
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; display: block; }
.nav { display: flex; gap: 1.25rem; font-size: 0.95rem; font-family: var(--font-display); }
/* 44px minimum touch target: the links were 25px tall. */
.nav a {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  transition: color 0.18s var(--ease);
}
.nav a:hover { color: var(--gold); }

/* Brand + nav need 442px to sit on one row, so below 28rem the header wraps to
   two rows. Pin those rows to exactly 44px each and update --head-h to match,
   otherwise the anchor offset is short and headings land under the header. */
@media (max-width: 28rem) {
  :root { --head-h: 5.5rem; }
  .site-head .wrap { min-height: 0; row-gap: 0; column-gap: 1rem; }
  .nav { gap: 1rem; font-size: 0.9rem; }
}

/* ---------- hero ---------- */

.hero {
  padding: 5.5rem 0 5rem;
  border-bottom: 1px solid var(--line);
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
/* A warm wash that bridges the flat obsidian page to the logo's cream-and-navy
   badge, so the mark reads as lit by the page instead of pasted onto it. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(42rem 26rem at 78% 44%, rgba(255, 200, 20, 0.11), transparent 64%),
    radial-gradient(52rem 32rem at 84% 50%, rgba(11, 23, 64, 0.62), transparent 72%),
    radial-gradient(70rem 40rem at 50% 120%, rgba(0, 0, 0, 0.55), transparent 70%);
  pointer-events: none;
}
.hero-grid { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 52rem) {
  .hero { padding: 7rem 0 6.5rem; min-height: min(82vh, 44rem); display: grid; align-items: center; }
  .hero-grid { grid-template-columns: minmax(0, 1fr) 24rem; gap: 4.5rem; }
  .hero-copy { order: 1; }
  .hero-logo { order: 2; }
}
.hero-logo { display: block; justify-self: center; max-width: 15rem; }
@media (min-width: 52rem) { .hero-logo { max-width: 100%; } }
.hero-logo img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.7))
          drop-shadow(0 0 56px rgba(255, 200, 20, 0.2));
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold);
  margin: 0 0 1.1rem;
}
h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
  margin: 0 0 1.25rem;
  color: var(--text);
  font-weight: 700;
  max-width: 18ch;
  text-wrap: balance;
}
.lede {
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  color: var(--muted);
  margin: 0;
  max-width: 58ch;
  text-wrap: pretty;
}

/* ---------- sections ---------- */

section { padding: 4rem 0; }
section + section { border-top: 1px solid var(--line); }
h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 1.5rem;
  font-weight: 700;
  text-wrap: balance;
}
h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--text);
  margin: 0 0 0.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
p { margin: 0 0 1.1rem; }
p:last-child { margin-bottom: 0; }

/* ---------- product card ---------- */

.product {
  background: linear-gradient(168deg, var(--surface), var(--ink) 78%);
  border: 1px solid var(--line-strong);
  border-radius: 1rem;
  padding: 2.25rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset,
              0 18px 40px -24px rgba(0, 0, 0, 0.9);
}
/* Icon and headline sit side by side; the screenshots below then span the full
   card width instead of being boxed into a narrow column. */
.product-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}
@media (min-width: 46rem) {
  .product-head { grid-template-columns: 7rem minmax(0, 1fr); gap: 2.5rem; }
}
.product-icon {
  width: 7rem;
  height: 7rem;
  border-radius: 1.4rem;
  background: linear-gradient(160deg, var(--surface-alt), var(--ink));
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  box-shadow: 0 0 34px -10px rgba(255, 200, 20, 0.35);
}
.product-icon img { width: 68%; height: auto; display: block; }
.badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--gold-dark);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  margin-bottom: 0.9rem;
}
.feature-list { list-style: none; margin: 2.5rem 0 0; padding: 0; display: grid; gap: 0.9rem; }
@media (min-width: 46rem) { .feature-list { grid-template-columns: 1fr 1fr; gap: 1.2rem 2rem; } }
.feature-list li { padding-left: 1.4rem; position: relative; color: var(--muted); font-size: 0.97rem; }
.feature-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.62em;
  width: 0.5rem; height: 0.5rem;
  border-radius: 2px;
  background: var(--gold);
}

/* ---------- about ---------- */

/* The blanket-fort story is the most distinctive thing on the site, so it gets
   the visual weight and the filing details step back. */
.about-grid { display: grid; gap: 2.5rem; }
@media (min-width: 52rem) {
  .about-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 4rem; }
}
.story { max-width: 60ch; }
.story-lead {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
  line-height: 1.3;
  letter-spacing: -0.02em;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 1.2rem;
  text-wrap: balance;
}
.story p:not(.story-lead) { color: var(--text-soft); }

.facts {
  border-left: 2px solid var(--line-strong);
  padding: 0.2rem 0 0.2rem 1.4rem;
  align-self: start;
}
.facts-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin: 0 0 1.1rem;
  font-weight: 700;
}

dl { margin: 0; }
dt { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-top: 1.1rem; font-family: var(--font-display); }
dt:first-child { margin-top: 0; }
dd { margin: 0.25rem 0 0; color: var(--text-soft); }

/* The About section runs on the light half of the brand: warm cream ground,
   navy text, dark-gold links. Every value comes from bz_tokens.dart's light
   theme, and each pair is checked against WCAG above. */
#about {
  background-color: var(--cream-bg);
  background-image: url("/assets/grain.png");
  color: var(--cream-body);
  border-top: 0;
}
#about h2,
#about .story-lead { color: var(--cream-text); }
#about .story p:not(.story-lead) { color: var(--cream-body); }
#about a { color: var(--cream-link); }
#about .facts { border-left-color: var(--cream-line); }
#about .facts-title { color: var(--cream-link); }
#about dt { color: var(--cream-muted); }
#about dd { color: var(--cream-text); }
/* The gold focus ring is only 1.50:1 on cream, so it needs the dark-gold one. */
#about :focus-visible { outline-color: var(--cream-link); }

/* ---------- legal / long-form ---------- */

.legal { padding: 3.5rem 0 5rem; max-width: 46rem; }
.legal h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); margin-bottom: 0.5rem; max-width: none; }
.legal .effective { color: var(--muted); font-size: 0.92rem; margin-bottom: 2.5rem; }
.legal h2 { font-size: 1.3rem; margin: 2.5rem 0 0.9rem; padding-top: 1.5rem; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--head-h) + 1rem); }
.legal h3 { margin-top: 1.6rem; }
.legal ul { padding-left: 1.2rem; margin: 0 0 1.1rem; }
.legal li { margin-bottom: 0.55rem; }
.legal strong { color: var(--text); font-weight: 600; }
.callout {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--gold);
  border-radius: 0.5rem;
  padding: 1.25rem 1.5rem;
  margin: 0 0 2rem;
}
.callout ul { margin-bottom: 0; }

/* ---------- 404 ---------- */

.notfound { padding: 6rem 0 8rem; max-width: 44rem; }
.notfound h1 { max-width: 16ch; }
.notfound .lede { margin-bottom: 0; }

/* ---------- footer ---------- */

.site-foot {
  border-top: 1px solid var(--line);
  padding: 2.5rem 0 3.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-foot .wrap { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.site-foot .nav { gap: 1.5rem; }
.site-foot .nav a { color: var(--muted); }

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

/* utility classes, kept out of inline style= so the strict CSP in _headers
   (style-src 'self') does not have to allow 'unsafe-inline' */
.cta-line { margin-top: 1.6rem; }
.callout-title { margin-top: 0; }

/* ---------- app screenshots ---------- */

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
  gap: 2.25rem;
  margin: 2.75rem auto 0;
  max-width: 42rem;
}
.shots figure { margin: 0; }
.shots img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 1.1rem;
  border: 1px solid var(--line-strong);
  background: var(--ink);
  box-shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.95);
}
/* A slight tilt so the pair reads as objects on a surface rather than as two
   boxes in a grid. Straightens on hover. */
.shots figure:first-child img { rotate: -1.75deg; }
.shots figure:last-child  img { rotate: 1.75deg; }
.shots figcaption {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

/* ---------- motion ----------
   All of this is CSS only: no JavaScript runs on this site, and the CSP has no
   script-src on purpose. Every rule below is additive, so with motion disabled
   (or in a browser without scroll-driven animation) the page renders in its
   finished state with nothing missing. */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* Hero entrance. @starting-style means the default IS the end state, so
     unsupported browsers simply show the finished hero. */
  .hero-copy > *,
  .hero-logo {
    transition: opacity 0.6s var(--ease), translate 0.6s var(--ease);
  }
  @starting-style {
    .hero-copy > * { opacity: 0; translate: 0 0.75rem; }
    .hero-logo { opacity: 0; translate: 0 1.25rem; }
  }
  .hero-copy .eyebrow { transition-delay: 0.04s; }
  .hero-copy h1 { transition-delay: 0.12s; }
  .hero-copy .lede { transition-delay: 0.2s; }
  .hero-logo { transition-delay: 0.28s; }

  .product { transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease); }
  .product:hover { border-color: var(--gold-dark); }
  .shots img {
    transition: transform 0.3s var(--ease), rotate 0.3s var(--ease),
                border-color 0.3s var(--ease);
  }
  .shots figure:hover img {
    transform: translateY(-5px);
    rotate: 0deg;
    border-color: var(--gold-dark);
  }

  /* Scroll reveals, gated on real support so Firefox (where scroll-driven
     animation is still behind a flag) gets the static finished layout rather
     than a zero-duration flash. */
  @supports (animation-timeline: view()) {
    .feature-list li,
    .shots figure,
    .story-lead,
    .facts {
      animation: bz-reveal linear both;
      animation-timeline: view();
      animation-range: entry 5% cover 30%;
    }
  }
}

@keyframes bz-reveal {
  from { opacity: 0; translate: 0 1rem; }
  to   { opacity: 1; translate: 0 0; }
}
