/* ============================================================================
   Stones to Starships -- site styles.

   Palette is lifted directly from Docs/UI/IndustrialCabinPalette.md so the
   site and the game menu chrome read as one brand. Do not invent new accents
   here; if the game palette changes, change it here too.

   Design rules carried over from that doc:
     * ONE hero accent -- yellow means "you chose this / it is ready".
     * Cyan means "the grid is doing work" -- system state, never decoration.
     * Category colors are stripes, never faces.
   ========================================================================= */

:root {
  /* Industrial Cabin tokens */
  --accent:         #E8B923;  /* warm construction yellow */
  --accent-bright:  #f5c93b;
  --lattice:        #4ECDC4;  /* cyan display */
  --warning:        #E8925A;
  --structure:      #292621;  /* panel faces */
  --structure-deep: #1E1D1A;  /* insets, page ground */
  --ink:            #F2F0EA;  /* body text */
  /* Opacity floors are contrast-driven, not taste-driven. Against the
     --structure-deep ground these land at roughly 6.4:1 and 5.3:1; dropping
     faint to the 0.38 it started at gives 2.9:1, which fails WCAG AA for the
     footer legal line and the small section labels that use it. */
  --ink-muted:      rgba(242, 240, 234, 0.62);
  --ink-faint:      rgba(242, 240, 234, 0.55);
  --rule:           rgba(242, 240, 234, 0.12);

  --font-display: "Montserrat", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --measure: 68ch;      /* readable line length */
  --shell: 1120px;      /* page max width */
  --gap: clamp(1rem, 3vw, 2rem);
  --section-y: clamp(3.5rem, 9vw, 7rem);
  --radius: 4px;        /* industrial: nearly square, not pill-shaped */
}

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--structure-deep);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------ typography -- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.4rem, 1.4rem + 4.6vw, 5rem); font-weight: 900; }
h2 { font-size: clamp(1.7rem, 1.2rem + 2.1vw, 2.6rem); font-weight: 800; }
h3 { font-size: clamp(1.15rem, 1rem + 0.7vw, 1.4rem); font-weight: 700; }

p { margin: 0 0 1.15em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }

/* Keyboard focus stays obvious -- the one place we ignore the palette. */
:focus-visible {
  outline: 3px solid var(--lattice);
  outline-offset: 3px;
  border-radius: 2px;
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.9rem;
}

.eyebrow--lattice { color: var(--lattice); }

.lede { font-size: clamp(1.05rem, 1rem + 0.5vw, 1.3rem); color: var(--ink-muted); }

/* ---------------------------------------------------------------- layout -- */

.shell {
  width: min(100% - 2.5rem, var(--shell));
  margin-inline: auto;
}

section { padding-block: var(--section-y); }

.skip-link {
  position: absolute;
  left: -9999px;
  background: var(--accent);
  color: var(--structure-deep);
  padding: 0.7rem 1.1rem;
  font-weight: 700;
  z-index: 100;
}

.skip-link:focus { left: 1rem; top: 1rem; }

/* ------------------------------------------------------------------ nav -- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(30, 29, 26, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.85rem;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.wordmark:hover { color: var(--accent); }

.nav { display: flex; gap: clamp(0.9rem, 2.5vw, 1.8rem); align-items: center; }

.nav a {
  font-size: 0.83rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-decoration: none;
}

.nav a:hover, .nav a[aria-current="page"] { color: var(--accent); }

@media (max-width: 33rem) {
  .nav a.nav--optional { display: none; }
}

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

.hero {
  position: relative;
  padding-block: clamp(4rem, 12vw, 9rem);
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
}

/* Faint industrial grid. Pure CSS -- no image request, no layout cost. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(242, 240, 234, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 240, 234, 0.12) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 20%, transparent 78%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 20%, transparent 78%);
  opacity: 0.5;
}

.hero > * { position: relative; z-index: 1; }

.hero h1 {
  text-transform: uppercase;
  letter-spacing: -0.015em;
  margin-bottom: 0.35em;
}

.hero .tagline {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 0.85rem + 0.5vw, 1.2rem);
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--lattice);
  margin: 0 0 1.6rem;
  max-width: none;
}

.hero .lede { max-width: 56ch; }

/* --------------------------------------------------------------- status -- */

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lattice);
  border: 1px solid rgba(78, 205, 196, 0.35);
  background: rgba(78, 205, 196, 0.07);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 1.6rem;
}

/* The "powered pulse" motion signature from the palette doc. */
.status-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lattice);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

/* -------------------------------------------------------------- buttons -- */

.actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 2rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn--primary { background: var(--accent); color: var(--structure-deep); }
.btn--primary:hover { background: var(--accent-bright); color: var(--structure-deep); }
.btn--ghost { border-color: var(--rule); color: var(--ink); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* --------------------------------------------------------------- panels -- */

.panel {
  background: var(--structure);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: clamp(1.4rem, 3vw, 2rem);
}

/* Category stripe -- an edge, never a face. */
.panel--striped { border-left: 4px solid var(--accent); }
.panel--lattice { border-left: 4px solid var(--lattice); }

.grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

/* ------------------------------------------------------------- features -- */

.feature {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  grid-template-columns: 1fr;
  padding-block: clamp(2rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--rule);
}

.feature:last-of-type { border-bottom: 0; }

@media (min-width: 52rem) {
  .feature { grid-template-columns: 1fr 1fr; }
  .feature:nth-of-type(even) .feature__media { order: -1; }
}

.feature h3 {
  font-size: clamp(1.4rem, 1.1rem + 1.3vw, 2rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

/* Screenshot slot. Holds its aspect ratio so nothing reflows when the real
   image lands -- that reflow is most of a bad Cumulative Layout Shift score. */
.shot {
  aspect-ratio: 16 / 9;
  width: 100%;
  background: var(--structure);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

.shot--empty {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: center;
  padding: 1rem;
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 10px,
      rgba(242, 240, 234, 0.03) 10px, rgba(242, 240, 234, 0.03) 20px);
}

/* ------------------------------------------------------------------ faq -- */

.faq details {
  border-bottom: 1px solid var(--rule);
  padding-block: 1.1rem;
}

.faq summary {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  color: var(--accent);
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
}

.faq details[open] summary::after { content: "\2212"; }

.faq details > div { padding-top: 0.85rem; color: var(--ink-muted); }

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

.footer {
  border-top: 1px solid var(--rule);
  padding-block: 3rem 2.5rem;
  color: var(--ink-muted);
  font-size: 0.88rem;
}

.footer__grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  margin-bottom: 2.5rem;
}

.footer h4 {
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.9rem;
}

.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: 0.45rem; }
.footer a { color: var(--ink-muted); text-decoration: none; }
.footer a:hover { color: var(--accent); text-decoration: underline; }

.footer__legal {
  border-top: 1px solid var(--rule);
  padding-top: 1.6rem;
  font-size: 0.8rem;
  color: var(--ink-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  justify-content: space-between;
}

/* ---------------------------------------------------------------- utils -- */

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

.stack > * + * { margin-top: 1.1rem; }
.center { text-align: center; }
.center p { margin-inline: auto; }

/* ---------------------------------------------------- narrow viewports -- */
/*
   The masthead is a wordmark plus a nav on one row. Both sites have long
   wordmarks ("Stubborn Machine Games" is 22 characters), and at 375px the
   nav ran off the right edge with the last item clipped -- unreachable, not
   just ugly. Letting the row wrap is the fix that cannot overflow again
   whatever the nav grows into later.
*/
.masthead__inner { flex-wrap: wrap; }

@media (max-width: 40rem) {
  .masthead__inner {
    justify-content: center;
    row-gap: 0.4rem;
    padding-block: 0.7rem;
  }
  .wordmark { font-size: 0.82rem; letter-spacing: 0.06em; }
  .nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.1rem;
  }
  .nav a { font-size: 0.74rem; letter-spacing: 0.06em; }
}

/* Long unbroken strings (a domain, a handle) must not push the page wide. */
body { overflow-wrap: break-word; }

/* --------------------------------------------------- disabled actions -- */
/*
   A "coming soon" primary button. Rendered in full accent yellow it would
   read as clickable and feel broken; rendered as plain muted text it would
   stop holding the space the real button will occupy. Outlined accent at
   reduced strength does both jobs.
*/
.btn:disabled,
.btn[aria-disabled="true"] {
  background: transparent;
  border-color: rgba(232, 185, 35, 0.4);
  color: rgba(232, 185, 35, 0.72);
  cursor: not-allowed;
}

.btn:disabled:hover { background: transparent; }

.btn__note {
  font-weight: 600;
  letter-spacing: 0.05em;
  opacity: 0.72;
}

/* A link inside the tagline keeps the tagline's own colour -- the default
   accent yellow would fight the cyan and read as a stray highlight. */
.tagline a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(78, 205, 196, 0.45);
  text-underline-offset: 5px;
}
.tagline a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}
