/* ============================================================
   THE FRACTIONIST — Global Stylesheet
   Palette: Near-black #1a1a1a, Off-white #f5f2ee, Accent #c8a96e
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;0,900;1,400;1,600&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=DM+Mono:wght@300;400&display=swap');

:root {
  --ink: #1a1a1a;
  --ink-light: #2e2e2e;
  --paper: #f5f2ee;
  --paper-mid: #ede9e3;
  --paper-dark: #e0dbd3;
  --gold: #c8a96e;
  --gold-dim: #a8895e;
  --muted: #7a756e;
  --rule: rgba(26, 26, 26, 0.12);
  --rule-dark: rgba(245, 242, 238, 0.12);

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Libre Baskerville', Georgia, serif;
  --font-mono: 'DM Mono', monospace;

  --max-w: 1160px;
  --col-w: 680px;

  --nav-h: 64px;
}

/* ── Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* Subtle grain overlay for off-white pages */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.5' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* ── NAV ── */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  z-index: 100;
  transition: background 0.3s, box-shadow 0.3s;
}

.site-nav.scrolled {
  box-shadow: 0 2px 24px rgba(0, 0, 0, 0.06);
  border-bottom: 1px solid rgba(200, 169, 110, 0.4);
}

.nav-logo .logo-img {
  height: 48px;
  width: auto;
}

.nav-logo .logo-dark {
  display: block;
}

.nav-logo .logo-light {
  display: none;
}

.nav-links {
  display: flex;
  gap: 36px;
  align-items: center;
}

.nav-links a,
.nav-mobile-menu a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active,
.nav-mobile-menu a:hover,
.nav-mobile-menu a.active {
  color: var(--ink);
}

.nav-toggle {
  display: none;
  font-size: 1.4rem;
  color: var(--ink);
}

.nav-mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  flex-direction: column;
  padding: 24px 40px;
  gap: 20px;
  z-index: 99;
}

.nav-mobile-menu.open {
  display: flex;
}

/* ── Page wrapper ── */
.page-wrap {
  padding-top: var(--nav-h);
  min-height: 100vh;
}

/* ── Typography scale ── */
h1 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
}

h2 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
}

h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.3;
}

h4 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--muted);
}

p {
  margin-bottom: 1.25em;
}

p:last-child {
  margin-bottom: 0;
}

/* ── Rule / Divider ── */
.rule {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 0;
}

.rule--gold {
  border-color: var(--gold);
  opacity: 0.5;
}

/* ── Domain Tag ── */
.tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.tag--gold {
  color: var(--gold-dim);
}

/* ── Failure Mode Pill ── */
.failure-mode {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 10px;
  border: 1px solid var(--rule);
  color: var(--muted);
  border-radius: 2px;
}

.failure-mode.elite-capture {
  border-color: rgba(200, 169, 110, 0.4);
  color: var(--gold-dim);
  background: rgba(200, 169, 110, 0.05);
}

.failure-mode.rent-seeking {
  border-color: rgba(180, 100, 80, 0.4);
  color: #b46450;
  background: rgba(180, 100, 80, 0.05);
}

.failure-mode.politicisation {
  border-color: rgba(80, 120, 180, 0.4);
  color: #5078b4;
  background: rgba(80, 120, 180, 0.05);
}

.failure-mode.moral-freeriding {
  border-color: rgba(100, 160, 100, 0.4);
  color: #64a064;
  background: rgba(100, 160, 100, 0.05);
}

.failure-mode.inconclusive {
  border-color: rgba(122, 117, 110, 0.4);
  color: var(--muted);
  font-style: italic;
  background: rgba(122, 117, 110, 0.05);
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 14px 32px;
  transition: all 0.2s;
}

.btn--primary {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
}

.btn--primary:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}

.btn--ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 40px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-left-wrap {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.footer-logo-img {
  height: 48px;
  width: auto;
  opacity: 0.9;
  transition: opacity 0.2s;
}

.footer-logo-img:hover {
  opacity: 1;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.site-footer .footer-mark {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-footer .footer-tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-socials {
  display: flex;
  gap: 16px;
}

.footer-socials a {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s;
}

.footer-socials a:hover {
  color: var(--ink);
}

/* ── Scroll animation base ── */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .site-nav {
    padding: 0 20px;
  }

  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: block;
  }

  .site-footer {
    padding: 28px 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}