/* =========================================================
   Notes site — shares the design language with sotamak1r.github.io
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
:root {
    --bg: #f4f1ea; --bg-elev: #ffffff; --bg-soft: #ebe7dd; --bg-dark: #0a0a0a;
    --grid: rgba(10,10,10,0.045);
    --border: #e2ddd1; --border-strong: #1a1a1a;
    --ink: #0a0a0a; --ink-2: #1f1f1f; --muted: #6b6b66; --muted-2: #9a9a93;
    --accent-blue: #1547ff; --accent-warm: #ff5b1f; --accent-lime: #d4ff3c;
    --accent-pink: #ff5fa2; --accent-cyan: #00d4ff;
    --radius: 20px; --radius-sm: 12px; --radius-lg: 32px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 12px 32px -10px rgba(0,0,0,.12);
    --shadow-lg: 0 30px 70px -20px rgba(0,0,0,.22);
    --ease: cubic-bezier(.2,.7,.2,1);
    --ease-spring: cubic-bezier(.34,1.56,.64,1);
    --maxw: 1240px;
    --maxw-reading: 820px;
}
html { background: var(--bg); scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--ink); background: var(--bg); line-height: 1.6;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "ss01", "cv11"; overflow-x: hidden;
}
a { color: var(--ink); text-decoration: none; transition: opacity .2s var(--ease); }
::selection { background: var(--accent-lime); color: var(--ink); }

/* fixed grid backdrop */
body::before {
    content: ""; position: fixed; inset: 0;
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 56px 56px;
    pointer-events: none; z-index: 0;
    mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 40%, transparent 100%);
}

/* cursor follower & scroll progress */
.cursor-glow {
    position: fixed; top: 0; left: 0;
    width: 480px; height: 480px; border-radius: 50%;
    background: radial-gradient(circle, rgba(21,71,255,.18), rgba(255,91,31,.07) 35%, transparent 70%);
    pointer-events: none; z-index: 1;
    transform: translate(-50%, -50%);
    transition: opacity .35s var(--ease);
    mix-blend-mode: multiply; opacity: 0;
}
@media (hover: hover) { .cursor-glow.on { opacity: 1; } }
.scroll-progress {
    position: fixed; top: 0; left: 0; height: 3px; width: 0%;
    background: linear-gradient(90deg, var(--accent-warm), var(--accent-pink), var(--accent-blue));
    z-index: 100; transition: width .08s linear;
    box-shadow: 0 0 14px rgba(21,71,255,.4);
}

/* floating pill nav */
.topnav {
    position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
    z-index: 50;
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    background: rgba(255,255,255,0.62);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 999px;
    padding: 6px 8px 6px 18px;
    display: flex; align-items: center; gap: 8px;
    box-shadow: 0 12px 36px -12px rgba(0,0,0,.15);
    transition: top .35s var(--ease), opacity .25s var(--ease);
    max-width: calc(100vw - 32px);
}
.topnav.hidden { top: -80px; }
.brand {
    font-weight: 700; font-size: 14px; letter-spacing: -0.01em; color: var(--ink);
    display: flex; align-items: center; gap: 8px;
    padding-right: 10px; border-right: 1px solid rgba(0,0,0,.08); margin-right: 4px;
}
.brand-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent-warm); display: inline-block;
    box-shadow: 0 0 0 4px rgba(255,91,31,.18);
    animation: brandPulse 2.6s var(--ease) infinite;
}
@keyframes brandPulse {
    0%,100% { box-shadow: 0 0 0 4px rgba(255,91,31,.18); }
    50%     { box-shadow: 0 0 0 8px rgba(255,91,31,.04); }
}
.topnav-links { display: flex; gap: 2px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.topnav-links::-webkit-scrollbar { display: none; }
.topnav-links a {
    color: var(--ink-2); font-size: 13px; font-weight: 500;
    padding: 8px 14px; border-radius: 999px; white-space: nowrap;
    position: relative; transition: color .25s var(--ease);
}
.topnav-links a::before {
    content: ""; position: absolute; inset: 0; border-radius: 999px;
    background: var(--ink); transform: scale(0);
    transition: transform .3s var(--ease-spring); z-index: -1;
}
.topnav-links a:hover, .topnav-links a.active { color: #fff; }
.topnav-links a:hover::before, .topnav-links a.active::before { transform: scale(1); }

/* layout */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; position: relative; z-index: 2; }
section { padding: 110px 0 60px; scroll-margin-top: 90px; position: relative; }
.eyebrow {
    display: inline-flex; align-items: center; gap: 10px;
    font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 500;
    color: var(--ink); text-transform: uppercase; letter-spacing: 0.18em;
    margin-bottom: 22px;
    padding: 6px 12px; background: var(--bg-elev);
    border: 1px solid var(--border); border-radius: 999px;
}
.eyebrow .num { font-weight: 700; color: var(--accent-warm); }
.section-title {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: clamp(38px, 5.6vw, 72px); font-weight: 700;
    letter-spacing: -0.035em; line-height: 1; color: var(--ink);
    margin: 0 0 36px;
}
.section-title .accent-italic {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic; font-weight: 400;
}
.section-title .underline-wavy { position: relative; display: inline-block; }
.section-title .underline-wavy::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 8px;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 8' preserveAspectRatio='none'><path d='M0 4 Q 10 0 20 4 T 40 4 T 60 4 T 80 4' stroke='%23ff5b1f' stroke-width='2.4' fill='none' stroke-linecap='round'/></svg>") repeat-x;
    background-size: 80px 8px;
}
.section-head {
    display: flex; justify-content: space-between; align-items: flex-end;
    gap: 24px; margin-bottom: 42px; flex-wrap: wrap;
}
.note { font-size: 13px; color: var(--muted); margin-bottom: 8px; font-family: 'JetBrains Mono', monospace; }

/* HERO (notes index) */
.hero { padding: 130px 0 50px; position: relative; }
.notes-hero { max-width: 880px; }
.hero-tag {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 6px 16px 6px 6px;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: 999px;
    font-size: 13px; color: var(--ink-2); font-weight: 500; margin-bottom: 26px;
}
.hero-tag .pill {
    background: var(--ink); color: #fff; font-size: 11px; font-weight: 600;
    padding: 4px 10px; border-radius: 999px; letter-spacing: 0.05em;
}
.hero-title {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: clamp(46px, 7vw, 96px); font-weight: 700;
    letter-spacing: -0.045em; line-height: 0.95; color: var(--ink);
    margin: 0 0 24px;
}
.hero-title .first {
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400; font-style: italic; letter-spacing: -0.02em;
    color: var(--muted); font-size: 0.42em; display: block; margin-bottom: 6px;
}
.hero-title .name-line { display: block; }
.hero-title .accent-word {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic; font-weight: 400; color: var(--accent-warm);
}
.hero-sub {
    font-size: clamp(16px, 1.4vw, 19px); color: var(--ink-2);
    line-height: 1.6; max-width: 700px; margin: 0 0 32px;
}
.hero-sub strong {
    color: var(--ink); font-weight: 600;
    background: linear-gradient(120deg, transparent 0% 50%, var(--accent-lime) 50%);
    background-size: 200% 100%; background-position: 0% 0%;
    transition: background-position .5s var(--ease);
    padding: 1px 4px; border-radius: 4px;
}
.hero-sub strong:hover { background-position: -100% 0%; }

/* ============== controls (search + tag filter) ============== */
.notes-controls {
    display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
    padding: 20px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.search-box {
    position: relative; flex: 1 1 320px; min-width: 240px;
}
.search-box i {
    position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
    color: var(--muted); font-size: 14px;
}
.search-box input {
    width: 100%; padding: 14px 18px 14px 44px;
    background: var(--bg-elev);
    border: 1px solid var(--border); border-radius: 999px;
    font-family: 'Inter', sans-serif; font-size: 14px; color: var(--ink);
    transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.search-box input:focus {
    outline: none; border-color: var(--ink);
    box-shadow: 0 0 0 4px rgba(0,0,0,.05);
}
.tag-list {
    display: flex; gap: 8px; flex-wrap: wrap;
}
.tag-btn {
    font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 500;
    padding: 8px 14px; border-radius: 999px;
    background: var(--bg-elev); border: 1px solid var(--border);
    color: var(--ink-2); cursor: pointer;
    transition: all .25s var(--ease-spring);
    letter-spacing: 0.02em;
}
.tag-btn span { color: var(--muted-2); margin: 0 2px; }
.tag-btn:hover { border-color: var(--ink); transform: translateY(-1px); }
.tag-btn.active {
    background: var(--ink); color: #fff; border-color: var(--ink);
}
.tag-btn.active span { color: var(--accent-lime); }

/* ============== note grid ============== */
.note-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 26px;
}
.note-card {
    position: relative;
    display: flex; flex-direction: column;
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    transition:
        transform .35s var(--ease-spring),
        box-shadow .35s var(--ease),
        border-color .25s var(--ease);
    color: inherit;
}
.note-card::after {
    content: ""; position: absolute; inset: 0;
    border-radius: var(--radius);
    background: radial-gradient(420px circle at var(--mx,50%) var(--my,50%),
                rgba(21,71,255,.08), rgba(255,91,31,.04) 30%, transparent 60%);
    opacity: 0; pointer-events: none; transition: opacity .35s var(--ease);
}
.note-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--ink);
}
.note-card:hover::after { opacity: 1; }
.note-idx {
    position: absolute; top: 14px; right: 16px;
    font-family: 'JetBrains Mono', monospace; font-size: 11px;
    color: var(--muted-2); letter-spacing: 0.18em; z-index: 3;
    transition: color .3s var(--ease);
}
.note-card:hover .note-idx { color: var(--accent-warm); }

.note-cover {
    aspect-ratio: 16/9; background: var(--bg-soft);
    overflow: hidden; position: relative;
}
.note-cover img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform 1s var(--ease), filter .5s var(--ease);
}
.note-card:hover .note-cover img {
    transform: scale(1.06); filter: saturate(1.1);
}
.note-cover .cover-fallback {
    width: 100%; height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(21,71,255,.15), transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255,91,31,.18), transparent 50%),
        var(--bg-soft);
    display: flex; align-items: center; justify-content: center;
}
.note-cover .cover-fallback span {
    font-family: 'Instrument Serif', Georgia, serif; font-style: italic;
    font-size: 64px; color: var(--ink-2); opacity: .55;
}

.note-body { padding: 22px 22px 24px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.note-meta { display: flex; align-items: center; gap: 8px; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; }
.note-meta .note-dot { color: var(--muted-2); }
.note-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px; font-weight: 600; letter-spacing: -0.018em;
    color: var(--ink); margin: 4px 0 0; line-height: 1.3;
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0% 1px; background-repeat: no-repeat; background-position: 0 100%;
    transition: background-size .55s var(--ease);
    display: inline;
}
.note-card:hover .note-title { background-size: 100% 1px; }
.note-summary {
    font-size: 14px; color: var(--ink-2); line-height: 1.55; margin: 6px 0 0;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.note-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.note-tag {
    font-family: 'JetBrains Mono', monospace; font-size: 11px;
    color: var(--ink-2);
    padding: 4px 10px; border-radius: 999px;
    background: var(--bg-soft); border: 1px solid var(--border);
    transition: background .25s var(--ease), color .25s var(--ease);
}
.note-card:hover .note-tag { background: var(--ink); color: var(--accent-lime); border-color: var(--ink); }

.empty-state {
    text-align: center; padding: 80px 20px; color: var(--muted);
    border: 1px dashed var(--border); border-radius: var(--radius);
    background: var(--bg-elev);
}
.empty-state .empty-emoji {
    font-family: 'Instrument Serif', Georgia, serif; font-style: italic;
    font-size: 64px; color: var(--ink-2); opacity: .5; margin-bottom: 14px;
}

/* ============== READING PAGE (single note) ============== */
body.reading main {
    max-width: var(--maxw);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 60px;
    padding: 110px 28px 0;
}
.note-article {
    max-width: var(--maxw-reading);
    width: 100%;
    margin: 0;
    grid-column: 1;
}
.toc {
    grid-column: 2;
    position: sticky; top: 110px; align-self: start;
    max-height: calc(100vh - 140px); overflow: auto;
    font-size: 13px;
    padding-left: 18px;
    border-left: 1px solid var(--border);
}
.toc-title {
    font-family: 'JetBrains Mono', monospace; font-size: 11px;
    color: var(--ink); text-transform: uppercase; letter-spacing: 0.18em;
    margin-bottom: 14px; font-weight: 600;
}
.toc ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.toc li.lvl-h3 { padding-left: 14px; font-size: 12.5px; }
.toc a {
    color: var(--muted); display: block; padding: 4px 8px;
    border-radius: 6px; line-height: 1.4;
    transition: color .2s var(--ease), background .2s var(--ease), padding .2s var(--ease);
    border-left: 2px solid transparent; margin-left: -2px;
}
.toc a:hover { color: var(--ink); }
.toc a.active {
    color: var(--ink); font-weight: 600;
    border-left-color: var(--accent-warm);
    background: linear-gradient(90deg, rgba(255,91,31,.06), transparent 80%);
}

@media (max-width: 980px) {
    body.reading main { grid-template-columns: 1fr; gap: 28px; }
    .toc { display: none; }
}

.back-link {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: 'JetBrains Mono', monospace; font-size: 12px;
    color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em;
    margin-bottom: 28px;
    transition: color .25s var(--ease);
}
.back-link:hover { color: var(--ink); }
.back-link .arrow { transition: transform .25s var(--ease-spring); display: inline-block; }
.back-link:hover .arrow { transform: translateX(-4px); }

.note-header { margin-bottom: 50px; }
.note-meta-line {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin-bottom: 18px;
}
.meta-pill {
    font-family: 'JetBrains Mono', monospace; font-size: 11px;
    background: var(--bg-elev); border: 1px solid var(--border);
    padding: 5px 12px; border-radius: 999px;
    color: var(--ink); letter-spacing: 0.04em;
}
.meta-pill.ghost { color: var(--muted); }
.meta-tags { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.note-h1 {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: clamp(36px, 5vw, 60px);
    font-weight: 700; letter-spacing: -0.035em;
    line-height: 1.05; color: var(--ink); margin: 0 0 16px;
}
.note-h1 .accent-italic {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic; font-weight: 400;
}
.note-lede {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic;
    font-size: clamp(18px, 1.6vw, 22px);
    color: var(--muted); margin: 0;
    line-height: 1.5;
}

/* ============== MARKDOWN BODY ============== */
.markdown-body {
    font-size: 16.5px; line-height: 1.78;
    color: var(--ink-2);
    word-wrap: break-word;
}
.markdown-body > *:first-child { margin-top: 0; }
.markdown-body > *:last-child { margin-bottom: 0; }

.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    color: var(--ink); letter-spacing: -0.02em; line-height: 1.25;
    margin-top: 2.2em; margin-bottom: .7em; font-weight: 600;
    scroll-margin-top: 90px; position: relative;
}
.markdown-body h1 { font-size: 2em; }
.markdown-body h2 {
    font-size: 1.65em;
    padding-bottom: .35em;
    border-bottom: 1px solid var(--border);
}
.markdown-body h3 { font-size: 1.3em; }
.markdown-body h4 { font-size: 1.1em; color: var(--ink-2); }

.heading-anchor {
    position: absolute; left: -22px; top: 50%; transform: translateY(-50%);
    color: var(--accent-warm); opacity: 0;
    font-weight: 400; font-size: 0.8em;
    transition: opacity .2s var(--ease);
}
.markdown-body h2:hover .heading-anchor,
.markdown-body h3:hover .heading-anchor { opacity: 1; }

.markdown-body p { margin: 0 0 1.2em; }
.markdown-body strong { color: var(--ink); font-weight: 600; }
.markdown-body em { font-style: italic; }

.markdown-body a {
    color: var(--accent-blue); font-weight: 500;
    border-bottom: 1px solid rgba(21,71,255,.25);
    transition: border-color .2s var(--ease), color .2s var(--ease);
}
.markdown-body a:hover {
    color: var(--accent-warm);
    border-bottom-color: var(--accent-warm);
}

.markdown-body ul, .markdown-body ol {
    padding-left: 1.6em; margin: 0 0 1.2em;
}
.markdown-body li { margin: .4em 0; }
.markdown-body li::marker { color: var(--accent-warm); }

.markdown-body blockquote {
    margin: 1.4em 0;
    padding: 14px 22px;
    border-left: 3px solid var(--accent-warm);
    background: var(--bg-elev);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--ink-2);
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic; font-size: 1.05em;
}
.markdown-body blockquote p:last-child { margin-bottom: 0; }

.markdown-body img {
    max-width: 100%; height: auto;
    display: block; margin: 1.6em auto;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

/* media figures (rendered from `![caption](xxx.png|.mp4|...)`) */
.markdown-body figure.md-video,
.markdown-body figure.md-figure {
    margin: 1.6em auto;
    text-align: center;
    width: fit-content;
    max-width: 100%;
}
.markdown-body figure.md-video video,
.markdown-body figure.md-figure img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}
.markdown-body figure.md-video video {
    background: #000;
}
.markdown-body figure.md-video figcaption,
.markdown-body figure.md-figure figcaption {
    margin-top: .7em;
    font-size: .9em;
    color: var(--muted, #888);
    font-style: italic;
}

.markdown-body hr {
    border: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin: 2.4em 0;
}

/* code */
.markdown-body code {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .9em;
    padding: 2px 6px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--ink);
}
.markdown-body pre {
    background: #0f0f12;
    color: #f5f3ec;
    border-radius: var(--radius-sm);
    padding: 18px 20px;
    overflow-x: auto;
    margin: 1.4em 0;
    box-shadow: var(--shadow-md);
    font-size: 14px; line-height: 1.6;
}
.markdown-body pre code {
    background: transparent; padding: 0; border: 0;
    color: inherit; font-size: inherit;
}

/* tables */
.markdown-body table {
    border-collapse: collapse;
    width: 100%; margin: 1.6em 0;
    font-size: .94em;
    overflow: hidden; border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    background: var(--bg-elev);
    display: block; overflow-x: auto;
}
.markdown-body table thead { background: var(--ink); color: #fff; }
.markdown-body table th,
.markdown-body table td {
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    text-align: left; vertical-align: top;
}
.markdown-body table th {
    font-family: 'Space Grotesk', sans-serif; font-weight: 600;
    border-bottom: 0; letter-spacing: -0.01em;
    color: #fff;
}
.markdown-body table tr:last-child td { border-bottom: 0; }
.markdown-body table tr:nth-child(even) { background: var(--bg-soft); }

/* katex display */
.markdown-body .katex-display {
    margin: 1.4em 0; overflow-x: auto; overflow-y: hidden;
    padding: 6px 0;
}

/* note footer */
.note-footer-nav {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 14px;
    margin: 70px 0 0;
    padding-top: 30px;
    border-top: 1px solid var(--border);
}
.btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 12px 20px; border-radius: 999px;
    font-size: 14px; font-weight: 500;
    transition: transform .3s var(--ease-spring), background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease), box-shadow .3s var(--ease);
    border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 8px 22px -6px rgba(0,0,0,.45); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -8px rgba(0,0,0,.55); }
.btn-ghost { background: var(--bg-elev); color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--ink); transform: translateY(-2px); background: var(--ink); color: #fff; }
.btn .arrow { transition: transform .3s var(--ease-spring); display: inline-block; }
.btn:hover .arrow { transform: translate(4px, -4px) rotate(-8deg); }
.btn-ghost:hover .arrow { transform: translate(-4px, 0); }

/* footer */
footer {
    margin-top: 100px; padding: 50px 0 40px;
    border-top: 1px solid var(--border); position: relative; z-index: 2;
}
.footer-inner {
    max-width: var(--maxw); margin: 0 auto; padding: 0 28px;
    display: flex; justify-content: space-between; align-items: center;
    gap: 20px; flex-wrap: wrap;
}
.footer-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.08em;
}
.footer-meta a { color: var(--muted); }
.footer-meta a:hover { color: var(--ink); }

/* back to top */
.totop {
    position: fixed; right: 22px; bottom: 22px;
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--ink); color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-md); cursor: pointer;
    z-index: 40; opacity: 0; transform: translateY(20px) scale(0.8);
    transition: opacity .3s var(--ease), transform .3s var(--ease-spring), background .25s var(--ease);
    border: 0;
}
.totop.show { opacity: 1; transform: translateY(0) scale(1); }
.totop:hover { background: var(--accent-warm); transform: translateY(-2px) scale(1.05); }

/* reveal */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .7s var(--ease), transform .8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

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

@media (max-width: 720px) {
    main { padding: 0 20px; }
    body.reading main { padding: 100px 20px 0; }
    .topnav { padding: 5px 6px 5px 14px; }
    .brand { font-size: 13px; }
    .topnav-links a { padding: 7px 11px; font-size: 12px; }
    .note-grid { grid-template-columns: 1fr; }
}
