/* ═══════════════════════════════════════════════════════════════════════════
 *  SPACE ZERO — Shared styles
 *  Loaded by every page. Tokens defined once; page-specific styles live
 *  in a <style> block at the top of each page.
 * ═════════════════════════════════════════════════════════════════════════ */

:root {
  --parchment:       #f4f1eb;
  --parchment-warm:  #ede6d4;
  --parchment-deep:  #e6dfc9;
  --ink:             #1a1612;
  --ink-soft:        #3a2e24;
  --muted:           #5e5347;
  --muted-light:     #7a6f5f;
  --rule:            rgba(58, 46, 36, 0.12);
  --rule-strong:     rgba(58, 46, 36, 0.22);
  --iceplant:        #c84494;
  --iceplant-soft:   #d66aa8;
  --amber:           #c8915b;
  --water:           #3c8f87;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--parchment);
  color: var(--ink);
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.mono {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
}

a { color: var(--ink); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--iceplant); }

/* ═══ HEADER ═══ */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: rgba(244, 241, 235, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.header-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 44px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}
.header-brand {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px; font-weight: 500;
  letter-spacing: 0.02em; font-style: italic;
  color: var(--ink);
}
.header-nav { display: flex; gap: 28px; align-items: center; }
.header-nav a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; text-transform: uppercase;
  letter-spacing: 0.16em; color: var(--muted);
}
.header-nav a:hover,
.header-nav a.active { color: var(--ink); }
.header-nav a.active {
  position: relative;
}
.header-nav a.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 1px;
  background: var(--iceplant);
  opacity: 0.6;
}

/* ═══ PAGE CHROME ═══ */
/* All pages leave vertical space under the fixed header */
.page-top-gap { height: 64px; }

/* ═══ SECTIONS ═══ */
.section { padding: 100px 40px; position: relative; }
.section-inner { max-width: 960px; margin: 0 auto; }
.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; text-transform: uppercase;
  letter-spacing: 0.22em; color: var(--muted);
  margin-bottom: 24px; text-align: center;
}
.section-title {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  font-weight: 400; text-align: center;
  margin: 0 0 48px;
  letter-spacing: 0.005em; line-height: 1.25;
}
.section-rule {
  width: 60px; height: 1px;
  background: var(--rule-strong);
  margin: 0 auto 40px;
}

/* ═══ ELEMENTS (used on Why page) ═══ */
.elements {
  background: rgba(237, 230, 212, 0.35);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.elements-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 56px 48px;
  margin-top: 20px;
}
.element { display: flex; flex-direction: column; }
.element-visual {
  width: 100%; aspect-ratio: 1.25; background: var(--parchment);
  border: 1px solid var(--rule);
  margin-bottom: 22px; overflow: hidden; position: relative;
}
.element-visual canvas { display: block; width: 100%; height: 100%; }
.element-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; letter-spacing: 0.2em; color: var(--muted);
  margin-bottom: 10px;
}
.element-title {
  font-size: 22px; font-weight: 500; margin: 0 0 14px;
  letter-spacing: 0.005em;
  display: flex; align-items: flex-start; gap: 14px;
}
.element-title::before {
  content: '·'; color: var(--iceplant);
  font-size: 32px; line-height: 0.7; font-weight: 400;
  flex-shrink: 0;
}
.element-body {
  font-size: 17px; color: var(--ink-soft);
  line-height: 1.65; margin: 0; font-weight: 400;
}

/* ═══ FOOTER ═══ */
.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--parchment);
  padding: 70px 40px 40px;
  color: var(--muted);
}
.footer-inner {
  max-width: 1180px; margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 50px;
}
.footer-brand canvas {
  display: block; width: 180px; height: auto; margin-bottom: 14px;
}
.footer-brand p {
  font-size: 14px; color: var(--muted); line-height: 1.7; margin: 0;
  font-style: italic; max-width: 260px;
}
.footer-col h4 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-soft); margin: 0 0 16px; font-weight: 400;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li {
  margin-bottom: 10px;
  font-size: 14px; color: var(--muted);
}
.footer-col a, .footer-col .placeholder {
  font-size: 14px; color: var(--muted);
}
.footer-col a:hover { color: var(--ink); }
.footer-col .placeholder {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; letter-spacing: 0.04em;
  color: var(--muted-light);
}
.footer-bottom {
  max-width: 1180px; margin: 0 auto;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted-light);
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 900px) {
  .header-inner { padding: 0 20px; }
  .header-nav { gap: 18px; }
  .section { padding: 70px 22px; }
  .elements-grid { grid-template-columns: 1fr; gap: 48px; }
  .site-footer { padding: 50px 22px 30px; }
  .footer-inner { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; gap: 14px; text-align: center; }
}
@media (max-width: 560px) {
  .header-brand { font-size: 16px; }
  .header-nav a { font-size: 12px; letter-spacing: 0.12em; }
  .header-nav { gap: 14px; }
}

/* ═══ FIREFOX PERFORMANCE MODE — applied when JS adds .ff-perf to <html>.
 * backdrop-filter over animating canvas is extremely expensive in Firefox;
 * a slightly more opaque solid tint reads almost identically. ═══ */
.ff-perf .site-header {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(244, 241, 235, 0.94);
}
