/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --accent:       #7a1414;
    --accent-dim:   #581010;
    --fg:           #1f2123;
    --fg-mid:       rgba(31,33,35,0.78);
    --fg-dim:       rgba(31,33,35,0.66);
    --bg:           #f6f6f5;
    --bg-tag:       #ebebea;
    --bg-pre:       #ebebea;
    --border:       rgba(31,33,35,0.12);
    --border-strong: rgba(31,33,35,0.24);
    --link:         #4b5866;
    --ok:           #117236;
    --warn:         #9a5b00;
    --err:          #b91c1c;
    --on-accent:    #ffffff;        /* text on filled accent backgrounds */
    --focus:        #1d4ed8;
    --font:         system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono:    ui-monospace, 'SF Mono', Menlo, 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
    --max-w:        min(88%, 1220px);
    --measure:      72ch;           /* comfortable line length for prose */
    --pad-x:        24px;
    /* type scale — nothing interactive or informative goes below --fs-xs (12px) */
    --fs-xs:        0.75rem;
    --fs-sm:        0.875rem;
    --fs-md:        1rem;
    --fs-lg:        1.125rem;
    --tap:          44px;           /* minimum touch target */
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; scroll-padding-top: 64px; }

body {
    background: var(--bg);
    overflow-x: clip;
    color: var(--fg);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-variant-numeric: tabular-nums;
}

/* ─── Site header & menu ─────────────────────────────────────────────────────── */
/* Desktop: mark + five content sections inline, utility hosts behind "infra",
   language + theme on the right. Phone: mark + controls + "menu", which opens
   one grouped list where every item says what is behind it. */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.sh-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--pad-x);
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 1.6rem;
}

.sh-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 44px;
    color: var(--fg);
    border-bottom: none;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
    flex-shrink: 0;
}
.sh-brand:hover { color: var(--fg); }
.sh-mark {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1.5px solid var(--fg);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sh-brand:hover .sh-mark,
.sh-brand[aria-current="page"] .sh-mark { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.sh-nav { display: flex; align-items: center; gap: 0.2rem; flex: 0 0 auto; }
.sh-main, .sh-infra { list-style: none; }
.sh-main { display: flex; align-items: center; gap: 0.1rem; }
.sh-group-title { display: none; }

.sh-main a,
.sh-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 40px;
    padding: 0 0.6rem;
    border: none;
    border-radius: 3px;
    background: none;
    color: var(--fg-mid);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}
.sh-main a:hover, .sh-more-btn:hover { color: var(--fg); background: var(--bg-tag); }
.sh-main .sh-desc { display: none; }
.sh-main a[aria-current="page"],
.sh-more.has-current > .sh-more-btn {
    color: var(--fg);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.55em;
}

.sh-more { position: relative; }
.sh-caret {
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.15s;
}
.sh-more.is-open .sh-caret { transform: translateY(1px) rotate(-135deg); }
.sh-infra {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 290px;
    padding: 0.35rem;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
    z-index: 110;
}
.sh-more.is-open .sh-infra { display: block; }
html:not(.js) .sh-more:hover .sh-infra,
html:not(.js) .sh-more:focus-within .sh-infra { display: block; }
.sh-infra a {
    display: grid;
    gap: 0.1rem;
    padding: 0.55rem 0.7rem;
    border-bottom: none;
    color: var(--fg);
    border-radius: 2px;
}
.sh-infra a:hover { background: var(--bg-tag); color: var(--fg); }
.sh-infra a[aria-current="page"] .sh-label { color: var(--accent); }
.sh-label { font-size: 0.875rem; }
.sh-desc { font-size: var(--fs-xs); color: var(--fg-dim); white-space: normal; }

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

/* Compact header (button + panel) is switched on by the inline script right
   after the header in base.html — not by a fixed breakpoint — whenever the
   menu does not fit on one line: narrow screens, but also long Russian labels,
   browser zoom or a large default font. */
.site-header.is-compact .sh-inner { min-height: 52px; gap: 0.8rem; position: relative; }
.site-header.is-compact .sh-menu-btn {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    background: none;
    color: var(--fg);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
}
.site-header.is-compact .sh-menu-btn[aria-expanded="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* the panel */
.site-header.is-compact .sh-nav { display: none; }
.site-header.is-compact.menu-open .sh-nav {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - 52px);
    overflow-y: auto;
    padding: 0.6rem var(--pad-x) 1.4rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border-strong);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.18);
}
.site-header.is-compact .sh-group-title {
    display: block;
    margin: 0.9rem 0 0.2rem;
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--accent);
    font-weight: 600;
}
.site-header.is-compact .sh-main { display: block; }
.site-header.is-compact .sh-main a,
.site-header.is-compact .sh-infra a {
    display: grid;
    gap: 0.1rem;
    min-height: 52px;
    align-content: center;
    padding: 0.45rem 0;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
    white-space: normal;
    background: none;
    color: var(--fg);
    text-decoration: none;
}
.site-header.is-compact .sh-main a:hover,
.site-header.is-compact .sh-infra a:hover { background: none; color: var(--accent); }
.site-header.is-compact .sh-main .sh-desc { display: block; }
.site-header.is-compact .sh-main a[aria-current="page"] .sh-label,
.site-header.is-compact .sh-infra a[aria-current="page"] .sh-label { color: var(--accent); }
.site-header.is-compact .sh-label { font-size: 1rem; }
.site-header.is-compact .sh-more-btn { display: none; }
.site-header.is-compact .sh-infra {
    display: block;
    position: static;
    min-width: 0;
    padding: 0;
    border: none;
    box-shadow: none;
}

/* Without JS nothing collapses: the menu simply wraps onto more lines. */
html:not(.js) .sh-inner { flex-wrap: wrap; padding-top: 0.3rem; padding-bottom: 0.3rem; }
html:not(.js) .sh-main { flex-wrap: wrap; }

@media (max-width: 420px) {
    .sh-name { display: none; }
}

/* ─── Legacy markup (ru.antonnovikov.com) ───────────────────────────────────── */
/* ru.antonnovikov.com runs on the separate ru node and links this stylesheet
   directly (unversioned URL) with the pre-2026-11 markup: .top-nav header and
   a plain <footer>. Keep those rules so the landing does not break whenever
   the main site's design changes. */

.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(246,246,245,0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    padding: 0;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: lowercase;
}

.top-nav-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 8px var(--pad-x);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    overflow: hidden;
}

.top-nav-links {
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

@media (max-width: 1024px) {
    .top-nav-inner {
        overflow: hidden;
        gap: 0;
        padding: 0;
    }
    .top-nav-links {
        flex: 1 1 0;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        min-width: 0;
        padding: 8px var(--pad-x);
        mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    }
    .top-nav-links::-webkit-scrollbar { display: none; }
    .top-nav .nav-right {
        flex-shrink: 0;
        padding: 8px var(--pad-x) 8px 0.8rem;
        border-left: 1px solid var(--border);
    }
}

.top-nav a {
    color: var(--fg-mid);
    text-decoration: none;
    transition: color 0.2s;
}

.top-nav a:hover { color: var(--accent); }
.top-nav a.nav-active { color: var(--accent); }

.top-nav .nav-sep {
    color: var(--fg-dim);
    margin: 0 0.6rem;
    user-select: none;
    flex-shrink: 0;
}


/* ─── Footer ──────────────────────────────────────────────────────────────────── */
footer:not(.site-footer) {
    text-align: center;
    color: var(--fg-dim);
    font-size: 0.78rem;
    padding: 2rem 0 1.6rem;
    flex-shrink: 0;
    letter-spacing: 0.03em;
    line-height: 2;
}

footer:not(.site-footer) .footer-nav { margin-top: 0.6rem; }

footer:not(.site-footer) .footer-nav a {
    color: var(--fg-dim);
    transition: color 0.2s;
    border-bottom: none;
}

footer:not(.site-footer) .footer-nav a:hover { color: var(--accent); }

footer:not(.site-footer) .footer-nav .separator {
    margin: 0 0.5rem;
    opacity: 0.4;
}

[data-theme="dark"] .top-nav { background: rgba(21,23,28,0.9); }
.top-nav .nav-right { gap: 0.7rem; margin-left: 0; }
footer:not(.site-footer) .footer-nav { display: block; margin: 0.6rem 0 0; }
footer:not(.site-footer) .footer-nav a { display: inline-flex; min-height: 40px; padding: 0 0.4rem; color: var(--fg-dim); }

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.site-main { flex: 1 0 auto; }

.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 40px var(--pad-x) 48px;
    width: 100%;
}

/* ─── Typography ──────────────────────────────────────────────────────────────── */
h1 {
    font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.3rem);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    line-height: 1.15;
    margin-top: 0.5rem;
    overflow-wrap: anywhere;
    hyphens: auto;
}

h2 {
    font-size: var(--fs-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--accent);
    margin-bottom: 1.4rem;
}

a {
    color: var(--fg);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

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

/* One focus ring for every interactive element: visible on both themes,
   only for keyboard focus (mouse clicks don't leave rings behind). */
:focus { outline: none; }
:focus-visible,
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    border-radius: 2px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 0;
}

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

/* ─── Header ──────────────────────────────────────────────────────────────────── */
header { margin-bottom: 0.5rem; }

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.header-text { flex: 1; }

.subtitle {
    margin-top: 0.4rem;
    font-size: 1rem;
    color: var(--fg-mid);
    letter-spacing: 0.04em;
}

.tagline {
    margin-top: 0.5rem;
    font-size: var(--fs-sm);
    max-width: var(--measure);
    color: var(--fg-dim);
    letter-spacing: 0.03em;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.hire-badge,
.connect-badge {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 2px;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    font-weight: 600;
    text-transform: uppercase;
    background: transparent;
    white-space: nowrap;
}

.hire-badge {
    color: var(--ok);
    border: 1px solid var(--ok);
}

.connect-badge {
    color: var(--fg-mid);
    border: 1px solid var(--border);
    cursor: pointer;
}

.connect-badge:hover {
    color: var(--accent);
    border-color: var(--accent);
}

@media (max-width: 720px) {
    .connect-badge { min-height: 40px; }
}

.header-links {
    margin-top: 1rem;
    font-size: var(--fs-sm);
    line-height: 2.6;
    letter-spacing: 0.03em;
}

.header-links a {
    color: var(--fg-mid);
    border-bottom: 1px solid var(--border);
    padding: 0.45rem 0 1px;
}

.header-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.header-links .sep {
    color: var(--fg-dim);
    margin: 0 0.45rem;
    user-select: none;
}

.header-avatar {
    width: 140px;
    height: 140px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    filter: grayscale(20%);
    transition: filter 0.3s, transform 0.3s;
}

.header-avatar:hover {
    filter: grayscale(0%);
    transform: translateY(-2px);
}

/* ─── Divider ─────────────────────────────────────────────────────────────────── */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.6rem 0;
}

/* ─── Section ─────────────────────────────────────────────────────────────────── */
.section { margin-bottom: 0.5rem; }

.section-sub {
    font-size: 0.9375rem;
    max-width: var(--measure);
    color: var(--fg-mid);
    margin: -0.6rem 0 1.3rem;
    line-height: 1.6;
    letter-spacing: 0.02em;
}

.featured-post { margin: 0 0 1.1rem; font-size: 0.9375rem; }
.featured-post a {
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    padding-bottom: 1px;
    letter-spacing: 0.02em;
}
.featured-post a:hover { border-bottom-color: var(--accent); }

/* ─── About ──────────────────────────────────────────────────────────────────── */
.about-text {
    font-size: 1.0625rem;
    color: var(--fg-mid);
    margin-bottom: 1.2rem;
    line-height: 1.7;
    max-width: var(--measure);
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: var(--fs-sm);
    color: var(--fg-dim);
    margin-bottom: 1.6rem;
    letter-spacing: 0.02em;
}

.highlights {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border: 1px solid var(--border);
}

.highlight-item {
    padding: 1.2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border-right: 1px solid var(--border);
}

.highlight-item:last-child { border-right: none; }

.highlight-num {
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--fg);
    line-height: 1;
}

.highlight-label {
    font-size: var(--fs-xs);
    color: var(--fg-dim);
    letter-spacing: 0.04em;
    line-height: 1.35;
}

/* ─── Stack Tags ──────────────────────────────────────────────────────────────── */
.stack-group {
    display: grid;
    grid-template-columns: 130px 1fr;
    align-items: start;
    gap: 0.6rem 1rem;
    margin-bottom: 0.85rem;
}

.stack-label {
    font-size: var(--fs-xs);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fg-dim);
    padding-top: 4px;
    line-height: 1.3;
}

.stack-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.stack-note {
    grid-column: 2;
    font-size: var(--fs-xs);
    color: var(--fg-dim);
    margin-top: 0.3rem;
    line-height: 1.4;
}

.tag {
    font-size: 0.8125rem;
    padding: 3px 9px;
    background: var(--bg-tag);
    border: 1px solid var(--border);
    letter-spacing: 0.02em;
    color: var(--fg);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
    cursor: default;
}

/* stack chips are plain text (spans), so they don't react to hover */

.tag.tag-sm {
    font-size: var(--fs-xs);
    padding: 2px 7px;
    color: var(--fg-mid);
    background: transparent;
}



/* Reset native <button> chrome for chips/controls converted from span/div to
   button for keyboard accessibility (blog + cheatsheet templates). Uses bare
   class/id selectors (not "button.foo") so specificity stays equal to the
   per-template rules that set background/border/color for these classes —
   those load after this stylesheet and win the cascade tie, preserving the
   existing look; this reset only fills in what they don't already set. */
.tag-chip, .pl-tag, .cs-tag, #search-clear, .clear-filters {
    font: inherit;
    background: none;
    border: 0;
    margin: 0;
    color: inherit;
    text-align: inherit;
    -webkit-appearance: none;
    appearance: none;
}

/* Core stack row — emphasised */
.stack-core .stack-label { color: var(--accent); }
.stack-core .tag {
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 500;
}

/* ─── Timeline / Experience ───────────────────────────────────────────────────── */
.timeline {
    position: relative;
    padding-left: 20px;
    border-left: 1px solid var(--border);
}

.job {
    position: relative;
    margin-bottom: 1.8rem;
    padding-left: 1.4rem;
}

.job::before {
    content: '';
    position: absolute;
    left: -25px;
    top: 6px;
    width: 7px;
    height: 7px;
    border: 1px solid var(--accent);
    background: var(--bg);
    transform: rotate(45deg);
}

.job:last-child { margin-bottom: 0; }

.job-meta {
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-bottom: 0.15rem;
}

.job-company {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.job-date {
    font-size: 0.8125rem;
    color: var(--fg-dim);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.job-role {
    font-size: var(--fs-xs);
    color: var(--accent);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.55rem;
}

.job-desc {
    font-size: 0.9688rem;
    color: var(--fg-mid);
    line-height: 1.7;
    max-width: var(--measure);
    margin-bottom: 0.7rem;
}

.job-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.job-tag {
    font-size: var(--fs-xs);
    color: var(--accent);
    letter-spacing: 0.04em;
    text-transform: lowercase;
    margin-left: 0.5rem;
    font-weight: normal;
}

.job-part {
    margin: 0 0 0.9rem;
    padding-left: 0.85rem;
    border-left: 2px solid var(--border);
}

.job-part:last-of-type { margin-bottom: 0.9rem; }

.job-part-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.2rem;
}

.job-part-name {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.job-part-note {
    font-size: var(--fs-xs);
    color: var(--accent);
    letter-spacing: 0.02em;
}

.job-part-date {
    font-size: 0.8125rem;
    color: var(--fg-dim);
    white-space: nowrap;
    margin-left: auto;
}

.job-part-desc {
    font-size: 0.9375rem;
    color: var(--fg-mid);
    line-height: 1.65;
    margin: 0;
}

.job-part-lead {
    font-size: 0.9375rem;
    max-width: var(--measure);
    color: var(--fg-mid);
    line-height: 1.6;
    font-style: italic;
    margin: 0 0 0.45rem;
}

.job-points {
    list-style: none;
    margin: 0;
    padding: 0;
}

.job-points {
    max-width: var(--measure);
}

.job-points li {
    position: relative;
    padding-left: 1rem;
    font-size: 0.9375rem;
    color: var(--fg-mid);
    line-height: 1.6;
    margin-bottom: 0.32rem;
}

.job-points li::before {
    content: '–';
    position: absolute;
    left: 0;
    color: var(--accent);
}

.job-points li:last-child { margin-bottom: 0; }

/* ─── Reading progress bar ────────────────────────────────────────────────────── */
#read-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: var(--accent);
    z-index: 9999;
    transition: width 0.1s linear;
    pointer-events: none;
}

/* ─── Scroll-to-top ───────────────────────────────────────────────────────────── */
#scroll-top {
    position: fixed;
    bottom: 1.6rem;
    right: 1.8rem;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--fg-mid);
    font: 0.78rem/1 var(--font);
    padding: 6px 10px;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, color 0.2s, border-color 0.2s;
    letter-spacing: 0.04em;
    z-index: 500;
}
#scroll-top { visibility: hidden; }
#scroll-top.visible { opacity: 1; pointer-events: auto; visibility: visible; }
#scroll-top:hover { color: var(--accent); border-color: var(--accent); }

/* ─── Latest posts (main page) ─────────────────────────────────────────────────── */
.latest-posts-list { list-style: none; padding: 0; }
.latest-posts-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
}
.latest-posts-list li:last-child { border-bottom: none; }
.latest-posts-list .lp-title {
    padding: 0.3rem 0;
    font-size: 1rem;
    color: var(--fg);
    border-bottom: none;
    flex: 1;
}
.latest-posts-list .lp-title:hover { color: var(--accent); }
.latest-posts-list .lp-date {
    font-size: 0.8125rem;
    color: var(--fg-dim);
    white-space: nowrap;
    flex-shrink: 0;
}
.latest-more {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 0 0.1rem;
    font-size: var(--fs-sm);
    color: var(--fg-dim);
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.04em;
}
.latest-more:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── Footer ──────────────────────────────────────────────────────────────────── */
.site-footer {
    flex-shrink: 0;
    margin-top: 2rem;
    border-top: 1px solid var(--border);
    color: var(--fg-dim);
    font-size: var(--fs-sm);
}
.sf-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 1.2rem var(--pad-x) 1.6rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem 1.5rem;
}
.footer-nav { display: flex; flex-wrap: wrap; margin: 0 -0.5rem; }
.footer-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 0.5rem;
    color: var(--fg-mid);
    border-bottom: none;
}
.footer-nav a:hover { color: var(--accent); }

/* ─── Contact Modal ───────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.55);
    align-items: center;
    justify-content: center;
}

.modal-box {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 2rem;
    max-width: 420px;
    width: 90%;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 0.6rem;
    right: 0.8rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--fg-dim);
    font-family: var(--font);
}

.modal-close:hover { color: var(--accent); }

.modal-title {
    margin: 0 0 1.2rem;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    font-weight: 600;
}

.modal-notice {
    font-size: 0.82rem;
    padding: 0.6rem 0.8rem;
    margin-bottom: 1.2rem;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: var(--fg);
}

.modal-notice a { color: var(--accent); }

.modal-label {
    display: block;
    margin-bottom: 1rem;
}

.modal-field-label {
    font-size: 0.8rem;
    color: var(--fg-dim);
    display: block;
    margin-bottom: 0.25rem;
}

.modal-field {
    width: 100%;
    padding: 0.45rem 0.6rem;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--fg);
    font: inherit;
}

textarea.modal-field { resize: vertical; }

.modal-status {
    font-size: 0.82rem;
    margin-bottom: 0.6rem;
    min-height: 1.2em;
}

.modal-submit {
    min-height: 40px;
    padding: 0.5rem 1.2rem;
    background: var(--accent);
    color: var(--on-accent);
    border: none;
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
}

.modal-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* ─── Shared components (design v2) ─────────────────────────────────────────── */
/* One small vocabulary reused by every page: page head, section title with a
   hairline, rows (meta column + text), buttons, chips, inputs, data tables,
   prose. Mono is reserved for meta: dates, counts, tags, labels. */

.page {                       /* standard page column */
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 40px var(--pad-x) 56px;
    width: 100%;
}
.page-head { margin-bottom: 2rem; max-width: 60rem; }
.eyebrow {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--accent);
    letter-spacing: 0.08em;
    text-transform: lowercase;
    margin-bottom: 0.5rem;
}
.page-head h1, .page-title {
    font-size: clamp(1.75rem, 1.2rem + 2vw, 2.6rem);
    font-weight: 650;
    letter-spacing: -0.015em;
    text-transform: none;
    line-height: 1.12;
    margin: 0;
    text-wrap: balance;
}
.lede, .page-head p.lede {
    margin-top: 0.8rem;
    max-width: var(--measure);
    font-size: 1.0625rem;
    color: var(--fg-mid);
    line-height: 1.6;
}

/* section title: small caps label + index + hairline to the right */
.sec-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 1.4rem;
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
}
.sec-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.sec-title .idx {
    font-family: var(--font-mono);
    letter-spacing: 0;
    color: var(--fg-dim);
    font-weight: 400;
}

.prose { max-width: var(--measure); color: var(--fg-mid); line-height: 1.7; margin-bottom: 0.9rem; }
.lead { max-width: var(--measure); font-size: 1.1875rem; line-height: 1.6; color: var(--fg); margin-bottom: 1rem; }
.muted { color: var(--fg-dim); }
.meta { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-dim); }

/* rows: list with a fixed meta column (date / count / icon) and text */
.rows { list-style: none; border-top: 1px solid var(--border); }
.rows li {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 1rem;
    align-items: baseline;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
}
.rows-meta { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--fg-dim); }
.rows a { color: var(--fg); border-bottom: none; }
.rows a:hover { color: var(--accent); }
.rows .is-featured a { color: var(--accent); }
@media (max-width: 520px) {
    .rows li { grid-template-columns: 1fr; gap: 0.15rem; }
}

/* buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 40px;
    padding: 0 1rem;
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    background: none;
    color: var(--fg);
    font: inherit;
    font-size: var(--fs-sm);
    letter-spacing: 0.01em;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.btn:hover { border-color: var(--fg); color: var(--fg); background: var(--bg-tag); }
.btn-primary { background: var(--fg); border-color: var(--fg); color: var(--bg); font-weight: 600; }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
@media (max-width: 720px) { .btn { min-height: 44px; } }

/* filter chips (interactive) */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 32px;
    padding: 0 0.7rem;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: none;
    color: var(--fg-mid);
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.chip:hover { color: var(--fg); border-color: var(--fg-mid); }
.chip[aria-pressed="true"], .chip.is-active { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.chip .count { font-family: var(--font-mono); font-size: var(--fs-xs); opacity: 0.75; }
@media (max-width: 720px) { .chip { min-height: 36px; } }

/* text inputs */
.input {
    width: 100%;
    min-height: 44px;
    padding: 0 0.85rem;
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    background: var(--bg);
    color: var(--fg);
    font: inherit;
    font-size: 1rem;
}
.input::placeholder { color: var(--fg-dim); }
.input:focus { border-color: var(--fg-mid); }

/* data tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th {
    text-align: left;
    font-weight: 400;
    font-size: var(--fs-xs);
    color: var(--fg-dim);
    letter-spacing: 0.04em;
    padding: 0.5rem 0.75rem 0.5rem 0;
    border-bottom: 1px solid var(--border-strong);
}
.table td { padding: 0.55rem 0.75rem 0.55rem 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* in-prose links are underlined at rest (colour alone is < 3:1 vs text) */
.prose a, .lead a, .md-body a, .lede a {
    color: var(--fg);
    border-bottom: none;
    text-decoration: underline;
    text-decoration-color: var(--border-strong);
    text-underline-offset: 3px;
}
.prose a:hover, .lead a:hover, .md-body a:hover, .lede a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* ─── Home (design v2) ───────────────────────────────────────────────────────── */
.home {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 48px var(--pad-x) 32px;
    display: grid;
    grid-template-columns: minmax(15rem, 19rem) minmax(0, 1fr);
    gap: 4.5rem;
    align-items: start;
}
.home-aside { align-self: stretch; }   /* full row height, so the inner block can stick */
.home-aside-inner { position: sticky; top: 88px; max-height: calc(100vh - 104px); overflow-y: auto; scrollbar-width: none; }
.home-aside-inner::-webkit-scrollbar { display: none; }
.home-id { display: grid; gap: 1rem; }
.home-avatar { width: 88px; height: 88px; border-radius: 4px; object-fit: cover; }
.home h1 {
    font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.1rem);
    letter-spacing: 0.07em;
    line-height: 1.1;
    margin: 0;
}
.home-role { margin-top: 0.5rem; color: var(--fg-mid); font-size: 1rem; }
.home-tagline { margin-top: 1rem; color: var(--fg-mid); font-size: var(--fs-sm); line-height: 1.6; }
.home-status {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin-top: 1.1rem;
    font-size: var(--fs-sm);
    color: var(--ok);
}
.home-status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(34,197,94,0.18); }
.home-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.2rem; }
.home-links { display: flex; flex-wrap: wrap; gap: 0 1rem; margin-top: 0.9rem; font-size: var(--fs-sm); }
.home-links a { display: inline-flex; align-items: center; min-height: 36px; color: var(--fg-mid); border-bottom: none; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.home-links a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.home-toc { margin-top: 2rem; border-top: 1px solid var(--border); padding-top: 0.6rem; }
.home-toc ol { list-style: none; }
.home-toc a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-height: 36px;
    color: var(--fg-dim);
    border-bottom: none;
    font-size: var(--fs-sm);
}
.home-toc .idx { font-family: var(--font-mono); font-size: var(--fs-xs); width: 1.4rem; }
.home-toc a::after { content: ''; flex: 0 0 0; height: 1px; background: var(--accent); transition: flex-basis 0.2s; }
.home-toc a:hover { color: var(--fg); }
.home-toc a[aria-current] { color: var(--fg); }
.home-toc a[aria-current]::after { flex-basis: 2rem; }
.home-where { margin-top: 1.4rem; font-size: var(--fs-xs); color: var(--fg-dim); font-family: var(--font-mono); }

.home-main { min-width: 0; }
.home-sec { padding-top: 0.4rem; margin-bottom: 4rem; scroll-margin-top: 72px; }
.home-sec:last-child { margin-bottom: 1rem; }

.facts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin-top: 2rem;
    border-top: 1px solid var(--border);
}
.facts > div { padding: 1rem 1rem 0 0; }
.facts dd {
    order: -1;
    font-size: clamp(1.8rem, 1.3rem + 1.6vw, 2.5rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.facts > div { display: flex; flex-direction: column; gap: 0.45rem; }
.facts dt { font-size: var(--fs-xs); color: var(--fg-dim); letter-spacing: 0.02em; line-height: 1.35; }

.stack { border-top: 1px solid var(--border); }
.stack-row {
    display: grid;
    grid-template-columns: 13rem 1fr;
    gap: 1.5rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
}
.stack-row dt { font-size: var(--fs-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-dim); padding-top: 0.2rem; line-height: 1.4; }
.stack-row dd { font-size: 0.9375rem; line-height: 1.7; color: var(--fg); }
.stack-row.is-core dt, .stack-row.is-core dd { color: var(--accent); }
.stack-row.is-core dd { font-weight: 500; }
.stack-note { display: block; margin-top: 0.3rem; font-size: var(--fs-xs); color: var(--fg-dim); }

.xp {
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr);
    gap: 1.5rem;
    padding: 1.4rem 0;
    border-top: 1px solid var(--border);
}
.xp:last-child { border-bottom: 1px solid var(--border); }
.xp-when { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--fg-dim); line-height: 1.5; padding-top: 0.15rem; }
.xp h3 { font-size: 1.125rem; font-weight: 600; letter-spacing: 0.01em; margin-bottom: 0.15rem; }
.xp h3 a { color: var(--fg); border-bottom: none; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.xp h3 a:hover { color: var(--accent); }
.xp-note { font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 400; color: var(--accent); margin-left: 0.3rem; letter-spacing: 0.04em; }
.xp-role { font-size: var(--fs-sm); color: var(--fg-dim); margin-bottom: 0.8rem; }
.xp .prose { font-size: 0.9688rem; }
.xp-part { margin: 1.1rem 0; padding-left: 1rem; border-left: 2px solid var(--border); }
.xp-part h4 { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.xp-part-when { font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 400; color: var(--fg-dim); margin-left: 0.4rem; }
.xp-lead { max-width: var(--measure); font-size: 0.9375rem; color: var(--fg-mid); font-style: italic; margin-bottom: 0.4rem; }
.points { list-style: none; max-width: var(--measure); margin-bottom: 0.8rem; }
.points li { position: relative; padding-left: 1.1rem; font-size: 0.9375rem; color: var(--fg-mid); line-height: 1.6; margin-bottom: 0.35rem; }
.points li::before { content: '–'; position: absolute; left: 0; color: var(--accent); }
.xp-tags { max-width: var(--measure); font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-dim); line-height: 1.7; }

.more-links { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; margin-top: 1rem; font-size: var(--fs-sm); }
.more-links a { display: inline-flex; align-items: center; min-height: 36px; color: var(--fg-mid); border-bottom: none; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.more-links a:hover { color: var(--accent); text-decoration-color: var(--accent); }

@media (max-width: 1080px) {
    .home { grid-template-columns: 1fr; gap: 2.5rem; padding-top: 32px; }
    .home-aside-inner { position: static; }
    .home-id { grid-template-columns: auto 1fr; align-items: center; }
    .home-avatar { width: 72px; height: 72px; }
    .home-tagline { max-width: var(--measure); }
    .home-toc { display: none; }
}
@media (max-width: 720px) {
    .facts { grid-template-columns: repeat(2, 1fr); }
    .facts > div { padding-bottom: 1rem; }
    .stack-row { grid-template-columns: 1fr; gap: 0.25rem; }
    .xp { grid-template-columns: 1fr; gap: 0.4rem; }
    .home-sec { margin-bottom: 3rem; }
    .home-actions .btn { flex: 1 1 auto; }
    .lead { font-size: 1.0625rem; }
}

/* ─── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root { --max-w: 100%; }

    .header-avatar { width: 72px; height: 72px; }

    .highlights { grid-template-columns: repeat(2, 1fr); }
    .highlight-item { border-right: none; border-bottom: 1px solid var(--border); }
    .highlight-item:nth-child(odd) { border-right: 1px solid var(--border); }
    .highlight-item:nth-last-child(-n+2) { border-bottom: none; }

}

@media (max-width: 480px) {
    :root { --pad-x: 18px; }

    .header-content { flex-direction: column; align-items: center; gap: 0.8rem; text-align: center; }
    .header-text { width: 100%; }
    .header-avatar { width: 72px; height: 72px; }
    .header-links { text-align: center; }
    .badge-row { justify-content: center; }

    .stack-group { grid-template-columns: 1fr; gap: 0.3rem; }
    .stack-label { min-width: unset; }
    .stack-note { grid-column: 1; }

    .timeline { padding-left: 14px; }
    .job { padding-left: 1rem; }
    .job::before { left: -19px; }
}

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

/* ─── Skip link ───────────────────────────────────────────────────────────────── */
.skip-link {
    position: absolute;
    top: -999px;
    left: 0;
    padding: 0.6rem 1rem;
    background: var(--accent);
    color: var(--on-accent);
    font-size: var(--fs-sm);
    border-bottom: none;
    z-index: 9999;
    letter-spacing: 0.04em;
}

.skip-link:focus { top: 0; color: var(--on-accent); }

/* ─── Dark mode ───────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
    --accent:     #e06363;
    --accent-dim: #b83030;
    --fg:         #dfe2e6;
    --fg-mid:     rgba(223,226,230,0.78);
    --fg-dim:     rgba(223,226,230,0.64);
    --bg:         #15171c;
    --bg-tag:     #1d2026;
    --bg-pre:     #1d2026;
    --border:     rgba(255,255,255,0.1);
    --border-strong: rgba(255,255,255,0.22);
    --link:       #8fb0c4;
    --ok:         #46c06e;
    --warn:       #f0b44c;
    --err:        #f07171;
    --focus:      #7aa7ff;
    --on-accent:  #15171c;          /* #fff on #e06363 is only 3.4:1 */
}

[data-theme="dark"] .hire-badge {
    color: #46c06e;
    border-color: #46c06e;
}

[data-theme="dark"] .header-avatar { filter: grayscale(20%) brightness(0.9); }
[data-theme="dark"] .header-avatar:hover { filter: grayscale(0%) brightness(1); }

/* ─── Nav right: language + theme ────────────────────────────────────────────── */
.nav-right { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }

/* Two-state segmented control. The current language is plain text with
   aria-current, the other one is a real link (works without JS; with JS it
   also carries the current query string and #anchor, see script.js). */
.lang-switcher {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    overflow: hidden;
    font-size: var(--fs-xs);
    letter-spacing: 0.06em;
    line-height: 1;
}
.lang-switcher > * + * { border-left: 1px solid var(--border-strong); }
.lang-switcher .ls-active,
.lang-switcher .ls-inactive {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.6rem;
    min-height: 32px;
    padding: 0 0.55rem;
    border-bottom: none;
}
.lang-switcher a:focus-visible { outline-offset: -3px; }
.lang-switcher .ls-active   { background: var(--fg); color: var(--bg); font-weight: 600; cursor: default; }
.lang-switcher .ls-inactive { color: var(--fg-mid); }
.lang-switcher .ls-inactive:hover { color: var(--accent); background: var(--bg-tag); }

/* ─── Theme toggle button ─────────────────────────────────────────────────────── */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid transparent;
    border-radius: 3px;
    cursor: pointer;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1;
    color: var(--fg-mid);
    transition: color 0.15s, border-color 0.15s;
    user-select: none;
    flex-shrink: 0;
}

.theme-toggle:hover { color: var(--accent); border-color: var(--border); }

/* ─── Service-worker update notice ───────────────────────────────────────────── */
.sw-update {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: none;
    align-items: center;
    gap: 0.8rem;
    max-width: calc(100% - 2rem);
    padding: 0.55rem 0.6rem 0.55rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    font-size: var(--fs-sm);
}
.sw-update.is-visible { display: flex; }
.sw-update span { color: var(--fg-mid); }
.sw-update button {
    font: inherit;
    min-height: 36px;
    padding: 0 0.9rem;
    cursor: pointer;
    border: 1px solid var(--border-strong);
    background: none;
    color: var(--fg);
}
.sw-update .sw-reload { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ─── Print ───────────────────────────────────────────────────────────────────── */
@media print {
    .site-header, .skip-link, .site-footer .footer-nav { display: none; }

    body {
        font-size: 11pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    :root {
        --accent: #6b0000;
        --fg: #000;
        --fg-mid: #333;
        --fg-dim: #666;
        --border: #ccc;
        --bg: #fff;
        --bg-tag: #f0f0f0;
        --pad-x: 0px;
    }

    .container { padding: 0; }

    h1 { font-size: 18pt; }
    h2 { font-size: 8pt; margin-bottom: 0.8rem; }

    .header-avatar { width: 72px; height: 72px; }

    .highlights { border: 1px solid #ccc; }

    a { color: inherit; border-bottom: none; }
    a[href^="http"]::after,
    a[href^="mailto"]::after { content: " (" attr(href) ")"; font-size: 0.7em; color: #666; }

    .tag, .tag.tag-sm {
        background: transparent;
        border: 1px solid #ccc;
        color: #333;
    }

    footer { padding: 1rem 0 0; }

    .divider { border-top: 1px solid #ccc; }

    @page {
        margin: 1.5cm 2cm;
    }
}

/* ─── Dashboard pages (proxy, vpn) ───────────────────────────────────────────── */
.dashboard-content {
    max-width: var(--max-w);
    margin: 0 auto;
    width: 100%;
    padding: 32px var(--pad-x) 40px;
    flex: 1;
}

.dashboard-content h2 {
    font-size: 1em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--accent);
    margin: 14px 0 2px;
}

.dashboard-content pre {
    margin: 0;
    white-space: pre;
    overflow-x: auto;
    background: var(--bg-pre);
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--sc-accent, var(--border));
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.dashboard-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 3px 0 8px;
}

.dashboard-content a {
    color: var(--link);
    text-decoration: none;
    border-bottom: none;
}

.dashboard-content a:hover {
    text-decoration: underline;
    color: var(--link);
    border-bottom: none;
}

.dashboard-content details {
    margin: 6px 0;
    border: 1px solid var(--border);
    background: var(--bg-pre);
    padding: 6px 8px;
}

.dashboard-content details > summary {
    cursor: pointer;
    color: var(--fg-dim);
    list-style: none;
    user-select: none;
}

.dashboard-content details > summary::-webkit-details-marker { display: none; }
.dashboard-content details > summary::before { content: '\25B6 '; font-size: .75em; }
.dashboard-content details[open] > summary::before { content: '\25BC '; }
.dashboard-content details > div { margin-top: 8px; }

/* Dashboard utility classes */
.lbl  { color: var(--fg-dim); user-select: none; }
.hint { color: var(--fg-dim); font-size: 0.88em; margin-left: 0.5em; }

.val { cursor: pointer; transition: color .1s; }
.val:hover { color: var(--fg-dim); }
.val.flash { color: var(--ok) !important; }

.tog { cursor: pointer; color: var(--fg-dim); font-size: .9em; margin-left: 4px; user-select: none; }
.tog:hover { color: var(--fg); }

.secret { letter-spacing: 2px; }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; vertical-align: middle; flex-shrink: 0; }
.dot-on  { background: #2a2; }
.dot-off { background: #666; }
.dot-ok    { background: #22c55e; box-shadow: 0 0 4px #22c55e80; animation: pulse 2.5s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .dot-ok, .dot-error { animation: none; } }
.dot-error { background: #ef4444; box-shadow: 0 0 4px #ef444480; animation: pulse 1.8s ease-in-out infinite; }
.dot-na    { background: var(--fg-dim); }
@keyframes pulse { 0%,100% { opacity:1 } 50% { opacity:0.4 } }
.up   { background: #2a2; }
.down { background: #c33; }

.status-ts { color: var(--fg-dim); font-size: .82em; margin-top: 4px; }

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font: 13px/1.6 var(--font-mono);
    background: var(--bg-pre);
    border: 1px solid var(--border);
}
.stats-table th { color: var(--fg-dim); font-weight: normal; text-align: left;
                  padding: 4px 8px; border-bottom: 1px solid var(--border); }
.stats-table td { padding: 3px 8px; border-bottom: 1px solid var(--border); }
.stats-table tr:last-child td { border-bottom: none; }
.stats-table td:not(:first-child) { text-align: right; color: var(--fg); }
.stats-table td:first-child { color: var(--fg-dim); }

.wg-table {
    width: 100%;
    border-collapse: collapse;
    font: 13px/1.6 var(--font-mono);
    background: var(--bg-pre);
    border: 1px solid var(--border);
}
.wg-table th { color: var(--fg-dim); font-weight: normal; text-align: left;
               padding: 4px 8px; border-bottom: 1px solid var(--border); }
.wg-table td { padding: 3px 8px; border-bottom: 1px solid var(--border); }
.wg-table tr:last-child td { border-bottom: none; }

.ip-row   { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.ip-badge { padding: 1px 6px; border-radius: 2px; font-size: .82em; font-weight: bold; }
.ip-vpn   { background: rgba(40,160,40,.12); color: var(--ok); border: 1px solid var(--ok); }
.ip-open  { background: rgba(180,50,50,.12); color: var(--accent); border: 1px solid var(--accent); }

img.qr { display: block; margin: 8px 0; border: 1px solid var(--border);
         image-rendering: pixelated; width: 160px; height: 160px; }

/* ─── Stat cards (global) ────────────────────────────────────────────────── */
.stat-card {
    padding: 0.65rem 0.85rem;
    background: var(--bg-pre);
    border: 1px solid var(--border);
    border-left: 3px solid var(--sc-accent, var(--border));
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.stat-label {
    font-size: var(--fs-xs);
    color: var(--fg-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: var(--font-mono);
    line-height: 1.3;
}
.stat-value {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--fg);
    font-family: var(--font-mono);
    overflow-wrap: anywhere;
    line-height: 1.2;
}
.health-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.9rem;
}
.health-card {
    flex: 1 1 140px;
    padding: 0.48rem 0.85rem;
    background: var(--bg-pre);
    border: 1px solid var(--border);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.health-lbl {
    font-size: var(--fs-xs);
    color: var(--fg-dim);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-family: var(--font-mono);
}
.health-val {
    font-size: var(--fs-xs);
    font-weight: 700;
    font-family: var(--font-mono);
    padding: 2px 7px;
    border-radius: 2px;
    letter-spacing: 0.04em;
    transition: color .2s, background .2s;
}
.health-ok      { color: var(--ok); background: rgba(34,197,94,0.12); }
.health-fail    { color: var(--err); background: rgba(239,68,68,0.12); }
.health-neutral { color: var(--fg-dim); background: transparent; }
