/* ===== reset / base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  background: #0c0c0e;
  color: #d8d8d8;
  font-family:
    "Inter",
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    sans-serif;
  font-size: 17px;
  line-height: 1.75;
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings:
    "ss01" on,
    "cv11" on,
    "kern" on;
}

a {
  color: #6ec1e4;
  text-decoration: none;
}
a:hover {
  color: #9be0ff;
  text-decoration: underline;
}

/* ===== fonts ===== */
:root {
  --serif:
    "Source Serif 4", "Source Serif Pro", "Iowan Old Style", "Georgia",
    "Charter", serif;
  --mono:
    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  --bg: #0c0c0e;
  --bg-1: #131316;
  --bg-2: #1a1a1f;
  --bg-3: #22222a;
  --border: #2a2a33;
  --border-soft: #1f1f26;
  --text: #e6e6e8;
  --text-2: #a9a9b3;
  --text-3: #6f6f7a;
  --accent: #ffb454; /* warm gold */
  --accent-2: #ff8a3d;
  --accent-soft: rgba(255, 180, 84, 0.12);
  --green: #b8e986;
  --cyan: #6ec1e4;
  --pink: #ff7a90;
  --danger: #ff6b6b;
}

/* ===== layout ===== */
.app {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-rows: 56px 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar content";
  height: 100vh;
  width: 100vw;
}
.chat {
  display: none !important;
}

@media (max-width: 1100px) {
  .app {
    grid-template-columns: 240px 1fr;
  }
}
@media (max-width: 720px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "content";
  }
  .sidebar {
    display: none;
  }
  .content {
    padding: 32px 24px 100px;
  }
}

/* ===== topbar ===== */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #16161b, #101014);
  position: relative;
  z-index: 30;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.brand .pi-mark {
  font-family: var(--mono);
  font-size: 22px;
  color: var(--accent);
  background: var(--accent-soft);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 180, 84, 0.3);
}
.brand .subtitle {
  color: var(--text-2);
  font-weight: 400;
  font-size: 13px;
}
.topnav {
  display: flex;
  gap: 4px;
}
.topnav a {
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 13px;
}
.topnav a:hover {
  background: var(--bg-2);
  color: var(--text);
  text-decoration: none;
}
.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.btn {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover {
  background: var(--bg-3);
  border-color: #383843;
}
.btn.primary {
  background: var(--accent);
  color: #1a1100;
  border-color: transparent;
  font-weight: 600;
}
.btn.primary:hover {
  background: var(--accent-2);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
}
.btn.ghost:hover {
  background: var(--bg-2);
}

/* ===== sidebar ===== */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 12px;
}
.sidebar-section {
  margin-bottom: 24px;
}
.sidebar-section h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin: 0 0 8px 8px;
  font-weight: 600;
}
.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar-nav li a {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 13px;
  border-left: 2px solid transparent;
}
.sidebar-nav li a:hover {
  background: var(--bg-2);
  color: var(--text);
  text-decoration: none;
}
.sidebar-nav li a.active {
  background: var(--bg-2);
  color: var(--accent);
  border-left-color: var(--accent);
}
.sidebar-nav li.nested a {
  padding-left: 24px;
  font-size: 12.5px;
  color: var(--text-3);
}
.sidebar-nav li.nested a:hover {
  color: var(--text);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  color: var(--text-2);
  font-size: 13px;
  border-radius: 6px;
}
.sidebar-link:hover {
  background: var(--bg-2);
  color: var(--text);
  text-decoration: none;
}
.sidebar-link::after {
  content: "↗";
  opacity: 0.5;
  margin-left: auto;
}

/* ===== main content ===== */
.content {
  grid-area: content;
  overflow-y: auto;
  padding: 48px 64px 160px;
  scroll-behavior: smooth;
}
.content article {
  max-width: 720px;
  margin: 0 auto;
}

/* ===== typography ===== */
h1 {
  font-size: 42px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 16px 0 24px;
  color: #fff;
}
h2 {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 88px 0 28px;
  color: #fff;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
h3 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 56px 0 18px;
  color: var(--accent);
  display: flex;
  align-items: baseline;
  gap: 12px;
}
h3 .num {
  font-family: var(--mono);
  color: var(--text-3);
  font-size: 14px;
  font-weight: 500;
  min-width: 40px;
}
h4 {
  font-size: 12px;
  font-weight: 600;
  margin: 32px 0 12px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
p {
  margin: 0 0 22px;
  color: #d8d8dc;
}
p + p {
  margin-top: -4px;
}

/* ===== readability: lead-in bolds, highlights, drop caps, mini-heads ===== */

/* Lead-in: first phrase of a paragraph styled so skimmers absorb the thesis */
.lead-in {
  color: #fff;
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* Highlight: subtle yellow underline glow on a key phrase */
.hl {
  background: linear-gradient(
    180deg,
    transparent 62%,
    rgba(255, 180, 84, 0.22) 62%,
    rgba(255, 180, 84, 0.22) 92%,
    transparent 92%
  );
  padding: 0 2px;
  color: #f4eadf;
  font-weight: 500;
}
.hl-cyan {
  background: linear-gradient(
    180deg,
    transparent 62%,
    rgba(110, 193, 228, 0.2) 62%,
    rgba(110, 193, 228, 0.2) 92%,
    transparent 92%
  );
  padding: 0 2px;
  color: #e6e6e8;
}
.hl-pink {
  background: linear-gradient(
    180deg,
    transparent 62%,
    rgba(255, 122, 144, 0.18) 62%,
    rgba(255, 122, 144, 0.18) 92%,
    transparent 92%
  );
  padding: 0 2px;
  color: #f5dde0;
}

/* Drop-cap for the first paragraph of a major section */
.dropcap::first-letter {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 56px;
  line-height: 0.9;
  float: left;
  margin: 6px 12px 0 0;
  color: var(--accent);
  letter-spacing: 0;
}

/* Standout one-sentence paragraph — uses serif italic, larger size */
.standout {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.5;
  color: #fff;
  font-style: italic;
  margin: 28px 0 32px;
  letter-spacing: -0.005em;
  font-weight: 400;
}

/* Mini-head: a small label that sits ABOVE a paragraph, giving skimmers a rest stop.
   Use as a child <span class="mini-head">…</span> at the start of a paragraph, or as a <h5>. */
.mini-head,
h5.mini-head {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 28px 0 6px;
}

/* Inline aside — sits flush with text but visually softer. Use a <span class="aside">…</span> */
.aside {
  color: var(--text-3);
  font-style: italic;
  font-family: var(--serif);
}

/* Margin note — anchors a small note in the right margin on wide screens.
   Falls back to inline italic on smaller widths. */
.margin-note {
  display: inline;
  color: var(--text-3);
  font-style: italic;
  font-family: var(--serif);
  font-size: 0.95em;
}
@media (min-width: 1280px) {
  .margin-note {
    position: absolute;
    left: calc(100% + 24px);
    width: 180px;
    margin-top: 4px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-3);
    font-style: italic;
    font-family: var(--serif);
    border-left: 1px solid var(--border);
    padding-left: 12px;
  }
  .margin-note::before {
    content: "↳ ";
    color: var(--accent);
    font-style: normal;
    font-family: var(--mono);
  }
  .has-margin-note {
    position: relative;
  }
}

/* Numbered point inline — for breaking a long sentence into 3 visible beats */
.beat {
  display: block;
  padding-left: 28px;
  position: relative;
  margin: 6px 0;
}
.beat::before {
  content: attr(data-n);
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-soft);
  border: 1px solid rgba(255, 180, 84, 0.3);
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* "Reading rest" — a subtle horizontal pause inside long sections */
.rest {
  text-align: center;
  margin: 36px 0;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.3em;
}
.rest::before {
  content: "· · ·";
}

/* Complaint list — title on its own line, separator before each item */
.complaint-list {
  list-style: none;
  padding: 0;
  margin: 24px 0 32px;
  counter-reset: complaint;
}
.complaint-list li {
  counter-increment: complaint;
  position: relative;
  padding: 18px 0 18px 56px;
  border-top: 1px solid var(--border-soft);
  margin: 0;
}
.complaint-list li:last-child {
  border-bottom: 1px solid var(--border-soft);
}
.complaint-list li::before {
  content: counter(complaint);
  position: absolute;
  left: 0;
  top: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid rgba(255, 180, 84, 0.28);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.complaint-title {
  display: block;
  font-weight: 700;
  color: #fff;
  font-size: 18px;
  letter-spacing: -0.005em;
  margin-bottom: 6px;
  line-height: 1.3;
}
.complaint-body {
  display: block;
  color: var(--text-2);
  line-height: 1.65;
  font-size: 15.5px;
}

/* Proposes list — five-move enumeration with monospace numerals */
.proposes-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 28px;
  display: grid;
  gap: 4px;
}
.proposes-list li {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  margin: 0;
  border-bottom: 1px dashed var(--border-soft);
}
.proposes-list li:last-child {
  border-bottom: none;
}
.proposes-num {
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  min-width: 24px;
  text-align: right;
}
.proposes-text {
  color: var(--text);
  font-size: 17px;
  line-height: 1.55;
}
.proposes-text strong {
  color: #fff;
  text-decoration-color: rgba(255, 180, 84, 0.5);
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

strong {
  color: #fff;
  font-weight: 600;
}
em {
  color: var(--text);
  font-style: italic;
  font-family: var(--serif);
}
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

/* ===== inline code + code blocks ===== */
code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--green);
}
pre {
  background: #0a0a0c;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.55;
}
pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: #c8c8d0;
  font-size: inherit;
}

/* ===== code ref badges (the github links) ===== */
.codelink {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 0.82em;
  background: rgba(255, 180, 84, 0.08);
  border: 1px solid rgba(255, 180, 84, 0.25);
  color: var(--accent);
  padding: 1px 7px;
  border-radius: 4px;
  text-decoration: none !important;
  white-space: nowrap;
  vertical-align: baseline;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}
.codelink:hover {
  background: rgba(255, 180, 84, 0.18);
  border-color: var(--accent);
  color: var(--accent);
}
.codelink::after {
  content: "↗";
  font-size: 0.85em;
  opacity: 0.7;
}

/* ===== callout boxes ===== */
.callout {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 20px 24px;
  margin: 28px 0;
  color: var(--text);
  line-height: 1.7;
}
.callout.quote {
  border-left-color: var(--cyan);
  font-style: italic;
  color: var(--text-2);
}
.callout.warn {
  border-left-color: var(--pink);
}
.callout.tip {
  border-left-color: var(--green);
}
.callout strong {
  color: var(--accent);
}
.callout p:last-child {
  margin-bottom: 0;
}

/* ===== chips for principle headings ===== */
.section-label {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  margin-bottom: 4px;
}

/* ===== tables ===== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}
th,
td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}
th {
  background: var(--bg-2);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}
td code {
  font-size: 0.85em;
}

/* ===== lists ===== */
ul,
ol {
  padding-left: 26px;
  margin: 0 0 24px;
}
li {
  margin-bottom: 12px;
  line-height: 1.7;
}
li:last-child {
  margin-bottom: 0;
}
li > p {
  margin: 0 0 10px;
}
li > p:last-child {
  margin-bottom: 0;
}
ul li::marker,
ol li::marker {
  color: var(--text-3);
}

/* ===== glossary cards (foundations) ===== */
.gloss-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin: 16px 0 28px;
}
.gloss-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.gloss-card h5 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 600;
}
.gloss-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}
.gloss-card p strong {
  color: var(--text);
}

/* ===== TOC progress indicator ===== */
.read-progress {
  position: fixed;
  top: 56px;
  left: 0;
  height: 2px;
  background: var(--accent);
  width: 0;
  transition: width 0.1s linear;
  z-index: 40;
}

/* ===== chat panel ===== */
.chat {
  grid-area: chat;
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, #18181d, #131318);
}
.chat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.chat-title .pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(184, 233, 134, 0.6);
}
.chat-title .pulse.idle {
  background: var(--text-3);
  box-shadow: none;
}
.chat-title .pulse.busy {
  background: var(--accent);
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}
.chat-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 100%;
}
.msg-role {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  font-family: var(--mono);
}
.msg-role.user {
  color: var(--cyan);
}
.msg-role.assistant {
  color: var(--accent);
}
.msg-body {
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.user .msg-body {
  background: rgba(110, 193, 228, 0.08);
  border-color: rgba(110, 193, 228, 0.2);
}
.msg.assistant .msg-body {
  background: var(--bg-2);
}
.msg-body p {
  margin: 0 0 10px;
}
.msg-body p:last-child {
  margin-bottom: 0;
}
.msg-body code {
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.06);
  font-size: 0.85em;
}
.msg-body pre {
  margin: 8px 0;
  font-size: 12px;
  background: #08080a;
}
.msg-body a {
  color: var(--accent);
}
.msg-body a:hover {
  color: var(--accent-2);
}
.msg-body ul,
.msg-body ol {
  padding-left: 18px;
  margin: 6px 0;
}

.chat-empty {
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
  padding: 24px 12px;
  line-height: 1.6;
}
.chat-empty strong {
  color: var(--text);
}
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  justify-content: center;
}
.suggestion-chip {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 5px 10px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}
.suggestion-chip:hover {
  background: var(--bg-3);
  color: var(--text);
  border-color: var(--accent);
}

.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 12px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--bg);
}
#chat-input {
  flex: 1;
  resize: none;
  min-height: 40px;
  max-height: 200px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  outline: none;
}
#chat-input:focus {
  border-color: var(--accent);
}
#chat-send {
  background: var(--accent);
  color: #1a1100;
  border: none;
  border-radius: 8px;
  padding: 0 14px;
  height: 40px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  white-space: nowrap;
}
#chat-send:hover {
  background: var(--accent-2);
}
#chat-send:disabled {
  background: var(--bg-3);
  color: var(--text-3);
  cursor: not-allowed;
}

.chat-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--border-soft);
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  font-family: var(--mono);
}
.chat-footer button {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 11px;
  font-family: var(--mono);
  padding: 0;
}
.chat-footer button:hover {
  color: var(--accent);
}

/* ===== api key dialog ===== */
.api-key-prompt {
  background: var(--bg-2);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 14px;
  margin: 12px 0;
  font-size: 13px;
}
.api-key-prompt p {
  margin: 0 0 10px;
}
.api-key-prompt .key-row {
  display: flex;
  gap: 6px;
}
.api-key-prompt input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}
.api-key-prompt input:focus {
  border-color: var(--accent);
}
.api-key-prompt button {
  background: var(--accent);
  color: #1a1100;
  border: none;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ===== hero: stat grid + pitch card + promise band ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 28px 0 22px;
}
@media (max-width: 820px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.stat-card {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 14px 14px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}
.stat-num {
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
  letter-spacing: -0.03em;
}
.stat-label {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.45;
  font-weight: 600;
}
.stat-label .dim {
  display: block;
  margin-top: 3px;
  color: var(--text-3);
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.pitch-card {
  background: linear-gradient(
    180deg,
    rgba(110, 193, 228, 0.07),
    rgba(110, 193, 228, 0.015)
  );
  border: 1px solid rgba(110, 193, 228, 0.22);
  border-left: 3px solid var(--cyan);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 18px 0 22px;
}
.pitch-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cyan);
  margin-bottom: 8px;
  font-weight: 600;
}
.pitch-card p {
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
}
.pitch-card strong {
  color: #fff;
}

.promise-band {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 22px 0 8px;
  font-size: 15px;
  line-height: 1.65;
}
.promise-band strong {
  color: var(--accent);
}

/* ===== pull quotes ===== */
.pull-quote {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.45;
  font-style: italic;
  color: #fff;
  margin: 40px 0;
  padding: 14px 8px 14px 36px;
  border-left: 3px solid var(--accent);
  position: relative;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.pull-quote::before {
  content: "“";
  position: absolute;
  left: 8px;
  top: -10px;
  font-size: 64px;
  color: var(--accent);
  opacity: 0.18;
  font-family: Georgia, serif;
  line-height: 1;
}
.pull-quote cite {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-3);
  font-style: normal;
  letter-spacing: 0.01em;
  font-family: var(--mono);
}
.pull-quote cite::before {
  content: "— ";
  color: var(--text-3);
}

/* ===== key-insight callout ===== */
.callout.insight {
  background: linear-gradient(
    180deg,
    rgba(255, 180, 84, 0.08),
    rgba(255, 180, 84, 0.015)
  );
  border: 1px solid rgba(255, 180, 84, 0.28);
  border-left: 4px solid var(--accent);
  padding: 14px 18px 14px 20px;
  margin: 22px 0;
  border-radius: 8px;
}
.callout.insight .insight-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 700;
  font-family: var(--mono);
  margin-bottom: 8px;
}
.callout.insight .insight-label::before {
  content: "◆";
  font-size: 12px;
}
.callout.insight p {
  margin: 0 0 10px;
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--text);
}
.callout.insight p:last-child {
  margin-bottom: 0;
}
.callout.insight strong {
  color: #fff;
  font-weight: 600;
}

/* ===== section TL;DR pill + h2 meta ===== */
.section-tldr {
  display: block;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-2);
  margin: 0 0 28px;
  line-height: 1.6;
}
.section-tldr strong {
  color: var(--accent);
  font-weight: 600;
}
.section-tldr code {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.06);
  font-size: 0.86em;
}

.h2-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  color: var(--text-3);
  font-family: var(--mono);
  margin: -10px 0 14px;
  letter-spacing: 0.02em;
  flex-wrap: wrap;
}
.h2-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.h2-meta .dot {
  color: var(--border);
  margin: 0 -2px;
}
.h2-meta .read-time::before {
  content: "◷ ";
  color: var(--accent);
}
.h2-meta .item-count::before {
  content: "▣ ";
  color: var(--cyan);
}

/* ===== principles "at a glance" overview ===== */
.principles-glance {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px 18px;
  margin: 14px 0 32px;
}
.principles-glance > summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  outline: none;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
}
.principles-glance > summary::-webkit-details-marker {
  display: none;
}
.principles-glance > summary::before {
  content: "▶";
  font-size: 10px;
  color: var(--text-3);
  transition: transform 0.2s ease;
  display: inline-block;
}
.principles-glance[open] > summary::before {
  transform: rotate(90deg);
}
.principles-glance > summary:hover {
  color: var(--accent-2);
}
.principles-glance .glance-desc {
  color: var(--text-3);
  font-weight: 400;
  font-size: 12px;
  font-family: var(--mono);
  margin-left: 4px;
}
.glance-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 22px;
  margin-top: 14px;
}
@media (max-width: 720px) {
  .glance-grid {
    grid-template-columns: 1fr;
  }
}
.glance-grid a {
  display: flex;
  gap: 10px;
  padding: 4px 0;
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px dashed transparent;
  align-items: baseline;
}
.glance-grid a:hover {
  color: var(--text);
  border-bottom-color: var(--border-soft);
}
.glance-grid .pn {
  font-family: var(--mono);
  color: var(--accent);
  min-width: 34px;
  font-weight: 600;
  font-size: 12px;
}
.glance-grid .group-label {
  grid-column: 1 / -1;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin: 12px 0 2px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-soft);
  font-weight: 600;
}
.glance-grid .group-label:first-of-type {
  margin-top: 4px;
}

/* ===== "fun fact" inline marker ===== */
.factoid {
  display: inline-block;
  background: rgba(184, 233, 134, 0.08);
  border: 1px solid rgba(184, 233, 134, 0.25);
  color: var(--green);
  border-radius: 4px;
  padding: 1px 7px;
  font-family: var(--mono);
  font-size: 11.5px;
  margin: 0 2px;
}

/* ===== intro: lede + before/after cards ===== */
.lede {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.55;
  color: var(--text);
  margin: 16px 0 36px;
  font-style: italic;
  border-left: 2px solid var(--accent);
  padding-left: 20px;
}
.lede strong {
  color: #fff;
  font-style: normal;
  font-family: "Inter", sans-serif;
  font-weight: 600;
}

.intro-h3 {
  font-size: 22px;
  margin: 56px 0 18px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.intro-h3 .marker {
  width: 26px;
  height: 26px;
  background: var(--accent-soft);
  border: 1px solid rgba(255, 180, 84, 0.3);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}

.bf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0 28px;
}
@media (max-width: 820px) {
  .bf-grid {
    grid-template-columns: 1fr;
  }
}
.bf-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.bf-card h4 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bf-card.bf-before {
  border-left: 3px solid var(--pink);
}
.bf-card.bf-before h4 {
  color: var(--pink);
}
.bf-card.bf-after {
  border-left: 3px solid var(--green);
}
.bf-card.bf-after h4 {
  color: var(--green);
}
.bf-card ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
  font-size: 14.5px;
  color: var(--text-2);
  line-height: 1.65;
}
.bf-card li {
  margin-bottom: 14px;
  padding-left: 20px;
  position: relative;
}
.bf-card li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.bf-card.bf-before li::before {
  background: var(--pink);
  opacity: 0.6;
}
.bf-card.bf-after li::before {
  background: var(--green);
  opacity: 0.7;
}
.bf-card li strong {
  color: var(--text);
  font-weight: 600;
}
.bf-card li code {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.06);
  font-size: 0.86em;
}

/* ===== diagram cards ===== */
.diagram-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px 18px;
  margin: 14px 0 28px;
  overflow-x: auto;
}
.diagram-card .diagram-title {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 8px;
}
.diagram-card .diagram-title .title-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.diagram-card .diagram-title .name {
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.diagram-card .diagram-title .tag {
  background: rgba(255, 180, 84, 0.08);
  border: 1px solid rgba(255, 180, 84, 0.3);
  border-radius: 4px;
  padding: 1px 8px;
  font-size: 10px;
  color: var(--accent);
  white-space: nowrap;
}
.diagram-card .diagram-caption {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 12px;
  line-height: 1.55;
  padding-top: 10px;
  border-top: 1px dashed var(--border-soft);
}
.diagram-card .mermaid {
  background: transparent;
  text-align: center;
  font-family: var(--mono);
  min-height: 40px;
}
.diagram-card .mermaid svg {
  max-width: 100% !important;
  height: auto !important;
}
.diagram-card pre.ascii {
  background: #08080a;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 14px 18px;
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #c8c8d0;
  font-family: var(--mono);
  overflow-x: auto;
  white-space: pre;
}
.diagram-card pre.ascii .hl {
  color: var(--accent);
}
.diagram-card pre.ascii .hl2 {
  color: var(--cyan);
}
.diagram-card pre.ascii .hl3 {
  color: var(--green);
}
.diagram-card pre.ascii .dim {
  color: var(--text-3);
}

/* ===== misc ===== */
.kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--text-2);
}
.dim {
  color: var(--text-3);
}

/* ===== anchor offset (so heading isn't under topbar) ===== */
:target {
  scroll-margin-top: 72px;
}
section {
  scroll-margin-top: 72px;
}
h2,
h3 {
  scroll-margin-top: 72px;
}

/* ===== highlight on visit ===== */
.flash {
  animation: flash 1.5s ease;
}
@keyframes flash {
  0% {
    background: rgba(255, 180, 84, 0.18);
  }
  100% {
    background: transparent;
  }
}

/* ===== scrollbars (webkit) ===== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--bg-3);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3a3a44;
}
