:root {
    color-scheme: light dark;
    --color-bg: #eef2f5;
    --color-surface: #ffffff;
    --color-surface-soft: #f7f9fb;
    --color-text: #1f2933;
    --color-muted: #5f6b76;
    --color-primary: #26343b;
    --color-primary-dark: #172127;
    --color-accent: #2f5f7f;
    --color-accent-strong: #214861;
    --color-border: #d7dee5;
    --color-warning-bg: #fff8e5;
    --color-warning-border: #c78a00;
    --color-warning-text: #3b2a00;
    --color-link: #245f86;
    --color-link-hover: #173c55;
    --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-card: 0 4px 14px rgba(15, 23, 42, 0.07);
    --radius: 12px;
    --max-width: 1100px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-bg: #0b1117;
        --color-surface: #121a23;
        --color-surface-soft: #172230;
        --color-text: #e8eef5;
        --color-muted: #a8b5c2;
        --color-primary: #d7e6f2;
        --color-primary-dark: #f3f8fc;
        --color-accent: #8bc7ef;
        --color-accent-strong: #b6ddf7;
        --color-border: #2d3b4a;
        --color-warning-bg: #2b2412;
        --color-warning-border: #d19a22;
        --color-warning-text: #f7e5b3;
        --color-link: #8bc7ef;
        --color-link-hover: #cbeaff;
        --shadow-soft: 0 12px 28px rgba(0, 0, 0, 0.35);
        --shadow-card: 0 8px 18px rgba(0, 0, 0, 0.28);
    }
}

:root[data-theme="dark"] {
    --color-bg: #0b1117;
    --color-surface: #121a23;
    --color-surface-soft: #172230;
    --color-text: #e8eef5;
    --color-muted: #a8b5c2;
    --color-primary: #d7e6f2;
    --color-primary-dark: #f3f8fc;
    --color-accent: #8bc7ef;
    --color-accent-strong: #b6ddf7;
    --color-border: #2d3b4a;
    --color-warning-bg: #2b2412;
    --color-warning-border: #d19a22;
    --color-warning-text: #f7e5b3;
    --color-link: #8bc7ef;
    --color-link-hover: #cbeaff;
    --shadow-soft: 0 12px 28px rgba(0, 0, 0, 0.35);
    --shadow-card: 0 8px 18px rgba(0, 0, 0, 0.28);
}

:root[data-theme="light"] {
    --color-bg: #eef2f5;
    --color-surface: #ffffff;
    --color-surface-soft: #f7f9fb;
    --color-text: #1f2933;
    --color-muted: #5f6b76;
    --color-primary: #26343b;
    --color-primary-dark: #172127;
    --color-accent: #2f5f7f;
    --color-accent-strong: #214861;
    --color-border: #d7dee5;
    --color-warning-bg: #fff8e5;
    --color-warning-border: #c78a00;
    --color-warning-text: #3b2a00;
    --color-link: #245f86;
    --color-link-hover: #173c55;
    --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-card: 0 4px 14px rgba(15, 23, 42, 0.07);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.65;
    transition: background-color 160ms ease, color 160ms ease;
}

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

a:focus-visible,
button:focus-visible {
    outline: 3px solid rgba(139, 199, 239, 0.55);
    outline-offset: 3px;
    border-radius: 4px;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 12px;
    background: var(--color-surface);
    color: var(--color-text);
    padding: 8px 12px;
    z-index: 999;
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.skip-link:focus { left: 12px; }

.header-banner {
    background-image: linear-gradient(rgba(255,255,255,0.34), rgba(255,255,255,0.34)), url('../images/BuffSky.jpg');
    background-color: #d8e7ef;
    background-size: cover;
    background-position: center;
    min-height: 260px;
    width: min(100%, var(--max-width));
    margin: 0 auto;
    color: #000;
    padding: 28px 18px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-soft);
}

:root[data-theme="dark"] .header-banner {
    background-image: linear-gradient(rgba(0,0,0,0.28), rgba(0,0,0,0.28)), url('../images/BuffSky.jpg');
    background-color: #152333;
    color: #fff;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .header-banner {
        background-image: linear-gradient(rgba(0,0,0,0.28), rgba(0,0,0,0.28)), url('../images/BuffSky.jpg');
        background-color: #152333;
        color: #fff;
    }
}

.header-banner h1 {
    margin: 0 0 26px;
    font-size: clamp(2.1rem, 5vw, 3.75rem);
    line-height: 1.1;
    text-shadow: 0 1px 3px rgba(255,255,255,0.9);
}

:root[data-theme="dark"] .header-banner h1 {
    text-shadow: 0 2px 6px rgba(0,0,0,0.75);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .header-banner h1 {
        text-shadow: 0 2px 6px rgba(0,0,0,0.75);
    }
}

.site-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.site-nav li { display: inline-flex; }

.site-nav a,
.theme-toggle {
    color: #111;
    text-decoration: none;
    font: inherit;
    font-weight: 700;
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.82);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: background 160ms ease, color 160ms ease, transform 160ms ease, border-color 160ms ease;
    cursor: pointer;
}

.site-nav a:hover,
.site-nav a.active,
.theme-toggle:hover {
    background: #26343b;
    color: #fff;
    transform: translateY(-1px);
}

.theme-toggle {
    min-width: 106px;
}

main {
    width: min(calc(100% - 24px), var(--max-width));
    padding: clamp(22px, 4vw, 40px);
    background: var(--color-surface);
    margin: 22px auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

section { margin-bottom: 34px; }
section:last-child { margin-bottom: 0; }

h2, h3, h4 {
    color: var(--color-primary);
    line-height: 1.25;
}

h2 {
    margin-top: 0;
    font-size: clamp(1.6rem, 3vw, 2.15rem);
}

h3 {
    margin-top: 34px;
    font-size: 1.35rem;
}

h4 {
    margin-top: 26px;
    margin-bottom: 8px;
    font-size: 1.08rem;
}

.section-heading,
main > h2 {
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 10px;
}

p { margin: 0 0 1rem; }
ul, ol { padding-left: 24px; }
li + li { margin-top: 4px; }

footer {
    text-align: center;
    padding: 18px 10px;
    background: #26343b;
    color: #ffffff;
    width: 100%;
    margin-top: 28px;
}

footer p { margin: 0; }

article,
.card,
.project-card,
.highlight,
.highlight-box,
.station-info,
.notice,
.resume-card,
.professional-focus-card,
.experience-item,
.experience-details {
    background: var(--color-surface-soft);
    margin: 20px 0;
    padding: clamp(18px, 3vw, 26px);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
}

article h3,
.card h3,
.project-card h3,
.highlight h3,
.highlight-box h3,
.station-info h3,
.notice h3,
.resume-card h3,
.professional-focus-card h3,
.experience-item h3 {
    margin-top: 0;
}

.hero {
    text-align: center;
    padding: 10px 0 26px;
}

.hero h2 {
    font-size: clamp(1.65rem, 4vw, 2.35rem);
    margin-bottom: 14px;
}

.hero p {
    max-width: 900px;
    margin: 14px auto;
    line-height: 1.85;
}

.content-section,
.about-container { line-height: 1.8; }

.highlight,
.highlight-box,
.professional-focus-card {
    border-left: 6px solid var(--color-accent);
}

.station-info { background-color: var(--color-surface-soft); }
.project-card { border-left: 6px solid var(--color-primary); }
.project-card ul { margin-top: 8px; }

.download-button,
.button-link {
    display: inline-block;
    background: #26343b;
    color: #fff;
    padding: 10px 15px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    margin: 8px 8px 8px 0;
    border: 1px solid #26343b;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.button-secondary {
    background: transparent;
    color: var(--color-link);
    border-color: var(--color-border);
}

.download-button:hover,
.button-link:hover {
    background: var(--color-accent-strong);
    border-color: var(--color-accent-strong);
    color: #fff;
    transform: translateY(-1px);
}

.project-image {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    margin-top: 12px;
    box-shadow: var(--shadow-card);
}

.notice {
    background: var(--color-warning-bg);
    border-left: 6px solid var(--color-warning-border);
    color: var(--color-warning-text);
}

.meta,
.role-meta,
.skills-line {
    color: var(--color-muted);
    font-size: 0.95rem;
}

.meta { font-style: italic; }
.skills-line { margin-top: 12px; }

.skills-grid,
.two-column-list { columns: 2; column-gap: 48px; }

.contact-list {
    list-style: none;
    padding-left: 0;
}

.contact-list li { margin-bottom: 10px; }

/* Resume pages */
.resume-page main,
main.resume-page { max-width: var(--max-width); }

.resume-hero,
.resume-hero-balanced {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
    gap: clamp(18px, 4vw, 34px);
    align-items: start;
    margin-bottom: 34px;
}

.resume-title {
    font-weight: 700;
    color: var(--color-accent-strong);
    font-size: 1.12rem;
    margin-bottom: 0.3rem;
}

.lead-text {
    font-size: 1.08rem;
    line-height: 1.75;
}

.eyebrow {
    color: var(--color-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    margin-bottom: 0.5rem;
}

.resume-actions { margin-top: 12px; }

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-left: 0;
    list-style: none;
}

.tag-list li,
.tech-stack span,
.role-note {
    background: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    border-radius: 999px;
    padding: 6px 10px;
    line-height: 1.2;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0;
}

.experience-item { border-left: 5px solid var(--color-border); }
.experience-item.featured-role { border-left-color: var(--color-accent); }
.compact-experience,
.compact-role { padding-top: 18px; padding-bottom: 18px; }

.experience-details summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--color-primary);
}

.resume-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.mini-experience-list {
    padding-left: 0;
    list-style: none;
}

.mini-experience-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.mini-experience-list li:last-child { border-bottom: 0; }

@media (max-width: 860px) {
    .resume-hero,
    .resume-hero-balanced,
    .resume-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .header-banner {
        min-height: 220px;
        padding: 22px 10px;
        border-radius: 0;
    }

    .site-nav ul { gap: 8px; }

    .site-nav a,
    .theme-toggle {
        display: block;
        padding: 8px 11px;
        font-size: 0.95rem;
    }

    .theme-toggle { min-width: auto; }

    main {
        margin: 14px auto;
        padding: 22px 16px;
        width: min(calc(100% - 18px), var(--max-width));
    }

    .skills-grid,
    .two-column-list { columns: 1; }
}

@media print {
    :root,
    :root[data-theme="dark"] {
        --color-bg: #fff;
        --color-surface: #fff;
        --color-surface-soft: #fff;
        --color-text: #000;
        --color-muted: #333;
        --color-primary: #000;
        --color-border: #999;
        --color-link: #000;
    }

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

    .header-banner {
        background: none !important;
        color: #000 !important;
        min-height: auto;
        box-shadow: none;
        border-radius: 0;
        padding: 0 0 12px;
    }

    .site-nav,
    footer,
    .download-button,
    .button-link,
    .theme-toggle {
        display: none !important;
    }

    main {
        width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
        border-radius: 0;
    }

    article,
    .card,
    .project-card,
    .highlight,
    .highlight-box,
    .station-info,
    .notice,
    .resume-card,
    .professional-focus-card,
    .experience-item,
    .experience-details {
        box-shadow: none;
        border: 1px solid #999;
        break-inside: avoid;
    }
}
