/* π-starter project overview — theme, layout, cards, animations, dark/light, responsive */

/* ---------- tokens ---------- */
:root {
  --bg: #0b1220;
  --bg-2: #0f172a;
  --panel: #141d31;
  --panel-2: #1b2740;
  --stroke: #26344f;
  --text: #e6edf7;
  --muted: #93a3bd;
  --accent: #22c55e;      /* tool/dev bright green */
  --accent-2: #38bdf8;    /* cyan */
  --accent-3: #facc15;    /* gold */
  --pink: #f472b6;
  --violet: #a78bfa;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --glass: rgba(20,29,49,.65);
  --radius: 16px;
  --maxw: 1200px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="light"] {
  --bg: #f4f7fb;
  --bg-2: #eaeff7;
  --panel: #ffffff;
  --panel-2: #f1f5fb;
  --stroke: #d6deeb;
  --text: #10203a;
  --muted: #556480;
  --shadow: 0 10px 30px rgba(20,40,80,.12);
  --glass: rgba(255,255,255,.7);
  /* accents are re-tuned for a light surface: the dark-theme values are bright
     hues that collapse to 1.5-2.7:1 on white, so the API method tags, directory
     names and hero numbers read as washed-out grey. These darker variants clear
     WCAG AA against --panel (#fff) and --panel-2 (#f1f5fb). */
  --accent: #15803d;
  --accent-2: #0369a1;
  --accent-3: #a16207;
  --pink: #be185d;
  --violet: #6d28d9;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(56,189,248,.12), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(34,197,94,.10), transparent 55%),
    var(--bg);
  line-height: 1.6;
  transition: background .3s ease, color .3s ease;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
code { font-family: var(--mono); font-size: .9em; background: var(--panel-2); padding: .1em .4em; border-radius: 6px; overflow-wrap: anywhere; }

/* ---------- progress bar ---------- */
#progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 200; transition: width .1s linear;
}

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px);
  background: var(--glass);
  border-bottom: 1px solid var(--stroke);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 18px;
}
.brand { font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: .3px; }
.brand .pi { color: var(--accent); font-weight: 800; }
.links { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.links a {
  color: var(--muted); font-size: 14px; padding: 6px 10px; border-radius: 8px;
  transition: color .2s, background .2s;
}
.links a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.links a.active { color: var(--accent); background: rgba(34,197,94,.12); }
.theme-toggle, .hamburger {
  background: var(--panel-2); border: 1px solid var(--stroke); color: var(--text);
  border-radius: 10px; cursor: pointer; font-size: 16px; width: 38px; height: 34px;
}
.hamburger { display: none; flex-direction: column; gap: 3px; align-items: center; justify-content: center; }
.hamburger span { width: 16px; height: 2px; background: var(--text); display: block; }

/* ---------- hero ---------- */
.hero {
  max-width: var(--maxw); margin: 0 auto; padding: 64px 0 32px;
}
.hero-card {
  position: relative; overflow: hidden;
  border-radius: 24px; padding: 48px 40px;
  background:
    linear-gradient(135deg, rgba(34,197,94,.20), rgba(56,189,248,.14) 45%, rgba(250,204,21,.10)),
    var(--panel);
  border: 1px solid var(--stroke); box-shadow: var(--shadow);
}
.hero-card::after {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 60%; height: 160%;
  background: radial-gradient(circle at center, rgba(56,189,248,.25), transparent 60%);
  animation: floaty 12s ease-in-out infinite; pointer-events: none;
}
@keyframes floaty { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-24px)} }
.eyebrow { text-transform: uppercase; letter-spacing: 2px; font-size: 12px; color: var(--accent-2); font-weight: 700; margin: 0; }
.hero h1 { font-size: clamp(40px, 8vw, 76px); margin: 6px 0 8px; font-weight: 800; letter-spacing: -1px; }
.tagline { max-width: 640px; font-size: clamp(16px, 2.4vw, 20px); color: var(--text); margin: 0 0 22px; }
.badges { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.badge {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 13px;
  background: var(--panel-2); border: 1px solid var(--stroke); border-radius: 999px; padding: 6px 14px;
}
.badge .bl { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 6px; max-width: 640px; }
.stat { display: flex; flex-direction: column; background: var(--panel-2); border: 1px solid var(--stroke); border-radius: 14px; padding: 14px 16px; }
.stat .num, .num { font-size: 34px; font-weight: 800; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.stat .label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.repo { margin-top: 20px; color: var(--muted); font-size: 14px; }
/* hero calls-to-action: the page is a landing page, so the two real destinations
   (the repo and the shareable card) are buttons, not links buried in muted prose. */
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 6px 0 26px; }
.cta {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px;
  padding: 11px 20px; border-radius: 12px; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.cta svg { width: 18px; height: 18px; }
.cta:hover { transform: translateY(-2px); text-decoration: none; }
.cta.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #06131f; box-shadow: 0 8px 22px rgba(34,197,94,.22); }
.cta.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--stroke); }
.cta.ghost:hover { border-color: var(--accent-2); }

/* ---------- sections ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 20px 40px; }
section { padding: 40px 0; border-top: 1px solid var(--stroke); scroll-margin-top: 70px; }
.section-head h2 { font-size: 30px; margin: 0 0 4px; font-weight: 800; }
.section-head .sub { color: var(--muted); margin: 0 0 22px; font-size: 15px; }
.section-head h2::before { content: "▹ "; color: var(--accent); }

.grid-2, .grid-3 { display: grid; gap: 18px; margin-bottom: 8px; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--panel); border: 1px solid var(--stroke); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
  display: flex; flex-direction: column;
}
.card h3 { margin: 0 0 8px; font-size: 18px; }
.card h3 .ic { width: 19px; height: 19px; vertical-align: -3px; margin-right: 7px; color: var(--accent-2); }
.card p { margin: 0; color: var(--muted); }
.card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(0,0,0,.4); border-color: var(--accent-2); }
:root[data-theme="light"] .card:hover { box-shadow: 0 16px 34px rgba(20,40,80,.16); }
.card.mini h4 { margin: 0 0 6px; color: var(--accent-2); font-size: 15px; }
.stat-card { text-align: center; }
.stat-card p { margin-top: 6px; }

.callout {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--stroke); border-left: 3px solid var(--accent-2); border-radius: 12px; padding: 14px 18px; color: var(--text); margin-top: 18px; font-size: 15px;
}

/* The three diagrams carry a hardcoded dark canvas, so the frame is always dark —
   in light mode a white panel behind a dark SVG reads as three black holes. Keeping
   the frame dark makes the image look intentional and identical across themes. */
.diagram { background: #0b1220; border: 1px solid var(--stroke); border-radius: var(--radius); padding: 16px; margin: 0 0 18px; box-shadow: var(--shadow); }
.diagram img { width: 100%; height: auto; max-width: 1080px; display: block; margin: 0 auto; }

/* interactive archify views: self-contained HTML embedded via iframe + link chips */
.embed { width: 100%; height: 640px; border: 1px solid var(--stroke); border-radius: var(--radius); background: var(--panel); margin-bottom: 16px; box-shadow: var(--shadow); }
a.chip { color: var(--text); text-decoration: none; }
a.chip:hover { text-decoration: none; }

/* ---------- capability chips ---------- */
.cap-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  background: var(--panel); border: 1px solid var(--stroke); color: var(--text);
  border-radius: 999px; padding: 8px 16px; font-size: 14px; transition: transform .15s, border-color .15s, background .15s;
}
.chip:hover { transform: translateY(-2px); border-color: var(--accent); background: var(--panel-2); }

/* ---------- tables ---------- */
/* No horizontal scroll wrapper on desktop (the table fits the column), which is what
   lets the header stay sticky against the page as it scrolls; the wrapper returns to
   overflow-x:auto below 720px where the table genuinely overflows, and the header
   un-pins there (a sticky header inside a scroll container would not move with the page). */
.table-wrap { border: 1px solid var(--stroke); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 480px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--stroke); }
th { background: var(--panel-2); color: var(--muted); text-transform: uppercase; font-size: 12px; letter-spacing: 1px; }
thead th { position: sticky; top: 59px; z-index: 3; box-shadow: 0 1px 0 var(--stroke); }
tbody tr { background: var(--panel); transition: background .15s; }
tbody tr:nth-child(even) { background: var(--panel-2); }
tbody tr:hover { background: color-mix(in srgb, var(--accent-2) 12%, var(--panel)); }
tbody tr:last-child td { border-bottom: none; }
.m-get { color: var(--accent-2); font-family: var(--mono); font-weight: 600; }
.m-post { color: var(--accent); font-family: var(--mono); font-weight: 600; }
.m-put { color: var(--accent-3); font-family: var(--mono); font-weight: 600; }
.m-patch { color: var(--violet); font-family: var(--mono); font-weight: 600; }
.m-delete { color: var(--pink); font-family: var(--mono); font-weight: 600; }
/* group headers inside the generated route table */
tbody th { font-family: var(--mono); color: var(--text); text-transform: none; letter-spacing: 0; font-size: 13px; background: var(--panel-2); }

/* ---------- tree ---------- */
.tree details { margin: 4px 0; }
.tree summary {
  cursor: pointer; list-style: none; padding: 8px 12px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--stroke); font-family: var(--mono); font-size: 14px;
  transition: background .15s;
}
.tree summary::-webkit-details-marker { display: none; }
.tree summary::before { content: "▸ "; color: var(--accent-2); }
.tree details[open] > summary::before { content: "▾ "; }
.tree summary:hover { background: var(--panel-2); }
.tree .dir { color: var(--accent-3); font-weight: 600; }
.tree-body { margin: 4px 0 8px 18px; padding-left: 14px; border-left: 1px solid var(--stroke); }
.tree .leaf { color: var(--muted); font-size: 13.5px; padding: 6px 12px; }
.tree .leaf code { color: var(--text); }

/* ---------- tabs ---------- */
.tabs { background: var(--panel); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.tab-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tab-btn { background: var(--panel-2); border: 1px solid var(--stroke); color: var(--muted); border-radius: 10px; padding: 8px 14px; cursor: pointer; font-size: 14px; transition: all .15s; flex: 1 1 auto; text-align: center; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: #06131f; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-color: transparent; font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none; } }

/* ---------- code blocks ---------- */
.codeblock { position: relative; }
.codeblock pre {
  margin: 0 0 10px; padding: 16px 16px 16px 20px; overflow-x: auto; border-radius: 12px;
  background: #060b16; border: 1px solid var(--stroke);
  font-family: var(--mono); font-size: 13.5px; line-height: 1.7; color: #cfe3ff;
}
:root[data-theme="light"] .codeblock pre { background: #0f172a; }
.cm { color: #6b7f9e; font-style: italic; }
.kw { color: #7dd3fc; }
.st { color: #86efac; }
.fn { color: #facc15; }
.brw { color: #f472b6; }
.copy { position: absolute; top: 8px; right: 8px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--stroke); border-radius: 8px; padding: 3px 10px; font-size: 12px; cursor: pointer; z-index: 2; }
.copy:hover { color: var(--text); border-color: var(--accent); }
.copy.done { color: var(--accent); border-color: var(--accent); }

/* ---------- doc list ---------- */
.doclist { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.doclist li { background: var(--panel); border: 1px solid var(--stroke); border-radius: 12px; padding: 14px 16px; transition: border-color .15s, transform .15s; }
.doclist li:hover { border-color: var(--accent-2); transform: translateX(2px); }

/* ---------- footer ---------- */
.foot { max-width: var(--maxw); margin: 20px auto 40px; padding: 24px 20px; border-top: 1px solid var(--stroke); display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.cite { color: var(--muted); font-size: 14px; margin-top: 16px; }

/* ---------- back to top ---------- */
#backTop {
  position: fixed; right: 22px; bottom: 22px; width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #06131f; border: none;
  font-size: 20px; cursor: pointer; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(12px);
  transition: opacity .25s, transform .25s; z-index: 120;
}
#backTop.show { opacity: 1; pointer-events: auto; transform: none; }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .doclist { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .hamburger { display: flex; }
  .links { position: absolute; top: 58px; left: 0; right: 0; flex-direction: column; background: var(--glass); backdrop-filter: blur(12px); border-bottom: 1px solid var(--stroke); padding: 0; max-height: 0; overflow: hidden; transition: max-height .3s ease; }
  .links.open { max-height: 460px; padding: 8px 16px 14px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero-card { padding: 32px 22px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: none; gap: 14px; }
  .table-wrap { overflow-x: auto; }
  thead th { position: static; }
}
