@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("/assets/jbm.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;
}

:root {
    --bg: #f0eee9;
    --bg-elevated: #f5f3ee;
    --ink: #1a1a18;
    --ink-soft: #3a3a36;
    --muted: #6b6b66;
    --muted-2: #8a8a84;
    --line: #d8d6d0;
    --line-strong: #c4c2bb;
    --terminal: #0c0c0b;
    --terminal-2: #131312;
    --accent: #4a9eff;
    --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
    --green: #2d9f52;
    --yellow: #b8860b;
    --red: #c73e3e;
    --radius-lg: 6px;
    --radius-md: 4px;
    --radius-sm: 2px;
    --max: 1160px;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --term-bg: #1a1d22;
    --term-sidebar-bg: #15181d;
    --term-active-bg: #20242c;
    --term-border: #2b3038;
    --term-text: #c8cdd4;
    --term-muted: #5a6068;
    --term-prompt: #4a9eff;
    --term-cmd: #8ecf7a;
    --term-str: #e6c060;
    --logo-filter: none;
    --logo-opacity: 0.72;
}

[data-palette="herdr"] {
  --bg: #0c0c0b; --bg-elevated: #131312; --ink: #f0ece0; --ink-soft: #dedad0;
  --muted: #8a8a80; --muted-2: #5c5c55; --line: #252522; --line-strong: #2e2e2b;
  --accent: #4a9eff; --green: #52c97a; --yellow: #e6b84a; --red: #e05a5a;
  --term-bg: #0c0c0b; --term-sidebar-bg: #131312; --term-active-bg: #191918;
  --term-border: #252522; --term-text: #dedad0; --term-muted: #5c5c55; --term-prompt: #4a9eff;
  --term-cmd: #52c97a; --term-str: #e6b84a;
}
[data-palette="catppuccin"] {
  --bg: #11111b; --bg-elevated: #181825; --ink: #f5e0dc; --ink-soft: #cdd6f4;
  --muted: #9399b2; --muted-2: #6c7086; --line: #313244; --line-strong: #45475a;
  --accent: #89b4fa; --green: #a6e3a1; --yellow: #f9e2af; --red: #f38ba8;
  --term-bg: #11111b; --term-active-bg: #1e1e2e; --term-border: #313244; --term-text: #cdd6f4; --term-muted: #6c7086; --term-prompt: #89b4fa;
  --term-cmd: #a6e3a1; --term-str: #f9e2af;
}
[data-palette="catppuccin-latte"] {
  --bg: #eff1f5; --bg-elevated: #e6e9ef; --ink: #1e1e2e; --ink-soft: #4c4f69;
  --muted: #6c6f85; --muted-2: #9ca0b0; --line: #ccd0da; --line-strong: #bcc0cc;
  --accent: #1e66f5; --green: #40a02b; --yellow: #df8e1d; --red: #d20f39;
  --term-bg: #eff1f5; --term-active-bg: #dce0e8; --term-border: #ccd0da; --term-text: #4c4f69; --term-muted: #9ca0b0; --term-prompt: #1e66f5;
  --term-cmd: #40a02b; --term-str: #df8e1d;
}
[data-palette="terminal"] {
  --bg: #000000; --bg-elevated: #080808; --ink: #ffffff; --ink-soft: #d8d8d8;
  --muted: #888888; --muted-2: #555555; --line: #1a1a1a; --line-strong: #2a2a2a;
  --accent: #4a9eff; --green: #55d66b; --yellow: #e6d55a; --red: #ff6b6b;
  --term-bg: #000000; --term-active-bg: #101010; --term-border: #1a1a1a; --term-text: #d8d8d8; --term-muted: #555555; --term-prompt: #4a9eff;
  --term-cmd: #55d66b; --term-str: #e6d55a;
}
[data-palette="tokyo-night"] {
  --bg: #1a1b26; --bg-elevated: #202331; --ink: #d5dcff; --ink-soft: #c0caf5;
  --muted: #737aa2; --muted-2: #565f89; --line: #2f3549; --line-strong: #414868;
  --accent: #7aa2f7; --green: #9ece6a; --yellow: #e0af68; --red: #f7768e;
  --term-bg: #1a1b26; --term-active-bg: #24283b; --term-border: #2f3549; --term-text: #c0caf5; --term-muted: #565f89; --term-prompt: #7aa2f7;
  --term-cmd: #9ece6a; --term-str: #e0af68;
}
[data-palette="tokyo-night-day"] {
  --bg: #e1e2e7; --bg-elevated: #d8d9e0; --ink: #1f2f66; --ink-soft: #3760bf;
  --muted: #68709a; --muted-2: #8990b3; --line: #b6bbd1; --line-strong: #a8aecb;
  --accent: #2e7de9; --green: #587539; --yellow: #8c6c3e; --red: #f52a65;
  --term-bg: #e1e2e7; --term-active-bg: #c4c8da; --term-border: #b6bbd1; --term-text: #3760bf; --term-muted: #8990b3; --term-prompt: #2e7de9;
  --term-cmd: #587539; --term-str: #8c6c3e;
}
[data-palette="dracula"] {
  --bg: #282a36; --bg-elevated: #303241; --ink: #ffffff; --ink-soft: #f8f8f2;
  --muted: #8a91b4; --muted-2: #6272a4; --line: #44475a; --line-strong: #6272a4;
  --accent: #bd93f9; --green: #50fa7b; --yellow: #f1fa8c; --red: #ff5555;
  --term-bg: #282a36; --term-active-bg: #383a4a; --term-border: #44475a; --term-text: #f8f8f2; --term-muted: #6272a4; --term-prompt: #bd93f9;
  --term-cmd: #50fa7b; --term-str: #f1fa8c;
}
[data-palette="nord"] {
  --bg: #2e3440; --bg-elevated: #343b49; --ink: #ffffff; --ink-soft: #eceff4;
  --muted: #8792a8; --muted-2: #5f6a80; --line: #434c5e; --line-strong: #4c566a;
  --accent: #88c0d0; --green: #a3be8c; --yellow: #ebcb8b; --red: #bf616a;
  --term-bg: #2e3440; --term-active-bg: #3b4252; --term-border: #434c5e; --term-text: #eceff4; --term-muted: #5f6a80; --term-prompt: #88c0d0;
  --term-cmd: #a3be8c; --term-str: #ebcb8b;
}
[data-palette="gruvbox"] {
  --bg: #282828; --bg-elevated: #32302f; --ink: #fbf1c7; --ink-soft: #ebdbb2;
  --muted: #a89984; --muted-2: #928374; --line: #504945; --line-strong: #665c54;
  --accent: #d79921; --green: #b8bb26; --yellow: #fabd2f; --red: #fb4934;
  --term-bg: #282828; --term-active-bg: #3c3836; --term-border: #504945; --term-text: #ebdbb2; --term-muted: #928374; --term-prompt: #d79921;
  --term-cmd: #b8bb26; --term-str: #fabd2f;
}
[data-palette="gruvbox-light"] {
  --bg: #fbf1c7; --bg-elevated: #f2e5bc; --ink: #282828; --ink-soft: #3c3836;
  --muted: #665c54; --muted-2: #928374; --line: #d5c4a1; --line-strong: #bdae93;
  --accent: #076678; --green: #79740e; --yellow: #b57614; --red: #9d0006;
  --term-bg: #fbf1c7; --term-active-bg: #ebdbb2; --term-border: #d5c4a1; --term-text: #3c3836; --term-muted: #928374; --term-prompt: #076678;
  --term-cmd: #79740e; --term-str: #b57614;
}
[data-palette="one-dark"] {
  --bg: #282c34; --bg-elevated: #2c313a; --ink: #d7dae0; --ink-soft: #abb2bf;
  --muted: #7f848e; --muted-2: #5c6370; --line: #3e4451; --line-strong: #4b5263;
  --accent: #61afef; --green: #98c379; --yellow: #e5c07b; --red: #e06c75;
  --term-bg: #282c34; --term-active-bg: #323842; --term-border: #3e4451; --term-text: #abb2bf; --term-muted: #5c6370; --term-prompt: #61afef;
  --term-cmd: #98c379; --term-str: #e5c07b;
}
[data-palette="one-light"] {
  --bg: #fafafa; --bg-elevated: #f5f5f6; --ink: #202228; --ink-soft: #383a42;
  --muted: #686b77; --muted-2: #a0a1a7; --line: #e5e5e6; --line-strong: #d5d7de;
  --accent: #4078f2; --green: #50a14f; --yellow: #c18401; --red: #e45649;
  --term-bg: #fafafa; --term-active-bg: #f0f0f1; --term-border: #e5e5e6; --term-text: #383a42; --term-muted: #a0a1a7; --term-prompt: #4078f2;
  --term-cmd: #50a14f; --term-str: #c18401;
}
[data-palette="solarized"] {
  --bg: #002b36; --bg-elevated: #073642; --ink: #eee8d5; --ink-soft: #93a1a1;
  --muted: #839496; --muted-2: #586e75; --line: #164a57; --line-strong: #586e75;
  --accent: #268bd2; --green: #859900; --yellow: #b58900; --red: #dc322f;
  --term-bg: #002b36; --term-active-bg: #0b3d4a; --term-border: #164a57; --term-text: #93a1a1; --term-muted: #586e75; --term-prompt: #268bd2;
  --term-cmd: #859900; --term-str: #b58900;
}
[data-palette="solarized-light"] {
  --bg: #fdf6e3; --bg-elevated: #eee8d5; --ink: #073642; --ink-soft: #657b83;
  --muted: #586e75; --muted-2: #93a1a1; --line: #d6ceb8; --line-strong: #93a1a1;
  --accent: #268bd2; --green: #859900; --yellow: #b58900; --red: #dc322f;
  --term-bg: #fdf6e3; --term-active-bg: #e6dec8; --term-border: #d6ceb8; --term-text: #657b83; --term-muted: #93a1a1; --term-prompt: #268bd2;
  --term-cmd: #859900; --term-str: #b58900;
}
[data-palette="kanagawa"] {
  --bg: #1f1f28; --bg-elevated: #252532; --ink: #f3ead3; --ink-soft: #dcd7ba;
  --muted: #8f8d80; --muted-2: #727169; --line: #363646; --line-strong: #54546d;
  --accent: #7e9cd8; --green: #76946a; --yellow: #c0a36e; --red: #c34043;
  --term-bg: #1f1f28; --term-active-bg: #2a2a37; --term-border: #363646; --term-text: #dcd7ba; --term-muted: #727169; --term-prompt: #7e9cd8;
  --term-cmd: #76946a; --term-str: #c0a36e;
}
[data-palette="kanagawa-lotus"] {
  --bg: #f2ecbc; --bg-elevated: #e5ddb0; --ink: #2a2a37; --ink-soft: #545464;
  --muted: #77736a; --muted-2: #a09cac; --line: #cbcbd1; --line-strong: #b7b2a0;
  --accent: #4d699b; --green: #6f894e; --yellow: #77713f; --red: #c84053;
  --term-bg: #f2ecbc; --term-active-bg: #dcd5ac; --term-border: #cbcbd1; --term-text: #545464; --term-muted: #a09cac; --term-prompt: #4d699b;
  --term-cmd: #6f894e; --term-str: #77713f;
}
[data-palette="rose-pine"] {
  --bg: #191724; --bg-elevated: #1f1d2e; --ink: #f4f0ff; --ink-soft: #e0def4;
  --muted: #908caa; --muted-2: #6e6a86; --line: #312f45; --line-strong: #403d52;
  --accent: #c4a7e7; --green: #9ccfd8; --yellow: #f6c177; --red: #eb6f92;
  --term-bg: #191724; --term-active-bg: #26233a; --term-border: #312f45; --term-text: #e0def4; --term-muted: #6e6a86; --term-prompt: #c4a7e7;
  --term-cmd: #9ccfd8; --term-str: #f6c177;
}
[data-palette="rose-pine-dawn"] {
  --bg: #faf4ed; --bg-elevated: #f2e9e1; --ink: #191724; --ink-soft: #464261;
  --muted: #797593; --muted-2: #9893a5; --line: #e6ded7; --line-strong: #d8d0ca;
  --accent: #907aa9; --green: #56949f; --yellow: #ea9d34; --red: #b4637a;
  --term-bg: #faf4ed; --term-active-bg: #fffaf3; --term-border: #e6ded7; --term-text: #464261; --term-muted: #9893a5; --term-prompt: #907aa9;
  --term-cmd: #56949f; --term-str: #ea9d34;
}
[data-palette="vesper"] {
  --bg: #101010; --bg-elevated: #1a1a1a; --ink: #ffffff; --ink-soft: #ffffff;
  --muted: #7e7e7e; --muted-2: #5c5c5c; --line: #282828; --line-strong: #343434;
  --accent: #ffc799; --green: #99ffe4; --yellow: #ffc799; --red: #ff8080;
  --term-bg: #101010; --term-active-bg: #232323; --term-border: #282828; --term-text: #ffffff; --term-muted: #5c5c5c; --term-prompt: #ffc799;
  --term-cmd: #99ffe4; --term-str: #ffc799;
}

[data-palette="herdr"],
[data-palette="catppuccin"],
[data-palette="terminal"],
[data-palette="tokyo-night"],
[data-palette="dracula"],
[data-palette="nord"],
[data-palette="gruvbox"],
[data-palette="one-dark"],
[data-palette="solarized"],
[data-palette="kanagawa"],
[data-palette="rose-pine"],
[data-palette="vesper"] {
  --logo-filter: invert(1) hue-rotate(180deg) brightness(1.08) contrast(0.9) saturate(1.05);
  --logo-opacity: 0.72;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
}

img, video {
    max-width: 100%;
    display: block;
}

button, a {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: var(--accent);
}

code, pre, kbd, samp {
    font-family: var(--mono);
}

::selection {
    background: var(--accent-soft);
}

/* ===== Header / Nav ===== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(12px);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    border-bottom: 1px solid var(--line);
}

.nav {
    /* Positioned so .nav-menu-panel can anchor to the whole bar — anchoring
       to the hamburger itself pushes the panel off-screen on narrow
       viewports (the button sits left of the nav-tools icon row). */
    position: relative;
    max-width: var(--max);
    margin: 0 auto;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--mono);
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--ink);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    color: var(--muted);
    font-size: 0.9rem;
    font-family: var(--mono);
}

/* Blinking block cursor marks the current page in the nav. */
.nav-links a[aria-current="page"]::after,
.nav-menu-panel a[aria-current="page"]::after {
    content: "";
    display: inline-block;
    width: 0.55ch;
    height: 1em;
    margin-left: 0.35ch;
    vertical-align: middle;
    transform: translateY(-0.08em);
    background: var(--accent);
    animation: type-cursor-blink 0.9s step-start infinite;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
    color: var(--accent);
}

.nav-menu {
    display: none;
    margin-left: auto;
}

.nav-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.22rem;
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--ink-soft);
    cursor: pointer;
    list-style: none;
    transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.nav-menu-button::-webkit-details-marker { display: none; }
.nav-menu-button::marker { content: ""; }

.nav-menu-button span {
    display: block;
    width: 0.92rem;
    height: 1px;
    background: currentColor;
}

.nav-menu-button:hover,
.nav-menu[open] .nav-menu-button {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
    background: var(--accent-soft);
}

.nav-menu-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 1.25rem;
    z-index: 30;
    display: grid;
    min-width: min(18rem, calc(100vw - 2rem));
    padding: 0.35rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.16);
}

.nav-menu-panel a {
    border-radius: var(--radius-sm);
    padding: 0.62rem 0.7rem;
    color: var(--ink-soft);
    font-family: var(--mono);
    font-size: 0.86rem;
    font-weight: 600;
}

.nav-menu-panel a:hover,
.nav-menu-panel a[aria-current="page"] {
    background: var(--accent-soft);
    color: var(--accent);
}

.nav-tools {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.nav-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--muted);
    transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.nav-icon-link:hover {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
    background: var(--accent-soft);
}

.nav-icon-link svg {
    width: 1rem;
    height: 1rem;
}

/* Solid glyphs (GitHub, LinkedIn) take the fill; stroke-drawn icons
   (email envelope, search magnifier) declare fill="none" and keep it. */
.nav-icon-link svg:not([fill="none"]) {
    fill: currentColor;
}

/* ===== Theme hint + overlay ===== */

.theme-hint {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    z-index: 30;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(8px);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.12s ease, color 0.12s ease;
}

.theme-hint::after {
    content: "";
    position: absolute;
    inset: -4px;
    border: 1px solid var(--accent);
    border-radius: calc(var(--radius-md) + 4px);
    opacity: 0;
    pointer-events: none;
}

.theme-hint:not(.is-seen)::after {
    animation: theme-hint-pulse 3.6s ease-in-out infinite;
}

.theme-hint:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.theme-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(1px);
}

.theme-overlay[hidden] { display: none; }

.theme-overlay-panel {
    width: min(480px, calc(100vw - 2rem));
    max-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 2px solid var(--accent);
    border-radius: 2px;
    background: var(--term-bg);
    font-family: var(--mono);
    color: var(--term-text);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

.theme-overlay-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.8rem 0.6rem;
    scrollbar-width: thin;
    scrollbar-color: var(--term-border) transparent;
}

.theme-overlay-list::-webkit-scrollbar { width: 5px; }
.theme-overlay-list::-webkit-scrollbar-thumb {
    background: var(--term-border);
    border-radius: 1px;
}

.theme-sep {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.8rem;
    margin-top: 0.3rem;
    color: var(--term-muted);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    pointer-events: none;
    user-select: none;
}

.theme-sep:first-child { margin-top: 0; }

.theme-overlay-list button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.35rem 0.8rem;
    border: 0;
    border-radius: 1px;
    background: transparent;
    color: var(--term-text);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.5;
}

.theme-overlay-list button:hover,
.theme-overlay-list button:focus-visible {
    outline: none;
    background: var(--term-active-bg);
    color: var(--term-text);
}

.theme-overlay-list button[aria-selected="true"] {
    background: var(--term-active-bg);
    color: var(--term-text);
    font-weight: 700;
}

.theme-overlay-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 1rem;
    border-top: 1px solid var(--term-border);
    color: var(--term-muted);
    font-size: 0.72rem;
    font-weight: 400;
}

.theme-overlay-actions {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.theme-overlay-footer .key {
    color: var(--term-muted);
    font-weight: 700;
}

.theme-close-btn {
    border: 0;
    border-radius: 1px;
    background: var(--term-active-bg);
    color: var(--term-muted);
    padding: 0.15rem 0.5rem;
    font-family: inherit;
    font-size: inherit;
    font-weight: 700;
    cursor: pointer;
}

.theme-close-btn:hover,
.theme-close-btn:focus-visible {
    outline: none;
    color: var(--term-text);
    background: var(--term-border);
}

/* ===== Search overlay ===== */

button.nav-icon-link {
    padding: 0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
}

.search-input-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--term-border);
}

.search-prompt {
    color: var(--term-prompt);
    font-weight: 700;
    flex: none;
}

.search-input-row input {
    flex: 0 1 auto;
    field-sizing: content;
    min-width: 1px;
    max-width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--term-text);
    /* The block .search-caret next to the input replaces the native caret. */
    caret-color: transparent;
    font-family: inherit;
    font-size: 0.9rem;
}

.search-input-row input::-webkit-search-cancel-button {
    display: none;
}

.search-caret {
    flex: none;
    width: 0.55ch;
    height: 1.05em;
    /* Cancel the row's flex gap so the block hugs the typed text. */
    margin-left: -0.55rem;
    background: var(--term-prompt);
    animation: type-cursor-blink 0.9s step-start infinite;
}

.search-results {
    flex: 1;
    min-height: 9rem;
    max-height: 50vh;
    overflow-y: auto;
    /* Keep wheel/trackpad/touch scrolling inside the panel instead of
       chaining to the page behind the overlay. */
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scrollbar-gutter: stable;
    padding: 0.6rem;
    scrollbar-width: thin;
    scrollbar-color: var(--term-muted) var(--term-active-bg);
}

.search-results::-webkit-scrollbar { width: 8px; }
.search-results::-webkit-scrollbar-track {
    background: var(--term-active-bg);
    border-radius: 4px;
}
.search-results::-webkit-scrollbar-thumb {
    background: var(--term-muted);
    border-radius: 4px;
}
.search-results::-webkit-scrollbar-thumb:hover {
    background: var(--term-text);
}

.search-result {
    display: block;
    padding: 0.5rem 0.8rem;
    border-radius: 1px;
    text-decoration: none;
}

.search-result:hover,
.search-result:focus-visible,
.search-result[aria-selected="true"] {
    outline: none;
    background: var(--term-active-bg);
}

.search-result-title {
    display: block;
    color: var(--term-text);
    font-size: 0.85rem;
    font-weight: 700;
}

.search-result-excerpt {
    display: block;
    margin-top: 0.15rem;
    color: var(--term-muted);
    font-size: 0.75rem;
    line-height: 1.55;
}

.search-result-excerpt mark {
    background: transparent;
    color: var(--term-str, var(--accent));
    font-weight: 700;
}

.search-empty {
    margin: 0;
    padding: 1rem 0.8rem;
    color: var(--term-muted);
    font-size: 0.8rem;
}

/* ===== Layout ===== */

.section {
    max-width: var(--max);
    margin: 0 auto;
    padding-inline: 1.25rem;
}

.section {
    padding-top: 5rem;
    padding-bottom: 5rem;
    border-top: 1px solid var(--line);
}

/* ===== Status dots ===== */

.eyebrow {
    margin: 0 0 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
}

.status-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    flex: 0 0 auto;
}

.dot-blue { background: var(--accent); }

/* ===== Buttons ===== */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.6rem;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-md);
    font-family: var(--mono);
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid transparent;
    transition: all 0.12s ease;
}

.button-primary {
    background: var(--ink);
    color: var(--bg);
}

.button-primary:hover {
    background: var(--accent);
    color: #fff;
}

.button-secondary {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--ink-soft);
}

.button-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

/* ===== Hero ===== */

.hero-lede {
    max-width: 600px;
    margin: 1.25rem 0 0;
    color: var(--ink-soft);
    font-size: clamp(1rem, 1.8vw, 1.18rem);
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.75rem;
}

/* ===== Page hero (commits, init) ===== */

.content-shell {
    padding-bottom: 5rem;
}

.page-hero {
    max-width: var(--max);
    margin: 0 auto;
    padding: 5rem 1.25rem 2.25rem;
}

.page-hero h1 {
    max-width: 14ch;
    margin: 0;
    color: var(--ink);
    font-family: var(--mono);
    font-weight: 400;
    font-size: clamp(2.8rem, 7vw, 6rem);
    line-height: 0.92;
    letter-spacing: -0.07em;
}

.page-hero .hero-lede {
    max-width: 680px;
    color: var(--muted);
}

/* ===== Blog post list ===== */

.post-list {
    display: grid;
}

/* Lines act as separators between posts, not around the list —
   the section border above and footer border below frame it already. */
.post-card + .post-card {
    border-top: 1px solid var(--line);
}

/* Git-tag badge on the newest commit in the log. */
.tag-latest {
    display: inline-block;
    margin-left: 0.7rem;
    padding: 0.12rem 0.6rem;
    border: 1px solid var(--accent);
    border-radius: 999px;
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    vertical-align: middle;
    transform: translateY(-0.15em);
}

/* Recent commits on main: the same branch-line tree as the post-page TOC.
   One line per commit, node on the line, Init as the root at the bottom. */
.commit-tree {
    display: grid;
    gap: 1.15rem;
    margin-left: 5px;
    border-left: 2px solid var(--line);
    font-family: var(--mono);
}

.commit-tree a {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.3rem 1rem;
    padding-left: 1.25rem;
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.45;
    text-decoration: none;
}

.commit-tree a::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 0.28em;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
    background: var(--bg);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.commit-tree a:hover {
    color: var(--accent);
}

.commit-tree a:hover::before {
    border-color: var(--accent);
}

/* The branch label heads the tree: filled node on the same line, like the
   company labels once were. */
.commit-tree .commit-tree-head {
    color: var(--accent);
    font-size: 0.95rem;
}

.commit-tree .commit-tree-head::before {
    left: -7px;
    top: 0.24em;
    width: 12px;
    height: 12px;
    border-color: var(--accent);
    background: var(--accent);
}

.commit-tree .commit-tree-head:hover {
    text-decoration: underline;
}

.commit-tree-date {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.post-card-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.45rem 0;
    text-decoration: none;
}

.post-card h2 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(1.45rem, 3vw, 2.05rem);
    font-family: var(--mono);
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.055em;
    transition: color 0.16s ease;
}

.post-card p {
    max-width: 680px;
    margin: 0.55rem 0 0;
    color: color-mix(in srgb, var(--ink) 62%, var(--muted));
    line-height: 1.55;
}

.post-card-meta {
    margin: 0.4rem 0 0;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 600;
}


.post-card:hover h2 {
    color: var(--accent);
}

/* ===== Article layout ===== */

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
    margin: 0 0 0.85rem;
    color: color-mix(in srgb, var(--ink) 58%, var(--muted));
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    text-transform: uppercase;
}

.post-meta > * + *::before {
    content: "/";
    margin-right: 0.55rem;
    color: var(--line-strong);
}

.article-layout {
    position: relative;
    display: grid;
    grid-template-columns: minmax(8rem, 12rem) minmax(0, 860px);
    gap: clamp(2rem, 6vw, 4rem);
    align-items: start;
    padding-top: 4rem;
    /* Sits directly under the sticky header's border — avoid a double line. */
    border-top: 0;
}

.article-shell {
    min-width: 0;
}

.article-toc {
    position: sticky;
    top: 6rem;
    padding-top: 0.35rem;
    color: color-mix(in srgb, var(--ink) 58%, var(--muted));
    font-family: var(--mono);
    font-size: 0.78rem;
}

/* Git-tree TOC: a branch line with one node per section; the node of the
   section currently in view fills with the accent color (scroll spy sets
   aria-current on the links). */
.article-toc nav {
    display: grid;
    gap: 0.9rem;
    margin-left: 5px;
    border-left: 2px solid var(--line);
}

.article-toc a {
    position: relative;
    padding-left: 1.1rem;
    color: color-mix(in srgb, var(--ink) 58%, var(--muted));
    line-height: 1.35;
    text-decoration: none;
}

.article-toc a::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 0.22em;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
    background: var(--bg);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.article-toc a:hover,
.article-toc a[aria-current="true"] {
    color: var(--accent);
}

.article-toc a:hover::before {
    border-color: var(--accent);
}

.article-toc a[aria-current="true"]::before {
    border-color: var(--accent);
    background: var(--accent);
}

.article-header {
    margin-bottom: 2.35rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--line);
}

.article-header h1 {
    max-width: 22ch;
    margin: 0;
    color: var(--ink);
    font-family: var(--mono);
    font-weight: 400;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1;
    letter-spacing: -0.055em;
}

.article-header p:last-child {
    max-width: 680px;
    margin: 1.2rem 0 0;
    color: color-mix(in srgb, var(--ink) 68%, var(--muted));
    font-size: 1.18rem;
    line-height: 1.7;
}

.article-prose {
    color: var(--ink);
    font-size: 1.04rem;
    line-height: 1.82;
}

.article-prose > *:first-child { margin-top: 0; }

.article-prose h1,
.article-prose h2,
.article-prose h3 {
    color: var(--ink);
    line-height: 1.05;
    letter-spacing: -0.04em;
    font-family: var(--mono);
    font-weight: 400;
}

.article-prose h1 {
    margin: 2.3rem 0 1rem;
    font-size: clamp(2rem, 5vw, 3.5rem);
}

.article-prose h2 {
    margin: 2.2rem 0 0.75rem;
    font-size: clamp(1.55rem, 3vw, 2.2rem);
}

.article-prose h3 {
    margin: 1.7rem 0 0.65rem;
    font-size: 1.25rem;
}

.article-prose p,
.article-prose ul,
.article-prose ol {
    margin: 1rem 0;
}

.article-prose ul,
.article-prose ol {
    padding-left: 1.35rem;
}

.article-prose li + li { margin-top: 0.42rem; }

.article-prose blockquote {
    margin: 1.2rem 0;
    border-left: 2px solid color-mix(in srgb, var(--accent) 72%, var(--line));
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--bg-elevated) 46%, transparent);
    padding: 0.72rem 0.95rem;
    color: color-mix(in srgb, var(--ink) 76%, var(--muted));
    font-size: 1.06rem;
    font-weight: 560;
    line-height: 1.7;
}

.article-prose blockquote p { margin: 0; }

.article-prose a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

.article-prose code {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--ink);
    padding: 0.08rem 0.28rem;
    font-size: 0.9em;
}

.article-prose pre {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    color: var(--ink);
    padding: 1rem;
}

/* Shiki (theme: 'css-variables') token colors, mapped onto the palette
   variables so syntax highlighting follows the active theme. */
:root {
    --astro-code-foreground: var(--ink-soft);
    --astro-code-background: var(--bg-elevated);
    --astro-code-token-constant: var(--accent);
    --astro-code-token-string: var(--term-str);
    --astro-code-token-string-expression: var(--term-str);
    --astro-code-token-comment: var(--muted-2);
    --astro-code-token-keyword: var(--red);
    --astro-code-token-parameter: var(--ink-soft);
    --astro-code-token-function: var(--term-cmd);
    --astro-code-token-punctuation: var(--muted);
    --astro-code-token-link: var(--accent);
}

.article-prose pre code {
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0;
}

.article-comments {
    margin-top: 3.2rem;
    padding-top: 2.2rem;
    border-top: 1px solid var(--line);
}


/* ===== Init (about) page ===== */

.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.4fr);
    gap: 4rem;
    align-items: start;
}

/* About card mirrors the Education sidebar card. */
.about-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    padding: 1.5rem;
}

.about-card h3 {
    margin: 0 0 1rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--muted);
}

.about-prose p {
    margin: 0 0 1.2rem;
    max-width: 62ch;
    color: color-mix(in srgb, var(--ink) 82%, var(--muted));
    font-size: 1rem;
    line-height: 1.75;
}

.about-prose p:last-child {
    margin-bottom: 0;
}

.sidebar-card {
    position: sticky;
    top: 6rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    padding: 1.5rem;
}

.sidebar-card h3 {
    margin: 0 0 1rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--muted);
}

.edu-entry {
    margin-bottom: 1rem;
}

.edu-entry:last-child { margin-bottom: 0; }

.edu-degree {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--ink);
}

.edu-school {
    margin: 0.15rem 0 0;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--muted);
}

/* Skills marquee at the bottom of init: one long strip of mono tags
   scrolling continuously, faded at both edges. */
.skills-marquee {
    /* Constrained to the content column so its top border lines up with
       the section dividers above it. */
    max-width: var(--max);
    margin: 4.5rem auto 0;
    padding: 1.2rem 1.25rem;
    border-top: 1px solid var(--line);
    overflow: hidden;
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.skills-track {
    display: flex;
    width: max-content;
    animation: skills-scroll 70s linear infinite;
}

/* Spacing lives on the items (not flex gap) so the track's second half is
   exactly as wide as the first and the -50% loop point is invisible. */
.skills-item {
    padding-right: 2.4rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    transition: color 0.15s ease;
}

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

.skills-marquee:hover .skills-track {
    animation-play-state: paused;
}

@keyframes skills-scroll {
    to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
    .skills-track {
        animation: none;
        width: auto;
        flex-wrap: wrap;
        gap: 0.5rem 0;
    }
}

/* ===== Footer ===== */

/* Full-bleed top border mirrors the header's bottom border, framing the
   page; the content inside stays centered. */
.footer {
    padding: 1.75rem 1.25rem;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.85rem;
    font-family: var(--mono);
}


.inline-links a:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}


/* ===== Animations ===== */

@keyframes theme-hint-pulse {
    0%, 70%, 100% { opacity: 0; transform: scale(1); }
    78% { opacity: 0.45; transform: scale(1.06); }
    88% { opacity: 0; transform: scale(1.13); }
}

@keyframes type-cursor-blink {
    50% { opacity: 0; }
}

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

.empty-note {
    color: var(--muted);
    font-family: var(--mono);
}

.section > .hero-actions {
    margin-top: 2.25rem;
}

/* ===== Responsive ===== */

@media (max-width: 860px) {
    .nav-links { display: none; }
    .nav-menu { display: block; }

    .about-grid {
        display: block;
    }

    .sidebar-card {
        position: static;
        margin-top: 3rem;
    }
}

@media (max-width: 1040px) {
    .article-layout {
        display: block;
        max-width: 860px;
    }

    .article-toc {
        display: none;
    }
}

/* Phones: tighten the big desktop whitespace so pages start (and sections
   meet) closer to the viewport. */
@media (max-width: 640px) {
    .page-hero {
        padding-top: 2.75rem;
        padding-bottom: 1.75rem;
    }

    .section {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    .content-shell {
        padding-bottom: 3rem;
    }

    .article-layout {
        padding-top: 2.25rem;
    }

    .skills-marquee {
        margin-top: 3rem;
    }

    .nav-tools {
        gap: 0.35rem;
    }
}

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

    .theme-hint::after { display: none; }
}
