:root {
    /* Paper + ink, not black-and-neon: a pale sage-tinted "graph
       paper" background, deep pine ink for text, copper (resistor
       lead) and PCB-trace green as the two accents. */
    --paper: #eef0e4;
    --paper-2: #f7f5ea;
    --card: #fbfaf2;
    --line: rgba(22, 33, 26, 0.14);
    --line-strong: rgba(22, 33, 26, 0.28);
    --ink: #16211a;
    --ink-soft: #3d4a3f;
    --muted: #6d7669;
    --copper: #a85a26;
    --copper-deep: #7c3f19;
    --green: #2f7a55;
    --green-deep: #1f5b3e;
    --shadow: 0 20px 46px rgba(22, 33, 26, 0.1);
    --max: 1160px;
    --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: var(--sans);
    background:
        radial-gradient(circle at 86% 6%, rgba(47, 122, 85, 0.08), transparent 30%),
        var(--paper);
    color: var(--ink);
    overflow-x: hidden;
}

body.menu-open {
    overflow: hidden;
}

a {
    color: inherit;
}

.noise {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.55;
    background-image:
        linear-gradient(rgba(22, 33, 26, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(22, 33, 26, 0.05) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(180deg, #000, transparent 88%);
}

.topbar {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 20;
    width: min(calc(100% - 32px), var(--max));
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 20px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: rgba(247, 245, 234, 0.86);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    text-decoration: none;
    font-weight: 700;
    color: var(--ink);
}

.wordmark span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--paper-2);
    background: var(--ink);
}

.desktop-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.desktop-nav a,
.nav-cta {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 0 14px;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

.desktop-nav a:hover {
    color: var(--ink);
    background: rgba(22, 33, 26, 0.06);
}

.nav-cta {
    color: var(--paper-2);
    background: var(--green-deep);
}

.nav-cta:hover {
    background: var(--copper-deep);
}

.menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--card);
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 17px;
    height: 2px;
    margin: 5px auto;
    border-radius: 999px;
    background: var(--ink);
}

.mobile-nav {
    position: fixed;
    top: 88px;
    left: 16px;
    right: 16px;
    z-index: 18;
    display: none;
    padding: 14px;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: rgba(247, 245, 234, 0.98);
    backdrop-filter: blur(14px);
}

.mobile-nav a {
    display: block;
    padding: 14px;
    border-radius: 10px;
    color: var(--ink-soft);
    text-decoration: none;
    font-weight: 700;
}

.mobile-nav a:hover {
    background: rgba(22, 33, 26, 0.06);
}

.side-rail {
    position: fixed;
    left: 22px;
    top: 50%;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 14px;
    transform: translateY(-50%) rotate(-90deg);
    transform-origin: left center;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.rail-line {
    width: 64px;
    height: 1px;
    background: var(--line-strong);
}

.rail-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
}

main {
    width: min(calc(100% - 44px), var(--max));
    margin: 0 auto;
}

.hero {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.78fr);
    gap: 54px;
    align-items: center;
    padding: 132px 0 72px;
}

.hero-copy {
    min-width: 0;
}

.availability {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 24px;
    padding: 6px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--green-deep);
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    background: var(--card);
}

.availability::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--copper);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    max-width: 850px;
    margin-bottom: 24px;
    color: var(--ink);
    font-weight: 700;
    font-size: clamp(2.7rem, 5.6vw, 4.6rem);
    line-height: 1.02;
    letter-spacing: -0.01em;
    overflow-wrap: break-word;
}

.hero-lead {
    max-width: 640px;
    color: var(--ink-soft);
    font-size: 1.1rem;
    line-height: 1.8;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 34px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.94rem;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.button:hover {
    transform: translateY(-2px);
}

.button.primary {
    color: var(--paper-2);
    background: var(--ink);
}

.button.primary:hover {
    background: var(--copper-deep);
}

.button.secondary {
    color: var(--ink);
    border: 1px solid var(--line-strong);
    background: var(--card);
}

.button.secondary:hover {
    border-color: var(--green-deep);
}

.portrait-shell {
    position: relative;
    min-height: 580px;
    display: flex;
    align-items: center;
}

.portrait-shell::before,
.portrait-shell::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--copper);
    z-index: 2;
}

.portrait-shell::before {
    top: 22px;
    left: 14px;
}

.portrait-shell::after {
    bottom: 22px;
    left: 14px;
}

.portrait-frame {
    position: relative;
    width: 100%;
    height: 520px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.portrait-frame img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: 50% 32%;
    filter: saturate(0.9) contrast(1.02) sepia(0.06);
}

.focus-tag {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
    padding: 12px 16px;
    border: 1px solid var(--line-strong);
    border-left: 2px solid var(--copper);
    border-radius: 10px;
    background: var(--card);
}

.focus-tag span {
    color: var(--copper);
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
}

.focus-tag strong {
    font-size: 0.96rem;
    font-weight: 600;
    color: var(--ink);
}

.proof-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: var(--line-strong);
}

.proof-strip div {
    min-height: 140px;
    padding: 24px;
    background: var(--card);
}

.proof-strip strong {
    display: block;
    color: var(--ink);
    font-family: var(--mono);
    font-size: 1.4rem;
    line-height: 1;
    font-weight: 600;
}

.proof-strip span {
    display: block;
    max-width: 220px;
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

section {
    scroll-margin-top: 110px;
}

.story,
.experience,
.work,
.skills,
.process,
.certifications,
.youtube,
.contact {
    padding: 92px 0;
}

.section-heading {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 760px;
    margin-bottom: 44px;
}

.section-heading.compact {
    margin-bottom: 32px;
}

.section-heading span,
.youtube span,
.contact-grid span {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--green-deep);
    font-family: var(--mono);
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.section-heading span::before,
.youtube span::before,
.contact-grid span::before {
    content: "";
    width: 22px;
    height: 1px;
    background: var(--copper);
}

.section-heading h2 {
    margin-bottom: 0;
    color: var(--ink);
    font-weight: 700;
    font-size: clamp(1.9rem, 3.6vw, 3rem);
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.story {
    max-width: 880px;
    margin-left: auto;
    margin-right: auto;
}

.story .section-heading {
    max-width: 100%;
}

.story-grid {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 100%;
}

.story-grid p {
    margin-bottom: 0;
    color: var(--ink-soft);
    font-size: 1.04rem;
    line-height: 1.8;
}

.foundation-highlight-card {
    padding: 22px 26px;
    border: 1px solid var(--line-strong);
    border-left: 5px solid var(--green);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(47, 122, 85, 0.08) 0%, rgba(247, 245, 234, 0.95) 100%);
    box-shadow: 0 4px 18px rgba(22, 33, 26, 0.04);
}

.foundation-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--copper-deep);
    font-family: var(--mono);
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.foundation-kicker::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--copper);
}

.foundation-statement {
    margin: 0 !important;
    color: var(--ink) !important;
    font-size: 1.06rem !important;
    line-height: 1.75 !important;
}

.foundation-statement strong {
    color: var(--green-deep);
    font-weight: 700;
    background: rgba(47, 122, 85, 0.14);
    padding: 2px 8px;
    border-radius: 4px;
    border-bottom: 2px solid var(--green);
}

.education-grid {
    gap: 8px;
}

.stats-section {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 14px;
}

.stat-item {
    padding: 18px;
    border: 1px solid var(--line);
    border-left: 2px solid var(--green);
    border-radius: 10px;
    background: var(--card);
}

.stat-item strong {
    display: block;
    font-family: var(--mono);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ink);
}

.stat-item span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.84rem;
}

.timeline {
    border-top: 1px solid var(--line);
}

.timeline-item {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 30px;
    padding: 28px 0;
    border-bottom: 1px solid var(--line);
}

.timeline-date {
    color: var(--copper-deep);
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.timeline-content h3,
.project-row h3,
.skill-grid h3,
.process-grid h3 {
    margin-bottom: 10px;
    color: var(--ink);
    font-size: 1.28rem;
    font-weight: 600;
    letter-spacing: -0.005em;
}

.timeline-content p,
.project-row p,
.skill-grid p,
.process-grid p,
.youtube p {
    margin-bottom: 0;
    color: var(--ink-soft);
    line-height: 1.7;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 24px;
}

.filter {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--ink-soft);
    background: var(--card);
    font: inherit;
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
}

.filter.active,
.filter:hover {
    color: var(--paper-2);
    border-color: transparent;
    background: var(--green-deep);
}

.project-list {
    display: grid;
    gap: 12px;
}

.project-row {
    display: grid;
    grid-template-columns: 60px minmax(0, 1.25fr) minmax(210px, 0.55fr);
    gap: 26px;
    align-items: start;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.project-row:hover {
    transform: translateY(-3px);
    border-color: var(--green);
    box-shadow: var(--shadow);
}

.project-row.featured {
    border-left: 2px solid var(--copper);
}

.project-index {
    display: grid;
    place-items: center;
    width: 44px;
    height: 32px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    color: var(--green-deep);
    font-family: var(--mono);
    font-size: 0.82rem;
    font-weight: 600;
}

.project-row ul {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    align-content: flex-start;
}

.project-row li {
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink-soft);
    font-family: var(--mono);
    font-size: 0.76rem;
    font-weight: 500;
    background: var(--paper-2);
}

.skill-grid,
.process-grid,
.certification-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    align-items: stretch;
}

.skill-grid article,
.process-grid div,
.certification-grid article {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
}

.process-grid strong {
    display: block;
    margin-bottom: 18px;
    color: var(--copper);
    font-family: var(--mono);
    font-size: 0.88rem;
    font-weight: 600;
}

.youtube {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 28px;
    align-items: end;
    margin: 30px 0 0;
    padding: 40px;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background: var(--card);
}

.youtube h2 {
    max-width: 720px;
    margin: 12px 0 12px;
    color: var(--ink);
    font-weight: 700;
    font-size: clamp(1.8rem, 3.4vw, 2.8rem);
    line-height: 1.08;
    letter-spacing: -0.01em;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.contact-grid a,
.contact-grid div {
    min-height: 126px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--ink);
    text-decoration: none;
    background: var(--card);
    font-weight: 500;
}

.contact-grid span {
    margin-bottom: 16px;
}

.contact-grid a:hover {
    border-color: var(--green);
}

.footer {
    width: min(calc(100% - 44px), var(--max));
    margin: 0 auto;
    padding: 32px 0 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    border-top: 1px solid var(--line);
}

.footer span {
    font-weight: 700;
    color: var(--ink);
}

.to-top {
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 10px 14px;
    color: var(--ink-soft);
    background: var(--card);
    font: inherit;
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
}

.to-top:hover {
    border-color: var(--green-deep);
}

.section-reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 600ms ease, transform 600ms ease;
}

.section-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }

    .section-reveal {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 1100px) {
    .side-rail {
        display: none;
    }

    .hero {
        grid-template-columns: minmax(0, 1fr);
        padding-top: 126px;
    }

    .portrait-shell {
        min-height: auto;
        max-width: 520px;
    }

    .skill-grid,
    .process-grid,
    .certification-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 780px) {
    .section-reveal {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    main,
    .footer {
        width: min(calc(100% - 28px), var(--max));
    }

    .topbar {
        top: 12px;
        width: calc(100% - 24px);
        grid-template-columns: 1fr auto;
    }

    .desktop-nav,
    .nav-cta {
        display: none;
    }

    .menu-toggle {
        display: block;
    }

    .mobile-nav.is-open {
        display: block;
    }

    .hero {
        gap: 34px;
        padding: 108px 0 56px;
    }

    h1 {
        width: 100%;
        max-width: calc(100vw - 28px);
        font-size: clamp(1.9rem, 7vw, 2.4rem);
        line-height: 1.08;
    }

    .hero-lead {
        font-size: 1rem;
    }

    .portrait-frame {
        height: 420px;
        border-radius: 16px;
    }

    .signal-card {
        right: 10px;
        bottom: 14px;
    }

    .proof-strip,
    .contact-grid {
        grid-template-columns: 1fr;
    }

    .proof-strip div {
        min-height: auto;
    }

    .stats-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .contact-grid a,
    .contact-grid div {
        min-height: auto;
        padding: 16px 18px;
    }

    .timeline-item,
    .project-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .skill-grid,
    .process-grid,
    .certification-grid {
        grid-template-columns: 1fr;
    }

    .youtube {
        grid-template-columns: 1fr;
        padding: 26px;
    }

    .footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }
}

@media (max-width: 460px) {
    .wordmark {
        font-size: 0.92rem;
    }

    .hero-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .button {
        width: 100%;
    }

    .portrait-frame {
        height: 360px;
    }

    .proof-strip div,
    .project-row,
    .skill-grid article,
    .process-grid div,
    .certification-grid article,
    .contact-grid a,
    .contact-grid div {
        padding: 18px;
        border-radius: 12px;
    }

    .story,
    .experience,
    .work,
    .skills,
    .process,
    .certifications,
    .youtube,
    .contact {
        padding: 60px 0;
    }
}

/* =========================================================
   PROJECT ROW WITH RIGHT-ALIGNED IMAGE
   ========================================================= */
.project-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.project-row {
    display: grid;
    grid-template-columns: 50px 1fr;
    gap: 24px;
    align-items: center;
    padding: 24px 28px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.project-row.has-image {
    grid-template-columns: 50px 1fr 240px;
}

.project-row:hover {
    transform: translateY(-2px);
    border-color: var(--green);
    box-shadow: var(--shadow);
}

.project-index {
    display: grid;
    place-items: center;
    width: 44px;
    height: 38px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    color: var(--green-deep);
    font-family: var(--mono);
    font-size: 0.85rem;
    font-weight: 600;
    align-self: start;
    margin-top: 4px;
}

.project-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.project-info h3 {
    margin: 0;
    font-size: 1.22rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
}

.project-info p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.95rem;
    line-height: 1.65;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 0 0;
    padding: 0;
    list-style: none;
}

.project-tags li {
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink-soft);
    font-family: var(--mono);
    font-size: 0.74rem;
    font-weight: 500;
    background: var(--paper-2);
}

/* Right-aligned image thumbnail */
.project-gallery {
    position: relative;
    width: 240px;
    height: 155px;
    border-radius: 10px;
    overflow: hidden;
    background: #f4f3ef;
    border: 1px solid var(--line);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.project-gallery:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border-color: var(--green);
}

.project-gallery img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    padding: 6px;
    box-sizing: border-box;
}

.gallery-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(18, 22, 20, 0.82);
    backdrop-filter: blur(4px);
    color: #fff;
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 12px;
    pointer-events: none;
    letter-spacing: 0.02em;
}

/* Certificate image styles */
.cert-img {
    width: 100%;
    height: 180px;
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    object-fit: contain;
    background: #f4f3ef;
    border: 1px solid var(--line);
    padding: 6px;
    box-sizing: border-box;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: block;
}

.cert-img:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 18px rgba(0,0,0,0.1);
}

/* =========================================================
   GALLERY LIGHTBOX OVERLAY
   ========================================================= */
.gallery-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 12, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.gallery-modal.show {
    display: flex;
    opacity: 1;
}

.gallery-modal-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 86vw;
    max-height: 85vh;
    box-sizing: border-box;
}

.gallery-image {
    max-width: 86vw;
    max-height: 82vh;
    border-radius: 10px;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.7);
    object-fit: contain;
    display: block;
    user-select: none;
}

/* Close Button */
.gallery-close {
    position: fixed;
    top: 24px;
    right: 28px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 100002;
}

.gallery-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.08);
}

/* Prev and Next Arrow Buttons */
.gallery-prev,
.gallery-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.65);
    border: 2px solid rgba(255, 255, 255, 0.45);
    color: #ffffff;
    font-size: 1.8rem;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s, border-color 0.2s;
    z-index: 100001;
    user-select: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.gallery-prev:hover,
.gallery-next:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: #ffffff;
    transform: translateY(-50%) scale(1.1);
}

.gallery-prev {
    left: 28px;
}

.gallery-next {
    right: 28px;
}

/* Counter */
.gallery-counter {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    font-family: var(--mono);
    font-size: 0.95rem;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 18px;
    border-radius: 20px;
    z-index: 100001;
    letter-spacing: 0.04em;
}

/* Single image state */
.gallery-modal.single .gallery-prev,
.gallery-modal.single .gallery-next {
    display: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .project-row.has-image {
        grid-template-columns: 44px 1fr;
    }
    .project-gallery {
        grid-column: 2;
        width: 100%;
        max-width: 320px;
        height: 180px;
    }
    .gallery-prev {
        left: 10px;
        width: 46px;
        height: 46px;
        font-size: 1.4rem;
    }
    .gallery-next {
        right: 10px;
        width: 46px;
        height: 46px;
        font-size: 1.4rem;
    }
}

@media (max-width: 600px) {
    .project-row,
    .project-row.has-image {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    .project-gallery {
        grid-column: 1;
        width: 100%;
        max-width: 100%;
        height: 200px;
    }
    .gallery-close {
        top: 14px;
        right: 14px;
        width: 42px;
        height: 42px;
        font-size: 1.6rem;
    }
    .gallery-prev {
        left: 8px;
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
    }
    .gallery-next {
        right: 8px;
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
    }
    .gallery-counter {
        bottom: 16px;
        font-size: 0.84rem;
        padding: 4px 14px;
    }
    .gallery-sound-btn {
        top: 10px;
        right: 10px;
        padding: 5px 12px;
        font-size: 0.76rem;
    }
}

.section-lead-muted {
    margin: 8px 0 0 0;
    color: var(--ink-soft);
    font-size: 1.02rem;
    line-height: 1.6;
    max-width: 720px;
}

/* Gallery Video Player & Overlay */
.gallery-video-wrapper {
    position: relative;
    display: none;
    align-items: center;
    justify-content: center;
    max-width: min(420px, 86vw);
    max-height: 82vh;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.85);
    background: #000;
}

.gallery-video {
    width: 100%;
    max-height: 82vh;
    border-radius: 12px;
    display: block;
    outline: none;
    background: #000;
}

/* Sound indicator / toggle button */
.gallery-sound-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-family: var(--mono);
    font-weight: 600;
    cursor: pointer;
    z-index: 15;
    display: none;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    transition: all 0.2s ease;
}

.gallery-sound-btn:hover {
    background: rgba(0, 0, 0, 0.95);
    border-color: #00f2fe;
    color: #00f2fe;
    transform: scale(1.04);
}

.gallery-sound-btn.is-muted {
    background: rgba(230, 57, 70, 0.88);
    border-color: rgba(255, 255, 255, 0.5);
    animation: soundPulse 1.8s infinite;
}

@keyframes soundPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Real-time Subtitle CC Overlay */
.gallery-cc-overlay {
    position: absolute;
    bottom: 56px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 14, 18, 0.90);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 242, 254, 0.45);
    color: #f3f4f6;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-family: var(--mono);
    font-weight: 600;
    pointer-events: none;
    z-index: 15;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 6px 22px rgba(0,0,0,0.65);
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
    transition: opacity 0.15s ease;
}

/* Video link on project card */
.project-video-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: var(--mono);
    font-weight: 500;
    color: #e63946;
    background: rgba(230, 57, 70, 0.08);
    border: 1px solid rgba(230, 57, 70, 0.25);
    text-decoration: none;
    transition: all 0.2s ease;
    width: fit-content;
}

.project-video-link:hover {
    background: #e63946;
    color: #ffffff;
    border-color: #e63946;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
}

.project-video-link svg {
    flex-shrink: 0;
}
