/* =========================================================
   NIGHTFORGE RP — design tokens
   Concept: industrial foundry / noir. Not medieval fantasy.
   "Forge" = steel, rivets, embers, sodium-vapor city light —
   grounded in Los Santos, not a blacksmith's shop.
   ========================================================= */

:root {
  /* color */
  --void: #0a0908;
  --iron: #131110;
  --panel: #1a1714;
  --panel-line: rgba(233, 228, 216, 0.08);
  --steel: #4a443c;
  --ember: #ff6a2b;
  --ember-dim: #b6431a;
  --molten: #c9a227;
  --ash: #ece7db;
  --ash-dim: #a29a8a;

  /* type */
  --font-display: "Oswald", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  /* layout */
  --edge: clamp(20px, 5vw, 96px);
  --max: 1240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--void);
  color: var(--ash);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

.wrap { max-width: var(--max); margin: 0 auto; padding-inline: var(--edge); }

h1, h2, h3 {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin: 0;
  color: var(--ash);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ember);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--ember);
}

/* Reduced motion respected globally */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- signature element: the ember seam ----------
   A thin glowing crack used as section dividers and accents —
   literal "forge" imagery (a seam of hot metal) rather than
   a decorative gradient rule. */
.seam {
  position: relative;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ember-dim) 20%, var(--ember) 50%, var(--ember-dim) 80%, transparent);
  opacity: 0.55;
}
.seam::after {
  content: "";
  position: absolute;
  inset: -6px 0;
  background: linear-gradient(90deg, transparent, rgba(255, 106, 43, 0.25) 50%, transparent);
  filter: blur(6px);
  animation: seam-glow 6s ease-in-out infinite;
}
@keyframes seam-glow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ---------- image slots ----------
   Multi-layer background: real photo (if present at the path)
   renders on top; a steel gradient sits underneath as a
   placeholder so the layout never looks "broken" before you
   drop assets in. Once the file exists at the given path, the
   gradient is simply hidden behind it — no code changes needed.
*/
.img-slot {
  position: relative;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-color: var(--panel);
}
.img-slot::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(135deg, rgba(233,228,216,0.03) 0 2px, transparent 2px 14px);
  pointer-events: none;
}

/* =========================== NAV =========================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 9, 8, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-line);
}
.nav .wrap {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand .mark {
  width: 9px;
  height: 9px;
  background: var(--ember);
  transform: rotate(45deg);
  box-shadow: 0 0 10px var(--ember);
}
.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nav-links a {
  text-decoration: none;
  color: var(--ash-dim);
  transition: color 0.15s;
}
.nav-links a:hover, .nav-links a:focus-visible { color: var(--ember); }
.nav-cta { display: flex; gap: 12px; }

.btn {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 12px 22px;
  border: 1px solid var(--steel);
  color: var(--ash);
  display: inline-block;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.btn:hover, .btn:focus-visible { border-color: var(--ember); color: var(--ember); }
.btn-primary {
  background: var(--ember);
  border-color: var(--ember);
  color: var(--void);
  font-weight: 600;
}
.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--ember-dim);
  border-color: var(--ember-dim);
  color: var(--void);
}
:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }

/* =========================== HERO =========================== */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: flex-end;
  background-image:
    url("../img/hero-skyline.jpg"),
    linear-gradient(160deg, #201a15 0%, #0a0908 65%);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, var(--void) 5%, rgba(10,9,8,0.55) 45%, rgba(10,9,8,0.35) 100%);
}
.hero-inner {
  position: relative;
  z-index: 2;
  padding-bottom: 72px;
  width: 100%;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  line-height: 1.02;
  max-width: 16ch;
  margin: 22px 0 20px;
}
.hero p {
  max-width: 46ch;
  color: var(--ash-dim);
  font-size: 1.05rem;
  margin: 0 0 32px;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 46px; }

.readout {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--ash-dim);
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-top: 1px solid var(--panel-line);
  padding-top: 18px;
}
.readout span {
  padding-right: 22px;
  margin-right: 22px;
  border-right: 1px solid var(--panel-line);
}
.readout span:last-child { border-right: none; }
.readout b { color: var(--ember); font-weight: 600; }

/* =========================== SECTION SHELL =========================== */
section { padding: 96px 0; }
.section-head { max-width: 640px; margin-bottom: 48px; }
.section-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin-top: 14px; }
.section-head p { color: var(--ash-dim); margin-top: 14px; max-width: 56ch; }

/* =========================== THESIS =========================== */
.thesis { background: var(--iron); }
.thesis .wrap { max-width: 880px; }
.thesis blockquote {
  margin: 0;
  font-family: var(--font-display);
  text-transform: none;
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  line-height: 1.4;
  color: var(--ash);
  font-weight: 400;
}
.thesis cite {
  display: block;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ash-dim);
  margin-top: 20px;
  letter-spacing: 0.04em;
}

/* =========================== GALLERY =========================== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 110px;
  gap: 10px;
}
.gallery-grid .img-slot { grid-column: span 2; grid-row: span 2; }
.gallery-grid .g-wide { grid-column: span 4; }
.gallery-grid .g-tall { grid-row: span 3; }
@media (max-width: 760px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 140px; }
  .gallery-grid .img-slot { grid-column: span 1 !important; grid-row: span 2 !important; }
}

/* =========================== DOSSIER (features) =========================== */
.dossier-item {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
  padding: 56px 0;
  border-top: 1px solid var(--panel-line);
}
.dossier-item:last-child { border-bottom: 1px solid var(--panel-line); }
.dossier-item:nth-child(even) .dossier-media { order: 2; }
.dossier-media.img-slot { aspect-ratio: 4 / 3; }
.dossier-num {
  font-family: var(--font-mono);
  color: var(--ember);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}
.dossier-text h3 {
  font-size: 1.6rem;
  margin: 14px 0 16px;
}
.dossier-text p { color: var(--ash-dim); max-width: 44ch; }
.dossier-text a {
  display: inline-block;
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ember);
  text-decoration: none;
  border-bottom: 1px solid var(--ember-dim);
  padding-bottom: 2px;
}
@media (max-width: 760px) {
  .dossier-item { grid-template-columns: 1fr; gap: 24px; }
  .dossier-item:nth-child(even) .dossier-media { order: 0; }
}

/* =========================== ROLES (case files) =========================== */
.roles-list { border-top: 1px solid var(--panel-line); }
.role-row {
  display: grid;
  grid-template-columns: 100px 1fr 2fr;
  gap: 24px;
  align-items: baseline;
  padding: 22px 0;
  border-bottom: 1px solid var(--panel-line);
  transition: background 0.15s;
}
.role-row:hover { background: rgba(233, 228, 216, 0.025); }
.role-file {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ash-dim);
  letter-spacing: 0.04em;
}
.role-name {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
.role-desc { color: var(--ash-dim); font-size: 0.92rem; max-width: 60ch; }
@media (max-width: 720px) {
  .role-row { grid-template-columns: 1fr; gap: 6px; }
}

/* =========================== PRINCIPLES =========================== */
.principles { background: var(--iron); }
.principles-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--panel-line);
  border: 1px solid var(--panel-line);
}
.principle {
  background: var(--iron);
  padding: 36px 32px;
}
.principle h3 {
  font-size: 1.05rem;
  color: var(--ember);
  margin-bottom: 12px;
}
.principle p { color: var(--ash-dim); font-size: 0.92rem; margin: 0; }
@media (max-width: 760px) {
  .principles-list { grid-template-columns: 1fr; }
}

/* =========================== CTA =========================== */
.cta {
  position: relative;
  text-align: center;
  overflow: hidden;
  background: radial-gradient(ellipse at center, rgba(255,106,43,0.14), transparent 70%), var(--void);
}
.cta h2 { font-size: clamp(1.8rem, 4vw, 3rem); max-width: 20ch; margin: 0 auto 18px; }
.cta p { color: var(--ash-dim); max-width: 46ch; margin: 0 auto 36px; }
.cta-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* =========================== FOOTER =========================== */
footer { border-top: 1px solid var(--panel-line); padding: 64px 0 32px; background: var(--void); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 48px;
}
.footer-brand p { color: var(--ash-dim); font-size: 0.9rem; max-width: 34ch; margin-top: 14px; }
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ash-dim);
  margin: 0 0 16px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-col a { text-decoration: none; color: var(--ash); font-size: 0.9rem; }
.footer-col a:hover { color: var(--ember); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--panel-line);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ash-dim);
}
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
}

/* =========================================================
   INNER PAGES — rules / tos / pure mode
   ========================================================= */

.nav-links a.active { color: var(--ember); }

.page-header {
  padding: 64px 0 48px;
  border-bottom: 1px solid var(--panel-line);
  background: linear-gradient(180deg, var(--iron), var(--void));
}
.page-header h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  margin: 16px 0 14px;
}
.page-header p {
  color: var(--ash-dim);
  max-width: 60ch;
  margin: 0;
}
.page-header .updated {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ash-dim);
  margin-top: 18px;
  display: inline-block;
}

/* two-column layout: sticky sidebar + content */
.page-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 64px;
  padding: 72px 0 120px;
  align-items: start;
}
.page-sidebar {
  position: sticky;
  top: 96px;
}
.sidebar-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ash-dim);
  margin-bottom: 16px;
  display: block;
}
.toc {
  list-style: none;
  margin: 0 0 32px;
  padding: 0;
  border-left: 1px solid var(--panel-line);
}
.toc li a {
  display: block;
  padding: 8px 0 8px 18px;
  text-decoration: none;
  color: var(--ash-dim);
  font-size: 0.88rem;
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.toc li a:hover, .toc li a:focus-visible, .toc li a.active {
  color: var(--ember);
  border-left-color: var(--ember);
}

.search-box {
  position: relative;
  margin-bottom: 12px;
}
.search-box input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  color: var(--ash);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 12px 14px;
}
.search-box input:focus-visible { outline: 1px solid var(--ember); }
.search-box input::placeholder { color: var(--ash-dim); }
.search-hint {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ash-dim);
  margin-top: 8px;
}

.prose h2 {
  font-size: 1.5rem;
  margin: 0 0 18px;
  scroll-margin-top: 100px;
}
.prose p, .prose li { color: var(--ash-dim); }
.prose section { padding: 0 0 48px; border: none; }
.prose section + section { border-top: 1px solid var(--panel-line); padding-top: 48px; }

/* rule category accordion */
.rule-category {
  border: 1px solid var(--panel-line);
  margin-bottom: 14px;
  scroll-margin-top: 100px;
}
.rule-category summary {
  cursor: pointer;
  list-style: none;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 1.02rem;
  background: var(--panel);
}
.rule-category summary::-webkit-details-marker { display: none; }
.rule-category summary .count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ash-dim);
  text-transform: none;
  letter-spacing: 0;
}
.rule-category summary::after {
  content: "+";
  font-family: var(--font-mono);
  color: var(--ember);
  font-size: 1.1rem;
  margin-left: 16px;
}
.rule-category[open] summary::after { content: "–"; }
.rule-category ol {
  margin: 0;
  padding: 22px 28px 26px 48px;
  color: var(--ash-dim);
}
.rule-category ol li { margin-bottom: 12px; line-height: 1.55; }
.rule-category ol li:last-child { margin-bottom: 0; }
.rule-category ol li b { color: var(--ash); font-weight: 600; }
.rule-category.hidden { display: none; }

.placeholder-note {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--molten);
  background: rgba(201, 162, 39, 0.08);
  border: 1px dashed rgba(201, 162, 39, 0.4);
  padding: 12px 16px;
  margin-bottom: 32px;
}

/* pure mode specific: compare list */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--panel-line);
  border: 1px solid var(--panel-line);
  margin: 24px 0 8px;
}
.compare-col { background: var(--iron); padding: 28px; }
.compare-col h3 {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.compare-col.on h3 { color: var(--ember); }
.compare-col.off h3 { color: var(--ash-dim); }
.compare-col ul { margin: 0; padding-left: 18px; color: var(--ash-dim); font-size: 0.92rem; }
.compare-col ul li { margin-bottom: 8px; }

@media (max-width: 900px) {
  .page-layout { grid-template-columns: 1fr; gap: 32px; }
  .page-sidebar { position: static; }
  .compare-grid { grid-template-columns: 1fr; }
}
