/* mainsite — "control room at night"
   Dark teal/indigo shader field behind everything; UI sits on it as quiet
   glass. One warm brass accent, matching the cursor-lantern in the shader.
   Fonts are self-hosted woff2 (fetched by scripts/fetch-assets.sh into
   /fonts/); every family has a system fallback, so a missing file degrades
   gracefully. */

/* ---- fonts ---- */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage-grotesque-wght.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/atkinson-hyperlegible-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/atkinson-hyperlegible-400i.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/atkinson-hyperlegible-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---- tokens ---- */
:root {
  --ink: #0a0e13;
  --fg: #e9eff2;
  --muted: #94a3ae;
  --brass: #e2a86c;
  --brass-bright: #f2c48d;
  --glass: rgba(18, 25, 32, 0.55);
  --glass-strong: rgba(13, 19, 25, 0.78);
  --line: rgba(233, 239, 242, 0.13);
  --line-strong: rgba(233, 239, 242, 0.24);
  --radius: 14px;
  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", "SF Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--fg);
  font: 400 17px/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
/* Background lives on html only: body must stay transparent, or its
   background would paint over the negative-z-index #bg canvas. */
html { background: var(--ink); }

::selection { background: var(--brass); color: var(--ink); }

/* ---- shader background (all pages) ---- */
#bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  /* CSS fallback if WebGL is unavailable: same palette, static */
  background:
    radial-gradient(90% 70% at 72% 12%, rgba(226, 168, 108, 0.07), transparent 60%),
    radial-gradient(80% 90% at 15% 85%, rgba(14, 42, 46, 0.8), transparent 65%),
    linear-gradient(155deg, #0a0e13 20%, #0d1420 60%, #0b161a);
}

/* ---- links & focus ---- */
a { color: var(--brass); text-decoration: none; }
a:hover { color: var(--brass-bright); }
:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ---- shell ---- */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(3rem, 9vh, 6rem) 1.35rem 4rem;
}

.crumb {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  margin: 0 0 2.75rem;
}
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--brass); }

/* ---- typography ---- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 560;
  letter-spacing: -0.015em;
  line-height: 1.15;
}
h1 { font-size: clamp(2rem, 5.5vw, 2.7rem); margin: 0 0 0.5rem; }

.wordmark {
  font-size: clamp(3.1rem, 10vw, 4.6rem);
  font-weight: 640;
  letter-spacing: -0.03em;
  margin: 0;
}
.wordmark .dot { color: var(--brass); }

.tagline {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 34em;
  margin: 0.75rem 0 0;
}

/* ---- directory index (home) ---- */
.dir {
  display: flex;
  flex-direction: column;
  margin-top: 3.25rem;
  border-top: 1px solid var(--line);
}

.dir .row {
  display: flex;
  align-items: baseline;
  gap: 1.4rem;
  padding: 1.3rem 0.85rem;
  border-bottom: 1px solid var(--line);
  color: inherit;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}
.dir .row:hover {
  background: var(--glass);
  border-color: var(--line-strong);
}

.dir .label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  min-width: 4.5em;
  transition: color 0.18s ease;
}
.dir .row:hover .label { color: var(--brass); }

.dir .body { flex: 1; display: block; }
.dir .title {
  display: block;
  font-family: var(--font-display);
  font-weight: 560;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}
.dir .desc {
  display: block;
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.15rem;
}

.dir .arrow {
  color: var(--muted);
  transition: transform 0.18s ease, color 0.18s ease;
}
.dir .row:hover .arrow {
  color: var(--brass);
  transform: translateX(5px);
}

/* ---- footer ---- */
footer {
  margin-top: 4rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}
footer p { margin: 0; }

/* ---- notes: post list ---- */
.post-list {
  list-style: none;
  padding: 0;
  margin: 2.5rem 0 0;
  border-top: 1px solid var(--line);
}
.post-list li {
  display: flex;
  align-items: baseline;
  gap: 1.4rem;
  margin: 0;
  padding: 1.05rem 0.85rem;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.18s ease;
}
.post-list li:hover { background: var(--glass); }
.post-list time {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
  min-width: 8.5ch;
}
.post-list a {
  color: var(--fg);
  font-family: var(--font-display);
  font-weight: 560;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.post-list a:hover { color: var(--brass-bright); }

/* ---- notes: article ---- */
article.post h1 { margin-bottom: 0.4rem; }
article.post .meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 2.5rem;
}
article.post h2 { font-size: 1.45rem; margin: 2.2rem 0 0.6rem; }
article.post h3 { font-size: 1.15rem; margin: 1.8rem 0 0.5rem; }
article.post p, article.post li { font-size: 1.02rem; }
article.post a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(226, 168, 108, 0.45); }
article.post a:hover { text-decoration-color: var(--brass-bright); }
article.post blockquote {
  margin: 1.5rem 0;
  padding: 0.2rem 1.2rem;
  border-left: 2px solid var(--brass);
  background: var(--glass);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
  font-style: italic;
}
article.post hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}
article.post img { max-width: 100%; border-radius: 8px; }

article.post pre {
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  overflow: auto;
}
article.post code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.08rem 0.35rem;
  color: #f0dcc0;
}
article.post pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--fg);
}

/* ---- shared glass panel + form bits (tools) ---- */
.panel {
  background: var(--glass-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.field input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(10, 14, 19, 0.85);
  color: var(--fg);
  font: 400 0.95rem/1.4 var(--font-mono);
  transition: border-color 0.18s ease;
}
.field input:focus {
  outline: none;
  border-color: var(--brass);
}

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