:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-soft: #eef2f4;
    --text: #18212f;
    --muted: #5f6b7a;
    --accent: #3a5b70;
    --accent-soft: #dbe6ee;
    --border: #d6dee6;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.75;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

nav a:hover,
nav a:focus-visible,
.nav-dropdown > button:hover,
.nav-dropdown > button:focus-visible {
    text-decoration: none;
}

header {
    position: relative;
    background: linear-gradient(180deg, #f8fafc 0%, #eef3f8 100%);
    color: var(--text);
    padding: 2rem 2rem 0;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.home-button:hover,
.home-button:focus-visible {
    color: var(--text);
    text-decoration: none;
}

.home-button {
    position: fixed;
    top: 1rem;
    left: 1rem;
    display: inline-flex;
    align-items: center;
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
    border: none;
    background: transparent;
    padding: 0;
    z-index: 1000;
}

.homepage .brand {
    margin-top: 3.5rem;
}

.topbar {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: 1080px;
    margin: 0 auto;
    padding-bottom: 1.5rem;
    z-index: 100;
}

.brand {
    flex: 1 1 0;
    min-width: 240px;
}

.brand-copy {
    margin: 0.75rem 0 0;
    max-width: 44rem;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.6;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
    width: auto;
}

.brand .eyebrow {
    margin: 0 0 0.85rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.82rem;
    font-weight: 700;
}

.brand h1 {
    margin: 0;
    font-size: clamp(2.9rem, 5vw, 4.6rem);
    line-height: 0.95;
}

.brand p {
    margin: 1rem 0 0;
    max-width: 46rem;
    color: var(--muted);
    font-size: 1.03rem;
}

nav a,
.nav-dropdown > button {
    color: var(--accent);
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0;
    background: transparent;
    border: none;
    font-weight: 700;
    text-decoration: none;
    font-family: inherit;
    font-size: 0.98rem;
    line-height: 1.2;
    white-space: nowrap;
}

nav a::after,
.nav-dropdown > button::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}

nav a:hover::after,
.nav-dropdown > button:hover::after,
.button:hover::after,
nav a:focus-visible::after,
.nav-dropdown > button:focus-visible::after,
.button:focus-visible::after {
    transform: scaleX(1);
}

nav a:hover,
.nav-dropdown > button:hover {
    color: var(--text);
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown > button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    background: transparent;
}

.nav-dropdown > button::before {
    content: '▾';
    font-size: 0.78rem;
    opacity: 0.85;
    margin-left: 0.1rem;
    line-height: 1;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.65rem);
    right: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 35px rgba(15, 35, 63, 0.08);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    z-index: 10;
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    background: transparent;
}

.dropdown-menu a:last-child {
    border-bottom: none;
}

.dropdown-menu a:hover {
    background: var(--surface-soft);
    color: var(--accent);
}

main {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}

.section {
    padding: 4rem 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
}

.section.section-hero {
    padding: 0;
    border: none;
}

.section:last-of-type {
    border-bottom: none;
    padding-bottom: 3rem;
}

.section-split {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
    gap: 2.5rem;
    align-items: start;
}

.section-split .text-block {
    display: grid;
    gap: 1.25rem;
}

.section-split .image-placeholder {
    min-height: 340px;
}

.section h2 {
    margin: 0 0 1.5rem;
    font-size: clamp(2rem, 4vw, 3rem);
}

.section p,
.section li {
    color: var(--muted);
    font-size: 1rem;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
    gap: 2.5rem;
    align-items: center;
    max-width: 1080px;
    margin: 0 auto;
}

.hero-banner {
    position: relative;
    overflow: hidden;
    /* full-bleed banner */
    width: 100vw;
    margin-left: calc(50% - 50vw);
    border-radius: 0;
}

.hero-banner .hero-media {
    height: 55vh;
    min-height: 320px;
}

.hero-banner .hero-media img,
.hero-banner .hero-media video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
}

.hero-banner.hero-banner--rotate .hero-media {
    display: grid;
    place-items: center;
    overflow: hidden;
}

.hero-banner.hero-banner--rotate .hero-media video,
.hero-banner.hero-banner--rotate .hero-media .rotated-media {
    width: auto;
    height: 125%;
    max-width: none;
    max-height: none;
    transform: rotate(90deg) translateX(-40%);
    transform-origin: center center;
}

.hero-media--side img {
    width: 100%;
    height: auto;
    border-radius: 30px;
    box-shadow: 0 36px 80px rgba(21, 40, 66, 0.12);
}

.hero-banner .hero-copy--banner {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    left: auto;
    max-width: 42%;
    padding: 1.5rem 1.75rem;
    background: rgba(15, 22, 34, 0.72);
    color: #f8fafc;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 30px 55px rgba(21, 40, 66, 0.16);
    z-index: 1;
}

.hero-copy--banner p {
    color: #e6edf8;
}

.hero-banner::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 15, 24, 0.15), rgba(10, 15, 24, 0.42));
    pointer-events: none;
}

.hero-copy {
    display: grid;
    gap: 1.2rem;
    max-width: 620px;
}

.media-gallery {
    margin: 1.5rem 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.2rem;
}

.media-gallery figure {
    margin: 0;
    display: grid;
    gap: 0.75rem;
}

.media-gallery img,
.media-gallery video {
    width: 100%;
    max-height: 420px;
    border-radius: 22px;
    object-fit: cover;
    display: block;
}

.media-gallery figcaption {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* project pages: hide the repeated top title so banner overlay is primary */
.project-page .topbar .brand h1 {
    position: absolute;
    left: -9999px;
}

@media (max-width: 900px) {
    .hero-banner {
        margin-left: 0;
        width: 100%;
        border-radius: 20px;
    }
    .hero-banner .hero-media {
        height: 42vh;
    }
    .hero-banner .hero-copy--banner {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        max-width: none;
        margin: 1rem;
        background: rgba(10,12,18,0.78);
    }
    .hero {
        grid-template-columns: 1fr;
    }
    .hero-media--side {
        max-width: 520px;
        margin: 0 auto;
    }
}

.hero-copy .eyebrow {
    margin: 0;
    letter-spacing: 0.18em;
    font-size: 0.88rem;
    color: rgb(114, 114, 114);
    font-weight: 700;
}

.hero-copy h2 {
    margin: 0;
    font-size: clamp(2.8rem, 5.5vw, 3.8rem);
    line-height: 1.04;
}

.hero-copy p {
    margin: 0;
    max-width: 44rem;
    color: var(--muted);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

body.js header .topbar,
body.js main section,
body.js .project-card,
body.js .software-card,
body.js .skill-card,
body.js .metric-card {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.65s ease, transform 0.65s ease;
    will-change: opacity, transform;
}

body.js .visible {
    opacity: 1;
    transform: none;
}

.button {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    color: var(--accent);
    font-weight: 700;
    background: transparent;
    border: none;
    text-decoration: none;
    cursor: pointer;
}

.button::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.27s ease;
}

.button:hover,
.button:focus-visible {
    text-decoration: none;
}

.button:hover::after,
.button:focus-visible::after {
    transform: scaleX(1);
}

.button.secondary {
    color: var(--text);
}

.image-placeholder {
    min-height: 360px;
    border-radius: 28px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-weight: 700;
    text-align: center;
    padding: 1.5rem;
}

.project-card img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    display: block;
}

.project-page .full-image-card {
    gap: 1.5rem;
    max-width: 75%;
    margin: 30px auto;
}

.project-page .project-card {
    text-align: center;
    gap: 1.15rem;
}

.project-page .project-card > img {
    width: auto;
    max-width: 100%;
    height: auto;
    aspect-ratio: auto;
    object-fit: contain;
    margin: 0 auto;
}

.project-card > img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
}

.project-card video {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    display: block;
}

.subsection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: stretch;
    margin-bottom: 2.5rem;
}

.subsection-grid > .subsection-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.subsection-grid > .card-grid {
    height: 100%;
    align-content: center;
}

.section h3 {
    margin-top: 2.5rem;
}

.section h3:first-of-type {
    margin-top: 0;
}

.subsection-text p:last-child {
    margin-bottom: 0;
}

.hero-image {
    width: 100%;
    height: auto;
    border-radius: 16px;
    display: block;
    box-shadow: 0 20px 45px rgba(21, 40, 66, 0.08);
}

@media (max-width: 700px) {
    .subsection-grid {
        grid-template-columns: 1fr;
    }
    .subsection-grid > .subsection-text {
        height: auto;
    }
    .subsection-grid > .card-grid {
        height: auto;
    }
}

.stats-grid,
.card-grid,
.project-grid,
.skill-grid,
.metric-grid {
    display: grid;
    gap: 1.25rem;
}

.section-heading {
    margin-bottom: 2rem;
    max-width: 720px;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card-grid {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.card-grid.centered-panel .project-card {
    width: 100%; /* 20% margins on each side, minus padding */
    margin-left: auto;
    margin-right: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-grid.centered-panel .project-card img {
    width: 100%;
    height: auto;
    border-radius: 12px;
}

.section-focus {
    background: transparent;
    padding: 4rem 0;
}

.section-focus .section-heading {
    max-width: 92vw;
    margin-bottom: 2rem;
}

.focus-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.75rem;
}

.focus-hint {
    margin: 0;
    color: var(--accent);
    font-weight: 700;
}

.focus-buttons {
    display: flex;
    gap: 0.75rem;
}

.focus-prev,
.focus-next {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 1.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 16px 32px rgba(21, 40, 66, 0.15);
}

.focus-prev:hover,
.focus-next:hover {
    background: var(--accent-soft);
    color: var(--text);
}

.focus-carousel {
    display: flex;
    gap: 1.75rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.focus-card {
    flex: 0 0 min(820px, 94vw);
    max-width: 920px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 2.25rem;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    scroll-snap-align: start;
}

.focus-card h3 {
    margin-top: 0;
}

.focus-card p {
    margin-bottom: 1rem;
    color: var(--muted);
}

.card-media {
    border-radius: 18px;
    overflow: hidden;
    min-height: 380px;
    max-height: 400px;
    width: 100%;
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 940px) {
    .focus-card {
        grid-template-columns: 1fr;
    }

    .card-media {
        max-height: 380px;
    }
}

.project-links {
    margin: 0.75rem 0 0;
    padding-left: 1.25rem;
}

.project-links li {
    margin-bottom: 0.5rem;
    color: var(--muted);
}

.project-links a {
    color: var(--text);
    text-decoration: none;
}

.project-links a:hover {
    text-decoration: underline;
}

.project-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.stat-card,
.card,
.project-card,
.skill-card,
.metric-card {
    background: transparent;
    border: none;
    padding: 0;
}

.stat-card h3,
.card h3,
.skill-card h3,
.metric-card h3 {
    margin: 0 0 0.5rem;
    color: var(--text);
    font-size: 1.1rem;
}

.stat-card p,
.card p,
.skill-card p,
.metric-card p,
.project-card p {
    margin: 0;
    color: var(--muted);
}

.project-card {
    display: grid;
    gap: 0.65rem;
    padding: 1.15rem;
    border-radius: 18px;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(21, 40, 66, 0.04);
}

.project-card .image-placeholder {
    min-height: 180px;
    border-radius: 16px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-weight: 700;
    text-align: center;
    padding: 1rem;
}

.project-card .card-images {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.project-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.rotate-frame {
    display: grid;
    justify-items: center;
    align-items: start;
    min-height: 520px;
    overflow: hidden;
    padding: 0;
}

.rotate-left {
    display: block;
    width: auto;
    min-width: 100%;
    min-height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    transform: rotate(-90deg);
    transform-origin: center;
}

.project-gallery {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    margin-top: 1.5rem;
}

.project-card:last-child {
    border-bottom: none;
}

.project-card span,
.project-card a {
    margin-top: 0.35rem;
}

.project-card a {
    color: var(--accent);
    font-weight: 700;
}

.software-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.software-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 1.1rem 1rem;
    display: grid;
    gap: 0.35rem;
}

.software-card strong {
    color: var(--text);
    font-size: 1rem;
}

.software-card span {
    color: var(--muted);
    font-size: 0.95rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-weight: 600;
}

.project-card h3 {
    margin: 0;
    font-size: 1.3rem;
}

.card-grid > div > img {
    max-height: 260px;
    width: auto;
    height: auto;
}

.full-image-card {
    display: grid;
    gap: 0.75rem;
    padding: 1.5rem;
    border-radius: 18px;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(21, 40, 66, 0.04);
    margin-top: 1.5rem;
}

.full-image-card img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    display: block;
    max-height: none;
}

.full-image-card h3 {
    margin: 0;
    font-size: 1.3rem;
}

.full-image-card p {
    margin: 0;
    color: var(--muted);
}

.highlight-list,
.timeline,
.project-details {
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-weight: 600;
}

.highlight-list,
.timeline,
.project-details {
    margin: 0;
    padding: 0;
    list-style: none;
}

.highlight-list li,
.timeline li,
.project-details li {
    margin-bottom: 1rem;
    padding-left: 1.15rem;
    position: relative;
    color: var(--muted);
}

.highlight-list li::before,
.timeline li::before,
.project-details li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent);
}

.timeline {
    display: grid;
    gap: 1rem;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1rem 0 0;
}

.tag {
    background: var(--accent-soft);
    color: var(--text);
    padding: 0.65rem 1rem;
    border-radius: 999px;
    font-size: 0.95rem;
}

footer {
    text-align: center;
    padding: 2rem 1.5rem 3rem;
    color: var(--muted);
    font-size: 0.95rem;
}

@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }
    nav {
        width: 100%;
        justify-content: flex-start;
    }
}
