
:root {
  --parch:  #f5ede0;
  --cream:  #ede3d3;
  --sand:   #d9c9b0;
  --rust:   #b5440a;
  --terra:  #c8601a;
  --ochre:  #8a6a10;
  --brown:  #6b3d1e;
  --ink:    #2a1a0e;
  --faded:  #6a5545;
  --aged:   #6a5040;

  --c-cap:  #7a1a10;
  --c-cons: #1a4a7a;
  --c-avail:#1a6a2a;
  --c-lb:   #6a1a7a;
  --c-lat:  #7a5a10;
  --c-est:  #1a5a5a;
  --c-fw:   #4a1a6a;
  --c-tip:  #1a3a5a;
}

*{ margin:0; padding:0; box-sizing:border-box; }

body {
  background: var(--parch);
  color: var(--ink);
  font-family: 'Crimson Pro', serif;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Parchment texture via layered radial gradients */
body::before {
  content:'';
  position:fixed; inset:0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(180,120,60,0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(140,80,30,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(200,150,80,0.04) 0%, transparent 70%);
  pointer-events:none; z-index:0;
}

/* Map grid lines overlay */
body::after {
  content:'';
  position:fixed; inset:0;
  background-image:
    linear-gradient(rgba(100,70,30,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100,70,30,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events:none; z-index:0;
}

/* ═══════════ HEADER ═══════════ */
header {
  position: relative; z-index: 1;
  padding: 0;
  border-bottom: 3px solid var(--rust);
}

.compass-bar {
  background: var(--rust);
  color: var(--parch);
  padding: 8px 56px;
  display: flex; justify-content: space-between;
  font-family: 'Courier Prime', monospace;
  font-size: 9px; letter-spacing: 3px;
}

.hdr-body {
  padding: 32px 56px 24px;
  display: flex; align-items: flex-start; gap: 48px;
}

.hdr-left { flex: 1; }

.hdr-kicker {
  font-family: 'Courier Prime', monospace;
  font-size: 9px; letter-spacing: 4px;
  color: var(--rust); text-transform: uppercase;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px;
}
.hdr-kicker::before { content:''; width:32px; height:1px; background:var(--rust); }

header h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(36px, 5.5vw, 76px);
  font-weight: 900; line-height: 1;
  color: var(--ink);
  margin-bottom: 10px;
}
header h1 em { color: var(--rust); font-style: italic; }

.hdr-desc {
  font-family: 'Crimson Pro', serif;
  font-size: 16px; color: var(--faded);
  line-height: 1.6; max-width: 520px;
  font-style: italic; margin-bottom: 0;
}

/* Compass rose decoration */
.compass {
  width: 100px; height: 100px;
  position: relative; flex-shrink: 0;
  margin-top: 8px;
}
.compass svg { width: 100%; height: 100%; }

/* Stats row */
.stats-row {
  display: flex; border-top: 1px solid var(--sand);
  border-bottom: 1px solid var(--sand);
  margin-top: 0;
}
.stat-cell {
  flex: 1; padding: 12px 20px;
  border-right: 1px solid var(--sand);
  text-align: center;
}
.stat-cell:last-child { border-right: none; }
.stat-val {
  font-family: 'Playfair Display', serif;
  font-size: 26px; font-weight: 700;
  color: var(--rust); line-height: 1;
  margin-bottom: 2px;
}
.stat-lbl {
  font-family: 'Courier Prime', monospace;
  font-size: 8px; letter-spacing: 2px;
  color: var(--aged); text-transform: uppercase;
}

/* ═══════════ NAV ═══════════ */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--cream);
  border-bottom: 2px solid var(--rust);
  display: flex; overflow-x: auto;
}
.nav-tab {
  padding: 12px 18px;
  font-family: 'Courier Prime', monospace;
  font-size: 9px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--aged);
  cursor: pointer; border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s; white-space: nowrap;
}
.nav-tab:hover { color: var(--brown); }
.nav-tab.active { color: var(--rust); border-bottom-color: var(--rust); }

/* ═══════════ CONTENT ═══════════ */
.content { padding: 44px 56px; position: relative; z-index: 1; max-width: 1280px; }
.view { display: none; }
.view.active { display: block; }

/* Section heading */
.sec-hd {
  font-family: 'Playfair Display', serif;
  font-size: 22px; font-weight: 700;
  color: var(--ink); margin-bottom: 6px;
  margin-top: 28px;
}
.sec-hd:first-child { margin-top: 0; }
.sec-rule {
  font-family: 'Courier Prime', monospace;
  font-size: 8px; letter-spacing: 3px;
  color: var(--aged); text-transform: uppercase;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--sand);
}

/* ═══════════ CAP DIAGRAM ═══════════ */
.cap-container {
  display: flex; gap: 28px; align-items: flex-start;
  flex-wrap: wrap; margin: 20px 0;
}
.cap-venn {
  position: relative;
  width: 320px; height: 300px; flex-shrink: 0;
}
.cap-circle {
  position: absolute;
  width: 190px; height: 190px; border-radius: 50%;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 24px;
  font-family: 'Playfair Display', serif;
  font-size: 16px; font-weight: 700; letter-spacing: 1px;
  border: 2px solid;
}
.cap-c { top:0; left:65px; background: rgba(122,26,16,0.08); border-color: var(--c-cap); color: var(--c-cap); }
.cap-a { bottom:0; left:0;   background: rgba(26,74,122,0.08); border-color: var(--c-cons); color: var(--c-cons); }
.cap-p { bottom:0; right:0;  background: rgba(26,106,42,0.08); border-color: var(--c-avail); color: var(--c-avail); }
.cap-label {
  position: absolute;
  font-family: 'Courier Prime', monospace;
  font-size: 9px; text-align: center; letter-spacing: 1px;
  color: var(--ink); line-height: 1.4;
}
.cap-ca  { top: 110px; left: 43px; }
.cap-cp  { top: 110px; right: 30px; }
.cap-ap  { bottom: 30px; left:50%; transform:translateX(-50%); }
.cap-mid { top:50%; left:50%; transform:translate(-50%,-50%); font-weight:700; color:var(--rust); }

.cap-legend { flex: 1; min-width: 280px; }
.cap-row {
  padding: 12px 14px; margin-bottom: 8px;
  border-left: 4px solid; background: rgba(0,0,0,0.03);
}
.cap-row-title {
  font-family: 'Playfair Display', serif;
  font-size: 14px; font-weight: 700; margin-bottom: 4px;
}
.cap-row-body { font-size: 13px; color: var(--faded); line-height: 1.5; }

/* ═══════════ CONSISTENCY SPECTRUM ═══════════ */
.spectrum {
  margin: 20px 0; position: relative;
}
.spec-track {
  height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, var(--rust) 0%, var(--ochre) 50%, var(--c-avail) 100%);
  margin-bottom: 32px; position: relative;
}
.spec-labels {
  position: absolute; top: 12px; left: 0; right: 0;
  display: flex; justify-content: space-between;
  font-family: 'Courier Prime', monospace;
  font-size: 8px; letter-spacing: 1px; color: var(--aged);
}
.spec-cards {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
}
.spec-card {
  padding: 14px;
  border: 1px solid var(--sand);
  background: var(--cream);
  border-top: 3px solid;
}
.spec-name {
  font-family: 'Playfair Display', serif;
  font-size: 13px; font-weight: 700;
  margin-bottom: 4px;
}
.spec-body { font-size: 11px; color: var(--faded); line-height: 1.5; }
.spec-eg {
  font-family: 'Courier Prime', monospace;
  font-size: 9px; color: var(--ochre);
  margin-top: 6px;
}

/* ═══════════ NINES TABLE ═══════════ */
.nines-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin: 16px 0;
}
.nine-card {
  padding: 16px;
  border: 1px solid var(--sand);
  background: var(--cream);
  text-align: center;
}
.nine-pct {
  font-family: 'Playfair Display', serif;
  font-size: 22px; font-weight: 900;
  color: var(--rust); margin-bottom: 4px;
}
.nine-down {
  font-family: 'Courier Prime', monospace;
  font-size: 10px; color: var(--aged);
  margin-bottom: 4px;
}
.nine-lbl { font-size: 11px; color: var(--faded); }

/* ═══════════ LB ALGORITHMS ═══════════ */
.lb-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin: 16px 0;
}
.lb-card {
  padding: 14px 16px;
  border: 1px solid var(--sand);
  background: var(--cream);
  border-left: 4px solid var(--rust);
}
.lb-name {
  font-family: 'Playfair Display', serif;
  font-size: 14px; font-weight: 700;
  margin-bottom: 6px;
}
.lb-body { font-size: 12px; color: var(--faded); line-height: 1.55; }
.lb-use {
  font-family: 'Courier Prime', monospace;
  font-size: 9px; color: var(--rust);
  margin-top: 6px; letter-spacing: 0.5px;
}

/* ═══════════ LATENCY TABLE ═══════════ */
.lat-table {
  width: 100%; border-collapse: collapse; margin: 14px 0;
}
.lat-table th {
  background: var(--rust); color: var(--parch);
  padding: 8px 14px; text-align: left;
  font-family: 'Courier Prime', monospace;
  font-size: 9px; letter-spacing: 2px; font-weight: 400;
}
.lat-table td {
  padding: 9px 14px; border-bottom: 1px solid var(--sand);
  font-size: 13px; color: var(--faded);
}
.lat-table td:first-child { color: var(--ink); }
.lat-table td:nth-child(2) {
  font-family: 'Courier Prime', monospace;
  color: var(--rust); font-size: 12px;
}
.lat-bar-cell { width: 200px; }
.lat-bar {
  height: 8px; background: var(--rust);
  border-radius: 2px; opacity: 0.7;
}
.lat-table tr:hover td { background: var(--cream); }

/* ═══════════ ESTIMATION ═══════════ */
.est-box {
  background: var(--cream);
  border: 1px solid var(--sand);
  padding: 20px 24px; margin: 16px 0;
}
.est-title {
  font-family: 'Playfair Display', serif;
  font-size: 18px; font-weight: 700;
  margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 1px solid var(--sand);
}
.est-step {
  display: flex; gap: 14px;
  margin: 8px 0; align-items: flex-start;
}
.est-num {
  font-family: 'Playfair Display', serif;
  font-size: 18px; font-weight: 700;
  color: var(--rust); flex-shrink: 0;
  width: 24px; text-align: right;
}
.est-body { font-size: 13px; color: var(--faded); line-height: 1.6; flex: 1; }
.est-val {
  font-family: 'Courier Prime', monospace;
  font-size: 12px; color: var(--ochre);
}

/* ═══════════ FRAMEWORK ═══════════ */
.fw-steps {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0; border: 1px solid var(--rust); margin: 16px 0;
  border-right: none;
}
.fw-step {
  border-right: 1px solid var(--rust);
  padding: 16px;
}
.fw-n {
  font-family: 'Playfair Display', serif;
  font-size: 38px; font-weight: 900;
  color: var(--sand); line-height: 1;
  margin-bottom: 8px;
}
.fw-title {
  font-family: 'Courier Prime', monospace;
  font-size: 9px; letter-spacing: 2px;
  color: var(--rust); text-transform: uppercase;
  margin-bottom: 8px;
}
.fw-body { font-size: 12px; color: var(--faded); line-height: 1.6; }

.fw-steps-b {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 0; border: 1px solid var(--rust); border-top: none;
  border-right: none;
}

/* ═══════════ TIPS TABLE ═══════════ */
.tips-table { width: 100%; border-collapse: collapse; margin: 14px 0; }
.tips-table th {
  background: var(--brown); color: var(--parch);
  padding: 8px 14px;
  font-family: 'Courier Prime', monospace;
  font-size: 9px; letter-spacing: 2px; font-weight: 400;
}
.tips-table td {
  padding: 10px 14px; border-bottom: 1px solid var(--sand);
  font-size: 13px; vertical-align: top; line-height: 1.5;
}
.tips-table td:first-child { color: var(--rust); font-weight: 600; }
.tips-table tr:hover td { background: var(--cream); }

/* ═══════════ TASKS ═══════════ */
.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-card { border: 1px solid var(--sand); overflow: hidden; }
.task-hd {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; cursor: pointer;
  background: var(--cream); border-bottom: 1px solid var(--sand);
  transition: background 0.12s;
}
.task-hd:hover { background: var(--sand); }
.t-num {
  font-family: 'Playfair Display', serif;
  font-size: 32px; font-weight: 900;
  color: var(--sand); flex-shrink: 0; line-height: 1;
}
.t-label { font-family: 'Playfair Display', serif; font-size: 15px; font-weight: 700; color: var(--ink); flex: 1; }
.t-meta { font-family: 'Courier Prime', monospace; font-size: 9px; color: var(--aged); white-space: nowrap; }
.t-arr { color: var(--aged); font-size: 18px; transition: transform 0.2s; }
.t-arr.open { transform: rotate(90deg); }
.task-bd { display: none; padding: 16px 18px; font-size: 13px; color: var(--faded); line-height: 1.7; }
.task-bd.open { display: block; }
.task-bd ol, .task-bd ul { margin-left: 20px; margin-top: 8px; }
.task-bd li { margin-bottom: 4px; }
.task-bd strong { color: var(--ink); font-family: 'Courier Prime', monospace; font-size: 12px; }

/* ═══════════ CHECKLIST ═══════════ */
.chk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chk {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; background: var(--cream);
  border: 1px solid var(--sand); cursor: pointer;
  transition: all 0.12s;
}
.chk:hover { border-color: var(--rust); }
.chk.done { border-color: var(--c-avail); background: rgba(26,106,42,0.05); }
.chk-box {
  width: 14px; height: 14px; border: 1px solid var(--sand);
  flex-shrink: 0; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-family: 'Courier Prime', monospace;
  transition: all 0.12s;
}
.chk.done .chk-box { background: var(--c-avail); border-color: var(--c-avail); color: white; }
.chk-lbl { font-size: 13px; color: var(--faded); line-height: 1.4; }
.chk.done .chk-lbl { color: var(--c-avail); text-decoration: line-through; }

.prog-row { display: flex; justify-content: space-between; font-family: 'Courier Prime', monospace; font-size: 10px; color: var(--aged); margin-bottom: 8px; }
.prog-track { height: 3px; background: var(--sand); margin-bottom: 24px; }
.prog-fill { height: 100%; background: var(--rust); transition: width 0.3s; width: 0%; }

/* Code / pre blocks */
pre.mono {
  background: var(--cream); border: 1px solid var(--sand);
  border-left: 3px solid var(--rust);
  padding: 14px 16px; margin: 12px 0;
  font-family: 'Courier Prime', monospace;
  font-size: 11.5px; line-height: 1.85;
  color: var(--brown); overflow-x: auto; white-space: pre;
}
.hl-rust { color: var(--rust); font-weight: 700; }
.hl-och  { color: var(--ochre); }
.hl-grn  { color: var(--c-avail); }
.hl-blu  { color: var(--c-cons); }
.hl-fad  { color: var(--aged); }

/* Alert/callout */
.callout {
  padding: 12px 16px; margin: 14px 0;
  border-left: 4px solid; font-size: 13px;
  line-height: 1.6; font-style: italic;
}
.callout.rust { border-color: var(--rust); color: var(--rust); background: rgba(181,68,10,0.05); }
.callout.och  { border-color: var(--ochre); color: var(--brown); background: rgba(196,154,40,0.06); }
.callout em   { font-style: normal; font-weight: 700; font-family: 'Playfair Display', serif; }

@media(max-width:900px){
  .content { padding: 28px 20px; }
  header .compass-bar, .hdr-body { padding-left: 20px; padding-right: 20px; }
  .spec-cards { grid-template-columns: 1fr 1fr; }
  .nines-grid { grid-template-columns: 1fr 1fr; }
  .lb-grid { grid-template-columns: 1fr 1fr; }
  .fw-steps { grid-template-columns: 1fr 1fr; }
  .fw-steps-b { grid-template-columns: 1fr; }
  .chk-grid { grid-template-columns: 1fr; }
}

/* ===== BOTTOM NAV ===== */
.b1-bottom-nav {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 2rem 1rem;
  margin-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.15);
}
.b1-nav-footer-btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  background: rgba(0,212,170,0.1);
  color: #00d4aa;
  border: 1px solid rgba(0,212,170,0.3);
  transition: all 0.2s;
  font-family: inherit;
}
.b1-nav-footer-btn:hover {
  background: rgba(0,212,170,0.2);
  transform: translateY(-2px);
}
