@import url("tokens.css");

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 480px at 88% -10%, rgba(173, 216, 230, 0.16), transparent 60%),
    radial-gradient(700px 420px at -10% 20%, rgba(173, 216, 230, 0.07), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0.01em;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: #d7eef6; }
button, input, select { font: inherit; color: inherit; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.5rem 0.8rem;
  z-index: 20;
}
.skip:focus { top: 1rem; }

.shell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.6rem 1.25rem 1.4rem;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  background: rgba(12, 15, 18, 0.72);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  text-decoration: none;
  color: var(--text);
}
.brand img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
}
.brand-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.brand-role {
  display: block;
  margin-top: 0.15rem;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  line-height: 1.35;
}

.nav { display: flex; flex-direction: column; gap: 0.2rem; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.38rem 0.55rem;
  border-radius: 8px;
  font-size: 0.92rem;
}
.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--text);
  background: var(--accent-dim);
}

.rail-meta {
  margin-top: auto;
  color: var(--faint);
  font-size: 0.78rem;
  line-height: 1.45;
}
.rail-meta a { color: var(--muted); }

.menu-btn {
  display: none;
  position: fixed;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 30;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.main { min-width: 0; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.75fr);
  gap: 2.5rem;
  align-items: end;
  padding: clamp(2.2rem, 5vw, 4.5rem) clamp(1.4rem, 4vw, 3.5rem) 2rem;
  border-bottom: 1px solid var(--line);
}

.kicker {
  margin: 0 0 0.85rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.02em; }
h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.4rem, 5.4vw, 4.6rem);
  line-height: 0.98;
  font-weight: 500;
}
.hero h1 {
  font-size: clamp(1.7rem, 2.6vw, 2.35rem);
  line-height: 1.15;
}
h1 em { font-style: italic; color: var(--accent); }
.lede {
  margin: 0;
  max-width: 38rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  line-height: 1.55;
}
.lede strong { color: var(--text); font-weight: 600; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.5rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.62rem 1rem;
  border: 1px solid transparent;
  font-size: 0.92rem;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 650; }
.btn-primary:hover { color: var(--accent-ink); background: #c5e6f0; }
.btn-ghost { border-color: var(--line-strong); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.portrait-wrap { position: relative; }
.portrait {
  width: min(100%, 340px);
  margin-left: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 28px 28px 80px 28px;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}
.stat {
  padding: 1.15rem 1.3rem 1.25rem;
  border-right: 1px solid var(--line);
}
.stat:last-child { border-right: 0; }
.stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 500;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.35rem;
}
.stat span { color: var(--muted); font-size: 0.84rem; }

.section {
  padding: clamp(2rem, 4vw, 3.4rem) clamp(1.4rem, 4vw, 3.5rem);
}
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.4rem;
}
.section-head h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.4rem); }
.section-head p { margin: 0.35rem 0 0; color: var(--muted); max-width: 36rem; }

.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.filters button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
}
.filters button[aria-pressed="true"],
.filters button:hover {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.work-list { display: grid; gap: 0.75rem; }
.work-card {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1.2fr) minmax(0, 1.4fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.05rem;
  background: linear-gradient(180deg, rgba(20, 25, 31, 0.92), rgba(12, 15, 18, 0.4));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.work-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  color: inherit;
}
.work-card .num {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.85rem;
}
.work-card h3 { margin: 0 0 0.25rem; font-size: 1.2rem; }
.work-card p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.18rem 0.45rem;
}
.priority {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--build);
  white-space: nowrap;
}
.priority.first { color: var(--ok); }

.systems {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 0.8rem;
}
.system {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.15rem 1.25rem;
  min-height: 100%;
}
.system.wide { grid-column: 1 / -1; display: grid; grid-template-columns: 1.1fr 1fr; gap: 1.5rem; }
.system h3 { margin: 0.2rem 0 0.55rem; font-size: 1.45rem; }
.system p { margin: 0; color: var(--muted); }
.system ul { margin: 0.8rem 0 0; padding-left: 1.1rem; color: var(--muted); }
.system li { margin: 0.28rem 0; }
.system li strong { color: var(--text); font-weight: 600; }

.flow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--accent);
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  white-space: pre;
  overflow-x: auto;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem;
  background: rgba(20, 25, 31, 0.55);
}
.panel h3 { margin: 0 0 0.5rem; font-size: 1.25rem; }
.panel p, .panel li { color: var(--muted); }
.panel ol, .panel ul { margin: 0.4rem 0 0; padding-left: 1.15rem; }

.contact {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.5rem;
  align-items: start;
}
.contact a.mail {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
}
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.contact-list a { color: var(--text); text-decoration: none; }
.contact-list a:hover { color: var(--accent); }

footer.site {
  padding: 1.2rem clamp(1.4rem, 4vw, 3.5rem) 2rem;
  color: var(--faint);
  font-size: 0.82rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

/* Documentation pages */
.doc-top {
  padding: 1.5rem clamp(1.4rem, 4vw, 3.5rem) 0;
}
.crumb { color: var(--faint); font-size: 0.82rem; }
.crumb a { color: var(--muted); text-decoration: none; }
.doc {
  padding: 1.2rem clamp(1.4rem, 4vw, 3.5rem) 3.5rem;
  display: grid;
  grid-template-columns: minmax(0, 46rem) 16rem;
  gap: 2.5rem;
  align-items: start;
}
.doc-body h1 { font-size: clamp(2rem, 4vw, 3.3rem); margin: 0.4rem 0 0.8rem; }
.doc-body h2 {
  margin: 2rem 0 0.6rem;
  font-size: 1.55rem;
  padding-top: 0.4rem;
}
.doc-body h3 { margin: 1.3rem 0 0.4rem; font-size: 1.15rem; }
.doc-body p { color: var(--muted); }
.doc-body strong { color: var(--text); font-weight: 650; }
.doc-body ul, .doc-body ol { color: var(--muted); padding-left: 1.2rem; }
.doc-body li { margin: 0.28rem 0; }
.case {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin: 1.2rem 0 0.4rem;
}
.case div {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.8rem;
}
.case span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.3rem;
}
.case p { margin: 0; font-size: 0.88rem; color: var(--text); }
.note {
  border-left: 3px solid var(--accent);
  padding: 0.2rem 0 0.2rem 0.9rem;
  color: var(--muted);
  margin: 1rem 0;
}
pre, code { font-family: var(--font-mono); }
pre {
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  color: #d7eef6;
  font-size: 0.82rem;
  line-height: 1.55;
}
code {
  font-size: 0.86em;
  color: var(--accent);
}
pre code { color: inherit; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 0.8rem 0 1rem;
}
th, td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { color: var(--accent); font-weight: 600; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
td { color: var(--muted); }
td strong { color: var(--text); }
.toc {
  position: sticky;
  top: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  background: rgba(20, 25, 31, 0.7);
}
.toc p {
  margin: 0 0 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.toc a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.84rem;
  padding: 0.22rem 0;
}
.toc a:hover,
.toc a.is-active { color: var(--accent); }
.doc-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1rem 0 0.2rem; }
.doc-tabs button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
}
.doc-tabs button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.doc-part[hidden] { display: none; }
.admonition {
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin: 1rem 0;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}
.admonition strong { display: block; margin-bottom: 0.25rem; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; }
.admonition.note { border-color: var(--accent-dim); }
.admonition.note strong { color: var(--accent); }
.admonition.caution { border-color: rgba(253, 186, 116, 0.45); }
.admonition.caution strong { color: var(--build); }
.admonition p { margin: 0; }
.doc-meta { color: var(--faint); font-size: 0.88rem; margin: 0 0 0.6rem; }
.callout {
  background: rgba(173, 216, 230, 0.08);
  border: 1px solid var(--accent-dim);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin: 1rem 0;
}
.callout strong { color: var(--accent); }
.symptom {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin: 0.7rem 0;
  background: var(--bg-elev);
}
.symptom h3 { margin-top: 0; }
.badge-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.6rem 0 0.2rem; }

.arch {
  display: grid;
  gap: 0.45rem;
  margin: 1rem 0;
}
.arch-row {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 0.7rem;
  align-items: stretch;
}
.arch-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  padding-top: 0.75rem;
}
.arch-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
}
.arch-card strong { display: block; margin-bottom: 0.15rem; }
.arch-card span { color: var(--muted); font-size: 0.9rem; }

.lanes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.lane {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1.2rem;
}
.lane h3 { margin: 0.15rem 0 0.45rem; font-size: 1.35rem; }
.lane p { margin: 0; color: var(--muted); }
.lane.span { grid-column: 1 / -1; }

.role-switch { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.9rem; }
.role-switch button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}
.role-switch button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.role-panel[hidden] { display: none; }
.role-panel h3 { margin: 0 0 0.4rem; font-size: 1.7rem; }
.role-panel .fit { margin: 0.8rem 0 0; color: var(--text); }

.org { margin-bottom: 1.4rem; }
.org-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.45rem;
  margin-bottom: 0.7rem;
}
.org-head h3 { margin: 0; font-size: 1.55rem; }
.org-head span { color: var(--faint); font-family: var(--font-mono); font-size: 0.75rem; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem 1.4rem; }
.cols h4 {
  margin: 0 0 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}
.degree h4 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--text);
  font-weight: 500;
}
.degree p { margin: 0; color: var(--muted); }
.cols ul { margin: 0; padding-left: 1.1rem; color: var(--muted); }
.cols li { margin: 0.25rem 0; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(18rem, 86vw);
    height: 100vh;
    z-index: 25;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    background: #10141a;
  }
  .rail.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .hero, .stats, .systems, .split, .contact, .doc, .system.wide, .work-card, .case, .arch-row, .lanes, .cols {
    grid-template-columns: 1fr;
  }
  .lane.span { grid-column: auto; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(odd) { border-right: 1px solid var(--line); }
  .portrait { margin: 0; }
  .toc { position: static; }
  .priority { display: none; }
}
