:root {
    --font-display: 'Syne', 'Avenir', sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --void: #09090b;
    --surface: #111114;
    --surface-raised: #19191e;
    --surface-overlay: #212127;

    --gold: #c9a84c;
    --gold-bright: #e8cf6a;
    --gold-dim: #7a6a30;
    --gold-glow: rgba(201, 168, 76, 0.12);

    --silver: #8e8e96;
    --silver-bright: #b8b8c0;
    --chrome: #dcdce4;

    --rule: #28282e;
    --rule-faint: #1e1e24;

    --text-primary: #e4e4ec;
    --text-body: #b0b0b8;
    --text-muted: #6e6e78;
    --text-faint: #484850;

    --bg-gradient-start: #1c1c22;
    --bg-gradient-middle: #121217;
    --bg-grid: rgba(255, 255, 255, 0.006);
    --shadow-strong: 0 18px 40px rgba(0, 0, 0, 0.22);
    --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.24);
    --toggle-bg: rgba(17, 17, 20, 0.82);
    --toggle-border: rgba(201, 168, 76, 0.22);
    --toggle-text: var(--text-primary);
    --toggle-icon-bg: linear-gradient(135deg, rgba(232, 207, 106, 0.9), rgba(201, 168, 76, 0.78));
    --theme-flash: radial-gradient(circle, rgba(255, 244, 209, 0.46) 0%, rgba(255, 255, 255, 0.14) 38%, rgba(255, 255, 255, 0) 72%);
    --theme-ring: rgba(232, 207, 106, 0.22);

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;
}

html[data-theme="light"] {
    --void: #f4ecdf;
    --surface: #fbf6eb;
    --surface-raised: #f6efdf;
    --surface-overlay: #fffdf8;

    --gold: #a97f21;
    --gold-bright: #c89935;
    --gold-dim: #d8c18c;
    --gold-glow: rgba(169, 127, 33, 0.12);

    --silver: #6f6659;
    --silver-bright: #4b4338;
    --chrome: #2f2a24;

    --rule: rgba(122, 95, 40, 0.22);
    --rule-faint: rgba(122, 95, 40, 0.12);

    --text-primary: #1f1a13;
    --text-body: #4f473b;
    --text-muted: #786d5d;
    --text-faint: #ab9b83;

    --bg-gradient-start: #fff8e9;
    --bg-gradient-middle: #f7efdf;
    --bg-grid: rgba(82, 58, 23, 0.035);
    --shadow-strong: 0 22px 44px rgba(129, 96, 36, 0.12);
    --shadow-soft: 0 14px 30px rgba(129, 96, 36, 0.12);
    --toggle-bg: rgba(255, 252, 245, 0.88);
    --toggle-border: rgba(169, 127, 33, 0.2);
    --toggle-text: #2b2218;
    --toggle-icon-bg: linear-gradient(135deg, #fff2bf, #e7bb51);
    --theme-flash: radial-gradient(circle, rgba(255, 255, 255, 0.96) 0%, rgba(255, 246, 214, 0.62) 35%, rgba(255, 255, 255, 0) 72%);
    --theme-ring: rgba(169, 127, 33, 0.16);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 17px;
}

body {
    font-family: var(--font-body);
    line-height: 1.7;
    background:
        radial-gradient(circle at top right, var(--bg-gradient-start) 0%, var(--bg-gradient-middle) 28%, var(--void) 62%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 30%),
        var(--void);
    color: var(--text-body);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    transition: background 1.1s ease, color 0.9s ease;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        var(--bg-grid) 3px,
        var(--bg-grid) 4px
    );
    transition: background-image 0.5s ease;
}

body::after {
    content: none;
}

a {
    color: var(--gold);
    text-decoration: none;
}

a:hover {
    color: var(--gold-bright);
}

img {
    max-width: 100%;
    display: block;
}

a,
.panel,
.download-panel,
.photo-frame,
.badge,
.btn,
.masthead,
.masthead::after,
.masthead-top,
.masthead-nav,
.section,
.section-header,
.timeline-item,
.cv-table th,
.cv-table td,
.footer,
.footer::after,
.footer-links,
.footer-social a,
.footer-social img {
    transition:
        color 0.8s ease,
        background 0.95s ease,
        border-color 0.8s ease,
        box-shadow 0.95s ease,
        filter 0.8s ease,
        transform 0.24s ease;
}

body.theme-transitioning,
body.theme-transitioning::before,
body.theme-transitioning a,
body.theme-transitioning .panel,
body.theme-transitioning .download-panel,
body.theme-transitioning .photo-frame,
body.theme-transitioning .badge,
body.theme-transitioning .btn,
body.theme-transitioning .masthead,
body.theme-transitioning .masthead::after,
body.theme-transitioning .masthead-top,
body.theme-transitioning .masthead-nav,
body.theme-transitioning .section,
body.theme-transitioning .section-header,
body.theme-transitioning .timeline-item,
body.theme-transitioning .cv-table th,
body.theme-transitioning .cv-table td,
body.theme-transitioning .footer,
body.theme-transitioning .footer::after,
body.theme-transitioning .footer-links,
body.theme-transitioning .footer-social a,
body.theme-transitioning .footer-social img,
body.theme-transitioning .theme-toggle,
body.theme-transitioning .theme-toggle-icon,
body.theme-transitioning .theme-toggle-icon::before,
body.theme-transitioning .theme-toggle-icon::after {
    transition-duration: 1.1s !important;
}

.site-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-5) var(--space-8);
}

.masthead {
    text-align: center;
    padding: var(--space-7) 0 var(--space-5);
    border-bottom: 1px solid var(--gold);
    margin-bottom: var(--space-7);
}

.masthead::after {
    content: "";
    display: block;
    border-bottom: 1px solid var(--gold-dim);
    margin-top: 4px;
}

.masthead-top {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
    font-family: var(--font-mono);
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-muted);
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--rule);
}

.masthead-nameplate {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 7vw, 4.1rem);
    line-height: 1;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    letter-spacing: -0.03em;
}

.masthead-nameplate span {
    color: var(--gold);
}

.masthead-motto {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
    margin-bottom: var(--space-5);
}

.masthead-nav {
    display: flex;
    justify-content: center;
    gap: var(--space-5);
    flex-wrap: wrap;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    border-top: 1px solid var(--rule);
    padding-top: var(--space-3);
}

.masthead-nav a {
    color: var(--silver);
}

.masthead-nav a.active,
.masthead-nav a:hover {
    color: var(--gold);
}

.section {
    border-bottom: 1px solid var(--rule);
    padding-bottom: var(--space-7);
    margin-bottom: var(--space-7);
}

.section:last-of-type {
    border-bottom: none;
}

.section-header {
    margin-bottom: var(--space-6);
    border-bottom: 1px solid var(--rule-faint);
    padding-bottom: var(--space-4);
}

.section-kicker {
    font-family: var(--font-mono);
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.62rem;
    margin-bottom: var(--space-2);
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    color: var(--text-primary);
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-3);
}

.section-deck {
    max-width: 68ch;
    color: var(--text-muted);
}

.grid-2,
.grid-3 {
    display: grid;
    gap: 30px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
    background: linear-gradient(145deg, var(--surface-overlay), var(--surface));
    border: 1px solid var(--gold-dim);
    padding: var(--space-5);
    transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
}

.panel:hover {
    transform: translateY(-4px);
    border-color: rgba(201, 168, 76, 0.36);
    box-shadow: var(--shadow-strong);
}

.panel h3 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
}

.panel h4 {
    font-family: var(--font-mono);
    color: var(--silver-bright);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.7rem;
    margin-bottom: var(--space-3);
}

.panel p,
.panel li {
    color: var(--text-body);
}

.panel ul {
    list-style: none;
    display: grid;
    gap: var(--space-2);
}

.lede {
    color: var(--silver-bright);
    font-size: 1.1rem;
    max-width: 66ch;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.badge {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    border: 1px solid var(--gold-dim);
    color: var(--gold);
    padding: 6px 10px;
}

.quote {
    margin-top: var(--space-5);
    border-left: 2px solid var(--gold);
    background: var(--gold-glow);
    padding: var(--space-4) var(--space-5);
    font-style: italic;
    color: var(--silver-bright);
}

.quote cite {
    display: block;
    margin-top: var(--space-3);
    font-style: normal;
    font-family: var(--font-mono);
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

.photo-frame {
    border: 1px solid var(--gold-dim);
    padding: var(--space-3);
    background: var(--surface);
    transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
}

.photo-frame:hover {
    transform: translateY(-4px);
    border-color: rgba(201, 168, 76, 0.36);
    box-shadow: var(--shadow-strong);
}

.photo-caption {
    margin-top: var(--space-3);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

.timeline {
    display: grid;
    gap: var(--space-4);
}

.timeline-item {
    border-left: 2px solid var(--rule);
    padding-left: var(--space-4);
    transition: border-color 0.24s ease, transform 0.24s ease;
}

.timeline-item:hover {
    border-left-color: var(--gold);
    transform: translateX(4px);
}

.timeline-label {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--gold);
    margin-bottom: var(--space-1);
}

.timeline-item h4 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.skill-grid {
    display: grid;
    gap: var(--space-5);
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.skill-list {
    list-style: none;
    display: grid;
    gap: var(--space-2);
}

.skill-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid var(--rule-faint);
    padding-bottom: var(--space-2);
    gap: var(--space-3);
}

.skill-item strong {
    color: var(--text-primary);
    font-weight: 600;
}

.skill-level {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold);
}


.cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-5);
}

.section-link-row {
    margin-bottom: var(--space-6);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border: 1px solid var(--rule);
    color: var(--silver-bright);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    transition: all 0.2s ease;
}

.btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.btn-primary {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--void);
}

.btn-primary:hover {
    background: var(--gold-bright);
    color: var(--void);
}

.btn-secondary {
    border-color: var(--silver);
    color: var(--silver);
    background: transparent;
}

.cv-table-wrap {
    overflow-x: auto;
}

.cv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.94rem;
}

.cv-table caption {
    caption-side: top;
    text-align: left;
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
}

.cv-table th,
.cv-table td {
    border-bottom: 1px solid var(--rule-faint);
    padding: var(--space-3);
    text-align: left;
    vertical-align: top;
}

.cv-table th {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gold);
    font-size: 0.62rem;
}

.cv-table td strong {
    color: var(--text-primary);
}

.download-panel {
    border: 1px solid var(--gold-dim);
    background: linear-gradient(160deg, rgba(201, 168, 76, 0.12), rgba(17, 17, 20, 0.9));
    padding: var(--space-5);
    transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
}

.download-panel:hover {
    transform: translateY(-4px);
    border-color: var(--gold);
    box-shadow: var(--shadow-strong);
}

.download-panel h3 {
    margin-bottom: var(--space-3);
}

.footer {
    margin-top: var(--space-8);
    border-top: 1px solid var(--gold);
    position: relative;
}

.footer::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 0;
    right: 0;
    border-top: 1px solid var(--gold-dim);
}

.footer-inner {
    padding: var(--space-7) 0 var(--space-6);
    text-align: center;
}

.footer-nameplate {
    font-family: var(--font-display);
    font-size: 1.65rem;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.footer-nameplate span {
    color: var(--gold);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--rule);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.footer-links a {
    color: var(--text-muted);
}

.footer-links a:hover,
.footer-links a.active {
    color: var(--gold);
}

.footer-legal {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text-faint);
    line-height: 1.8;
}

.margin-top {
    margin-top: var(--space-5);
}

.theme-toggle {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 10001;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    padding: 8px;
    border: 1px solid var(--toggle-border);
    border-radius: 2px;
    background: var(--toggle-bg);
    color: var(--toggle-text);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    border-color: var(--gold);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.2);
    outline: none;
}

.theme-toggle-icon {
    position: relative;
    width: 48px;
    height: 28px;
    border-radius: 2px;
    flex-shrink: 0;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(74, 78, 104, 0.95), rgba(26, 27, 38, 0.98));
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.16), 0 0 0 1px rgba(255, 255, 255, 0.08);
    transition: transform 0.5s ease, background 0.45s ease, box-shadow 0.35s ease;
}

.theme-toggle:hover .theme-toggle-icon,
.theme-toggle:focus-visible .theme-toggle-icon {
    transform: scale(1.05);
}

.theme-toggle-icon::before,
.theme-toggle-icon::after {
    content: "";
    position: absolute;
    border-radius: 2px;
    transition: transform 0.55s ease, opacity 0.45s ease, background 0.45s ease, box-shadow 0.35s ease;
}

.theme-toggle-icon::before {
    width: 20px;
    height: 20px;
    top: 4px;
    left: 4px;
    background: linear-gradient(145deg, rgba(245, 246, 255, 0.98), rgba(186, 195, 230, 0.94));
    box-shadow: inset -3px -3px 0 rgba(27, 31, 47, 0.3);
}

.theme-toggle-icon::after {
    inset: 0;
    border-radius: 2px;
    opacity: 1;
    background:
        radial-gradient(circle at 12px 9px, rgba(255, 255, 255, 0.8) 0 1.2px, transparent 1.4px),
        radial-gradient(circle at 22px 11px, rgba(255, 255, 255, 0.5) 0 1px, transparent 1.2px),
        radial-gradient(circle at 30px 8px, rgba(255, 255, 255, 0.7) 0 1.1px, transparent 1.3px);
}

.theme-toggle[data-mode="dark"] .theme-toggle-icon::before {
    transform: translateX(0);
}

.theme-toggle[data-mode="dark"] .theme-toggle-icon::after {
    opacity: 1;
}

.theme-toggle[data-mode="light"] .theme-toggle-icon {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(244, 239, 228, 0.96));
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.8), 0 0 0 1px rgba(169, 127, 33, 0.08);
}

.theme-toggle[data-mode="light"] .theme-toggle-icon::before {
    transform: translateX(20px);
    background: linear-gradient(145deg, rgba(255, 235, 148, 0.99), rgba(232, 182, 58, 0.96));
    box-shadow:
        0 0 0 6px rgba(245, 209, 97, 0.18),
        inset 0 1px 2px rgba(255, 255, 255, 0.45);
}

.theme-toggle[data-mode="light"] .theme-toggle-icon::after {
    opacity: 0;
}

.theme-toggle-text {
    display: none;
}

html[data-theme="light"] .panel {
    background: linear-gradient(145deg, rgba(255, 255, 251, 0.98), rgba(246, 238, 224, 0.96));
}

html[data-theme="light"] .download-panel {
    background: linear-gradient(160deg, rgba(255, 240, 204, 0.72), rgba(255, 252, 244, 0.98));
}

html[data-theme="light"] .photo-frame {
    background: linear-gradient(180deg, rgba(255, 255, 251, 0.98), rgba(246, 238, 224, 0.94));
}

html[data-theme="light"] .quote {
    color: var(--silver-bright);
}

html[data-theme="light"] .badge {
    background: rgba(255, 250, 241, 0.82);
}

html[data-theme="light"] .btn:not(.btn-primary) {
    background: rgba(255, 251, 243, 0.76);
}

html[data-theme="light"] .footer-social a {
    background: rgba(255, 250, 241, 0.88);
    box-shadow: var(--shadow-soft);
}

html[data-theme="light"] .footer-social a:hover,
html[data-theme="light"] .footer-social a:focus-visible {
    background: rgba(255, 253, 248, 0.98);
}

html[data-theme="light"] .footer-social img {
    filter: saturate(0.96) contrast(1.02);
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.7s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

::view-transition-old(root) {
    animation-name: theme-fade-out;
}

::view-transition-new(root) {
    animation-name: theme-fade-in;
}

@keyframes theme-fade-out {
    from {
        opacity: 1;
        filter: blur(0);
    }

    to {
        opacity: 0.92;
        filter: blur(3px);
    }
}

@keyframes theme-fade-in {
    from {
        opacity: 0.74;
        filter: blur(8px) saturate(1.08);
    }

    to {
        opacity: 1;
        filter: blur(0) saturate(1);
    }
}

@media (max-width: 900px) {
    .grid-2,
    .grid-3,
    .skill-grid {
        grid-template-columns: 1fr;
    }

    .masthead-top {
        justify-content: center;
    }

}

@media (max-width: 600px) {
    html {
        font-size: 16px;
    }

    .site-shell {
        padding: 0 var(--space-4) var(--space-7);
    }

    .masthead-nav {
        gap: var(--space-3);
    }

    .cta-row {
        flex-direction: column;
        align-items: stretch;
    }

    .theme-toggle {
        top: 12px;
        right: 12px;
        width: 64px;
    }

}

@media (min-width: 1024px) {
    .large-screen-only {
        display: block;
    }
}

@media (max-width: 1023px) {
    .large-screen-only {
        display: none;
    }
}

.footer-social {
    position: fixed;
    bottom: var(--space-2);
    right: var(--space-2);
    display: flex;
    gap: var(--space-2);
}

.footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-right: 0;
    padding: 0;
    border: 1px solid rgba(201, 168, 76, 0.16);
    border-radius: 10px;
    background: rgba(17, 17, 20, 0.86);
    box-shadow: var(--shadow-soft);
    transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease, background-color 0.24s ease;
}

.footer-social a:hover,
.footer-social a:focus-visible {
    transform: translateY(-4px) scale(1.08);
    border-color: var(--gold);
    background: rgba(33, 33, 39, 0.96);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(232, 207, 106, 0.22);
}

.footer-social img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 10px;
    transition: transform 0.24s ease, filter 0.24s ease;
}

.footer-social a:hover img,
.footer-social a:focus-visible img {
    transform: scale(1.08);
    filter: brightness(1.12);
}

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