/* ==========================================================================
   BEASEFORGE — site stylesheet
   --------------------------------------------------------------------------
   One file, five sections. Change things at the TOP first:
     1. Tokens      — colours, fonts, sizes, spacing. Rebrand here.
     2. Base        — element defaults (body, headings, links, focus).
     3. Layout      — containers, sections, grids. No colours here.
     4. Components  — header, buttons, cards, forms… one block each.
     5. Utilities   — small single-purpose helpers.
   Naming: .block, .block__part, .block--variant  (e.g. .card__body, .btn--outline)
   Rule of thumb: never put style="" in the HTML. Add or reuse a class.
   ========================================================================== */


/* 1. TOKENS
   ========================================================================== */
:root {
  /* Brand palette (locked — see brand sheet) */
  --near-black: #111111;
  --charcoal:   #3A3A38;
  --ash:        #5F5E5A;
  --parchment:  #F2EFE8;
  --amber:      #F8A020;
  --ember:      #C04800;

  /* Supporting shades (derived, for contrast) */
  --ember-dark:     #8A3400;  /* Ember text on Parchment (passes 4.5:1) */
  --surface-raised: #1A1A19;  /* cards, alternate sections */
  --surface-sunken: #0A0A0A;  /* footer */
  --line:           #2A2A28;  /* borders on dark */

  /* Semantic roles — use these in components, not the raw palette */
  --bg:          var(--near-black);
  --text:        var(--parchment);
  --text-muted:  #C9C6BF;     /* body copy on dark (passes AA) */
  --text-subtle: #A8A59E;     /* small print on dark (passes AA) */
  --accent:      var(--amber);
  --accent-alt:  var(--ember);

  /* Type */
  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body:    'Nunito Sans', system-ui, sans-serif;

  /* Fluid type scale: clamp(min, preferred, max) — scales with screen width */
  --step-display: clamp(3.5rem, 2rem + 6vw, 6.5rem);   /* page h1 */
  --step-1:       clamp(2.75rem, 1.8rem + 3.5vw, 4.5rem); /* big h2 */
  --step-2:       clamp(2.25rem, 1.6rem + 2.2vw, 3.5rem); /* section h2 */
  --step-3:       clamp(1.75rem, 1.4rem + 1vw, 2.5rem);   /* card h2/h3 */
  --step-4:       1.625rem;                             /* small h3 */
  --text-lg:      1.25rem;
  --text-md:      1.125rem;
  --text-base:    1rem;
  --text-sm:      0.9375rem;
  --text-xs:      0.8125rem;

  /* Spacing scale */
  --space-2xs: 0.5rem;
  --space-xs:  0.75rem;
  --space-sm:  1rem;
  --space-md:  1.5rem;
  --space-lg:  2rem;
  --space-xl:  3rem;
  --space-2xl: 4rem;
  --space-section: clamp(4rem, 3rem + 4vw, 7rem);

  /* Layout */
  --container: 75rem;   /* 1200px */
  --gutter:    clamp(1.25rem, 4vw, 2rem);
  --tap:       2.75rem; /* minimum touch target (44px) */
}


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

html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 0.95;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-wrap: balance;
}

p { margin: 0; }

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

a { color: var(--accent); }
a:hover { color: var(--text); }

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

input, select, textarea, button { font: inherit; color: inherit; }


/* 3. LAYOUT
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: 47.5rem; }

/* Vertical rhythm for page sections */
.section       { padding-block: var(--space-section); }
.section--flush-top { padding-top: 0; }

/* Background variants */
.section--raised {
  background: var(--surface-raised);
  border-block: 1px solid var(--line);
}
.section--light {
  background: var(--parchment);
  color: var(--near-black);
  --text-muted: var(--charcoal);   /* re-map roles inside light bands */
  --accent: var(--near-black);
}
.section--ruled { border-top: 1px solid var(--line); }

/* Two columns that stack on small screens. Main column is wider. */
.split {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xl);
  align-items: center;
}
.split--top  { align-items: flex-start; }
.split__main { flex: 999 1 30rem; min-width: 0; }
.split__side { flex: 1 1 20rem; min-width: 0; }
.split__side > img { width: min(22.5rem, 65vw); }   /* hero logo: full size on desktop, smaller on phones */
.split__half { flex: 1 1 26rem; min-width: 0; }

/* Responsive card grid. Set --grid-min on the element to change card width. */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(var(--grid-min, 18rem), 100%), 1fr));
  gap: var(--grid-gap, var(--space-md));
}
.grid--2      { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--roomy  { --grid-min: 15rem; --grid-gap: var(--space-lg); }   /* stat columns */
.grid--tiles  { --grid-min: 19rem; --grid-gap: 1.25rem; }          /* archetype tiles */
.grid--cards  { --grid-min: 20rem; --grid-gap: 1.75rem; }          /* arcade game cards */

/* Horizontal group that wraps (buttons, tags, nav) */
.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cluster-gap, var(--space-sm));
  align-items: center;
}
.cluster--between { justify-content: space-between; }
.cluster--center  { justify-content: center; }
.cluster--tight   { --cluster-gap: var(--space-2xs); }

/* Vertical stack with even gaps */
.stack { display: flex; flex-direction: column; gap: var(--stack-gap, var(--space-sm)); }


/* 4. COMPONENTS
   ========================================================================== */

/* --- Text styles --------------------------------------------------------- */
.eyebrow {
  margin-bottom: var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}
.section--light .eyebrow { color: var(--ember-dark); }

.title-display { font-size: var(--step-display); line-height: 0.92; }
.title-1       { font-size: var(--step-1); }
.title-2       { font-size: var(--step-2); }
.title-3       { font-size: var(--step-3); }
.title-4       { font-size: var(--step-4); }

.lead    { max-width: 36rem; font-size: var(--text-lg); color: var(--text-muted); }
.body-lg { font-size: var(--text-md); color: var(--text-muted); }
.muted   { color: var(--text-muted); }
.small   { font-size: var(--text-sm); color: var(--text-subtle); }

/* Spacing after headings / before actions */
.heading-gap { margin-top: var(--space-md); }
.intro-gap   { margin-bottom: var(--space-xl); }
.actions     { margin-top: var(--space-xl); }

.prose { font-size: var(--text-md); line-height: 1.7; color: var(--text-muted); }
.prose > * + * { margin-top: var(--space-md); }

/* --- Skip link (visible on keyboard focus only) -------------------------- */
.skip-link {
  position: absolute;
  left: var(--space-sm);
  top: -100px;
  z-index: 10;
  padding: var(--space-xs) var(--space-sm);
  background: var(--accent);
  color: var(--near-black);
  font-weight: 600;
}
.skip-link:focus { top: var(--space-sm); }

/* --- Site header ---------------------------------------------------------- */
.site-header { border-bottom: 1px solid var(--line); }
.site-header__inner { padding-block: 1.25rem; }

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text);
  text-decoration: none;
}
.brand__mark { width: 2.5rem; height: 2.5rem; }
.brand__name {
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-lg);
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--accent); }
.site-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 0.4em; }
.site-nav .site-nav__cta { color: var(--accent); }

/* --- Site footer ---------------------------------------------------------- */
.site-footer {
  background: var(--surface-sunken);
  border-top: 1px solid var(--line);
  font-size: var(--text-sm);
  color: var(--text-subtle);
}
.site-footer__inner { padding-block: 2.5rem; }
.site-footer .brand__name { font-size: 1.25rem; }
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-footer a { color: var(--text-subtle); }
.site-footer a:hover { color: var(--text); }

/* --- Buttons -------------------------------------------------------------- */
/* Use on <a> or <button>. Variants: --primary (amber), --outline, --dark */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0 1.75rem;
  border: 2px solid transparent;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn--primary { background: var(--amber); color: var(--near-black); }
.btn--primary:hover { background: var(--parchment); color: var(--near-black); }

.btn--outline { border-color: var(--parchment); color: var(--parchment); }
.btn--outline:hover { background: var(--parchment); color: var(--near-black); }

.btn--dark { background: var(--near-black); color: var(--amber); }
.btn--dark:hover { background: var(--charcoal); color: var(--amber); }

.btn--sm { min-height: var(--tap); padding: 0 1.25rem; font-size: 1.1875rem; }

/* Not-a-link placeholder, e.g. "Coming soon" on unreleased Arcade games */
.btn--soon { border-color: var(--ash); color: var(--text-muted); cursor: default; }

/* --- Tags ----------------------------------------------------------------- */
.tag {
  display: inline-block;
  padding: 0.3rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.tag--amber   { background: var(--amber); color: var(--near-black); }
.tag--ember   { background: var(--ember); color: var(--parchment); }
.tag--outline { border: 1px solid var(--ash); color: var(--text-muted); }

/* --- Placeholder (swap for <img> when art exists) ------------------------- */
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  background: var(--charcoal);
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-align: center;
}
.ratio-16x10 { aspect-ratio: 16 / 10; }
.ratio-4x3   { aspect-ratio: 4 / 3; }
.ratio-1x1   { aspect-ratio: 1 / 1; }
.ratio-hero  { min-height: clamp(16rem, 45vw, 28rem); }   /* shorter on phones */
/* Real images: pair with a ratio class, e.g. <img class="media-cover ratio-16x10" …>.
   Height comes from the ratio (never height:100% — inside grid cards that fills the whole card). */
.media-cover { width: 100%; height: auto; object-fit: cover; background: var(--charcoal); }

/* --- Card ----------------------------------------------------------------- */
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface-raised);
  border: 1px solid var(--line);
}
.card__body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 0.875rem;
  padding: 1.75rem;
}
.card__text { flex-grow: 1; color: var(--text-muted); }
.card__body > .btn { align-self: flex-start; }

/* Card variant: the whole card is a link (Games page flagship) */
.card--link { flex-direction: row; flex-wrap: wrap; color: var(--text); text-decoration: none; }
.card--link > * { flex: 1 1 26rem; }
.card--link .card__body { justify-content: center; padding: var(--space-xl); gap: var(--space-sm); }
.card--link:hover { border-color: var(--accent); color: var(--text); }
.card__more {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* --- Stat (big number + label) -------------------------------------------- */
.stat { padding-top: 0.875rem; border-top: 3px solid var(--amber); }
.stat--ember { border-top-color: var(--ember); }
.stat--ash   { border-top-color: var(--ash); }
.stat--light { border-top-color: var(--parchment); }
.stat__value {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1;
}
.stat__value--lg { font-size: 3.5rem; }
.stat__label { font-size: var(--text-sm); color: var(--text-muted); }
.stat__title { margin-top: 0.375rem; font-size: var(--step-4); }
.stat__text  { margin-top: 0.625rem; color: var(--text-muted); }
.stat__index {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-subtle);
}

/* --- Archetype tile ------------------------------------------------------- */
.archetype {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  padding: 1.75rem;
  background: var(--surface-raised);
  border: 1px solid var(--line);
}
.archetype__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  background: var(--charcoal);
  color: var(--amber);
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 700;
}
.archetype__text { margin-top: 0.5rem; font-size: var(--text-sm); color: var(--text-muted); }

/* --- Game facts (players / time / age) ------------------------------------ */
.facts { --cluster-gap: var(--space-md); margin-top: var(--space-lg); font-size: var(--text-sm); color: var(--text-muted); }
.facts strong { color: var(--text); }

/* --- Forms ---------------------------------------------------------------- */
.form, .form__row { --stack-gap: 1.25rem; --cluster-gap: 1.25rem; }
.field { display: flex; flex-direction: column; gap: var(--space-2xs); }
.form__row > .field { flex: 1 1 14rem; }   /* side-by-side fields share the row; stacked fields keep natural height */
.field__label { font-size: var(--text-sm); font-weight: 600; }

.input {
  min-height: 3.25rem;
  padding: 0 1rem;
  background: var(--surface-raised);
  border: 2px solid var(--ash);
  border-radius: 0;
  color: var(--text);
  font-size: var(--text-base);
}
.input::placeholder { color: var(--text-subtle); }
.input:focus { border-color: var(--accent); outline: none; }
.input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
textarea.input { padding-block: 0.875rem; resize: vertical; }

.section--light .input { background: #FFFFFF; border-color: var(--charcoal); color: var(--near-black); }
.section--light .input::placeholder { color: var(--ash); }

/* Inline sign-up: email + button on one row, wraps on phones */
.signup { --cluster-gap: var(--space-xs); justify-content: center; }
.signup .input { flex: 1 1 20rem; }
.signup .btn { min-height: 3.5rem; }

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  min-height: var(--tap);
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-muted);
  cursor: pointer;
}
.checkbox input { width: 1.25rem; height: 1.25rem; accent-color: var(--amber); }

/* --- Arcade filters ------------------------------------------------------- */
.filter {
  min-height: var(--tap);
  padding: 0 1.25rem;
  background: transparent;
  border: 2px solid var(--ash);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.filter[aria-pressed="true"] { background: var(--parchment); border-color: var(--parchment); color: var(--near-black); }

/* --- CTA band (heading + button side by side) ----------------------------- */
.cta-band { --cluster-gap: var(--space-xl); }
.cta-band__text { flex: 999 1 30rem; min-width: 0; }


/* 5. UTILITIES
   ========================================================================== */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
:where(.list-reset) { margin: 0; padding: 0; list-style: none; }  /* zero specificity: component margins still win */
.text-center { text-align: center; }
.mx-auto     { margin-inline: auto; }
[hidden]     { display: none !important; }
