/* Mr Wright's Rules — shared styles
   Palette: near-black / signal green / warm amber
   Type: JetBrains Mono (display/accents) + Inter (body) */

:root {
  --bg: #0d1117;
  --bg-alt: #161b22;
  --card: #161b22;
  --ink: #c9d1d9;
  --ink-soft: #8b949e;
  --accent: #3fb950;
  --accent-dark: #2ea043;
  --warn: #f0883e;
  --line: rgba(201,209,217,0.14);
  --radius: 6px;
  --max: 900px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .display { font-family: var(--mono); color: #f0f6fc; margin: 0 0 0.5em; line-height: 1.25; font-weight: 700; }
p { margin: 0 0 1em; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--accent);
  color: #04150a;
  padding: 12px 20px;
  z-index: 100;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-weight: 700;
}
.skip-link:focus { left: 16px; top: 16px; }

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

/* ---------- Header / Nav ---------- */
header.site {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(13,17,23,0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 28px;
  max-width: var(--max);
  margin: 0 auto;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.1rem;
  color: #f0f6fc;
  text-decoration: none;
}
.brand .prompt { color: var(--accent); margin-right: 2px; }
nav.links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.88rem;
}
nav.links a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding-bottom: 3px;
}
nav.links a:hover, nav.links a[aria-current="page"] {
  color: #f0f6fc;
  border-color: var(--accent);
}

/* ---------- Page header banner (non-home pages) ---------- */
.page-header {
  background: var(--bg-alt);
  padding: 56px 0 46px;
  border-bottom: 1px solid var(--line);
}
.page-header .kicker { color: var(--accent); }
.page-header h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); max-width: 26ch; }
.page-header p.lede { color: var(--ink-soft); max-width: 60ch; margin-top: 14px; font-size: 1.08rem; }

/* ---------- Hero (home) ---------- */
.hero { padding: 76px 0 64px; border-bottom: 1px solid var(--line); }
.hero .kicker { color: var(--accent); }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); max-width: 20ch; }
.hero p.lede { color: var(--ink-soft); max-width: 58ch; margin-top: 18px; font-size: 1.15rem; }
.hero .cta-row { margin-top: 30px; display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------- Sections ---------- */
section { padding: 64px 0; }
section.alt { background: var(--bg-alt); }
section + section { border-top: 1px solid var(--line); }

.kicker {
  display: inline-block;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.76rem;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.section-head { max-width: 62ch; margin-bottom: 36px; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.section-head p { color: var(--ink-soft); margin-top: 12px; }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* ---------- Rule cards (rules list + home teaser) ---------- */
.rule-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rule-card {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.rule-card:hover { border-color: var(--accent); transform: translateX(2px); }
.rule-card .num {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--accent);
}
.rule-card h3 { color: #f0f6fc; font-size: 1.15rem; margin-bottom: 6px; }
.rule-card p { color: var(--ink-soft); margin: 0; font-size: 0.98rem; }
.rule-card .arrow { color: var(--ink-soft); font-family: var(--mono); font-size: 1.2rem; }
.rule-card:hover .arrow { color: var(--accent); }
@media (max-width: 600px) {
  .rule-card { grid-template-columns: 44px 1fr; }
  .rule-card .arrow { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  text-decoration: none;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 13px 24px;
  border-radius: var(--radius);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary {
  background: var(--accent);
  color: #04150a;
  box-shadow: 0 3px 0 var(--accent-dark);
}
.btn-primary:hover { color: #04150a; transform: translateY(-2px); box-shadow: 0 5px 0 var(--accent-dark); }
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--line);
}
.btn-secondary:hover { border-color: var(--accent); color: #f0f6fc; }

/* ---------- Rule detail pages ---------- */
.prose { max-width: 68ch; color: var(--ink); }
.prose h2 { font-size: 1.3rem; margin-top: 1.6em; }
.prose h3 { font-size: 1.05rem; margin-top: 1.4em; color: var(--ink); font-family: 'Inter', sans-serif; font-weight: 700; }
.prose strong { color: #f0f6fc; }
.prose ol, .prose ul { padding-left: 1.3em; }
.prose li { margin-bottom: 0.5em; }

.summary-box {
  max-width: 68ch;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-top: 40px;
}
.summary-box h2 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 14px;
}
.summary-box ul { list-style: none; padding: 0; margin: 0; }
.summary-box li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 10px;
  color: var(--ink);
}
.summary-box li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.rule-nav {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.92rem;
}
.rule-nav a { text-decoration: none; }
.rule-nav .label { display: block; color: var(--ink-soft); font-size: 0.78rem; margin-bottom: 4px; }
.rule-nav .next { text-align: right; margin-left: auto; }

/* ---------- Footer ---------- */
footer.site {
  background: var(--bg-alt);
  color: var(--ink-soft);
  padding: 52px 0 28px;
  border-top: 1px solid var(--line);
}
footer.site h4 { color: #f0f6fc; font-size: 1rem; font-family: var(--mono); margin-bottom: 12px; }
footer.site a { color: var(--ink-soft); text-decoration: none; }
footer.site a:hover { color: var(--accent); }
.foot-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 30px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
@media (max-width: 700px) { .foot-grid { grid-template-columns: 1fr; } }
.fine {
  padding-top: 18px;
  font-size: 0.8rem;
  color: #6e7681;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}
.fine a { color: #6e7681; }
.fine a:hover { color: var(--accent); }
.build-number { font-family: var(--mono); white-space: nowrap; }

/* ---------- 404 ---------- */
.notfound {
  min-height: 55vh;
  display: flex; align-items: center; justify-content: center;
  padding: 60px 24px;
}
.notfound-card {
  max-width: 520px; width: 100%;
  text-align: center;
}
.notfound-card .prompt-line {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.95rem;
  margin-bottom: 18px;
}
.notfound-card h1 { font-size: 1.8rem; }
.notfound-card p { color: var(--ink-soft); max-width: 44ch; margin: 14px auto 0; }
.notfound-card .cta-row { margin-top: 30px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
