/* ============================================================
 * MISTFALL — desktop stylesheet.
 * Pure black background, white type, hairline borders.
 * No colored gradients, no glassmorphism, no webfonts
 * (system stack only → commercially safe by default).
 * ============================================================ */

:root {
  --bg: #000000;
  --fg: #f2f2f2;
  --fg-dim: rgba(255, 255, 255, 0.62);
  --fg-faint: rgba(255, 255, 255, 0.47);
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.3);
  --wrap: 880px;
  /* Native widgets (select menus, scrollbars, form controls) follow the
   * dark theme instead of the browser's light default. */
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: auto; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Kill the browser's translucent tap highlight (the blue flash on
   * links/buttons in mobile Chrome, Safari and many webviews).
   * The site draws its own hairline focus ring for keyboard users. */
  -webkit-tap-highlight-color: transparent;
}

body { overflow-x: hidden; }

::selection { background: rgba(255, 255, 255, 0.85); color: #000; }

a { color: inherit; }

/* Focus: a mouse click must never draw a ring (the UA default is a blue
 * box); keyboard navigation gets the site's white hairline instead —
 * one global rule so no focusable element can fall through to the UA. */
:focus { outline: none; }

:focus-visible {
  outline: 1px solid #ffffff;
  outline-offset: 3px;
}

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

/* ---------- fixed layers ---------- */

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center,
    rgba(0, 0, 0, 0) 48%,
    rgba(0, 0, 0, 0.38) 82%,
    rgba(0, 0, 0, 0.72) 100%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.65'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* ---------- layout ---------- */

main { position: relative; z-index: 5; }

.section { position: relative; z-index: 5; }

.wrap {
  width: min(var(--wrap), calc(100vw - 80px));
  margin: 0 auto;
}

.hero {
  height: 100vh;
  height: 100svh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.scroll-hint {
  margin: 0 0 34px;
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.48);
  /* transform only — GSAP scrubs this element's opacity on scroll */
  animation: hint-bob 2.4s ease-in-out infinite;
}

@keyframes hint-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

.about {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 14vh 0;
}

.writing { padding: 14vh 0; }

.projects { padding: 14vh 0 20vh; }

.footer {
  min-height: 64vh;
  display: flex;
  align-items: center;
  padding: 10vh 0;
}

/* ---------- shared text ---------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 34px;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.eyebrow::before {
  content: '';
  flex: none;
  width: 26px;
  height: 1px;
  background: var(--line-strong);
}

.noscript-note {
  position: relative;
  z-index: 10;
  text-align: center;
  font-size: 14px;
  color: var(--fg-dim);
}

/* ---------- writing (post list) ---------- */

#post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-row {
  border-top: 1px solid var(--line);
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.post-row:last-child { border-bottom: 1px solid var(--line); }

.post-row:hover { background-color: rgba(255, 255, 255, 0.028); transform: translateX(4px); }

.post-link {
  display: block;
  padding: 22px 12px 22px 0;
  text-decoration: none;
  color: inherit;
}

.post-link:focus-visible {
  outline: 1px solid #ffffff;
  outline-offset: -1px;
}

.post-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 6px;
}

.post-row-title {
  font-size: 16px;
  font-weight: 500;
  color: #ffffff;
  transition: opacity 0.25s ease;
}

.post-row:hover .post-row-title { opacity: 0.7; }

.post-row-date {
  flex: none;
  font-size: 12px;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.post-row-summary {
  margin: 0;
  max-width: 62ch;
  font-size: 14px;
  line-height: 1.7;
  color: var(--fg-dim);
}

/* ---------- single post page (public/posts/*.html) ---------- */

.post {
  position: relative;
  z-index: 5;
  max-width: 720px;
  margin: 0 auto;
  padding: 11vh 26px 15vh;
}

.post-back {
  margin: 0 0 34px;
  font-size: 12px;
  letter-spacing: 0.12em;
}

.post-back a {
  color: var(--fg-faint);
  text-decoration: none;
  transition: color 0.25s ease;
}

.post-back a:hover { color: #ffffff; }

.post-back a:focus-visible { outline: 1px solid #ffffff; outline-offset: 4px; }

.post-title {
  margin: 0 0 12px;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.01em;
  color: var(--fg);
}

.post-meta {
  margin: 0 0 46px;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}

.post-content p {
  margin: 0 0 1.3em;
  font-size: 16.5px;
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.82);
}

.post-content h2 {
  margin: 2.3em 0 0.9em;
  font-size: 20px;
  font-weight: 600;
  color: var(--fg);
}

.post-content a {
  color: #ffffff;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.35);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.25s ease;
}

.post-content a:hover { text-decoration-color: #ffffff; }

.post-content a:focus-visible { outline: 1px solid #ffffff; outline-offset: 3px; }

.post-content blockquote {
  margin: 1.8em 0;
  padding: 2px 0 2px 20px;
  border-left: 2px solid var(--line-strong);
  color: var(--fg-dim);
}

.post-content blockquote p { color: inherit; margin-bottom: 0.6em; }

.post-content ul, .post-content ol { color: rgba(255, 255, 255, 0.82); line-height: 1.85; }

.post-content li { margin-bottom: 0.5em; }

.post-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
}

.post-content pre {
  margin: 1.8em 0;
  padding: 16px 18px;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  line-height: 1.6;
}

.post-content pre code { background: none; padding: 0; font-size: 13px; }

.post-end {
  margin-top: 54px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

/* ---------- language switch (corner) ---------- */

.lang-switch {
  position: fixed;
  top: 22px;
  right: 118px;
  z-index: 30;
  padding: 7px 13px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg-dim);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.14em;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.lang-switch:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.55);
}

.lang-switch:focus-visible {
  outline: 1px solid #ffffff;
  outline-offset: 3px;
}

/* ---------- about ---------- */

.about-name {
  margin: 0 0 16px;
  font-size: 21px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--fg);
}

.about-tagline {
  margin: 0 0 30px;
  max-width: 46ch;
  font-size: 15px;
  line-height: 1.75;
  color: var(--fg-dim);
}

.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.about-links a {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  padding-bottom: 3px;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.about-links a:hover { color: #ffffff; border-color: rgba(255, 255, 255, 0.7); }

.about-links a:focus-visible {
  outline: 1px solid #ffffff;
  outline-offset: 4px;
}

/* ---------- projects ---------- */

#project-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-row {
  border-top: 1px solid var(--line);
  padding: 26px 12px 26px 0;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.project-row:last-child { border-bottom: 1px solid var(--line); }

.project-row:hover { background-color: rgba(255, 255, 255, 0.028); transform: translateX(4px); }

.row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 8px;
}

.project-name {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.project-name a {
  color: #ffffff;
  text-decoration: none;
  transition: opacity 0.25s ease;
}

.project-name a:hover { opacity: 0.7; }

.project-name a:focus-visible {
  outline: 1px solid #ffffff;
  outline-offset: 5px;
}

.project-year {
  flex: none;
  font-size: 12px;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}

.project-desc {
  margin: 0 0 16px;
  max-width: 62ch;
  font-size: 14px;
  line-height: 1.7;
  color: var(--fg-dim);
}

.row-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 24px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tags li {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.17);
  padding: 3px 9px;
  transition: border-color 0.25s ease, color 0.25s ease;
}

.project-row:hover .tags li {
  border-color: rgba(255, 255, 255, 0.32);
  color: rgba(255, 255, 255, 0.75);
}

.row-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.row-links a,
.stars {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  transition: color 0.25s ease;
}

.row-links a:hover { color: #ffffff; }

.row-links a:focus-visible {
  outline: 1px solid #ffffff;
  outline-offset: 4px;
}

.stars { color: rgba(255, 255, 255, 0.47); font-variant-numeric: tabular-nums; }

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

.footer-line {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--fg-dim);
}

.footer-line a {
  color: #ffffff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  transition: border-color 0.25s ease;
}

.footer-line a:hover { border-color: #ffffff; }

.footer-line a:focus-visible {
  outline: 1px solid #ffffff;
  outline-offset: 4px;
}

.footer-note {
  margin: 0 0 34px;
  font-size: 13px;
  color: var(--fg-faint);
}

.footer-copy {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.47);
}

/* ---------- narrow desktop windows ---------- */

@media (max-width: 720px) {
  .wrap { width: calc(100vw - 48px); }
  .row-head { flex-direction: column; gap: 4px; }
  .row-meta { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
 * Additions: skip link, static wordmark, palette, filters,
 * footer meta, post reading aids, reduced motion.
 * ============================================================ */

/* ---------- skip link ---------- */

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 100;
  padding: 10px 16px;
  background: #ffffff;
  color: #000000;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus-visible,
.skip-link:focus { top: 16px; }

/* ---------- static wordmark fallback ---------- */

.wordmark-static {
  position: absolute;
  left: 50%;
  top: 47%;
  width: min(62vw, 780px);
  /* The outline SVG keeps the font's native y-up coordinates for Three.js;
   * a plain <img> needs one vertical flip to read the right way up. */
  transform: translate(-50%, -50%) scaleY(-1);
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  display: block;
}

html.is-static .wordmark-static { opacity: 1; }
html.is-static #stage { display: none; }

/* ---------- hero drag affordance ---------- */

.hero { cursor: grab; }
.hero:active { cursor: grabbing; }

/* ---------- project tools ---------- */

.project-tools-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin: 0 0 18px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  appearance: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.17);
  color: rgba(255, 255, 255, 0.62);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.chip:hover { color: #ffffff; border-color: rgba(255, 255, 255, 0.45); }

.chip.is-active {
  background: #ffffff;
  border-color: #ffffff;
  color: #000000;
}

.chip:focus-visible { outline: 1px solid #ffffff; outline-offset: 2px; }

.sort-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sort-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.sort-select {
  appearance: none;
  background: #000000;
  color: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  padding: 5px 10px;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.sort-select:focus-visible { outline: 1px solid #ffffff; outline-offset: 2px; }

.random-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  color: rgba(255, 255, 255, 0.62);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 6px 12px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.random-btn:hover { color: #ffffff; border-color: rgba(255, 255, 255, 0.55); }
.random-btn:focus-visible { outline: 1px solid #ffffff; outline-offset: 2px; }

.project-empty {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--fg-dim);
}

.link-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  color: #ffffff;
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.project-row[hidden] { display: none; }

.project-row.is-spotlight {
  background-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 2px 0 0 #ffffff;
  transform: translateX(4px);
}

/* ---------- now line ---------- */

.now-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin: 34px 0 0;
  max-width: 60ch;
  font-size: 12px;
  color: var(--fg-faint);
}

.now-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffffff;
  align-self: center;
  animation: now-pulse 3.4s ease-in-out infinite;
}

@keyframes now-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.now-label {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.now-text { color: var(--fg-dim); }

.now-date { font-variant-numeric: tabular-nums; }

/* ---------- footer meta / clock ---------- */

.footer-links {
  display: flex;
  gap: 18px;
  margin: 20px 0 0;
}

.footer-links a {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.47);
  text-decoration: none;
}

.footer-links a:hover { color: #ffffff; }

.site-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 22px 0 0;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.47);
}

.site-meta span { white-space: nowrap; }

#site-clock { font-variant-numeric: tabular-nums; }

/* ---------- command palette ---------- */

.palette {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 0;
}

.palette[hidden] { display: none; }

.palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.palette-panel {
  position: relative;
  width: min(620px, calc(100vw - 40px));
  background: #070707;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 40px 140px rgba(0, 0, 0, 0.85);
  animation: palette-in 0.18s ease-out;
}

@keyframes palette-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.palette-input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: #ffffff;
  font: inherit;
  font-size: 16px;
  padding: 17px 20px;
  outline: none;
}

.palette-input::placeholder { color: rgba(255, 255, 255, 0.47); }

.palette-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 52vh;
  overflow-y: auto;
}

.palette-item {
  display: grid;
  grid-template-columns: 86px 1fr auto;
  align-items: baseline;
  gap: 14px;
  padding: 9px 14px;
  cursor: pointer;
  border-left: 1px solid transparent;
}

.palette-item.is-active {
  background: rgba(255, 255, 255, 0.07);
  border-left-color: #ffffff;
}

.palette-group {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.47);
}

.palette-label { font-size: 14px; color: rgba(255, 255, 255, 0.9); }

.palette-item-hint {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.47);
}

.palette-empty {
  margin: 0;
  padding: 18px 20px 22px;
  font-size: 13px;
  color: var(--fg-dim);
}

.palette-hint {
  margin: 0;
  padding: 10px 20px 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.47);
}

.palette-open {
  position: fixed;
  top: 22px;
  right: 26px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px 6px 13px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg-dim);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.14em;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.palette-open:hover { color: #ffffff; border-color: rgba(255, 255, 255, 0.55); }
.palette-open:focus-visible { outline: 1px solid #ffffff; outline-offset: 3px; }

.palette-open kbd {
  font: inherit;
  font-size: 9px;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.47);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 2px 4px;
}

html.palette-on { overflow: hidden; }

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 10px);
  z-index: 95;
  margin: 0;
  padding: 9px 16px;
  background: #ffffff;
  color: #000000;
  font-size: 11px;
  letter-spacing: 0.08em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- hidden showcase: inverted ---------- */

html.secret-invert { filter: invert(1) hue-rotate(180deg); }

/* ---------- cross-document view transitions ---------- */

@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.28s;
}

/* ---------- post reading aids (injected by post.js) ---------- */

.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  z-index: 40;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.read-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: #ffffff;
  transition: width 0.1s linear;
}

.post-toc {
  margin: 0 0 40px;
  padding: 16px 18px;
  border: 1px solid var(--line);
}

.post-toc p {
  margin: 0 0 10px;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.post-toc ol {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.9;
}

.post-toc a { color: var(--fg-dim); text-decoration: none; }
.post-toc a:hover { color: #ffffff; }

.post-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 34px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.post-tools button {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg-dim);
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 5px 9px;
  cursor: pointer;
}

.post-tools button:hover { color: #ffffff; border-color: rgba(255, 255, 255, 0.5); }
.post-tools button[aria-pressed="true"] { background: #ffffff; color: #000000; border-color: #ffffff; }

.post-content { font-size: calc(16.5px * var(--post-scale, 1)); }
.post-content p { font-size: 1em; }

.post-content h2 { position: relative; }

.anchor-link {
  margin-left: 10px;
  font-size: 0.64em;
  color: rgba(255, 255, 255, 0.3);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.post-content h2:hover .anchor-link,
.anchor-link:focus-visible { opacity: 1; color: #ffffff; }

.post-content blockquote { position: relative; }

.quote-btn {
  position: absolute;
  top: 0;
  right: 0;
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  color: rgba(255, 255, 255, 0.35);
  font: inherit;
  font-size: 10px;
  padding: 2px 7px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.post-content blockquote:hover .quote-btn,
.quote-btn:focus-visible { opacity: 1; color: #ffffff; }

.post-content pre { position: relative; }

.code-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  appearance: none;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.55);
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.post-content pre:hover .code-copy,
.code-copy:focus-visible { opacity: 1; color: #ffffff; }

.post-prevnext {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 48px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.post-prevnext a {
  display: block;
  color: var(--fg);
  text-decoration: none;
}

.post-prevnext small {
  display: block;
  margin-bottom: 5px;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.post-prevnext a:hover { opacity: 0.7; }

.post-prevnext .next { text-align: right; }

.post-stamp {
  margin: 54px 0 0;
  display: flex;
  justify-content: center;
}

.post-stamp span {
  display: inline-block;
  padding: 10px 22px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.5);
  transform: rotate(-4deg);
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.post-stamp.is-on span { opacity: 1; transform: rotate(-4deg) scale(1); }
.post-stamp span { transform: rotate(-8deg) scale(1.08); }

.post-feed {
  margin: 22px 0 0;
  text-align: center;
}

.post-feed a {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.47);
  text-decoration: none;
}

.post-feed a:hover { color: #ffffff; }

/* ---------- footer utilities / signature ---------- */

.footer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 0;
}

.footer-tool {
  appearance: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.55);
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 7px 11px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease,
    transform 0.22s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.footer-tool:hover { color: #ffffff; border-color: rgba(255, 255, 255, 0.55); }
.footer-tool:focus-visible { outline: 1px solid #ffffff; outline-offset: 3px; }
.footer-tool[aria-pressed="true"] { background: #ffffff; border-color: #ffffff; color: #000000; }

.signature {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.signature[hidden] { display: none; }

.signature-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
}

.signature-panel {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: #000000;
  border: 1px solid var(--line);
  padding: 26px 26px 22px;
}

.signature-hint {
  margin: 8px 0 18px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--fg-dim);
}

.signature-input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font: inherit;
  font-size: 16px;
  padding: 8px 2px;
}

.signature-input:focus { outline: none; border-bottom-color: #ffffff; }

.signature-canvas {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 18px;
  background: #000000;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.signature-canvas[hidden] { display: none; }

.signature-canvas-3d {
  cursor: grab;
  touch-action: none;
}

.signature-canvas-3d:active { cursor: grabbing; }

/* ---------- hidden terminal ---------- */

.term {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(46vh, 420px);
  z-index: 88;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.97);
  border-top: 1px solid var(--line-strong);
  color: var(--fg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.65;
}

.term[hidden] { display: none; }

.term-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.term-close {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--fg-faint);
  font: inherit;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  cursor: pointer;
}

.term-close:hover { color: #ffffff; }

.term-out {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.term-line { white-space: pre-wrap; }
.term-line.dim { color: rgba(255, 255, 255, 0.47); }
.term-line.echo { color: rgba(255, 255, 255, 0.88); }
.term-line.list { color: rgba(255, 255, 255, 0.7); }

.term-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}

.term-prompt { flex: none; color: rgba(255, 255, 255, 0.55); }

.term-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  color: #ffffff;
  font: inherit;
  caret-color: #ffffff;
}

html.terminal-on .scroll-hint { opacity: 0; }

/* ---------- developer HUD ---------- */

.hud {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 70;
  margin: 0;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid var(--line);
  color: rgba(255, 255, 255, 0.62);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: 0.04em;
  white-space: pre;
  pointer-events: none;
}

.hud[hidden] { display: none; }

/* ---------- project monogram ---------- */

.monogram {
  position: fixed;
  width: 180px;
  height: 180px;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.monogram.is-on { opacity: 0.85; }

.signature-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

html.signature-on { overflow: hidden; }

/* ---------- live activity ---------- */

.activity { margin-top: 46px; }

.activity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 16px;
}

.activity-map { grid-column: 1 / -1; }

.activity-card {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.activity-label {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.heatmap {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 10px;
}

.hm { fill: rgba(255, 255, 255, 0.055); }
.hm.l1 { fill: rgba(255, 255, 255, 0.22); }
.hm.l2 { fill: rgba(255, 255, 255, 0.42); }
.hm.l3 { fill: rgba(255, 255, 255, 0.68); }
.hm.l4 { fill: rgba(255, 255, 255, 0.92); }

.hm-month {
  fill: rgba(255, 255, 255, 0.47);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.lang-list,
.activity-recent {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.lang-row {
  display: grid;
  grid-template-columns: 66px 1fr 34px;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.66);
}

.lang-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lang-bar {
  display: block;
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
}

.lang-bar i {
  display: block;
  height: 100%;
  background: #ffffff;
}

.lang-pct {
  font-size: 10px;
  text-align: right;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}

.activity-recent li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
}

.activity-recent a {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-recent a:hover { color: #ffffff; }

.activity-recent span {
  flex: none;
  font-size: 10px;
  color: var(--fg-faint);
}

/* ---------- magnetic cursor ---------- */

.about-links a,
.footer-links a,
.footer-tool,
.chip,
.palette-open,
.lang-switch {
  transform: translate(var(--mag-x, 0px), var(--mag-y, 0px));
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease,
    transform 0.22s cubic-bezier(0.2, 0.7, 0.3, 1);
}

@media (max-width: 900px) {
  .activity-grid { grid-template-columns: 1fr 1fr; }
  .activity-map { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .activity-grid { grid-template-columns: 1fr; }
  .signature { padding: 12px; }
  .signature-panel { padding: 20px 18px 18px; }
}

@media (max-width: 640px) {
  .post-prevnext { grid-template-columns: 1fr; }
  .post-prevnext .next { text-align: left; }
  .palette-open span { display: none; }
  .palette-open { gap: 0; padding: 7px 9px; }
  .lang-switch { right: 78px; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .grain { display: none; }
}

html.reduce-motion .grain { display: none; }
html.reduce-motion * { scroll-behavior: auto !important; }
html.reduce-motion .scroll-hint { animation: none; opacity: 0; }
