@import url("phi.css");
/* ── Clutch Justice — Walk the Case ─────────────────────────────── */
/* Dark-first, minimal, investigation-grade UI */

:root {
  --bg: #0a0a0a;
  --bg-surface: #111;
  --bg-elevated: #1a1a1a;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #f59e0b;
  --accent-bright: #fbbf24;
  --link: #60a5fa;
  --link-hover: #93c5fd;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.15);
  --red: #ef4444;
  --green: #10b981;
  --radius: 8px;
  --max-width: 1100px;
}

[data-theme="light"] {
  --bg: #fafafa;
  --bg-surface: #fff;
  --bg-elevated: #f1f5f9;
  --text: #1e293b;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.15);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: var(--lh);
  font-size: 16px;
}

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

.skip-link {
  position: absolute; top: -100px; left: 0;
  background: var(--accent); color: #000; padding: 8px 16px;
  z-index: 100; font-weight: 700;
}
.skip-link:focus { top: 0; }

/* ── Navigation ────────────────────────────────────────────────── */
.site-nav {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 56px;
}

.nav-brand {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--text);
  flex-shrink: 0;
}

.brand-icon { font-size: 20px; }
.brand-text { font-weight: 800; font-size: 16px; letter-spacing: -0.02em; }
.brand-sub {
  font-size: 10px; font-weight: 600;
  color: var(--accent); text-transform: uppercase;
  letter-spacing: 0.08em;
}

.search-wrapper {
  flex: 1; max-width: 300px; position: relative;
}

#search-input {
  width: 100%; padding: 6px 12px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-size: 13px; outline: none;
}
#search-input:focus { border-color: var(--accent); }

.search-results {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-top: 4px;
  max-height: 400px; overflow-y: auto; z-index: 60;
}
.sr-item {
  display: block; padding: 8px 12px; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.sr-item:hover { background: var(--bg-elevated); }
.sr-item strong { display: block; font-size: 13px; }
.sr-item span { display: block; font-size: 11px; color: var(--text-muted); }
.sr-empty { padding: 12px; color: var(--text-dim); font-size: 13px; text-align: center; }

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

.nav-link, .nav-group-btn {
  padding: 6px 12px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); border: none; background: none;
  cursor: pointer; border-radius: var(--radius);
  transition: color 0.2s, background 0.2s;
}
.nav-link:hover, .nav-group-btn:hover {
  color: var(--text); background: var(--bg-elevated); text-decoration: none;
}

.nav-walk {
  color: var(--accent) !important;
  font-weight: 700;
}
.nav-walk:hover { color: var(--accent-bright) !important; }

.nav-group { position: relative; }
.nav-dropdown {
  display: none; position: absolute; top: 100%; left: 0;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px 0;
  min-width: 240px; z-index: 60; margin-top: 4px;
}
.nav-group.open .nav-dropdown { display: block; }
.nav-dropdown a {
  display: block; padding: 8px 16px; color: var(--text);
}
.nav-dropdown a:hover { background: var(--bg-elevated); text-decoration: none; }
.nav-dropdown strong { display: block; font-size: 13px; }
.nav-dropdown span { display: block; font-size: 11px; color: var(--text-muted); }

.theme-toggle {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 6px; border-radius: var(--radius);
}
.theme-toggle:hover { color: var(--text); }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: none; }

.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-toggle span {
  display: block; width: 20px; height: 2px;
  background: var(--text); margin: 4px 0; transition: 0.3s;
}

/* ── Main Content ──────────────────────────────────────────────── */
.site-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 20px 64px;
}

/* ── Hero ───────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 60px 0 40px;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
  background: linear-gradient(135deg, var(--accent), var(--red));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 700px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

.hero-actions {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; font-size: 15px; font-weight: 700;
  border-radius: var(--radius); text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }

.btn-primary {
  background: var(--accent); color: #000;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
}
.btn-primary:hover {
  background: var(--accent-bright); color: #000;
  box-shadow: 0 6px 28px rgba(245, 158, 11, 0.4);
}

.btn-secondary {
  background: var(--bg-elevated); color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-surface); color: var(--text); }

/* ── Content ───────────────────────────────────────────────────── */
.page-content { max-width: 800px; margin: 0 auto; }

.page-header {
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.page-desc {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin: 0;
}

h2 { font-size: 1.5rem; font-weight: 700; margin: 2.5rem 0 1rem; letter-spacing: -0.01em; }
h3 { font-size: 1.2rem; font-weight: 700; margin: 2rem 0 0.75rem; }
h4 { font-size: 1rem; font-weight: 700; margin: 1.5rem 0 0.5rem; }

p { margin: 0 0 1rem; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ── Tables ────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 14px;
}

th, td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-elevated);
}

tr:hover { background: rgba(255,255,255,0.02); }

/* ── Code ──────────────────────────────────────────────────────── */
code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

pre {
  background: var(--bg-elevated);
  padding: 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--border);
}

pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
}

/* ── Case Grid ─────────────────────────────────────────────────── */
.case-grid h3 {
  margin-top: 2rem;
}

.case-grid h3 a {
  color: var(--accent);
}

/* ── How It Works ──────────────────────────────────────────────── */
.how-it-works {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin: 1.5rem 0;
}

.how-it-works h3 {
  margin-top: 0;
  font-size: 1rem;
}

/* ── Cards ─────────────────────────────────────────────────────── */
.subsection-card, .page-card {
  display: block;
  padding: 16px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  transition: border-color 0.2s, transform 0.2s;
  color: var(--text);
}
.subsection-card:hover, .page-card:hover {
  border-color: var(--accent);
  transform: translateX(4px);
  text-decoration: none;
}
.subsection-card h3, .page-card h3 { margin: 0 0 4px; font-size: 1rem; }
.subsection-card p, .page-card p { margin: 0; color: var(--text-muted); font-size: 13px; }

/* ── Graph Container ───────────────────────────────────────────── */
.graph-container {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

/* ── Footer ────────────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 48px 20px 32px;
  margin-top: 64px;
}

.footer-inner { max-width: var(--max-width); margin: 0 auto; }

.footer-tagline {
  text-align: center;
  font-size: 14px;
  margin-bottom: 32px;
  color: var(--text-muted);
}

.footer-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}

.footer-col-title {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 6px; }
.footer-col a { font-size: 13px; color: var(--text-muted); }
.footer-col a:hover { color: var(--text); }

.footer-bottom {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.footer-bottom p { font-size: 12px; color: var(--text-dim); margin: 4px 0; }
.footer-license { margin-top: 8px; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; flex-direction: column;
    position: absolute; top: 56px; left: 0; right: 0;
    background: var(--bg-surface); border-bottom: 1px solid var(--border);
    padding: 12px 20px;
  }
  .nav-toggle { display: block; }
  .nav-dropdown { position: static; }

  .hero h1 { font-size: 2rem; }
  .hero-sub { font-size: 1rem; }

  .how-it-works { grid-template-columns: 1fr; }

  .footer-columns { grid-template-columns: 1fr; }
}

/* ── Mermaid ───────────────────────────────────────────────────── */
pre.mermaid {
  background: transparent;
  border: none;
  text-align: center;
}
