/* =====================================================================
   Yaqoob Ahmed — Portfolio
   Single stylesheet. Vanilla CSS. Mobile-first, fluid typography.
   ===================================================================== */

/* ── Design tokens ──────────────────────────────────────────────────── */
:root {
    --bg:        #0d1117;
    --surface:   #161b22;
    --surface2:  #1c2330;
    --border:    #30363d;
    --text:      #c9d1d9;
    --heading:   #ffffff;
    --muted:     #a3acb8;
    --accent:    #58a6ff;
    --accent-2:  #79baff;
    --green:     #3fb950;
    --warn:      #d29922;
    --red:       #f85149;
    --focus:     #58a6ff;
    --nav-h:     56px;
    --nav-bg:    rgba(13, 17, 23, 0.88);
    --code-bg:   rgba(88, 166, 255, 0.10);
    --shadow:    0 4px 16px rgba(0,0,0,0.25);
    --radius:    8px;
    --radius-lg: 12px;

    /* Fluid root: 15px → 17px between 360px and 1280px */
    font-size: clamp(15px, 0.86rem + 0.35vw, 17px);

    color-scheme: dark light;
}

:root[data-theme="light"] {
    --bg:        #f6f8fa;
    --surface:   #ffffff;
    --surface2:  #f3f4f6;
    --border:    #d0d7de;
    --text:      #24292f;
    --heading:   #0f1419;
    --muted:     #4a5460;
    --accent:    #0860c8;
    --accent-2:  #0a59c2;
    --green:     #176f30;
    --warn:      #875a00;
    --red:       #cf222e;
    --focus:     #0860c8;
    --nav-bg:    rgba(255, 255, 255, 0.88);
    --code-bg:   rgba(9, 105, 218, 0.10);
    --shadow:    0 4px 14px rgba(15,20,25,0.06);
    color-scheme: light;
}
:root[data-theme="dark"] { color-scheme: dark; }

/* No JavaScript: the inline theme script never sets data-theme, so follow the
   OS preference here (the toggle is hidden below, since it can't work). */
@media (prefers-color-scheme: light) {
    :root:not([data-theme]) {
        --bg:        #f6f8fa;
        --surface:   #ffffff;
        --surface2:  #f3f4f6;
        --border:    #d0d7de;
        --text:      #24292f;
        --heading:   #0f1419;
        --muted:     #4a5460;
        --accent:    #0860c8;
        --accent-2:  #0a59c2;
        --green:     #176f30;
        --warn:      #875a00;
        --red:       #cf222e;
        --focus:     #0860c8;
        --nav-bg:    rgba(255, 255, 255, 0.88);
        --code-bg:   rgba(9, 105, 218, 0.10);
        --shadow:    0 4px 14px rgba(15,20,25,0.06);
        color-scheme: light;
    }
}

/* ── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    overflow-x: hidden;
}

img, svg { max-width: 100%; height: auto; }

/* ── Reduced motion ─────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
    html { scroll-behavior: auto; }
}

/* ── Skip link ──────────────────────────────────────────────────────── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 100;
    padding: 10px 18px;
    background: var(--accent);
    color: var(--bg);
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 0 0 6px 6px;
    text-decoration: none;
    transition: top 0.1s;
}
.skip-link:focus { top: 0; }

:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 3px;
    border-radius: 3px;
}

/* ── Layout container ───────────────────────────────────────────────── */
.wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 clamp(18px, 4vw, 32px);
}

/* ── Theme toggle ───────────────────────────────────────────────────── */
.theme-toggle {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.15s, background-color 0.15s;
}
.theme-toggle:hover { color: var(--text); background-color: var(--surface2); }
.theme-icon-dark, .theme-icon-light { display: none; }
:root[data-theme="dark"] .theme-icon-light  { display: block; }
:root[data-theme="light"] .theme-icon-dark  { display: block; }
:root:not([data-theme]) .topnav-links li:has(> .theme-toggle),
:root:not([data-theme]) .theme-toggle { display: none; }

/* ── Navigation ─────────────────────────────────────────────────────── */
/* Pin the whole <header>: a sticky .topnav cannot move inside a <header>
   that is exactly its own height. */
body > header { position: sticky; top: 0; z-index: 50; }
.topnav {
    background-color: var(--nav-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.topnav-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 8px clamp(18px, 4vw, 32px);
    min-height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.topnav-logo {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.92rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
    padding: 8px 0;
    flex: 0 1 auto;
    min-width: 0;
}

.topnav-links {
    display: flex;
    gap: clamp(10px, 2.4vw, 22px);
    list-style: none;
    align-items: center;
    flex-wrap: wrap;
}

.topnav-links li { display: flex; align-items: center; }
.topnav-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 10px 0;
    display: inline-flex;
    align-items: center;
    transition: color 0.15s;
    white-space: nowrap;
}
.topnav-links a:hover,
.topnav-links a:focus-visible { color: var(--text); }

/* ≤ 680px: one-row nav — prompt-only logo, Lab/Skills hidden, 44px targets */
@media (max-width: 680px) {
    .topnav-inner { flex-wrap: nowrap; column-gap: 12px; }
    .topnav-logo { flex: none; font-size: 0.84rem; }
    .topnav-logo .tn-user { display: none; }
    .topnav-links { gap: 14px; flex-wrap: nowrap; }
    .topnav-links .nav-secondary { display: none; }
    .topnav-links a { font-size: 0.86rem; min-height: 44px; }
    .theme-toggle { width: 44px; height: 44px; }
}
@media (max-width: 360px) {
    .topnav-inner { column-gap: 8px; }
    .topnav-links { gap: 8px; }
    .topnav-links a { font-size: 0.8rem; }
    .theme-toggle { width: 40px; }
}

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero {
    padding: clamp(40px, 8vw, 80px) 0 clamp(36px, 6vw, 64px);
    border-bottom: 1px solid var(--border);
}

.hero-eyebrow {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.55;
    max-width: 84ch;
    color: var(--muted);
    margin-bottom: 18px;
    text-wrap: balance;
}
.hero-status {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--green);
    box-shadow: 0 0 0 4px rgba(63, 185, 80, 0.18);
}

.hero h1 {
    font-size: clamp(2rem, 6.5vw, 3.4rem);
    font-weight: 800;
    color: var(--heading);
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 6px;
}

.hero-role {
    font-size: clamp(1.15rem, 0.95rem + 1vw, 1.5rem);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--text);
    margin-bottom: 22px;
    text-wrap: balance;
}

.hero-bio {
    max-width: 62ch;
    font-size: clamp(1rem, 0.95rem + 0.3vw, 1.12rem);
    color: var(--text);
    line-height: 1.78;
    margin-bottom: 28px;
}
.hero-bio strong { color: var(--heading); font-weight: 700; }

.hero-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.hero-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.88rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 6px;
    background-color: var(--surface);
    min-height: 44px;
    transition: color 0.15s, border-color 0.15s, background-color 0.15s;
    word-break: break-word;
}
.hero-link:hover { color: var(--accent); border-color: rgba(88,166,255,0.5); }

.hero-link-cv {
    background-color: var(--accent);
    color: var(--bg) !important;
    border-color: var(--accent);
    font-weight: 700;
    font-family: inherit;
}
.hero-link-cv:hover { background-color: var(--accent-2); border-color: var(--accent-2); }
:root[data-theme="light"] .hero-link-cv { color: #fff !important; }
@media (max-width: 480px) {
    .hero-links { display: grid; grid-template-columns: 1fr; }
    .hero-link { justify-content: center; }
}

/* ── Sections ───────────────────────────────────────────────────────── */
.section {
    padding: clamp(40px, 7vw, 70px) 0;
    border-bottom: 1px solid var(--border);
}
.section:last-of-type { border-bottom: none; }

/* In-page anchors (/#experience, /projects/homelab-platform#recovery, …) and keyboard focus
   land just below the sticky nav. One offset only: an html scroll-padding-top would add to it. */
main h2[id], .section { scroll-margin-top: calc(var(--nav-h) + 12px); }
:target, :focus-visible { scroll-margin-top: calc(var(--nav-h) + 12px); }

.section-label {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.74rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-bottom: 6px;
}

.section-title {
    font-size: clamp(1.4rem, 1.1rem + 1.4vw, 1.75rem);
    font-weight: 700;
    color: var(--heading);
    margin-bottom: clamp(20px, 4vw, 32px);
}

/* ── Featured card ──────────────────────────────────────────────────── */
.featured-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: clamp(20px, 4vw, 36px);
    margin-bottom: 24px;
    text-decoration: none;
    display: block;
    transition: border-color 0.15s, background-color 0.15s;
}
.featured-card:hover {
    border-left-color: var(--green);
    background-color: var(--surface2);
}

.featured-eyebrow {
    font-size: 0.74rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 10px;
}

.featured-title {
    font-size: clamp(1.15rem, 1rem + 0.8vw, 1.4rem);
    font-weight: 700;
    color: var(--heading);
    margin-bottom: 12px;
    line-height: 1.3;
}

.featured-desc {
    color: var(--text);
    font-size: clamp(0.94rem, 0.9rem + 0.2vw, 1rem);
    line-height: 1.72;
    margin-bottom: 20px;
    max-width: 70ch;
}

.featured-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
@media (max-width: 560px) {
    .featured-stats { grid-template-columns: 1fr 1fr; gap: 16px; }
}

.fstat-val {
    font-size: clamp(1.15rem, 1rem + 0.9vw, 1.4rem);
    font-weight: 700;
    color: var(--green);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    line-height: 1;
    margin-bottom: 4px;
    display: block;
}
.fstat-label {
    font-size: 0.74rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Tags ───────────────────────────────────────────────────────────── */
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; }

.tag {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 4px;
    background-color: rgba(88,166,255,0.08);
    color: var(--accent);
    border: 1px solid rgba(88,166,255,0.2);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    white-space: nowrap;
}
.tag.green { background-color: rgba(63,185,80,0.08); color: var(--green); border-color: rgba(63,185,80,0.2); }
.tag.warn  { background-color: rgba(210,153,34,0.08); color: var(--warn);  border-color: rgba(210,153,34,0.2); }

/* ── Project grid ───────────────────────────────────────────────────── */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 16px;
    list-style: none;
}

.project-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(18px, 3vw, 24px);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: border-color 0.15s, background-color 0.15s;
}
.project-card:hover {
    border-color: var(--muted);
    background-color: var(--surface2);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 10px;
}

.card-title {
    font-size: clamp(1rem, 0.92rem + 0.4vw, 1.1rem);
    font-weight: 700;
    color: var(--heading);
    line-height: 1.35;
}

.card-badge {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.6;
}
.card-badge.live    { background-color: rgba(63,185,80,0.12);  color: var(--green);  border: 1px solid rgba(63,185,80,0.3); }
.card-badge.hardware{ background-color: rgba(248,81,73,0.08);  color: var(--red);    border: 1px solid rgba(248,81,73,0.25); }
.card-badge.progress{ background-color: rgba(88,166,255,0.08); color: var(--accent); border: 1px solid rgba(88,166,255,0.25); }
.card-badge.live::before { content: '● '; content: '● ' / ''; font-size: 0.55rem; }

.card-desc {
    color: var(--text);
    font-size: clamp(0.92rem, 0.88rem + 0.18vw, 0.98rem);
    line-height: 1.68;
    flex: 1;
    margin-bottom: 16px;
}

.card-footer { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }

/* ── Home: neutralise the deep-dive `main h2/h3/ul/li` rules, which also
      match the home page (40px label→title gap, 22px grid indent, uneven rows) ── */
.section-title  { margin-top: 0; }
.featured-title { margin-top: 0; }
.project-grid   { padding-left: 0; margin: 0; }
.project-grid > li { margin: 0; display: flex; }
.project-grid > li > .project-card { flex: 1 1 auto; }

/* ── Project groups (two headed grids under one "Projects" h2) ── */
.project-group {
    margin: 32px 0 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    line-height: 1.4;
    color: var(--muted);
}

/* ── Cards: title is the link, stretched over the card, so a live-demo pill
      can be a real link of its own; explicit "case study" cue ── */
.card-link { color: inherit; text-decoration: none; }
.card-link::before { content: ""; position: absolute; inset: 0; }
.featured-card { position: relative; }
.card-link:focus-visible { outline: none; }
:is(.project-card, .featured-card):has(.card-link:focus-visible) { outline: 2px solid var(--focus); outline-offset: 3px; }
.project-card::after,
.featured-card::after {
    content: "Read case study \2192";
    content: "Read case study \2192" / "";   /* visual cue only: the title is the link */
    display: block;
    margin-top: 16px;
    font: 600 0.82rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    color: var(--accent);
}
.project-card:hover { border-color: var(--accent); }
.project-card:hover .card-title,
.featured-card:hover .featured-title { color: var(--accent); }

/* Odd card count: last card spans both columns, tags move to a side column */
@media (min-width: 720px) {
    .project-grid > li:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .project-grid > li:last-child:nth-child(odd) > .project-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 15rem);
        column-gap: 32px;
        align-content: start;
    }
    .project-grid > li:last-child:nth-child(odd) .card-top,
    .project-grid > li:last-child:nth-child(odd) .card-desc,
    .project-grid > li:last-child:nth-child(odd) .card-cta,
    .project-grid > li:last-child:nth-child(odd) > .project-card::after { grid-column: 1; }
    .project-grid > li:last-child:nth-child(odd) .card-desc { margin-bottom: 0; }
    .project-grid > li:last-child:nth-child(odd) .card-footer {
        grid-column: 2;
        grid-row: 1 / span 2;
        align-content: flex-start;
        margin-top: 0;
    }
}

/* ── Experience (home): one role, its engagements on .timeline / .tag ── */
.xp-role-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 2px 16px;
}
.xp-role-head h3 {
    margin: 0;
    color: var(--heading);
    font-size: clamp(1.1rem, 1rem + 0.45vw, 1.28rem);
    line-height: 1.35;
}
.xp-when {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.88rem;
    color: var(--green);
    white-space: nowrap;
}
.xp-org { margin: 4px 0 0; color: var(--muted); font-size: 0.95rem; }
.timeline.xp { list-style: none; margin: 22px 0 0; }
.xp > .timeline-item { margin-bottom: 30px; }
.xp > .timeline-item:last-child { margin-bottom: 0; }
.xp h4 {
    margin: 0 0 2px;
    color: var(--heading);
    font-size: clamp(1rem, 0.96rem + 0.25vw, 1.1rem);
    line-height: 1.4;
}
.xp-meta {
    margin: 0 0 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.86rem;
    color: var(--muted);
}
.xp ul { list-style: disc; margin: 0 0 12px; }
.xp ul li { margin-bottom: 6px; }
.xp-edu { margin: 30px 0 6px; }
.xp-edu-label {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    color: var(--accent);
    font-weight: 700;
    margin-right: 10px;
}

/* "Full CV →" / "Read the lab case study →" at the end of a home section */
.more-link { margin: 0; }
.more-link a { color: var(--accent); font-weight: 600; text-decoration: none; }
.more-link a:hover { text-decoration: underline; }

/* One-sentence lead under a section title */
.section-intro { max-width: 68ch; margin: 0 0 22px; }

/* ── Portability (home #cloud): each pattern → the platforms I've used for it ── */
.port-thesis {
    margin: 0 0 6px;
    font-size: clamp(1.12rem, 1rem + 0.6vw, 1.38rem);
    font-weight: 700;
    line-height: 1.4;
    color: var(--heading);
    text-wrap: balance;
}
.port-thesis::before {
    content: "> ";
    content: "> " / "";
    color: var(--green);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}
.port-grid {
    margin: 0;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.port-row {
    display: grid;
    grid-template-columns: minmax(0, 14rem) minmax(0, 1fr);
    gap: 8px 24px;
    align-items: baseline;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}
.port-row:last-child { border-bottom: 0; }
.port-row dt {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--accent);
}
.port-row dd { margin: 0; }
.port-impl { display: flex; flex-wrap: wrap; gap: 6px 8px; list-style: none; margin: 0; padding: 0; }
.port-impl li {
    margin: 0;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background-color: var(--surface2);
    color: var(--text);
    font: 600 0.8rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}
@media (max-width: 640px) {
    .port-row { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
}

/* ── Home lab (home #homelab): capability cards on .service-grid / .service-card ── */
.lab-grid { list-style: none; padding-left: 0; margin: 0 0 22px; }
.lab-grid > li { margin: 0; }
.lab-grid > li > p { font-size: clamp(0.92rem, 0.88rem + 0.18vw, 0.98rem); line-height: 1.68; }

/* Inline call-to-action inside a card (e.g. "Live →" on the TLS card) */
.card-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0 14px;
    padding: 6px 10px;
    border-radius: 999px;
    background-color: rgba(63,185,80,0.10);
    color: var(--green);
    border: 1px solid rgba(63,185,80,0.3);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    align-self: flex-start;
    position: relative;
    z-index: 1;
    transition: background-color 0.15s;
}
.card-cta:hover { background-color: rgba(63,185,80,0.18); }
.card-cta::after { content: '↗'; content: '↗' / ''; font-size: 0.9em; opacity: 0.8; }

/* ── Stack table ────────────────────────────────────────────────────── */
.stack-table { width: 100%; border-collapse: collapse; }
.stack-table tr { border-bottom: 1px solid var(--border); }
.stack-table tr:last-child { border-bottom: none; }

.stack-cat {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    padding: 14px 20px 14px 0;
    width: 140px;
    white-space: nowrap;
    vertical-align: top;
    text-align: left;
}
.stack-val {
    font-size: 0.95rem;
    color: var(--text);
    padding: 14px 0;
    line-height: 1.7;
}

@media (max-width: 600px) {
    .stack-table, .stack-table tbody, .stack-table tr, .stack-table td {
        display: block;
        width: 100%;
    }
    .stack-table tr { padding: 12px 0; }
    .stack-cat { padding: 0 0 4px; width: auto; }
    .stack-val { padding: 0 0 4px; }
}

/* ── About ──────────────────────────────────────────────────────────── */
.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
    gap: 48px;
    align-items: start;
}
@media (max-width: 720px) {
    .about-grid { grid-template-columns: 1fr; gap: 24px; }
}

.about-text p {
    font-size: clamp(0.96rem, 0.92rem + 0.18vw, 1.02rem);
    color: var(--text);
    margin-bottom: 16px;
    line-height: 1.78;
}
.about-text p:last-child { margin-bottom: 0; }
.about-text strong { color: var(--heading); font-weight: 700; }

.about-facts {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
}

.fact-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.fact-row:first-child { padding-top: 0; }
.fact-row:last-child { padding-bottom: 0; border-bottom: none; }
.fact-label {
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.fact-val { color: var(--heading); font-size: 0.95rem; overflow-wrap: anywhere; }
.fact-val a { color: var(--accent); text-decoration: none; }
.fact-val a:hover { text-decoration: underline; }

/* ── Footer ─────────────────────────────────────────────────────────── */
footer {
    border-top: 1px solid var(--border);
    padding: clamp(24px, 5vw, 36px) clamp(18px, 4vw, 32px);
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: clamp(12px, 3vw, 24px);
    margin-bottom: 18px;
}
.footer-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 8px 0;
    display: inline-flex;
    align-items: center;
    transition: color 0.15s;
}
.footer-links a:hover { color: var(--text); }

/* Terminal sign-off + engineering credit */
.footer-prompt {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.85rem;
    color: var(--text);
    margin: 0 0 4px;
    line-height: 1.5;
}
.footer-prompt .fp-prompt {
    color: var(--accent);
    font-weight: 700;
    margin-right: 4px;
}
.footer-credit {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.6;
    max-width: 72ch;
    margin: 0 auto;
}

/* ── High-contrast / forced-colors ─────────────────────────────────── */
@media (forced-colors: active) {
    .featured-card, .project-card, .about-facts { border: 2px solid ButtonText; }
    .tag, .card-badge { border: 1px solid ButtonText; }
}

/* ── Mobile typography refinement (≤ 720px) ─────────────────────────
   Lift small-label and body-copy floors on phones. Desktop unaffected.
   Reason: at 15.4px root, sub-14px mobile rendering thins enough to
   feel dim/cramped even when desktop renders the same rems crisply.
   Also slightly heavier weight on labels for better OLED legibility. */
@media (max-width: 720px) {
    /* Eyebrows + section labels */
    .hero-eyebrow      { font-size: 0.86rem; letter-spacing: 0.08em; line-height: 1.6; }
    .section-label,
    .project-group     { font-size: 0.82rem; }
    .featured-eyebrow  { font-size: 0.82rem; }
    .meta              { font-size: 1rem; }
    .layer-label       { font-size: 0.82rem; }
    .fstat-label       { font-size: 0.78rem; }
    .metric-label      { font-size: 0.84rem; }

    /* Badges / tags / chips */
    .card-badge        { font-size: 0.74rem; padding: 4px 9px; }
    .tag               { font-size: 0.82rem; padding: 4px 10px; }
    .tech-tag          { font-size: 0.88rem; }
    .port-impl li      { font-size: 0.84rem; }
    .port-row dt       { font-size: 0.9rem; }

    /* Body copy floors */
    .hero-bio          { font-size: 1.06rem; line-height: 1.72; }
    .featured-desc     { font-size: 1rem; }
    .card-desc,
    .lab-grid > li > p { font-size: 0.98rem; line-height: 1.7; }
    .about-text p      { font-size: 1.02rem; }
    main p             { font-size: 1.06rem; line-height: 1.7; }
    main li            { font-size: 1.04rem; line-height: 1.7; }

    /* Stack table values */
    .stack-cat         { font-size: 0.92rem; }
    .stack-val         { font-size: 1.02rem; line-height: 1.65; }

    /* About-facts */
    .fact-label        { font-size: 0.76rem; }
    .fact-val          { font-size: 1rem; }

    /* Timeline / SLO blocks (project deep-dive pages) */
    .timeline-title    { font-size: 1.04rem; }
    .timeline-sub      { font-size: 0.96rem; line-height: 1.65; }
    .slo-label         { font-size: 0.92rem; }
    .slo-val           { font-size: 0.92rem; }

    /* Footer */
    .footer-links a    { font-size: 0.96rem; padding: 10px 10px; }
    .footer-prompt     { font-size: 0.92rem; }
    /* Lift credit color + weight on mobile: thin monospace at 0.86rem
       reads dim on OLED even at AAA contrast — firmer strokes fix it. */
    .footer-credit     { font-size: 0.86rem; line-height: 1.7; padding: 0 12px;
                         color: var(--text); font-weight: 500; }
    .footer-credit .fc-tagline,
    .footer-credit .fc-sep    { color: var(--muted); font-weight: 400; }

    /* Code spans appear larger so monospace doesn't shrink visually */
    code               { font-size: 0.95em; }
}

/* ── Footer credit: stack copyright onto its own line on narrow phones
      so the bullet separator never orphans at line start ──────────── */
@media (max-width: 480px) {
    .footer-credit .fc-sep { display: none; }
    .footer-credit .fc-copy { display: block; margin-top: 4px; }
}

/* ===================================================================
   Project deep-dive page styles
   =================================================================== */
.project-header {
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 30px;
    margin-top: 40px;
}

.project-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.92rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    margin: 24px 0 0;
    padding: 8px 0;
    transition: color 0.15s;
}
.project-back:hover { color: var(--accent); }

main h1 {
    font-size: clamp(1.9rem, 1.4rem + 2.4vw, 2.6rem);
    margin-bottom: 16px;
    color: var(--heading);
    line-height: 1.15;
    letter-spacing: -0.02em;
}
.meta {
    color: var(--muted);
    font-size: 0.95rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    line-height: 1.7;
}

main h2 {
    font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.5rem);
    color: var(--accent);
    margin: 40px 0 14px;
    line-height: 1.3;
}
main h3 {
    font-size: clamp(1.05rem, 0.98rem + 0.35vw, 1.18rem);
    color: var(--text);
    margin: 26px 0 10px;
    line-height: 1.35;
}

main p {
    margin-bottom: 18px;
    font-size: clamp(1rem, 0.96rem + 0.2vw, 1.07rem);
    line-height: 1.75;
    color: var(--text);
}
main p strong { color: var(--heading); font-weight: 700; }

.highlight-box {
    background-color: var(--surface);
    border-left: 4px solid var(--green);
    padding: 20px 22px;
    margin: 30px 0;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: clamp(0.95rem, 0.92rem + 0.15vw, 1rem);
}
.highlight-box.warn   { border-left-color: var(--warn); }
.highlight-box.danger { border-left-color: var(--red); }

.tech-stack { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 30px; }
.tech-tag {
    background-color: var(--code-bg);
    color: var(--accent);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    border: 1px solid rgba(88,166,255,0.18);
}
.tech-tag.green { background-color: rgba(63, 185, 80, 0.10); color: var(--green); border-color: rgba(63, 185, 80, 0.22); }
.tech-tag.warn  { background-color: rgba(210, 153, 34, 0.10); color: var(--warn); border-color: rgba(210, 153, 34, 0.22); }

main ul { margin: 0 0 18px; padding-left: 22px; }
main li {
    margin-bottom: 10px;
    font-size: clamp(0.98rem, 0.94rem + 0.18vw, 1.04rem);
    line-height: 1.7;
}
.topnav-links li { margin: 0; padding: 0; }

code {
    background-color: var(--code-bg);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.92em;
    overflow-wrap: anywhere;
}

/* Metrics cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
    gap: 14px;
    margin: 30px 0;
}
.metric-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
    container-type: inline-size;
}
.metric-value {
    /* Capped by the card width (20cqi), so an 8-character monospace value
       still fits a narrow card in a four-up row or on a phone. */
    font-size: min(clamp(1.5rem, 1.2rem + 1.4vw, 2rem), 20cqi);
    font-weight: 700;
    color: var(--green);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    display: block;
    margin-bottom: 6px;
    line-height: 1.1;
}
.metric-label {
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Architecture diagram block */
.architecture-diagram {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin: 30px 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.82rem;
    color: var(--green);
    overflow-x: auto;
    line-height: 1.7;
    -webkit-overflow-scrolling: touch;
}
.layer-label {
    color: var(--muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.layer-block { margin-bottom: 20px; }
.layer-block:last-child { margin-bottom: 0; }

/* Timeline */
.timeline { border-left: 2px solid var(--border); padding-left: 24px; margin: 20px 0; }
.timeline-item { position: relative; margin-bottom: 22px; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -30px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--green);
    border: 2px solid var(--bg);
}
.timeline-item.warn::before   { background-color: var(--warn); }
.timeline-item.danger::before { background-color: var(--red);  }
.timeline-title { font-weight: 600; color: var(--text); font-size: 0.98rem; }
.timeline-sub   { color: var(--muted); font-size: 0.9rem; margin-top: 4px; line-height: 1.6; }

/* SLO bars */
.slo-bar-wrap {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin: 20px 0;
}
.slo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.slo-row:last-child { margin-bottom: 0; }
.slo-label {
    width: 120px;
    font-size: 0.85rem;
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    flex-shrink: 0;
}
.slo-track {
    flex: 1 1 80px;
    height: 10px;
    background-color: var(--border);
    border-radius: 5px;
    overflow: hidden;
}
.slo-fill { height: 100%; border-radius: 5px; background-color: var(--green); }
.slo-val {
    font-size: 0.85rem;
    color: var(--green);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    width: 60px;
    text-align: right;
    flex-shrink: 0;
}

/* ===================================================================
   Project deep-dive components
   Token-based, so both themes work. Card headings accept h3 or h4.
   Colour modifiers such as .teal intentionally fall back to the default
   accent (no new palette colours to maintain).
   =================================================================== */

/* Code, file listings and ASCII diagrams: monospace, framed, scroll
   horizontally inside the box instead of wrapping or being clipped. */
pre,
.code-block,
.flow-diagram {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin: 20px 0 24px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.84rem;
    line-height: 1.7;
    color: var(--text);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    tab-size: 4;
}
.code-block,
.flow-diagram,
.architecture-diagram { white-space: nowrap; }
.layer-label { white-space: normal; }
@media (max-width: 360px) {
    .architecture-diagram { padding: 14px; font-size: 0.74rem; }
}
.flow-diagram { color: var(--green); }
.code-block .kw  { color: var(--accent); }
.code-block .fn  { color: var(--green); }
.code-block .str { color: var(--warn); }
.code-block .num { color: var(--red); }
.code-block .cm  { color: var(--muted); font-style: italic; }

.file-header {
    margin: 20px 0 0;
    padding: 6px 14px;
    background-color: var(--surface2);
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.78rem;
    color: var(--muted);
    overflow-wrap: anywhere;
}
.file-header + pre { margin-top: 0; border-radius: 0 0 var(--radius) var(--radius); }

/* Two-up card grids */
.two-col,
.service-grid,
.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 16px;
    margin: 24px 0;
}
.two-col > .card,
.service-card,
.comparison-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
}
.two-col > .card :is(h3, h4),
.service-card :is(h3, h4),
.comparison-card :is(h3, h4) {
    margin: 0 0 8px;
    font-size: 1rem;
    line-height: 1.35;
    color: var(--heading);
}
.two-col > .card p,
.service-card p,
.comparison-card p {
    margin: 0;
    font-size: 0.94rem;
    line-height: 1.65;
    color: var(--text);
}
.comparison-card.bad  { border-top: 3px solid var(--red); }
.comparison-card.good { border-top: 3px solid var(--green); }
.comparison-card.bad  :is(h3, h4) { color: var(--red); }
.comparison-card.good :is(h3, h4) { color: var(--green); }

/* Data tables */
.analysis-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0 28px;
    font-size: 0.9rem;
}
.analysis-table th {
    text-align: left;
    padding: 10px 12px;
    background-color: var(--surface);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 2px solid var(--border);
}
.analysis-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    color: var(--text);
}
.analysis-table tr:last-child td { border-bottom: 0; }
@media (max-width: 480px) {
    .analysis-table { font-size: 0.84rem; }
    .analysis-table th,
    .analysis-table td { padding: 8px 6px; }
    .analysis-table th { text-transform: none; letter-spacing: 0; }
    .analysis-table td { overflow-wrap: break-word; }
}
.analysis-table .good { color: var(--green); font-weight: 700; }
.analysis-table .warn { color: var(--warn); font-weight: 700; }

/* Numbered steps: .request-flow > .flow-step > .flow-num + .flow-text */
.request-flow { margin: 20px 0 24px; }
.flow-step { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.flow-num {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    margin-top: 2px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--accent);
    color: var(--bg);
    font-size: 0.82rem;
    font-weight: 700;
}
:root[data-theme="light"] .flow-num { color: #fff; }
.flow-text strong { display: block; color: var(--heading); margin-bottom: 2px; }
.flow-text span   { color: var(--muted); font-size: 0.94rem; line-height: 1.6; }

/* TLS inspector: chain connector, status pills, failure list */
.chain-line { margin: -10px 0 -10px 30px; color: var(--muted); line-height: 1; }
.cert-status {
    flex-shrink: 0;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid currentColor;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.78rem;
    font-weight: 700;
}
.cert-status.good { color: var(--green); }
.cert-status.warn { color: var(--warn); }
.failure-list { list-style: none; padding: 0; margin: 20px 0; }
.failure-list li {
    display: flex;
    gap: 14px;
    padding: 16px;
    margin-bottom: 10px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--red);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.failure-list li.warn { border-left-color: var(--warn); }
.failure-list li.info { border-left-color: var(--accent); }
.failure-icon  { flex-shrink: 0; line-height: 1.6; }
.failure-body  { flex: 1; min-width: 0; }
.failure-title { font-weight: 700; color: var(--heading); margin-bottom: 4px; }
.failure-desc  { color: var(--text); font-size: 0.95rem; line-height: 1.65; }

/* ── Case studies: reading measure, balanced titles ── */
main > .wrap:not(.cv) > :is(p, h2, h3, ul:not([class]), ol:not([class])),
main > .wrap:not(.cv) > section > :is(p, h2, h3, ul:not([class]), ol:not([class])) { max-width: 72ch; }
main h1 { text-wrap: balance; }

/* Meta strip: a "Label: value" pair wraps as a unit. Write each "|" inside the
   span it follows ("<span>Role: … |</span>"), never between spans; a pair too
   long for the line wraps evenly, so its trailing "|" never sits alone and no
   line starts with a separator. */
.meta > span { display: inline-block; text-wrap: balance; }

/* In-content links get one consistent style (replaces inline style="color:var(--accent)") */
main a:not([class]) { color: var(--accent); text-underline-offset: 2px; }
main a:not([class]):hover { text-decoration-thickness: 2px; }

/* Accent variants used in markup but never defined */
.highlight-box.teal { border-left-color: var(--accent); }

/* Metric strips: no 5+1 orphan rows */
@media (min-width: 721px) {
    .metrics-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .metrics-grid:has(> :nth-child(4):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .metrics-grid:has(> :nth-child(5):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metrics-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* SLO widget: caption class + budget-state colours */
.slo-caption { margin-bottom: 16px; font-size: 0.9rem; color: var(--muted); }
.slo-fill.warn   { background-color: var(--warn); }
.slo-fill.danger { background-color: var(--red); }
.slo-val.warn    { color: var(--warn); }
.slo-val.danger  { color: var(--red); }

/* End of every case study: hiring CTA + previous/next case study */
.hire-cta { border-left-color: var(--accent); }
.hire-cta a { color: var(--accent); font-weight: 600; }
.project-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 32px 0 8px;
}
.pager-link {
    display: block;
    padding: 16px 18px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--heading);
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    transition: border-color 0.15s;
}
.pager-link:hover { border-color: var(--accent); }
.pager-next { text-align: right; }
.pager-link span {
    display: block;
    margin-bottom: 4px;
    font: 600 0.72rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}
@media (max-width: 560px) {
    .project-pager { grid-template-columns: 1fr; }
    .pager-next { text-align: left; }
}

/* Screen-reader-only text */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}


/* ===================================================================
   CV page (/resume)
   One HTML source for the on-screen CV and the downloadable PDF:
   the PDF is /resume printed with the @media print rules below.
   =================================================================== */
.btn {
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    color: var(--text);
    background-color: var(--surface2);
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background-color: var(--surface); border-color: var(--muted); }
.btn.primary { background-color: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn.primary:hover { background-color: var(--accent-2); border-color: var(--accent-2); }
:root[data-theme="light"] .btn.primary { color: #fff; }

.cv { max-width: 860px; padding-top: clamp(28px, 5vw, 48px); padding-bottom: clamp(40px, 6vw, 64px); }
.cv-head { padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.cv-head h1 {
    font-size: clamp(2rem, 1.6rem + 2vw, 2.7rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}
.cv-title { font-size: 1.08rem; font-weight: 600; color: var(--heading); margin-bottom: 10px; }
.cv-head .cv-contact {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.86rem;
    color: var(--muted);
}
.cv-contact li { margin: 0; font-size: inherit; line-height: 1.6; }
/* Separator trails its item, so a wrapped row never starts with one */
.cv-contact li:not(:last-child)::after { content: '·'; content: '·' / ''; margin: 0 10px; color: var(--muted); }
.cv-contact a { color: var(--accent); text-decoration: none; }
.cv-contact a:hover { text-decoration: underline; }
.cv-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.cv h2 {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent);
    margin: 36px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.cv-h2-note { color: var(--muted); font-weight: 400; letter-spacing: 0.04em; text-transform: none; margin-left: 8px; }
.cv-summary { max-width: 75ch; }

.cv-role-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 2px 16px;
}
.cv-role-head h3 { margin: 0; color: var(--heading); font-size: clamp(1.05rem, 1rem + 0.3vw, 1.18rem); }
.cv-when {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.88rem;
    color: var(--green);
    white-space: nowrap;
}
main .cv-org { color: var(--muted); font-size: 0.95rem; margin: 4px 0 6px; }
.cv h4 { color: var(--heading); font-size: 1rem; margin: 20px 0 8px; }
.cv-eng-meta {
    display: block;
    margin-top: 2px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.84rem;
    font-weight: 400;
    color: var(--muted);
}
.cv ul { margin-bottom: 10px; }
.cv li { margin-bottom: 7px; }
main .cv-tech { color: var(--muted); font-size: 0.92rem; margin: 4px 0 0; }
.cv-tech strong { color: var(--text); }
.cv-work a { color: var(--accent); text-decoration: none; white-space: nowrap; margin-left: 4px; }
.cv-work a::after { content: ' →'; content: ' →' / ''; }
.cv-work a:hover { text-decoration: underline; }
.cv-print-only { display: none; }

.cv-skills { display: grid; gap: 10px; margin: 0; }
.cv-skills div {
    display: grid;
    grid-template-columns: minmax(150px, 200px) 1fr;
    gap: 4px 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.cv-skills div:last-child { border-bottom: none; }
.cv-skills dt {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--accent);
    padding-top: 2px;
}
.cv-skills dd { margin: 0; line-height: 1.65; }
@media (max-width: 600px) {
    .cv-skills div { grid-template-columns: 1fr; }
}

/* Print / PDF: US Letter, black on white, two pages */
@page { size: letter; margin: 0.5in 0.6in; }

/* ── Print ──────────────────────────────────────────────────────────── */
@media print {
    /* Paper is always light: with a dark color-scheme, Chrome paints the page
       canvas, @page margins included, near-black around the content. */
    :root, :root[data-theme] {
        color-scheme: light;
        --bg: #fff; --surface: #fff; --surface2: #f3f4f6; --border: #d0d7de;
        --text: #24292f; --heading: #0f1419; --muted: #4a5460;
        --accent: #0860c8; --accent-2: #0a59c2; --green: #176f30; --warn: #875a00; --red: #cf222e;
        --focus: #0860c8; --code-bg: rgba(9, 105, 218, 0.10); --shadow: none;
    }
    html, body { background: #fff; }
    body { color: #000; }
    .topnav, footer, .skip-link, .theme-toggle, .project-back { display: none !important; }
    a { color: #000; text-decoration: underline; }
    .featured-card, .project-card, .about-facts, .highlight-box,
    .architecture-diagram, .slo-bar-wrap, .metric-card {
        background: #fff !important; border-color: #888 !important; box-shadow: none !important;
    }
    .hero, .section { border-color: #888; page-break-inside: avoid; }

    .cv-actions, .cv-screen-only { display: none !important; }
    /* Case-study links print as a separate absolute link (a.cv-print-only): the PDF is
       printed from a local server, so the relative on-screen link would point there. */
    .cv-work a.cv-print-only { display: inline; font-size: 9pt; margin-left: 0; }
    .cv-work a.cv-print-only::after { content: none; }
    .cv { max-width: none; padding: 0; }
    .cv, .cv * { color: #111 !important; border-color: #bbb !important; }
    .cv a { text-decoration: none; }
    .cv-head { padding-bottom: 8pt; }
    .cv-head h1 { font-size: 21pt; margin-bottom: 2pt; }
    .cv-title { font-size: 11pt; margin-bottom: 3pt; }
    .cv-head .cv-contact { font-size: 8.5pt; margin: 0; }
    .cv-contact li:not(:last-child)::after { margin: 0 6pt; }
    .cv-summary { max-width: none; }
    .cv h2 { font-size: 8.5pt; margin: 11pt 0 5pt; padding-bottom: 2pt; }
    .cv h3 { font-size: 10.5pt; }
    .cv h4 { font-size: 9.5pt; margin: 6pt 0 2pt; }
    .cv-eng-meta { font-size: 8.5pt; margin-top: 0; }
    .cv p, .cv li, .cv dd, .cv-when, main .cv-org, main .cv-tech { font-size: 9pt; line-height: 1.38; }
    .cv p { margin-bottom: 3pt; }
    .cv ul { padding-left: 14pt; margin-bottom: 3pt; }
    .cv li { margin-bottom: 1.5pt; }
    .cv-skills { gap: 2pt; }
    .cv-skills div { grid-template-columns: 138pt 1fr; padding-bottom: 2pt; border-bottom: none; }
    .cv-skills dt { font-size: 8.5pt; padding-top: 0; }
    .cv-role-head, .cv-skills div, .cv li { break-inside: avoid; }
    .cv h2, .cv h4 { break-after: avoid; }
}
