/* Cache Protocol — inherits from protocol.hyper.space styles.css */

:root {
  --bg: #fafaf8;
  --fg: #1a1a1a;
  --surface: #f5f5f0;
  --surface-raised: #ffffff;
  --surface-hover: #f0f0eb;
  --card-bg: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #888888;
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 6px 24px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.18), 0 4px 14px rgba(0,0,0,0.1);
  --border-divider: transparent;
  --font-serif: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", monospace;
  --teal: #00ccbc;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
::selection { background: rgba(0,0,0,0.1); color: var(--text-primary); }

body {
  background: var(--bg);
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--text-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 960px; margin: 0 auto; padding: 0 32px; }

/* Header */
.header {
  height: 56px; background: var(--bg); display: flex; align-items: center;
  border-bottom: 1px solid var(--border-divider);
}
.header .container { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.logo { font-family: var(--font-serif); font-size: 17px; font-weight: 700; color: var(--text-primary); letter-spacing: 0.04em; }
.logo:hover { text-decoration: none; }
.logo .logo-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); margin-left: 6px; vertical-align: middle; position: relative; top: -1px; }
.nav { display: flex; align-items: center; gap: 24px; }
.nav a { font-family: var(--font-serif); font-size: 13px; font-weight: 400; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); }
.nav a:hover { color: var(--text-primary); text-decoration: none; }

/* Hero */
.hero { padding: 60px 0 48px; }
.section-label {
  display: block; font-family: var(--font-serif); font-size: 11px; font-weight: 400;
  text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); margin-bottom: 16px;
}
.hero h1 { font-family: var(--font-serif); font-size: 42px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; color: var(--text-primary); margin-bottom: 12px; }
.hero-subtitle { font-family: var(--font-serif); font-size: 18px; font-style: italic; color: var(--text-secondary); margin-bottom: 8px; }
.hero-desc { font-family: var(--font-serif); font-size: 15px; color: var(--text-secondary); line-height: 1.7; max-width: 640px; margin-bottom: 32px; }
.hero-stats { display: flex; gap: 40px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat-value { font-family: var(--font-mono); font-size: 20px; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.stat-label { font-family: var(--font-serif); font-size: 10px; font-weight: 400; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); margin-top: 4px; }

/* Sections */
.section { padding: 60px 0; border-top: 1px solid var(--border-divider); }
.section h2 { font-family: var(--font-serif); font-size: 24px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.01em; margin-bottom: 12px; }
.section p { margin-bottom: 16px; max-width: 720px; }
.section-subtext { font-family: var(--font-serif); font-size: 15px; color: var(--text-secondary); line-height: 1.7; }
sup { font-size: 10px; color: var(--text-muted); }
sup a { color: var(--text-muted); font-family: var(--font-mono); }

/* Primitive list */
.primitive-list-clean { display: flex; flex-direction: column; gap: 0; margin-top: 24px; }
.primitive-row { display: flex; align-items: baseline; gap: 16px; padding: 14px 0; border-bottom: 1px solid rgba(0,0,0,0.06); }
.primitive-row:last-child { border-bottom: none; }
.pnum { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); flex-shrink: 0; width: 24px; }
.pname { font-family: var(--font-serif); font-size: 15px; font-weight: 700; color: var(--text-primary); flex-shrink: 0; width: 140px; }
.pdesc { font-family: var(--font-serif); font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

/* Code blocks (Stripe dark-on-light) */
pre {
  background: #0a0d14; border: none; padding: 20px 24px; border-radius: 8px;
  overflow-x: auto; font-family: var(--font-mono); font-size: 13.5px; line-height: 1.6;
  color: #e1e4e8; margin: 20px 0; -webkit-font-smoothing: antialiased;
}
pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
code {
  font-family: var(--font-mono); background: #f0ede8; border: none;
  padding: 2px 6px; border-radius: 3px; font-size: 13px; color: #1a1a1a;
}

/* Prism overrides */
.token.comment { color: #6a737d !important; }
.token.keyword, .token.operator { color: #ff7b72 !important; }
.token.string, .token.attr-value { color: #a5d6ff !important; }
.token.function { color: #d2a8ff !important; }
.token.number, .token.constant, .token.property { color: #79c0ff !important; }
.token.class-name, .token.builtin { color: #ffa657 !important; }
.token.punctuation { color: #c9d1d9 !important; }

/* Terminal window */
.terminal-window { border-radius: 8px; overflow: hidden; box-shadow: var(--shadow-lg); margin-top: 24px; }
.terminal-dots { display: flex; align-items: center; gap: 6px; padding: 0 16px; flex-shrink: 0; }
.terminal-dots span { width: 12px; height: 12px; border-radius: 50%; }
.terminal-dots span:nth-child(1) { background: #ff5f56; }
.terminal-dots span:nth-child(2) { background: #ffbd2e; }
.terminal-dots span:nth-child(3) { background: #27c93f; }
.terminal-tabs { display: flex; background: #161b22; padding: 0; gap: 0; border-bottom: 1px solid #21262d; align-items: center; }
.terminal-tab { font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: #8b949e; background: transparent; border: none; padding: 12px 20px; cursor: pointer; transition: color 0.15s, background 0.15s; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.terminal-tab:hover { color: #c9d1d9; background: rgba(255,255,255,0.04); }
.terminal-tab.active { color: #f0f0f0; border-bottom-color: #f0f0f0; background: rgba(255,255,255,0.06); }
.terminal-body { background: #0a0d14; }
.terminal-pane { display: none; }
.terminal-pane.active { display: block; }
.terminal-pane pre { margin: 0; border-radius: 0; box-shadow: none; }
.terminal-footer { background: #161b22; padding: 8px 20px; font-family: var(--font-mono); font-size: 11px; color: #484f58; border-top: 1px solid #21262d; }
.terminal-footer a { color: #8b949e; }

/* ASCII diagrams */
.ascii-diagram {
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.4;
  color: #8b949e; white-space: pre; overflow-x: auto; padding: 24px;
  background: #0a0d14; border: none; border-radius: 8px; margin: 20px 0;
}
.ascii-diagram pre { background: none; border: none; padding: 0; margin: 0; font-size: inherit; border-radius: 0; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-family: var(--font-serif); font-size: 14px; margin: 16px 0; }
thead th { font-family: var(--font-serif); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-primary); padding: 8px 12px; text-align: left; border-bottom: 2px solid var(--text-primary); }
tbody td { font-size: 14px; color: var(--text-secondary); padding: 10px 12px; border-bottom: 1px solid var(--border-divider); vertical-align: top; }
.table-wrapper { overflow-x: auto; }

/* Cards */
.card { background: var(--card-bg); border: none; border-radius: 8px; padding: 24px; box-shadow: var(--shadow-md); transition: box-shadow 0.2s ease; }
.card:hover { box-shadow: var(--shadow-lg); }

/* Compare boxes (for Hyperspace vs Lab) */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0; }
.compare-box { background: var(--card-bg); border-radius: 8px; padding: 20px; box-shadow: var(--shadow-sm); }
.compare-box h3 { font-family: var(--font-serif); font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.compare-box ul { list-style: none; }
.compare-box li { font-family: var(--font-serif); font-size: 13px; color: var(--text-secondary); line-height: 1.8; padding-left: 16px; position: relative; }
.compare-box li::before { content: '\2014'; position: absolute; left: 0; color: var(--text-muted); }
.box-lab h3 { color: var(--text-muted); }
.box-hyper h3 { color: var(--text-primary); }

/* SVG diagrams */
.diagram-wrap { margin: 24px 0; background: #000; border-radius: 8px; overflow: hidden; box-shadow: var(--shadow-md); }
.diagram-wrap svg { display: block; width: 100%; height: auto; }

/* Chalk / Excalidraw style blocks */
.chalk{background:#000;border-radius:8px;padding:28px;font-family:'Virgil','Segoe Print','Comic Sans MS','Caveat',cursive;box-shadow:var(--shadow-md);margin:24px 0}
.chalk *{font-family:inherit}
.chalk h4{font-size:16px;font-weight:700;color:#fff;margin-bottom:16px}
.chalk-flow{display:flex;align-items:center;gap:0;flex-wrap:wrap;justify-content:center}
.chalk-box{background:none;border:1.5px solid rgba(255,255,255,0.25);border-radius:10px;padding:14px 18px;text-align:center;position:relative}
.chalk-box h5{font-size:14px;font-weight:700;color:#fff;margin-bottom:2px}
.chalk-box p{font-size:12px;color:#aaa;margin:0;line-height:1.4}
.chalk-arrow{font-size:22px;color:rgba(255,255,255,0.3);padding:0 10px;flex-shrink:0}
.chalk-mesh{display:flex;gap:10px;flex-wrap:wrap;justify-content:center;padding:12px 16px;border:1.5px dashed rgba(255,255,255,0.15);border-radius:12px}
.chalk-node{width:40px;height:40px;border-radius:50%;border:1.5px solid rgba(255,255,255,0.2);display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:600;color:#bbb}
.chalk-cards{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:20px}
.chalk-card{border:1.5px solid rgba(255,255,255,0.12);border-radius:8px;padding:14px 16px}
.chalk-card h6{font-size:13px;font-weight:700;color:#fff;margin-bottom:4px}
.chalk-card p{font-size:11px;color:#aaa;line-height:1.5;margin:0}
.chalk-steps{margin-top:16px;font-size:13px;color:#aaa;line-height:2.2}
.chalk-steps strong{color:#fff}
.chalk-layer{border:1.5px solid rgba(255,255,255,0.2);border-radius:10px;padding:16px 20px;display:flex;justify-content:space-between;align-items:flex-start}
.chalk-layer-left h5{font-size:15px;font-weight:700;color:#fff;margin-bottom:4px}
.chalk-layer-left p{font-size:12px;color:#aaa;line-height:1.5;margin:0}
.chalk-layer-right{text-align:right;flex-shrink:0;padding-left:16px}
.chalk-layer-right .rate{font-size:28px;font-weight:700;color:#fff}
.chalk-layer-right .rate-sub{font-size:10px;color:#aaa}
.chalk-miss{text-align:center;font-size:13px;color:rgba(255,255,255,0.3);padding:4px 0}
.chalk-result{display:inline-block;font-size:12px;font-weight:600;color:#fff;border:1px solid rgba(255,255,255,0.2);padding:3px 10px;border-radius:12px;margin-top:8px}
.chalk-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin-top:16px}
.chalk-stat{text-align:center;border:1px solid rgba(255,255,255,0.08);border-radius:6px;padding:12px 8px}
.chalk-stat .v{font-size:18px;font-weight:700;color:#fff}
.chalk-stat .l{font-size:10px;color:#aaa;margin-top:2px}
@media(max-width:640px){.chalk-cards{grid-template-columns:1fr}.chalk-flow{flex-direction:column}.chalk-arrow{transform:rotate(90deg)}.chalk-stats{grid-template-columns:repeat(2,1fr)}}

/* Footer */
.footer { padding: 40px 0; border-top: 1px solid var(--border-divider); }
.footer .container { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.footer a { font-family: var(--font-serif); font-size: 13px; color: var(--text-muted); }
.footer a:hover { color: var(--text-primary); }
.footer-note { font-family: var(--font-serif); font-size: 13px; color: var(--text-muted); }

/* Responsive */
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .hero h1 { font-size: 26px; }
  .hero-stats { gap: 24px; }
  .stat-value { font-size: 18px; }
  .section h2 { font-size: 20px; }
  .compare-grid { grid-template-columns: 1fr; }
  .primitive-row { flex-direction: column; gap: 4px; }
  .pname { width: auto; }
  pre { padding: 14px; font-size: 12px; }
  .ascii-diagram { font-size: 11px; padding: 14px; }
  .nav { display: none; }
}
