@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Space+Grotesk:wght@500;600;700&display=swap");

:root {
  color-scheme: light dark;
  --paper: light-dark(#f7f5f0, #121413);
  --surface: light-dark(#efece5, #191c1a);
  --panel: light-dark(#ffffff, #1e2220);
  --ink: light-dark(#171a18, #f1eee7);
  --muted: light-dark(#5a605c, #9ba19c);
  --line: light-dark(#dcd6ca, #2f3532);
  --line-strong: light-dark(#bfb7a8, #454e49);
  --accent: light-dark(#d94f2b, #ee6b47);
  --on-accent: #ffffff;
  --teal: light-dark(#1c7c54, #3ab783);
  --red: light-dark(#b8293d, #ef5b6c);
  --yellow: light-dark(#c2820a, #e5aa2b);
  --shadow-sm: light-dark(0 1px 2px rgba(23, 26, 24, 0.05), 0 1px 2px rgba(0, 0, 0, 0.35));
  --shadow-md: light-dark(0 6px 20px rgba(23, 26, 24, 0.06), 0 8px 24px rgba(0, 0, 0, 0.4));
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.75rem;
  --step-3: clamp(2.05rem, 1.35rem + 2.6vw, 3.1rem);
  --step-4: clamp(2.6rem, 1.5rem + 4.8vw, 4.75rem);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--display);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); font-weight: 700; letter-spacing: -0.04em; line-height: 1.02; }
h2 { font-size: var(--step-2); font-weight: 700; }
h3 { font-size: var(--step-1); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
p { margin: 0; max-width: 64ch; text-wrap: pretty; }

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--accent) 65%, transparent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.22em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
a:hover { color: var(--accent); text-decoration-color: var(--accent); }

code, pre, kbd { font-family: var(--mono); font-size: 0.85em; }
:not(pre) > code {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.08em 0.36em;
  border-radius: 5px;
}
pre {
  margin: 0;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  line-height: 1.55;
  background: light-dark(#1b1f1d, #0c0e0d);
  color: #edeae2;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  tab-size: 2;
}
pre .c { color: #919a94; }

:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(100% - 2rem, 74rem); margin-inline: auto; }
.stack > * + * { margin-top: var(--gap, 1rem); }
.muted { color: var(--muted); }
.small { font-size: var(--step--1); }

/* Tactile architectural buttons */
button, .button {
  font: 600 var(--step--1)/1.1 var(--body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  padding: 0.72em 1.1em;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
button:hover, .button:hover {
  background: color-mix(in srgb, var(--ink) 86%, var(--accent));
  color: var(--paper);
  transform: translateY(-1px);
}
button:active, .button:active { transform: translateY(0); }
button:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }

button.quiet, .button.quiet {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line-strong);
}
button.quiet:hover, .button.quiet:hover {
  background: var(--surface);
  border-color: var(--ink);
  color: var(--ink);
}
button.accent, .button.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
button.accent:hover, .button.accent:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000);
  border-color: color-mix(in srgb, var(--accent) 88%, #000);
  color: var(--on-accent);
}
button.tiny { font-size: 0.8125rem; padding: 0.45em 0.75em; }

input[type="text"], input[type="search"], textarea, select {
  font: inherit;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.6em 0.8em;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type="text"]:focus-visible, input[type="search"]:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
label { font-weight: 600; display: block; margin-bottom: 0.3rem; font-size: var(--step--1); }

/* Elevated archival panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 2.5vw, 1.5rem);
  box-shadow: var(--shadow-sm);
}
.panel.ruled {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

/* Status indicator pip (retains .jack hook for scripts) */
.jack {
  display: inline-block;
  width: 0.62em;
  height: 0.62em;
  border-radius: 2px;
  border: 1.5px solid var(--muted);
  vertical-align: 0.02em;
  margin-right: 0.55em;
  flex-shrink: 0;
}
.jack.on {
  background: var(--teal);
  border-color: var(--teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 20%, transparent);
}

.log {
  font: var(--step--1)/1.55 var(--mono);
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 14rem;
  overflow: auto;
}
.log li { padding: 0.45rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; white-space: pre-wrap; }
.log li:first-child { border-top: 0; }
.log .who { font-weight: 600; color: var(--accent); }

/* Header bar */
.site-bar {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.5rem;
}
.site-bar nav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: var(--step--1);
}
.site-bar nav a {
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--muted);
}
.site-bar nav a:hover {
  background: var(--surface);
  color: var(--ink);
}
.site-bar nav a[aria-current="page"],
.site-bar nav a[aria-current="true"] {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
}

.wordmark {
  font: 700 1.15rem/1 var(--display);
  letter-spacing: -0.03em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
}
.wordmark:hover { color: var(--ink); }
.wordmark::before {
  content: "";
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 5px;
  background: var(--accent);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
  background-image: linear-gradient(135deg, transparent 42%, var(--on-accent) 42%, var(--on-accent) 58%, transparent 58%);
}

footer {
  border-top: 1px solid var(--line);
  margin-top: 2rem;
  padding-block: 1.5rem 3.5rem !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Feature references appended by refs.js */
a.ref { text-decoration-thickness: 1px; }
a.ref:hover { text-decoration-thickness: 2px; }
.refs { border-top: 1px solid var(--line-strong); padding-block: clamp(1.6rem, 4vw, 2.6rem) 1rem; display: grid; gap: 1rem; }
.refs h2 { font-size: var(--step-2); }
.refs-features { margin: 0; columns: 2 20rem; column-gap: 3rem; font-size: var(--step--1); }
.refs-features > div { break-inside: avoid; padding-block: 0.65rem; border-top: 1px solid var(--line); }
.refs-features dt { font-family: var(--mono); font-weight: 600; }
.refs-features dd { margin: 0.15rem 0 0; }
.refs-links { display: inline-flex; flex-wrap: wrap; gap: 0 0.8rem; font-weight: 600; }
.refs-projects { margin: 0; padding-left: 1.1rem; font-size: var(--step--1); }
