:root {
  --bg-0:        #0b0720;
  --bg-1:        #120a2b;
  --text:        #cbd5e1;
  --text-strong: #e5e7eb;
  --muted:       #94a3b8;
  --line:        rgba(255,255,255,.10);
  --accent:      #ff2d8d;
  --accent-2:    #ff4aa3;
  --accent-solid: #db0070;
  --accent-solid-hover: #c00062;
  --code-bg:     #0a0618;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(900px 500px at 50% 0%, rgba(255,45,141,.06), transparent 55%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--accent-2); }

/* Navigation (matches the rest of the site) */
.site-nav {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(11,7,32,.72);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 200;
}
.nav-inner { max-width: 1180px; margin: 0 auto; padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; height: 62px; flex-wrap: wrap; }
.logo { font-size: 1rem; font-weight: 700; color: var(--text-strong); text-decoration: none; letter-spacing: -0.02em; }
.logo span { color: var(--accent); }
.nav-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; display: none; }
.hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; padding: 6px 4px; }
.hamburger span { display: block; width: 20px; height: 1.5px; background: var(--text-strong); border-radius: 1px; transition: transform 0.25s ease, opacity 0.25s ease; }
.nav-toggle:checked + .hamburger span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle:checked + .hamburger span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle:checked + .hamburger span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
.nav-toggle:focus-visible + .hamburger { outline: 2px solid var(--accent); outline-offset: -4px; border-radius: 8px; }
.nav-links { display: flex; gap: 2.25rem; list-style: none; }
.nav-links a { font-size: 0.85rem; font-weight: 500; color: var(--muted); text-decoration: none; transition: color 0.15s; padding: 0.2rem 0; position: relative; }
.nav-links a::after { content: ''; position: absolute; bottom: -6px; left: 0; right: 0; height: 2px; background: var(--accent); transform: scaleX(0); transition: transform 0.18s ease; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text-strong); }
.nav-links a:hover::after, .nav-links a[aria-current="page"]::after { transform: scaleX(1); }

.skip-link { position: absolute; left: 1rem; top: -100px; z-index: 300; padding: 0.6rem 1rem; border-radius: 10px; background: var(--accent-solid); color: #fff; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 0.75rem; }

.breadcrumb { font-size: 0.78rem; color: var(--muted); margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text-strong); }
.eyebrow { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 1rem; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.1rem); font-weight: 800; letter-spacing: -0.035em; color: var(--text-strong); line-height: 1.1; margin-bottom: 1.25rem; text-wrap: balance; }
.dek { font-size: 1.12rem; color: var(--muted); max-width: 64ch; line-height: 1.65; }
p, li { text-wrap: pretty; }

/* Notes index */
.page { max-width: 820px; margin: 0 auto; padding: 4.5rem 2rem 4rem; }
.notes-index .dek { padding-bottom: 2rem; border-bottom: 1px solid var(--line); margin-bottom: 2.25rem; }
.note-list { list-style: none; display: grid; gap: 1rem; }
.note-card a { display: block; text-decoration: none; background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 16px; padding: 1.4rem 1.5rem; transition: border-color .15s, transform .15s; }
.note-card a:hover { border-color: rgba(255,45,141,.45); transform: translateY(-2px); }
.note-card a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.note-card-kicker { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.5rem; }
.note-card h2 { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text-strong); line-height: 1.25; margin-bottom: 0.5rem; text-wrap: balance; }
.note-card-dek { font-size: 0.95rem; color: var(--text); line-height: 1.6; }
.note-card-meta { font-size: 0.8rem; color: var(--muted); margin-top: 0.75rem; }

/* Article */
.note { max-width: 1120px; margin: 0 auto; padding: 4rem 2rem 4rem; }
.note-hero { max-width: 820px; padding-bottom: 2rem; border-bottom: 1px solid var(--line); margin-bottom: 2.75rem; }
.note-meta { display: flex; flex-wrap: wrap; gap: 0.75rem 2.25rem; margin-top: 1.75rem; }
.note-meta dt { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.note-meta dd { font-size: 0.92rem; font-weight: 600; color: var(--text-strong); }
.tag-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 1.25rem; }
.tag-list li { font-size: 0.75rem; font-weight: 500; color: var(--text); border: 1px solid var(--line); background: rgba(255,255,255,.03); border-radius: 999px; padding: 0.2rem 0.7rem; }

.note-shell { display: grid; grid-template-columns: 210px minmax(0, 720px); gap: 3.5rem; align-items: start; }
.note-rail { position: sticky; top: 92px; font-size: 0.82rem; }
.note-rail > p { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.75rem; }
.note-rail nav { display: grid; border-top: 1px solid var(--line); }
.note-rail a { padding: 0.6rem 0; border-bottom: 1px solid var(--line); color: var(--muted); text-decoration: none; line-height: 1.4; }
.note-rail a:hover { color: var(--text-strong); }

.note-prose { min-width: 0; font-family: 'Source Serif 4', Georgia, serif; font-size: 1.1rem; line-height: 1.8; color: var(--text); }
.note-prose > p:first-child { font-size: 1.24rem; color: var(--text-strong); }
.note-prose p, .note-prose ul, .note-prose ol, .note-prose table, .note-prose blockquote, .note-prose .highlighter-rouge { margin-top: 1.15rem; }
.note-prose h2 { font-family: 'Inter', sans-serif; font-size: clamp(1.4rem, 2.6vw, 1.8rem); font-weight: 800; letter-spacing: -0.025em; color: var(--text-strong); line-height: 1.2; margin: 3.5rem 0 0; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.note-prose h3 { font-family: 'Inter', sans-serif; font-size: 1.15rem; font-weight: 700; color: var(--text-strong); margin: 2.25rem 0 0; }
.note-prose ul, .note-prose ol { padding-left: 1.4rem; }
.note-prose li + li { margin-top: 0.5rem; }
.note-prose li::marker { color: var(--accent); }
.note-prose strong { color: var(--text-strong); font-weight: 600; }
.note-prose blockquote { border-left: 3px solid var(--accent); background: rgba(255,45,141,.06); border-radius: 0 12px 12px 0; padding: 1rem 1.25rem; font-size: 1rem; }
.note-prose blockquote p:first-child { margin-top: 0; }
.note-prose hr { border: 0; border-top: 1px solid var(--line); margin: 3rem 0; }
.note-prose table { width: 100%; border-collapse: collapse; font-family: 'Inter', sans-serif; font-size: 0.9rem; display: block; overflow-x: auto; }
.note-prose th, .note-prose td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.note-prose th { color: var(--text-strong); font-weight: 600; }
.note-prose code, .note-prose pre { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
.note-prose code { font-family: var(--mono); font-size: 0.82em; background: rgba(255,255,255,.07); border-radius: 5px; padding: 0.1em 0.35em; color: var(--text-strong); }
.note-prose pre { font-family: var(--mono); font-size: 0.8rem; line-height: 1.65; background: var(--code-bg); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.25rem; overflow-x: auto; tab-size: 2; color: #d6d9e6; }
.note-prose pre code { background: none; padding: 0; font-size: inherit; color: inherit; border-radius: 0; }
.note-prose pre:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.note-origin { font-family: 'Inter', sans-serif; font-size: 0.85rem; color: var(--muted); margin-top: 3rem !important; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.note-origin a { color: var(--muted); }

/* Rouge syntax tokens */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs { color: #7d8597; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kr, .highlight .kn, .highlight .ow, .highlight .kc { color: #ff7ab8; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sa, .highlight .dl, .highlight .se, .highlight .si, .highlight .sr { color: #9fe3b4; }
.highlight .mi, .highlight .mf, .highlight .m { color: #f7c97e; }
.highlight .nf, .highlight .fm { color: #8ec5ff; }
.highlight .nb, .highlight .bp, .highlight .nt, .highlight .na { color: #c7a6ff; }

/* Closing and related */
.closing-card { max-width: 990px; margin: 4rem 0 0 auto; background: rgba(255,45,141,.06); border: 1px solid rgba(255,45,141,.25); border-radius: 18px; padding: 1.75rem 1.9rem; }
.closing-card h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text-strong); margin-bottom: 0.5rem; }
.closing-card p:not(.eyebrow) { color: var(--text); max-width: 64ch; }
.closing-card .eyebrow { margin-bottom: 0.5rem; }
.closing-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }
.btn-primary, .btn-ghost { display: inline-flex; align-items: center; font-size: 0.9rem; font-weight: 600; border-radius: 12px; padding: 0.72rem 1.5rem; text-decoration: none; transition: background .15s, border-color .15s, color .15s, transform .15s; }
.btn-primary { color: #fff; background: var(--accent-solid); border: 1.5px solid var(--accent-solid); }
.btn-primary:hover { background: var(--accent-solid-hover); border-color: var(--accent-solid-hover); transform: translateY(-2px); }
.btn-ghost { color: var(--text-strong); border: 1.5px solid rgba(255,45,141,.55); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary:focus-visible, .btn-ghost:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.more-notes { max-width: 990px; margin: 3rem 0 0 auto; }
.more-notes h2 { font-size: 1.1rem; font-weight: 700; color: var(--text-strong); margin-bottom: 0.9rem; }
.next-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.75rem; }
.next-links a { display: block; text-decoration: none; background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem; transition: border-color .15s, transform .15s; }
.next-links a:hover { border-color: rgba(255,45,141,.45); transform: translateY(-2px); }
.next-links b { display: block; color: var(--text-strong); font-size: 0.92rem; line-height: 1.35; }
.next-links span { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 0.35rem; }

footer { border-top: 1px solid var(--line); padding: 2rem; text-align: center; font-size: 0.8rem; color: var(--muted); margin-top: 2rem; }
footer a { color: var(--muted); }
footer a:hover { color: var(--text-strong); }

@media (max-width: 1000px) {
  .note-shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .note-rail { display: none; }
  .note-prose, .note-hero { max-width: 720px; }
  .closing-card, .more-notes { margin-left: 0; max-width: 720px; }
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .hamburger { display: flex; justify-content: center; height: 62px; align-items: center; }
  .nav-inner { position: relative; height: auto; min-height: 62px; padding: 0 1.25rem; }
  .logo { height: 62px; display: flex; align-items: center; gap: 0.28em; }
  .nav-links { display: none; width: 100%; flex-direction: column; gap: 0; border-top: 1px solid var(--line); background: rgba(18,10,43,.92); border-radius: 0 0 14px 14px; }
  .nav-links a::after { display: none; }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; padding: 0.75rem 1.25rem; font-size: 0.9rem; border-bottom: 1px solid var(--line); }
  .nav-links li:last-child a { border-bottom: none; }
  .nav-toggle:checked ~ .nav-links { display: flex; }
  .page, .note { padding: 3rem 1.25rem 3rem; }
  .note-prose { font-size: 1.03rem; }
  .note-prose > p:first-child { font-size: 1.12rem; }
  .note-prose pre { font-size: 0.74rem; padding: 0.9rem 1rem; }
  .btn-primary, .btn-ghost { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .note-card a, .next-links a, .btn-primary, .btn-ghost, .hamburger span { transition: none; }
  .note-card a:hover, .next-links a:hover, .btn-primary:hover { transform: none; }
}
