/* ============================================================
   mikixd.xyz — stylesheet
   Self-hosted fonts, minimal design, light/dark, print-safe.
   ============================================================ */

/* ---------- fonts (variable, self-hosted) ---------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/inter-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("assets/fonts/jetbrainsmono-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- tokens ---------- */
:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #fafafa;
  --surface: #ffffff;
  --fg: #141414;
  --muted: #5c5c5c;
  --border: #e5e5e5;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --accent-text: #4f46e5;
  --accent-bg: #4f46e5;
  --glow: rgba(99,102,241,.18);
  --ok: #22c55e;
  --ok-text: #15803d;
  --err: #ef4444;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px -12px rgba(0,0,0,.1);
  color-scheme: light;
  accent-color: var(--accent-text);
}

:root[data-theme="dark"] {
  --bg: #0d0d0d;
  --surface: #161616;
  --fg: #f2f2f2;
  --muted: #949494;
  --border: #262626;
  --accent: #818cf8;
  --accent-2: #67e8f9;
  --accent-text: #818cf8;
  --accent-bg: #4f46e5;
  --ok-text: #22c55e;
  --glow: rgba(129,140,248,.16);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0d0d;
    --surface: #161616;
    --fg: #f2f2f2;
    --muted: #949494;
    --border: #262626;
    --accent: #818cf8;
    --accent-2: #67e8f9;
    --accent-text: #818cf8;
    --accent-bg: #4f46e5;
    --ok-text: #22c55e;
    --glow: rgba(129,140,248,.16);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
  overflow-x: hidden;
}

::selection { background: var(--accent-bg); color: #fff; }

img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* native scrollbars match the theme */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-track { background: transparent; }

[id] { scroll-margin-top: 2rem; }

/* ---------- view transitions ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) {
  animation: vt-out .18s ease both;
}
::view-transition-new(root) {
  animation: vt-in .3s cubic-bezier(.22,1,.36,1) both;
}
@keyframes vt-out { to { opacity: 0; transform: translateY(6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- grain overlay ---------- */
.noise {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- scroll progress ---------- */
#progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
  z-index: 1000;
}

/* ---------- cursor glow ---------- */
#glow {
  position: fixed;
  top: 0; left: 0;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 65%);
  pointer-events: none;
  z-index: 1;
  transform: translate(-50%, -50%);
  opacity: 0;
  will-change: transform;
}
@media (pointer: fine) { #glow { opacity: 1; } }

/* ---------- a11y ---------- */
.skip-link {
  position: fixed;
  top: -100px;
  left: 1rem;
  z-index: 2000;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .6rem 1rem;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
  transition: top .2s ease;
}
.skip-link:focus { top: 1rem; }

a:focus-visible, .card:focus-visible, .palette-btn:focus-visible, #to-top:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- entrance animations ---------- */
/* if JS never runs, show everything instead of a blank page */
.no-js .reveal {
  opacity: 1;
  transform: none;
}
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s cubic-bezier(.22,1,.36,1), transform .6s cubic-bezier(.22,1,.36,1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.hero .eyebrow { transition-delay: .02s; }
.hero h1 { transition-delay: .05s; }
.hero .sub { transition-delay: .08s; }
.hero .hint { transition-delay: .1s; }
.hero .now-line { transition-delay: .12s; }
.hero .term { transition-delay: .15s; }
.section-head { transition-delay: .05s; }
.cards .card:nth-child(1) { transition-delay: .05s; }
.cards .card:nth-child(2) { transition-delay: .12s; }
.about { transition-delay: .2s; }
.footer { transition-delay: .25s; }

/* ---------- blinking cursor ---------- */
.cursor {
  display: inline-block;
  width: .55em;
  height: 1.05em;
  margin-left: .08em;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.1s steps(2, start) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

kbd {
  font-family: var(--font-mono);
  font-size: .72em;
  padding: .15em .5em;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
}

/* ---------- nav ---------- */
.nav {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 10;
}

.brand {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--fg);
  text-decoration: none;
}

.nav-right { display: flex; align-items: center; }

.palette-btn {
  display: flex;
  align-items: center;
  gap: .6rem;
  font: inherit;
  font-size: .8rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .4rem .7rem;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.palette-btn:hover { border-color: var(--accent-text); color: var(--fg); }

/* ---------- hero ---------- */
.hero {
  max-width: 760px;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3rem;
  position: relative;
}

.aurora { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  animation: drift 16s ease-in-out infinite;
}
.b1 { width: 420px; height: 420px; top: -120px; left: -80px; background: var(--accent); opacity: .14; }
.b2 { width: 360px; height: 360px; top: 60px; right: -120px; background: var(--accent-2); opacity: .12; animation-delay: -5s; }
.b3 { width: 300px; height: 300px; bottom: -120px; left: 30%; background: var(--accent); opacity: .08; animation-delay: -10s; }
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.08); }
  66% { transform: translate(-20px, 24px) scale(.95); }
}

.hero > * { position: relative; z-index: 1; }

.eyebrow {
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-size: clamp(2.6rem, 8vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: -.03em;
  font-weight: 800;
}

.gradient {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer {
  to { background-position: 200% center; }
}

.sub {
  margin-top: 1.5rem;
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 34rem;
  font-variant-numeric: tabular-nums;
}

.typing-prefix { color: var(--fg); font-weight: 600; }
.typing-caret {
  display: inline-block;
  width: .5em;
  height: 1em;
  margin-left: .1em;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.1s steps(2, start) infinite;
}

.hint {
  margin-top: 2.5rem;
  font-size: .85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.now-line {
  margin-top: .75rem;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--muted);
}
.now-line .dot { animation: none; background: var(--ok); }
.now-line a {
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: border-color .2s;
}
.now-line a:hover { border-color: var(--accent-text); }

/* ---------- terminal demo (index only) ---------- */
.term {
  margin-top: 1.5rem;
  max-width: 34rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .45);
  overflow: hidden;
  font-family: var(--font-mono);
}
.term-bar {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem .9rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.tb-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted);
  opacity: .35;
}
.tb-dot:nth-child(1) { background: #f56565; opacity: .8; }
.tb-dot:nth-child(2) { background: #ecc94b; opacity: .8; }
.tb-dot:nth-child(3) { background: #48bb78; opacity: .8; }
.tb-title {
  margin-left: auto;
  font-size: .72rem;
  color: var(--muted);
  letter-spacing: .02em;
}
.term-body {
  padding: .9rem .95rem .55rem;
  font-size: .86rem;
  line-height: 1.65;
  max-height: 15rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-variant-numeric: tabular-nums;
}
.term-line { white-space: pre-wrap; word-break: break-word; }
.term-input-row {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: 0 .95rem .9rem;
  font-size: .86rem;
  line-height: 1.65;
  font-family: var(--font-mono);
}
.term-input-row input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--fg);
  font: inherit;
  caret-color: var(--accent-text);
  min-width: 0;
}
.term-input-row input:focus { outline: none; }
.term:focus-within { border-color: var(--accent-text); }
.term-input-row input::placeholder { color: var(--muted); opacity: .55; }
.term a {
  color: var(--accent-text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.term a:hover { border-color: var(--accent-text); }
.t-green { color: var(--ok-text); }
.t-blue { color: var(--accent-text); }
.t-dim { color: var(--muted); }
.t-red { color: #f56565; }

/* ---------- inner pages (blog / 404) ---------- */
.page-hero {
  max-width: 760px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 1rem;
  position: relative;
}
.page-hero .eyebrow { margin-bottom: .75rem; }
.page-hero h1 { font-size: clamp(2rem, 5vw, 2.8rem); letter-spacing: -.02em; font-weight: 800; line-height: 1.15; }

/* ---------- main ---------- */
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem;
  position: relative;
  z-index: 2;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

h2 {
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.count {
  font-size: .8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- project cards ---------- */
.cards { display: grid; gap: 1rem; }

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--fg);
  box-shadow: var(--shadow);
  transition: transform .4s cubic-bezier(.22,1,.36,1), border-color .25s, box-shadow .3s;
  will-change: transform;
  transform: perspective(900px) translateY(0) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  position: relative;
  overflow: hidden;
}

/* spotlight that follows the mouse inside the card */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), var(--glow), transparent 70%);
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.card:hover::before { opacity: 1; }

.card:hover {
  border-color: var(--accent-text);
  box-shadow: 0 2px 4px rgba(0,0,0,.05), 0 16px 40px -12px rgba(99,102,241,.3);
}

.card.visible { transform: perspective(900px) translateY(0) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
@media (pointer: fine) {
  .card:hover.visible { transform: perspective(900px) translateY(-3px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
}

.card > * { position: relative; z-index: 1; }

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.index {
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.status {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: .4rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  animation: pulse 2s infinite;
}
.dot.green { background: var(--ok); }
.dot.red { background: var(--err); animation: none; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
  50% { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

.card h3 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: .4rem;
}

.arrow {
  display: inline-block;
  font-size: 1rem;
  transition: transform .25s ease;
}
.card:hover .arrow { transform: translate(3px, -3px); }

.card p {
  color: var(--muted);
  font-size: .95rem;
  max-width: 30rem;
}

.card-meta {
  display: flex;
  gap: .5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.tag {
  font-size: .72rem;
  font-weight: 600;
  padding: .25rem .6rem;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  letter-spacing: .03em;
}

.card.ghost {
  border-style: dashed;
  background: transparent;
  box-shadow: none;
  opacity: .7;
  transform: none;
}
.card.ghost::before { display: none; }
.card.ghost:hover {
  border-color: var(--border);
  box-shadow: none;
}
.card.ghost.visible { transform: none; }
@media (pointer: fine) {
  .card.ghost:hover.visible { transform: none; }
}

/* ---------- blog ---------- */
/* ---------- blog ---------- */
.blog-search { margin-bottom: .5rem; position: relative; }
.blog-search input {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
  font-size: .95rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .6rem 2.6rem .6rem .9rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.blog-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.blog-search input:focus {
  border-color: var(--accent-text);
  box-shadow: 0 0 0 3px var(--glow);
}
.blog-search input::placeholder { color: var(--muted); }
.post-clear {
  position: absolute;
  right: .5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.7rem;
  height: 1.7rem;
  line-height: 1;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
}
.post-clear:hover { color: var(--accent-text); background: var(--surface); }
.post-count {
  display: block;
  margin: .15rem .1rem 0;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--muted);
  letter-spacing: .04em;
}

#post-empty { color: var(--muted); font-size: .9rem; padding: 1rem 0; }

.post-list { list-style: none; }

.post-link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--fg);
  transition: border-color .2s;
}
.post-link:hover { border-color: var(--accent-text); }
.post-link .pl-title { font-size: 1.1rem; font-weight: 600; letter-spacing: -.01em; }
.badge-new {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fff;
  background: #4f46e5;
  border-radius: 999px;
  padding: .15em .6em;
  vertical-align: middle;
  transform: translateY(-1px);
}
.post-link:hover .pl-title { color: var(--accent-text); }
.post-link .pl-date {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.post-link .pl-excerpt {
  display: block;
  color: var(--muted);
  font-size: .9rem;
  margin-top: .2rem;
}

/* single post */
.post-back {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .9rem;
  color: var(--muted);
  text-decoration: none;
  transition: color .2s;
}
.post-back:hover { color: var(--accent-text); }

article.post { max-width: 42rem; }
.breadcrumb {
  margin: 0 0 1.25rem;
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--muted);
}
.breadcrumb a { color: var(--muted); text-decoration: none; border-bottom: 1px solid transparent; }
.breadcrumb a:hover { color: var(--accent-text); border-bottom-color: var(--accent-text); }
.breadcrumb span[aria-current="page"] { color: var(--fg); }
article.post h1 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); letter-spacing: -.02em; font-weight: 800; line-height: 1.15; }
.post-meta {
  margin: .75rem 0 2.5rem;
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: .75rem;
}

article.post p { margin: 1.25rem 0; color: var(--fg); overflow-wrap: break-word; }
article.post h2 {
  margin: 2.5rem 0 .75rem;
  font-size: 1.3rem;
  letter-spacing: -.01em;
  text-transform: none;
  color: var(--fg);
  scroll-margin-top: 6rem;
}
article.post h3 { scroll-margin-top: 6rem; }

/* ---------- post table of contents ---------- */
.post-toc {
  margin: 0 0 2.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: .85rem;
}
.post-toc summary {
  cursor: pointer;
  padding: .6rem 1rem;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  user-select: none;
}
.post-toc summary:hover { color: var(--accent-text); }
.post-toc ol { list-style: none; margin: 0; padding: 0 .5rem .75rem 1.5rem; }
.post-toc li { margin: .3rem 0; }
.post-toc li.toc-h3 { padding-left: 1rem; }
.post-toc a { color: var(--muted); text-decoration: none; border-bottom: none; }
.post-toc a:hover { color: var(--accent-text); }
article.post ul, article.post ol { margin: 1.25rem 0 1.25rem 1.5rem; }
article.post li { margin: .4rem 0; }
article.post a { color: var(--accent-text); text-decoration: none; border-bottom: 1px solid var(--border); }
article.post a:hover { border-color: var(--accent-text); }
article.post a[target="_blank"]::after {
  content: " \2197";
  font-size: .78em;
  opacity: .7;
  margin-left: .15em;
}

/* heading permalinks on posts */
article.post h2, article.post h3 { position: relative; }
.heading-link {
  margin-left: .35em;
  font-size: .78em;
  font-weight: 600;
  color: var(--muted);
  opacity: 0;
  border-bottom: none !important;
  transition: opacity .15s, color .15s;
}
h2:hover .heading-link, h3:hover .heading-link,
.heading-link:focus-visible { opacity: 1; }
.heading-link:hover { color: var(--accent-text); }
@media (hover: none) { .heading-link { opacity: 1; } }

article.post pre {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .85rem;
  line-height: 1.6;
  break-inside: avoid;
}
article.post code:not(pre code) {
  font-family: var(--font-mono);
  font-size: .85em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .1em .4em;
}

.post-end {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: .9rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.post-end a { color: var(--accent-text); text-decoration: none; }
.post-actions { display: inline-flex; gap: .5rem; flex-wrap: wrap; }

.copy-btn {
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  color: var(--accent-text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .4rem .9rem;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.copy-btn:hover { border-color: var(--accent-text); }

/* ---------- post prev/next pager ---------- */
.post-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .9rem;
  margin-top: 2.75rem;
}
.pp {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .85rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color .2s, transform .2s;
}
.pp:hover { border-color: var(--accent-text); transform: translateY(-1px); }
.pp-dir {
  font-size: .7rem;
  font-family: var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.pp-title { color: var(--fg); font-weight: 600; line-height: 1.35; }
.pp:hover .pp-title { color: var(--accent-text); }
.pp-next { text-align: right; grid-column: 2; }

/* ---------- about / footer ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.about {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.about p { margin-top: .75rem; color: var(--muted); max-width: 34rem; }

.latest-card {
  display: block;
  margin-top: 1.25rem;
  max-width: 42rem;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color .2s, transform .2s;
}
.latest-card:hover { border-color: var(--accent-text); transform: translateY(-1px); }
.latest-meta {
  display: block;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--muted);
}
.latest-title { display: block; margin-top: .45rem; color: var(--fg); font-weight: 600; font-size: 1.05rem; letter-spacing: -.01em; }
.latest-card:hover .latest-title { color: var(--accent-text); }
.latest-excerpt { display: block; margin-top: .45rem; color: var(--muted); font-size: .9rem; line-height: 1.5; }

.footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 3rem 1.5rem 2.5rem;
  text-align: center;
  font-size: .85rem;
  color: var(--muted);
}
.footer-hint { margin-top: .5rem; font-size: .78rem; }

.footer-links {
  margin-top: .75rem;
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  font-size: .82rem;
}
.footer-links a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.footer-links a:hover { color: var(--accent-text); border-color: var(--accent-text); }

/* ---------- back to top ---------- */
#to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 900;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, border-color .2s;
}
#to-top::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 8px;
  background: conic-gradient(var(--accent-text) var(--p, 0%), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
}
#to-top.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
#to-top:hover { border-color: var(--accent-text); }

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 16px);
  z-index: 1500;
  background: var(--fg);
  color: var(--bg);
  font-size: .85rem;
  font-weight: 600;
  padding: .6rem 1.1rem;
  border-radius: 10px;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- command palette ---------- */
.palette {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16vh 1rem 1rem;
}
.palette[hidden] { display: none; }

.palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn .15s ease;
}

.palette-panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -12px rgba(0,0,0,.35);
  overflow: hidden;
  animation: pop .18s cubic-bezier(.22,1,.36,1);
}

@keyframes pop {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.palette-input-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.palette-icon { color: var(--muted); display: block; flex-shrink: 0; }
.palette-input-row input {
  flex: 1;
  font: inherit;
  font-size: 1rem;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
}
.palette-input-row input::placeholder { color: var(--muted); }

.palette-list {
  max-height: 340px;
  overflow-y: auto;
  padding: .5rem;
}
.palette-list::-webkit-scrollbar { width: 8px; }
.palette-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.palette-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: .6rem .75rem .3rem;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--fg);
}
.palette-item.active { background: var(--accent-bg); color: #fff; }
.palette-item .pi-title { font-weight: 600; font-size: .95rem; flex: 1; }
.palette-item .pi-desc {
  font-size: .8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.palette-item.active .pi-desc { color: rgba(255,255,255,.8); }
.palette-item .pi-arrow { opacity: 0; transform: translate(-3px, 3px); transition: all .2s; }
.palette-item.active .pi-arrow { opacity: 1; transform: translate(0, 0); }

.palette-empty {
  padding: 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
}

.palette-footer {
  display: flex;
  justify-content: center;
  gap: 1.1rem;
  padding: .6rem 1rem .7rem;
  border-top: 1px solid var(--border);
  font-size: .72rem;
  color: var(--muted);
}
.palette-footer span { display: inline-flex; align-items: center; gap: .3rem; }
.palette-footer kbd { font-size: .68em; padding: .1em .4em; }

/* ---------- keyboard help overlay ---------- */
.help {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.help[hidden] { display: none; }

.help-panel {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -12px rgba(0,0,0,.35);
  overflow: hidden;
  animation: pop .18s cubic-bezier(.22,1,.36,1);
}

.help-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.help-title {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.help-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .8rem;
  line-height: 1;
  transition: border-color .2s, color .2s;
}
.help-close:hover { border-color: var(--accent-text); color: var(--fg); }

.help-list { padding: .75rem 1.25rem 1.1rem; }
.help-row {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .35rem 0;
}
.help-row .hk {
  min-width: 2.4rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .15rem .4rem;
  color: var(--fg);
}
.help-row span:last-child { color: var(--muted); font-size: .9rem; }

/* ---------- 404 ---------- */
.four-oh-four { text-align: center; padding: 6rem 1.5rem 4rem; }
.four-oh-four h1 {
  margin-top: 1.5rem;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  letter-spacing: -.02em;
  color: var(--fg);
}
.four-oh-four .term {
  margin: 2rem auto;
  max-width: 30rem;
  text-align: left;
}
.four-oh-four .code {
  font-family: var(--font-mono);
  font-size: clamp(4rem, 16vw, 7rem);
  font-weight: 600;
  letter-spacing: -.03em;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}
.four-oh-four p { color: var(--muted); margin: 1rem 0 2rem; }
.four-oh-four .btn {
  display: inline-block;
  background: #4f46e5;
  color: #fff;
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  padding: .7rem 1.5rem;
  border-radius: 10px;
  transition: opacity .2s, transform .2s;
}
.four-oh-four .btn:hover { opacity: .9; transform: translateY(-1px); }

/* ---------- konami easter egg ---------- */
body.retro::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 998;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.14) 0 1px, transparent 1px 3px);
}
body.retro #glow { display: none; }
body.retro .aurora .blob { animation-duration: 8s; }

/* ---------- print ---------- */
@media print {
  .noise, #progress, #glow, .aurora, .palette-btn, #to-top, #toast, .palette, .help, .skip-link, .term,
  .post-toc, .post-pager, .heading-link, .footer-hint, .footer-links, .blog-search, #post-empty {
    display: none !important;
  }
  article.post a[target="_blank"]::after { content: ""; }
  body { background: #fff; color: #000; }
  .card, article.post pre, article.post code:not(pre code) {
    background: #fff;
    border-color: #ccc;
    box-shadow: none;
  }
  .card { transform: none !important; }
  a { color: #000; text-decoration: underline; }
  .gradient { color: #000; -webkit-text-fill-color: #000; }
}

/* ---------- responsive ---------- */
@media (max-width: 480px) {
  .nav { padding-top: 1.25rem; }
  .hero { padding-top: 3.5rem; }
  .card { padding: 1.25rem; }
  .palette-btn kbd { display: none; }
  .post-link { flex-direction: column; gap: .15rem; }
  .footer-links { flex-wrap: wrap; }
  .post-pager { grid-template-columns: 1fr; }
  .post-pager .pp-next { grid-column: 1; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto; }
  .card, .card.visible { transform: none !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}

::view-transition-old(root) { animation-duration: .28s; }
::view-transition-new(root) { animation-duration: .28s; }
