/* Tokens, page frame, and the chrome every view shares.
   One definition of each token: the old blog.css was two stylesheets
   concatenated, so :root was declared twice and a stray `main{max-width:720px}`
   quietly overrode the 760px one above it. */

:root {
  --bg: #000;
  --fg: #fff;
  --dim: #8a8a8a;
  --faint: #5a5a5a;
  --accent: #3ef07f;
  --accent-ink: #04140a;
  --danger: #ff6b6b;
  --line: #222;
  --line-2: #2e2e2e;
  --card: #0b0b0b;
  --card-h: #101010;
  --chip: #161616;
  --signin: #333;
  --signin-h: #666;
  --sel: #1c2a20;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  /* The reading column. Wide enough for a generous feature card, still short of
     full width so the page keeps a shape on a large display. */
  --measure: 960px;
}

:root[data-theme="light"] {
  --bg: #faf9f5;
  --fg: #0b0b0c;
  --dim: #6a6a6a;
  --faint: #9b968a;
  --accent: #1f9d57;
  --accent-ink: #eafff986;
  --danger: #d13b3b;
  --line: #e6e3da;
  --line-2: #dcd8cc;
  --card: #fff;
  --card-h: #fffdf8;
  --chip: #f0eee7;
  --signin: #cfcabb;
  --signin-h: #a8a292;
  --sel: #cdeed8;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.6 var(--mono);
  transition: background .2s, color .2s;
}

::selection { background: var(--sel); }

a { color: var(--accent); text-decoration: none; }

/* The pre-baked list in index.html is the no-JS and crawler copy of the page.
   src/main.js sets this class as it boots, so a reader with JavaScript sees the
   app and never both. Without JS the class never lands and the baked list
   stays — which is the whole point of baking it. */
.js #prebaked { display: none; }

/* ---- header ---- */

header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 700;
  letter-spacing: .3px;
  color: var(--fg);
}

.brand .mark { width: 22px; height: 22px; border-radius: 6px; align-self: center; }
.brand b { color: var(--accent); }
.brand .seg { color: var(--dim); font-weight: 500; }
.brand .seg .accent { color: var(--accent); }

.spacer { flex: 1; }
.nav { display: flex; align-items: center; gap: 8px; }

.navlink {
  color: var(--dim);
  font: 600 13px var(--mono);
  padding: 8px 4px;
  letter-spacing: .02em;
}

.navlink:hover { color: var(--accent); }

/* ---- buttons ---- */

.btn {
  font: 600 13px var(--mono);
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--signin);
  border-radius: 8px;
  padding: 8px 13px;
  cursor: pointer;
  transition: .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn:hover { border-color: var(--signin-h); }
.btn[disabled] { opacity: .5; cursor: default; }

.btn.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 700;
}

.btn.btn-accent:hover { filter: brightness(1.05); border-color: var(--accent); }
.btn-ghost-danger:hover { border-color: var(--danger); color: var(--danger); }

.themebtn { width: 34px; height: 34px; justify-content: center; padding: 0; font-size: 14px; }

/* ---- utilities ---- */

.hide { display: none !important; }

.vh {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 30px 22px 110px;
}

.view { animation: fade .2s ease; }

@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- toast ---- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .4);
  max-width: 90vw;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 60;
}

.toast.show { opacity: 1; }
.toast b { color: var(--accent); }

/* ---- footer ---- */

footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 26px 22px 50px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 12px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

footer a { color: var(--faint); }
footer a:hover { color: var(--fg); }

@media (max-width: 560px) {
  header { padding: 13px 15px; gap: 8px; }
  .nav .lbl { display: none; }
  main { padding: 22px 16px 80px; }
}
