/* New Era Forge site styles. Uses only the tokens in tokens.css. Mobile-first; works at 360px. */

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
img, svg, video { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: var(--leading-tight); margin: 0 0 var(--space-3); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: var(--text-xl); }
h2 { font-size: var(--text-lg); margin-top: var(--space-6); }
h3 { font-size: var(--text-md); margin-top: var(--space-5); }
p, ul, ol, dl { margin: 0 0 var(--space-4); }
a { color: var(--color-link); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
code { font-family: var(--font-mono); font-size: 0.92em; }
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; border-radius: var(--radius-sm); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.prose { max-width: var(--measure); }
.muted { color: var(--color-muted); }
.lede { font-size: var(--text-md); color: var(--color-muted); max-width: var(--measure); }
.eyebrow { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-muted); margin-bottom: var(--space-2); }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: var(--space-3); top: -100px;
  background: var(--color-accent); color: var(--color-accent-contrast);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); z-index: 100;
}
.skip-link:focus { top: var(--space-3); }

/* ---------- Header & nav ---------- */
.site-header { border-bottom: 1px solid var(--color-line); background: var(--color-bg); }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 4rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--color-text); text-decoration: none; font-weight: 700; font-size: var(--text-md); }
.brand .mark { color: var(--color-text); }
.mark .mark-arc, .mark .mark-spark { color: var(--color-accent); }
.brand-new { font-weight: 400; }
/* Without JS the full list is always visible (a column on narrow screens). With JS, below 48em the
   list hides behind the Menu button until opened. */
.site-header-inner { position: relative; }
.site-nav { width: 100%; display: flex; flex-direction: column; align-items: flex-end; }
.nav-toggle { position: absolute; top: 0.75rem; right: 0; display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border: 1px solid var(--color-line); border-radius: var(--radius-sm); font: inherit; font-weight: 600; color: var(--color-text); background: var(--color-surface); cursor: pointer; }
.nav-toggle-icon { width: 1.1em; height: 2px; background: currentColor; box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor; display: inline-block; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon { background: transparent; box-shadow: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before { content: "×"; display: inline-block; font-size: 1.3em; line-height: 0; position: relative; top: 0.05em; }
.nav-list { list-style: none; margin: 0 0 var(--space-2); padding: 0; display: flex; flex-direction: column; gap: var(--space-1); width: 100%; }
.js .nav-list:not(.is-open) { display: none; }
.js .site-nav:has(.nav-list:not(.is-open)) { height: 0; }
.nav-list a, .theme-toggle { display: block; padding: var(--space-2) var(--space-3); color: var(--color-text); text-decoration: none; border-radius: var(--radius-sm); font-weight: 500; }
.nav-list a:hover, .theme-toggle:hover { background: var(--color-surface); }
.nav-list a[aria-current="page"] { font-weight: 700; box-shadow: inset 0 -3px 0 var(--color-accent); }
.nav-list a[aria-current="true"] { box-shadow: inset 0 -3px 0 var(--color-line); }
.theme-toggle { background: none; border: 1px solid var(--color-line); font: inherit; cursor: pointer; width: 100%; text-align: left; }
@media (min-width: 48em) {
  .site-header-inner { flex-wrap: nowrap; }
  .site-nav { width: auto; }
  .nav-toggle { display: none; }
  .nav-list, .js .nav-list:not(.is-open) { display: flex; flex-direction: row; align-items: center; margin: 0; width: auto; gap: var(--space-1); }
  .theme-toggle { width: auto; }
}

/* ---------- Main & footer ---------- */
.site-main { flex: 1; padding-block: var(--space-6) var(--space-8); }
.site-footer { border-top: 1px solid var(--color-line); padding-block: var(--space-6); color: var(--color-muted); font-size: var(--text-sm); }
.site-footer-inner { display: grid; gap: var(--space-4); }
.footer-brand { display: flex; gap: var(--space-3); align-items: flex-start; }
.footer-brand p { margin: 0; }
.footer-nav { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.footer-nav a { color: inherit; }
.footer-meta { margin: 0; }
@media (min-width: 48em) {
  .site-footer-inner { grid-template-columns: 1fr auto; align-items: start; }
  .footer-meta { grid-column: 1 / -1; }
}

/* ---------- Hero ---------- */
.hero { padding-block: var(--space-6) var(--space-7); }
.hero h1 { font-size: var(--text-2xl); max-width: 22ch; }
.hero .lede { font-size: var(--text-lg); }
.hero-art { display: none; }
@media (min-width: 60em) {
  .hero { display: grid; grid-template-columns: 1fr minmax(14rem, 22rem); gap: var(--space-6); align-items: center; }
  .hero-art { display: block; color: var(--color-text); }
}
.cta-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin-block: var(--space-5); }

/* ---------- Buttons ---------- */
.button {
  display: inline-block; padding: var(--space-3) var(--space-5);
  background: var(--color-accent); color: var(--color-accent-contrast);
  border-radius: var(--radius-sm); text-decoration: none; font-weight: 600;
  border: 2px solid transparent; transition: filter var(--ease);
}
.button:hover { filter: brightness(1.08); }
.button-secondary { background: transparent; color: var(--color-text); border-color: var(--color-line); }
.button-disabled { background: var(--color-badge-soon-bg); color: var(--color-badge-soon-fg); cursor: not-allowed; }

/* ---------- Sections ---------- */
.section { padding-block: var(--space-6); }
.section + .section { border-top: 1px solid var(--color-line); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); flex-wrap: wrap; }
.section-head h2 { margin-top: 0; }

/* ---------- Cards ---------- */
.card-grid { list-style: none; padding: 0; margin: 0 0 var(--space-5); display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
.card { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius); padding: var(--space-5); box-shadow: var(--shadow); display: flex; }
.card article { display: flex; flex-direction: column; gap: var(--space-2); width: 100%; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-2); flex-wrap: wrap; }
.card-title { margin: 0; font-size: var(--text-md); }
.card-title a { color: var(--color-text); text-decoration: none; }
.card-title a:hover { text-decoration: underline; }
.card-summary { margin: 0; color: var(--color-muted); flex: 1; }
.tag-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--space-1); font-size: var(--text-xs); }
.tag-list li { border: 1px solid var(--color-line); border-radius: 999px; padding: 0 var(--space-2); color: var(--color-muted); }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-size: var(--text-xs); font-weight: 600; padding: 0.1em 0.6em; border-radius: 999px; white-space: nowrap; vertical-align: middle; letter-spacing: 0.02em; }
.badge-live { background: var(--color-badge-live-bg); color: var(--color-badge-live-fg); }
.badge-preview { background: var(--color-badge-preview-bg); color: var(--color-badge-preview-fg); }
.badge-link-out { background: var(--color-badge-link-bg); color: var(--color-badge-link-fg); }
.badge-coming-soon { background: var(--color-badge-soon-bg); color: var(--color-badge-soon-fg); }
h1 .badge { font-size: var(--text-sm); }

/* ---------- Hub ---------- */
.jump ul { list-style: none; padding: 0; margin: 0 0 var(--space-5); display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.jump .count { color: var(--color-muted); }
.hub-group h2 { margin-top: var(--space-6); }
.legend { display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); font-size: var(--text-sm); border: 1px solid var(--color-line); border-radius: var(--radius); padding: var(--space-4); margin-block: var(--space-5); }
.legend div { display: flex; gap: var(--space-2); align-items: baseline; }
.legend dt, .legend dd { margin: 0; }

/* ---------- Facts (definition list) ---------- */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-4); }
.facts div { display: contents; }
.facts dt { font-weight: 600; color: var(--color-muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 30em) { .facts { grid-template-columns: 1fr; } .facts dt { margin-top: var(--space-2); } }

/* ---------- Steps / feature lists ---------- */
.steps { list-style: none; padding: 0; counter-reset: step; display: grid; gap: var(--space-4); }
.steps li { position: relative; padding-left: 3rem; }
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0; width: 2.2rem; height: 2.2rem;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--color-accent); color: var(--color-accent-contrast); font-weight: 700;
}
.steps h3 { margin: 0 0 var(--space-1); font-size: var(--text-base); }
.steps p { margin: 0; }
.feature-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); list-style: none; padding: 0; }
.feature-grid li { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius); padding: var(--space-5); }
.feature-grid h3 { margin-top: 0; font-size: var(--text-md); }
.feature-grid p:last-child { margin-bottom: 0; }

/* ---------- Operator TODO marker (visible until resolved) ---------- */
.todo {
  background: var(--color-todo-bg); color: var(--color-todo-fg);
  border-left: 4px solid var(--color-todo-line); border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3); margin-block: var(--space-3); font-size: var(--text-sm);
}
.todo strong { font-family: var(--font-mono); }

/* ---------- Not found ---------- */
.notfound h1 { font-size: var(--text-2xl); }
