/*
    DESIGN SYSTEM: Ledger & Ticker
    Ink-navy + brass, serif/mono pairing drawn from research reports,
    trading tickers and terminal data — built for a quant-finance/AI profile.
*/
:root {
    --paper: #F6F2E9;
    --paper-elevated: #FBF9F4;
    --bg-tertiary: #EFE9DA;
    --bg-primary: var(--paper);
    --bg-secondary: var(--paper-elevated);
    --bg-dark: #0F1626;
    --bg-dark-elevated: #171F35;

    --text-primary: #1B2131;
    --text-secondary: #565F72;
    --text-muted: #7A8298;
    --text-on-dark: #F2EEE3;
    --text-on-dark-muted: #98A0B8;

    /* Brass/gold accent — the ledger stamp, not a neon default */
    --accent-copper: #B3843C;
    --accent-copper-hover: #966E31;
    --accent-copper-light: rgba(179, 132, 60, 0.12);
    /* Accent dark enough to pass WCAG AA as small text on paper */
    --accent-text: #7A5626;

    --border: #E1D9C4;
    --border-hover: #CBBFA0;
    --border-on-dark: rgba(242, 238, 227, 0.12);

    --shadow-sm: 0 1px 2px 0 rgba(15, 22, 38, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(15, 22, 38, 0.1), 0 2px 4px -1px rgba(15, 22, 38, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(15, 22, 38, 0.12), 0 4px 6px -2px rgba(15, 22, 38, 0.06);
    --shadow-glow: 0 10px 40px -10px rgba(179, 132, 60, 0.35);

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Fraunces', Georgia, serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

    --border-radius: 12px;
    --portrait: 380px;

    /* Surfaces that flip in dark mode */
    --logo-plate: #FFFFFF;
    --nav-bg: rgba(15, 22, 38, 0.55);
    --nav-bg-scrolled: rgba(15, 22, 38, 0.92);
    --overlay-bg: rgba(246, 242, 233, 0.97);
    --caption-bg: rgba(251, 249, 244, 0.9);
    color-scheme: light;
}

/* ── Dark theme ─────────────────────────────────────────
   Two selectors, one token set: system preference (unless
   the user explicitly chose light) and the manual toggle. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #10151F;
        --paper-elevated: #161C29;
        --bg-tertiary: #1D2432;
        --bg-dark: #0A0E16;
        --bg-dark-elevated: #131926;

        --text-primary: #ECE8DE;
        --text-secondary: #A9B0C0;
        --text-muted: #7E8698;

        --accent-copper: #D3A45C;
        --accent-copper-hover: #E0B570;
        --accent-copper-light: rgba(211, 164, 92, 0.14);
        --accent-text: #D3A45C;

        --border: #262E3D;
        --border-hover: #374154;

        --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.55), 0 4px 6px -2px rgba(0, 0, 0, 0.4);

        --logo-plate: #F3F1EA;
        --nav-bg: rgba(10, 14, 22, 0.6);
        --nav-bg-scrolled: rgba(10, 14, 22, 0.94);
        --overlay-bg: rgba(16, 21, 31, 0.97);
        --caption-bg: rgba(22, 28, 41, 0.92);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --paper: #10151F;
    --paper-elevated: #161C29;
    --bg-tertiary: #1D2432;
    --bg-dark: #0A0E16;
    --bg-dark-elevated: #131926;

    --text-primary: #ECE8DE;
    --text-secondary: #A9B0C0;
    --text-muted: #7E8698;

    --accent-copper: #D3A45C;
    --accent-copper-hover: #E0B570;
    --accent-copper-light: rgba(211, 164, 92, 0.14);
    --accent-text: #D3A45C;

    --border: #262E3D;
    --border-hover: #374154;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.55), 0 4px 6px -2px rgba(0, 0, 0, 0.4);

    --logo-plate: #F3F1EA;
    --nav-bg: rgba(10, 14, 22, 0.6);
    --nav-bg-scrolled: rgba(10, 14, 22, 0.94);
    --overlay-bg: rgba(16, 21, 31, 0.97);
    --caption-bg: rgba(22, 28, 41, 0.92);
    color-scheme: dark;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5 {
    font-weight: 600;
    line-height: 1.15;
}

h1, h2, h3 {
    font-family: var(--font-display);
}

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

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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
}

/* ═══════════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════════ */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    z-index: 1000;
    transition: all 0.3s ease;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
}

nav.scrolled {
    background: var(--nav-bg-scrolled);
    border-bottom: 1px solid var(--border-on-dark);
    height: 70px;
    box-shadow: var(--shadow-sm);
}

nav .logo {
    color: var(--text-on-dark);
}

nav .nav-links a {
    color: var(--text-on-dark-muted);
}

nav .nav-links a:hover {
    color: var(--accent-copper);
}

nav .mobile-menu-btn {
    color: var(--text-on-dark);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 600;
    font-size: 1.4rem;
    letter-spacing: -0.5px;
}

.logo-mark {
    width: 32px;
    height: 32px;
    background: var(--accent-copper);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
}

.nav-links a {
    display: inline-block;
    padding: 0.6rem 0.15rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--accent-copper);
}

.nav-cta {
    background: var(--accent-copper);
    color: var(--bg-dark) !important;
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    transition: all 0.2s ease !important;
}

.nav-links a.nav-cta { padding: 0.55rem 1.2rem; }

.nav-cta:hover {
    background: var(--accent-copper-hover);
    transform: translateY(-2px);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-toggle {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-on-dark);
    border-radius: 9px;
    color: var(--text-on-dark);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

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

.mobile-menu-btn {
    display: none;
    width: 44px;
    height: 44px;
    place-items: center;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

/* ═══════════════════════════════════════════
   HERO SECTION
   ═══════════════════════════════════════════ */
.hero {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    /* Clear the fixed navbar (80px) and leave room below the buttons, so the
       content never touches either edge when it is taller than the screen. */
    padding: calc(80px + clamp(2rem, 6vh, 4rem)) 0 clamp(3.5rem, 9vh, 6rem);
    position: relative;
    overflow: hidden;
    background: var(--bg-dark);
    color: var(--text-on-dark);
}

.hero::before {
    content: '';
    position: absolute;
    inset: -10%;
    background-image:
        linear-gradient(rgba(242, 238, 227, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(242, 238, 227, 0.05) 1px, transparent 1px);
    background-size: 64px 64px;
    -webkit-mask-image: radial-gradient(circle at 78% 30%, black 0%, transparent 55%);
    mask-image: radial-gradient(circle at 78% 30%, black 0%, transparent 55%);
    animation: gridDrift 40s linear infinite;
    z-index: 0;
}

.hero::after {
    content: '';
    position: absolute;
    top: -20%; right: -10%;
    width: 600px; height: 600px;
    background: radial-gradient(circle, var(--accent-copper-light) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
}

@keyframes gridDrift {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 64px 128px, 64px 128px; }
}

.hero-container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 4rem;
    align-items: center;
}

.hero-status {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.3px;
    color: var(--text-on-dark-muted);
    margin-bottom: 1.5rem;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #5FBF7F;
    box-shadow: 0 0 0 0 rgba(95, 191, 127, 0.7);
    animation: statusPulse 2.4s ease-out infinite;
}

@keyframes statusPulse {
    0%   { box-shadow: 0 0 0 0 rgba(95, 191, 127, 0.6); }
    70%  { box-shadow: 0 0 0 7px rgba(95, 191, 127, 0); }
    100% { box-shadow: 0 0 0 0 rgba(95, 191, 127, 0); }
}

.hero h1 {
    font-size: clamp(2.25rem, 1.4rem + 2.6vw, 3.5rem);
    line-height: 1.1;
    letter-spacing: -1px;
    margin-bottom: 1.25rem;
    color: var(--text-on-dark);
}

.hero h1 em {
    font-style: italic;
    color: var(--accent-copper);
}

.hero-content .hero-status,
.hero-content h1,
.hero-content .hero-subtitle,
.hero-content .hero-cta-group {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-content.active .hero-status { opacity: 1; transform: none; transition-delay: 0.05s; }
.hero-content.active h1 { opacity: 1; transform: none; transition-delay: 0.18s; }
.hero-content.active .hero-subtitle { opacity: 1; transform: none; transition-delay: 0.36s; }
.hero-content.active .hero-cta-group { opacity: 1; transform: none; transition-delay: 0.52s; }

@media (prefers-reduced-motion: reduce) {
    .hero-content .hero-status,
    .hero-content h1, .hero-content .hero-subtitle, .hero-content .hero-cta-group {
        opacity: 1; transform: none; transition: none;
    }
    .status-dot { animation: none; }
}

.hero-subtitle {
    font-size: clamp(1rem, 0.9rem + 0.3vw, 1.1rem);
    color: var(--text-on-dark-muted);
    margin-bottom: 2rem;
    max-width: 550px;
}

.hero-cta-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.875rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 50px;
    padding: 0.8rem 1.6rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    line-height: 1;
    white-space: nowrap;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.btn i {
    font-size: 1.1em;
    transition: transform 0.2s ease;
}

.btn-primary {
    background: var(--accent-copper);
    color: var(--bg-dark);
    border: 1px solid var(--accent-copper);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--accent-copper-hover);
    border-color: var(--accent-copper-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover .fa-arrow-down { transform: translateY(2px); }

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--text-primary);
    transform: translateY(-2px);
}

/* Square icon-only button (keeps the hero buttons on one row) */
.btn.btn-icon { width: 50px; padding: 0; flex: none; font-size: 1.1rem; }

/* On the dark hero the secondary button is an outline, so the
   primary action stays the one clear focal point. */
.hero .btn-secondary {
    background: transparent;
    color: var(--text-on-dark);
    border-color: rgba(242, 238, 227, 0.28);
}

.hero .btn-secondary:hover {
    color: var(--text-on-dark);
    border-color: var(--accent-copper);
    background: var(--accent-copper-light);
}

.hero-visual {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1200px;
}

.hero-visual::before {
    content: '';
    position: absolute;
    width: var(--portrait);
    height: var(--portrait);
    border-radius: 50%;
    border: 1.5px solid var(--accent-copper);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translate(18px, -18px) rotate(-6deg);
    z-index: 0;
    opacity: 0.6;
}

.hero-visual::after {
    content: '';
    position: absolute;
    width: var(--portrait);
    height: var(--portrait);
    border-radius: 50%;
    background: var(--accent-copper-light);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translate(-14px, 14px);
    z-index: 0;
}

.photo-wrapper {
    width: var(--portrait);
    height: var(--portrait);
    border-radius: 50%;
    overflow: hidden;
    background: var(--border);
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-lg);
    transform: rotateY(var(--tilt-x, 0deg)) rotateX(var(--tilt-y, 0deg));
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

.photo-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    /* Rim light only — no colour wash over the face. */
    box-shadow: inset 0 0 0 1px rgba(242, 238, 227, 0.22);
    background: linear-gradient(160deg, rgba(179, 132, 60, 0.06), transparent 30%);
    pointer-events: none;
}

.photo-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    /* Keep the photo's own colour — just a touch of lift so it
       reads cleanly against the dark hero. */
    filter: saturate(1.06) contrast(1.04);
}

@media (prefers-reduced-motion: reduce) {
    .photo-wrapper { transform: none !important; }
}

.photo-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 4rem;
}

/* ═══════════════════════════════════════════
   SECTIONS
   One rhythm for every section: generous space,
   a heading, a short line, then the content.
   ═══════════════════════════════════════════ */
section {
    padding: 112px 0;
}

.section-light { background: var(--bg-secondary); }
.section-gray { background: var(--bg-primary); }

.section-dark {
    background: var(--bg-dark);
    color: var(--text-on-dark);
    border-block: 1px solid var(--border-on-dark);
}

.section-header {
    max-width: 640px;
    margin-bottom: 3.5rem;
}

.section-header-center {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.section-title {
    font-size: 2.4rem;
    letter-spacing: -0.5px;
    margin-bottom: 0.9rem;
}

.section-desc {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Shared inline link: mono, accent, arrow nudges on hover */
.text-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0;
    background: none;
    border: none;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--accent-text);
    cursor: pointer;
    transition: gap 0.2s ease, color 0.2s ease;
}

.text-link:hover {
    gap: 0.8rem;
    color: var(--accent-copper-hover);
}

.text-link i { font-size: 0.75rem; }

/* ═══════════════════════════════════════════
   SELECTED WORK
   The only cards on the page.
   ═══════════════════════════════════════════ */
.work-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.work-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 2rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.work-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.work-origin {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.work-card h3 {
    font-size: 1.4rem;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.work-fact {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent-text);
    padding-left: 0.75rem;
    border-left: 2px solid var(--accent-copper);
    margin-bottom: 1rem;
}

.work-summary {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.work-stack {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.work-card .work-stack { margin-top: auto; }

/* Expandable case study (featured cards and the "more" list) */
.case-study,
.more-item {
    margin-bottom: 1.25rem;
}

.case-study > summary,
.more-item > summary {
    list-style: none;
    cursor: pointer;
}

.case-study > summary::-webkit-details-marker,
.more-item > summary::-webkit-details-marker { display: none; }

.case-study > summary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--accent-text);
}

.case-study > summary:hover { color: var(--accent-copper-hover); }

.case-study > summary i,
.more-item > summary i {
    font-size: 0.7rem;
    transition: transform 0.25s ease;
}

.case-study[open] > summary i,
.more-item[open] > summary i { transform: rotate(180deg); }

.case-study dl,
.more-item dl {
    display: grid;
    grid-template-columns: 6.5rem 1fr;
    gap: 0.6rem 1rem;
    margin-top: 1.25rem;
    font-size: 0.92rem;
    animation: detailOpen 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.case-study dl {
    grid-template-columns: 1fr;
    gap: 0.2rem;
}

.case-study dd { margin-bottom: 0.6rem; }

.case-study dt,
.more-item dt {
    font-weight: 600;
    color: var(--text-primary);
}

.case-study dd,
.more-item dd {
    color: var(--text-secondary);
}

@keyframes detailOpen {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

/* More projects: a plain list, no boxes */
.more-title {
    font-size: 1.35rem;
    margin: 4.5rem 0 0.5rem;
}

.more-list {
    border-top: 1px solid var(--border);
}

.more-item {
    border-bottom: 1px solid var(--border);
    margin: 0;
}

.more-item > summary {
    display: grid;
    grid-template-columns: minmax(0, 20rem) 1fr auto;
    gap: 2rem;
    align-items: baseline;
    padding: 1.4rem 0;
}

.more-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.more-summary {
    color: var(--text-secondary);
}

.more-item > summary i { color: var(--text-muted); }

.more-item > summary:hover .more-name { color: var(--accent-text); }

.more-item dl {
    margin: 0 0 1rem;
    max-width: 760px;
}

.more-item .work-stack {
    margin: 0 0 1.5rem;
}

/* ═══════════════════════════════════════════
   EXPERIENCE — a plain dated list
   ═══════════════════════════════════════════ */
.exp-list {
    list-style: none;
    max-width: 880px;
    border-top: 1px solid var(--border);
}

.exp-item {
    display: grid;
    grid-template-columns: 9.5rem 1fr;
    gap: 2rem;
    padding: 2rem 0;
    border-bottom: 1px solid var(--border);
}

.exp-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-top: 0.45rem;
}

.exp-head {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 0.9rem;
}

.exp-head h3 {
    font-size: 1.25rem;
}

.exp-role {
    color: var(--accent-text);
    font-weight: 500;
    font-size: 0.95rem;
}

.exp-logo {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    object-fit: contain;
    background: var(--logo-plate);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
}

.exp-logo.is-wordmark {
    width: 72px;
    padding: 3px 6px;
}

.exp-body > p {
    color: var(--text-secondary);
    max-width: 65ch;
}

.exp-body .exp-note {
    margin-top: 0.9rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════
   CORE COMPETENCIES — tabs by area of work
   ═══════════════════════════════════════════ */
.skills-tablist {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}

.skills-tablist::-webkit-scrollbar { display: none; }

.skills-tab {
    flex-shrink: 0;
    padding: 0.85rem 1.1rem;
    margin-bottom: -1px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.skills-tab:hover { color: var(--text-primary); }

/* Wider screens: every area visible at once as wrapping pills */
@media (min-width: 769px) {
    .skills-tablist { flex-wrap: wrap; gap: 0.6rem; overflow: visible; border-bottom: 0; }
    .skills-tab {
        margin: 0;
        padding: 0.6rem 1.1rem;
        border: 1px solid var(--border);
        border-radius: 999px;
        transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    }
    .skills-tab:hover { border-color: var(--accent-copper); }
}


.skills-tab[aria-selected="true"] {
    color: var(--text-primary);
    font-weight: 600;
    border-bottom-color: var(--accent-copper);
}

@media (min-width: 769px) {
    .skills-tab[aria-selected="true"] {
        background: var(--accent-copper);
        border-color: var(--accent-copper);
        color: var(--bg-dark);
    }
}

.skills-panel {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 3.5rem;
    padding-top: 2.5rem;
}

.skills-panel[hidden] { display: none; }

.skills-panel:not([hidden]) {
    animation: detailOpen 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.skills-panel-text h3 {
    font-size: 1.5rem;
    margin-bottom: 0.9rem;
}

.skills-panel-text > p {
    color: var(--text-secondary);
}

.skills-proof {
    margin-top: 1.25rem;
    font-size: 0.92rem;
}

.skills-proof span {
    display: block;
    margin-bottom: 0.2rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-text);
}

.skills-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 0.6rem;
}

.skills-list li {
    padding: 0.5rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════
   TEACHING — the one dark band below the hero
   ═══════════════════════════════════════════ */
.teaching-grid > * { min-width: 0; }

.teaching-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 5rem;
    align-items: center;
}

.section-dark .section-title { color: var(--text-on-dark); }

.teaching-meta {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: #D3A45C;
    margin-bottom: 1.25rem;
}

.teaching-main > p:not(.teaching-meta) {
    color: var(--text-on-dark-muted);
    font-size: 1.05rem;
}

.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 3.5rem;
    margin: 2.25rem 0 0.5rem;
}

.stat-value {
    display: block;
    font-family: var(--font-display);
    font-size: 2.75rem;
    font-weight: 600;
    line-height: 1;
    color: #D3A45C;
}

.stat-label {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-on-dark-muted);
}

.teaching-cta {
    margin-top: 2.25rem;
}

/* Arrow nudges right to signal the link opens the post */
.teaching-cta:hover .fa-arrow-right { transform: translateX(3px); }

/* Dark band keeps the bright accent in both themes */
.section-dark .text-link { color: #D3A45C; }
.section-dark .text-link:hover { color: #E0B570; }

.teaching-quote {
    border-left: 2px solid #D3A45C;
    padding-left: 2rem;
}

.teaching-quote p {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.85rem;
    line-height: 1.3;
    color: var(--text-on-dark);
    margin-bottom: 1.25rem;
}

.teaching-quote footer {
    color: var(--text-on-dark-muted);
    font-size: 0.98rem;
}

/* ═══════════════════════════════════════════
   CREDENTIALS GALLERY
   ═══════════════════════════════════════════ */
.gallery-container {
    position: relative;
    max-width: 1000px;
    height: 500px;
    margin: 0 auto;
    overflow: hidden;
}

.gallery-track {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gallery-slide {
    position: absolute;
    width: 80%;
    max-width: 600px;
    height: 100%;
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    transform: scale(0.85);
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gallery-slide.active {
    opacity: 1;
    transform: scale(1);
    z-index: 3;
}

.gallery-slide.prev,
.gallery-slide.next {
    opacity: 0.35;
    z-index: 2;
    filter: blur(2px);
}

.gallery-slide.prev { transform: scale(0.85) translateX(-40%); }
.gallery-slide.next { transform: scale(0.85) translateX(40%); }

.gallery-slide img {
    width: 100%;
    height: 400px;
    object-fit: contain;
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 10px;
    box-shadow: var(--shadow-md);
}

.gallery-caption {
    margin-top: 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 1rem;
    pointer-events: none;
}

.gallery-btn {
    pointer-events: auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--caption-bg);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.gallery-btn:hover {
    background: var(--accent-copper);
    color: var(--bg-dark);
    border-color: var(--accent-copper);
}

.gallery-dots {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-top: 0.5rem;
}

.gallery-dot {
    /* 8px dot inside a 24px tap area */
    box-sizing: content-box;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-hover);
    background-clip: content-box;
    border: none;
    padding: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.gallery-dot.active {
    background: var(--accent-copper);
    background-clip: content-box;
    width: 22px;
    border-radius: 12px;
}

/* ═══════════════════════════════════════════
   CONTACT & FOOTER
   ═══════════════════════════════════════════ */
.contact-links {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.contact-links .btn { gap: 0.6rem; }

body > footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 2rem 0;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 2rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.footer-logo {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════ */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.active {
    opacity: 1;
    transform: none;
}

.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 1024px) {
    .hero-container { grid-template-columns: 1fr; gap: 2.25rem; text-align: center; }
    .hero-status { align-items: flex-start; text-align: center; max-width: 34ch; }
    .hero-status .status-dot { flex: none; margin-top: 0.45em; }
    .hero-subtitle { margin: 0 auto 2rem; }
    .hero-cta-group { justify-content: center; }
    .hero-visual { order: -1; }
    .work-grid { grid-template-columns: 1fr; max-width: 640px; }
    .teaching-grid { grid-template-columns: 1fr; gap: 3rem; }
}

@media (max-width: 960px) {
    .nav-links { display: none; }
    .mobile-menu-btn { display: grid; }
}

@media (max-width: 360px) {
    /* Long button labels wrap instead of pushing the page sideways */
    .btn { white-space: normal; text-align: center; }
}

@media (max-width: 480px) {
    .hero-cta-group { display: grid; grid-template-columns: 1fr 50px; max-width: 340px; margin: 0 auto; }
    .hero-cta-group .btn { width: 100%; }
    .hero-cta-group .btn:first-child { grid-column: 1 / -1; }
    .hero-cta-group .btn.btn-icon { width: 50px; }
    .teaching-cta { width: 100%; }
}

@media (max-width: 768px) {
    section { padding: 80px 0; }
    .section-title { font-size: 2rem; }
    .hero h1 { font-size: clamp(2rem, 1.2rem + 3.5vw, 2.5rem); }
    .hero-visual { --portrait: 240px; }

    .work-card { padding: 1.5rem; }

    .more-item > summary {
        grid-template-columns: 1fr auto;
        gap: 0.4rem 1rem;
    }
    .more-name { grid-column: 1; }
    .more-summary { grid-column: 1; grid-row: 2; font-size: 0.95rem; }
    .more-item > summary i { grid-column: 2; grid-row: 1; }
    .more-item dl { grid-template-columns: 1fr; gap: 0.2rem; }
    .more-item dd { margin-bottom: 0.6rem; }

    .exp-item { grid-template-columns: 1fr; gap: 0.6rem; padding: 1.75rem 0; }

    .skills-panel { grid-template-columns: 1fr; gap: 1.75rem; padding-top: 2rem; }
    .skills-tab { padding: 0.8rem 0.9rem; font-size: 0.9rem; }
    /* Fade the right edge so the sideways-scrolling tab row reads as scrollable */
    .skills-tablist {
        -webkit-mask-image: linear-gradient(90deg, black 85%, transparent);
        mask-image: linear-gradient(90deg, black 85%, transparent);
        padding-right: 2rem;
    }
    .exp-date { padding-top: 0; }
    .exp-head { align-items: flex-start; }

    .stats-row { gap: 2.5rem; }
    .teaching-quote { padding-left: 1.25rem; }
    .teaching-quote p { font-size: 1.5rem; }

    .gallery-container { height: 380px; }
    .gallery-slide img { height: 290px; }

    .footer-content { flex-direction: column; text-align: center; }
}

.mobile-nav-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

.mobile-nav-overlay.active { display: flex; }

.mobile-nav-overlay a {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.mobile-nav-overlay .close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

/* ═══════════════════════════════════════════
   WHATSAPP FLOATING BUTTON
   ═══════════════════════════════════════════ */
.whatsapp-float {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    background: #25D366;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: var(--shadow-lg);
    z-index: 999;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
}

.whatsapp-float.is-hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
    pointer-events: none;
}

.whatsapp-float:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 28px -6px rgba(37, 211, 102, 0.5);
}

@media (max-width: 768px) {
    .whatsapp-float {
        width: 50px;
        height: 50px;
        font-size: 1.6rem;
        right: 16px;
        bottom: 16px;
    }
}

/* ═══════════════════════════════════════════
   LIGHTBOX
   ═══════════════════════════════════════════ */
img[data-zoom] {
    cursor: zoom-in;
}

.gallery-slide:not(.active) img[data-zoom] {
    cursor: default;
}

.lightbox {
    border: none;
    padding: 0;
    background: transparent;
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
}

.lightbox[open] {
    display: flex;
}

.lightbox::backdrop {
    background: rgba(10, 14, 22, 0.88);
}

.lightbox img {
    max-width: min(92vw, 1100px);
    max-height: 92vh;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.lightbox-close {
    position: fixed;
    top: 16px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.24);
}

/* Live projects */
.project-card .work-stack { margin-top: 0; margin-bottom: 1.25rem; }
.project-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-top: auto; }
.project-links .text-link { margin-top: 0; }
.btn-sm { min-height: 40px; padding: 0.55rem 1.05rem; font-size: 0.85rem; }
.project-hub { border-style: dashed; justify-content: center; grid-column: 1 / -1; }
.project-featured { grid-column: 1 / -1; }
.project-featured .work-summary { max-width: 70ch; }
.project-hub .work-summary { margin-bottom: 1.25rem; }

/* Link inside running text */
.inline-link {
    color: var(--accent-text);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}
.inline-link:hover { color: var(--accent-copper-hover); }
