:root {
    --color-ink: #202124;
    --color-muted: #6d7278;
    --color-line: #dedede;
    --color-paper: #f6f6f4;
    --color-panel: #ffffff;
    --color-charcoal: #171717;
    --space-page: clamp(16px, 3vw, 42px);
    --site-width: 1440px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    background: var(--color-paper);
    color: var(--color-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

.site-main {
    flex: 1 0 auto;
}

a {
    color: inherit;
}

img {
    max-width: 100%;
}

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.site-header {
    background: var(--color-charcoal);
    color: #fff;
}

.site-about {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    transition: max-height 350ms ease, visibility 0s linear 350ms;
}

.site-about.is-open {
    max-height: 320px;
    visibility: visible;
    transition: max-height 350ms ease;
}

.site-about__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.35fr);
    gap: clamp(24px, 8vw, 120px);
    max-width: var(--site-width);
    margin: 0 auto;
    padding: 28px var(--space-page);
}

.site-about h2 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.site-about p {
    max-width: 720px;
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.65;
}

.site-about a {
    color: rgba(255, 255, 255, 0.86);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 24px;
    max-width: var(--site-width);
    min-height: 68px;
    margin: 0 auto;
    padding: 10px var(--space-page);
}

.site-brand {
    display: inline-flex;
    align-items: center;
    min-width: 180px;
}

.site-brand img {
    display: block;
    width: auto;
    max-width: 220px;
    max-height: 44px;
}

.site-menu {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 0 0 0 auto;
    padding: 0;
    list-style: none;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9rem;
}

.nav-toggle {
    display: inline-grid;
    place-items: center;
    width: 56px;
    height: 42px;
    margin-left: auto;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.site-menu + .nav-toggle {
    margin-left: 0;
}

.nav-toggle-icon {
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
}

.portfolio-shell {
    display: grid;
    grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
    gap: clamp(16px, 3vw, 36px);
    max-width: var(--site-width);
    margin: 0 auto;
    padding: 22px var(--space-page) 16px;
    align-items: start;
}

.portfolio-filters {
    padding-top: 0;
}

.filter-list {
    display: grid;
    gap: 2px;
}

.filter-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--color-line);
    background: transparent;
    color: var(--color-muted);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.filter-button[aria-pressed="true"] {
    background: #e8e8e5;
    color: var(--color-ink);
}

.filter-button[data-filter-value="Featured"] {
    margin-bottom: 10px;
    border-bottom-color: #b9b9b4;
    color: var(--color-ink);
    font-weight: 600;
}

.portfolio-stage {
    min-width: 0;
}

.portfolio-empty {
    padding: 0;
    color: var(--color-muted);
    font-size: 0.95rem;
}

.portfolio-empty p {
    margin: 0 0 16px;
}

.portfolio-viewer {
    position: relative;
    display: grid;
    grid-template-rows: auto auto;
    justify-items: center;
    min-height: 0;
    background: transparent;
    overflow: hidden;
}

.portfolio-image-wrap {
    position: relative;
    display: grid;
    justify-items: center;
    align-items: start;
    width: 100%;
    min-width: 0;
    padding: 0;
}

.portfolio-image-wrap img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 68vh;
    object-fit: contain;
    opacity: 1;
}

.portfolio-image-wrap img.is-crossfading {
    transition: opacity 1500ms ease;
}

.portfolio-image-wrap img.is-fading-out {
    opacity: 0;
}

.portfolio-image-wrap img.portfolio-image-transition {
    position: absolute;
    top: 0;
    left: 50%;
    z-index: 1;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%);
    transition: opacity 1500ms ease;
}

.portfolio-image-wrap img.portfolio-image-transition.is-visible {
    opacity: 1;
}

.portfolio-caption {
    width: 100%;
    min-height: 24px;
    padding: 2px 12px 10px;
    color: rgba(128, 128, 128, 0.55);
    font-size: 0.75rem;
    line-height: 1.35;
    text-align: center;
}

.viewer-control {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 44px;
    height: 56px;
    border: 0;
    background: rgba(23, 23, 23, 0.15);
    color: #fff;
    font-size: 2.4rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%);
    transition: opacity 140ms ease, background 140ms ease;
}

.portfolio-image-wrap:hover .viewer-control,
.portfolio-image-wrap:focus-within .viewer-control {
    opacity: 1;
    pointer-events: auto;
}

.viewer-control:hover,
.viewer-control:focus-visible {
    background: rgba(23, 23, 23, 0.4);
}

.viewer-control--prev {
    left: var(--viewer-control-left, 0);
}

.viewer-control--next {
    right: var(--viewer-control-right, 0);
}

.content-page {
    max-width: 880px;
    margin: 0 auto;
    padding: 48px var(--space-page);
}

.content-page h1 {
    margin-top: 0;
}

.site-footer {
    flex-shrink: 0;
    max-width: var(--site-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--space-page) 18px;
    color: rgba(70, 70, 70, 0.34);
    font-size: 0.8rem;
    text-align: right;
}

.fullscreen-gallery {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 52px;
    align-items: center;
    background: #050505;
    color: #fff;
}

.fullscreen-gallery[hidden] {
    display: none;
}

.fullscreen-gallery__stage {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: center;
    justify-items: center;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-width: 0;
    padding: max(12px, env(safe-area-inset-top)) 0 max(10px, env(safe-area-inset-bottom));
    touch-action: pan-y;
}

.fullscreen-gallery__stage img {
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    object-fit: contain;
}

.fullscreen-gallery__caption {
    min-height: 24px;
    padding: 6px 12px 0;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.75rem;
    line-height: 1.35;
    text-align: center;
}

.fullscreen-gallery__close {
    position: fixed;
    top: max(8px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
    z-index: 2;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
    font-size: 1.8rem;
    line-height: 1;
}

.fullscreen-gallery__control {
    z-index: 1;
    display: grid;
    place-items: center;
    width: 52px;
    height: 72px;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.76);
    cursor: pointer;
    font-size: 2.8rem;
    line-height: 1;
}

.fullscreen-gallery__control:hover,
.fullscreen-gallery__control:focus-visible,
.fullscreen-gallery__close:hover,
.fullscreen-gallery__close:focus-visible {
    background: rgba(255, 255, 255, 0.2);
}

.fullscreen-gallery-open {
    overflow: hidden;
}

@media (max-width: 760px) {
    :root {
        --space-page: 12px;
    }

    .site-about {
        max-height: 0;
    }

    .site-about.is-open {
        max-height: 420px;
    }

    .site-about__inner {
        grid-template-columns: 1fr;
        gap: 18px;
        padding: 18px var(--space-page);
    }

    .site-about p {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .portfolio-shell {
        grid-template-columns: 1fr;
        gap: 8px;
        width: 100%;
        padding: 8px 0 6px;
    }

    .site-nav {
        min-height: 54px;
        padding: 6px var(--space-page);
    }

    .site-brand {
        min-width: 0;
    }

    .site-brand img {
        max-width: 158px;
        max-height: 36px;
    }

    .site-menu {
        display: none;
    }

    .nav-toggle {
        width: 48px;
        height: 38px;
    }

    .portfolio-stage {
        order: 1;
        width: 100%;
    }

    .portfolio-filters {
        order: 2;
        width: 100%;
        padding: 0 var(--space-page);
    }

    .filter-list {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        overflow: visible;
        padding: 2px 0 10px;
    }

    .filter-button {
        flex: 0 1 auto;
        width: auto;
        max-width: 100%;
        min-height: 34px;
        padding: 7px 12px;
        border: 1px solid var(--color-line);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.45);
        font-size: 0.86rem;
        white-space: nowrap;
    }

    .filter-button[aria-pressed="true"] {
        background: var(--color-charcoal);
        border-color: var(--color-charcoal);
        color: #fff;
    }

    .portfolio-viewer {
        width: 100%;
    }

    .portfolio-image-wrap {
        height: calc(100vh - 134px);
        height: calc(100dvh - 134px);
        min-height: 0;
        touch-action: pan-y;
    }

    .portfolio-image-wrap img {
        width: 100%;
        height: 100%;
        max-width: 100vw;
        max-height: 100%;
        object-fit: contain;
    }

    .portfolio-caption {
        min-height: 20px;
        padding: 4px var(--space-page) 6px;
        font-size: 0.72rem;
    }

    .viewer-control {
        width: 38px;
        height: 52px;
        background: rgba(23, 23, 23, 0.22);
        font-size: 2rem;
        opacity: 0.82;
        pointer-events: auto;
    }

    .viewer-control:hover,
    .viewer-control:focus-visible {
        background: rgba(23, 23, 23, 0.38);
    }

    .site-footer {
        padding: 2px var(--space-page) 8px;
        font-size: 0.68rem;
        text-align: center;
    }
}

@media (max-width: 760px) and (orientation: landscape) {
    .site-nav {
        min-height: 46px;
    }

    .site-brand img {
        max-height: 30px;
    }

    .portfolio-shell {
        padding-top: 6px;
    }

    .portfolio-viewer {
        overflow: visible;
    }

    .portfolio-filters {
        padding-top: 0;
    }

    .portfolio-image-wrap {
        height: auto;
    }

    .portfolio-image-wrap img {
        width: auto;
        height: auto;
        max-width: 100vw;
        max-height: calc(100vh - 112px);
        max-height: calc(100dvh - 112px);
    }

    .portfolio-caption {
        padding-bottom: 4px;
    }

    .filter-button {
        min-height: 30px;
        padding: 5px 10px;
    }

    .fullscreen-gallery__stage {
        padding-top: max(8px, env(safe-area-inset-top));
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .fullscreen-gallery__caption {
        min-height: 20px;
        padding-top: 4px;
    }
}

@media (min-width: 761px) {
    .fullscreen-gallery {
        grid-template-columns: 76px minmax(0, 1fr) 76px;
    }

    .fullscreen-gallery__stage {
        padding-top: max(18px, env(safe-area-inset-top));
        padding-bottom: max(14px, env(safe-area-inset-bottom));
    }

    .fullscreen-gallery__close {
        top: max(16px, env(safe-area-inset-top));
        right: max(16px, env(safe-area-inset-right));
        width: 44px;
        height: 44px;
        font-size: 2rem;
    }

    .fullscreen-gallery__control {
        width: 76px;
        height: 96px;
        font-size: 3.4rem;
    }

    .fullscreen-gallery__caption {
        padding-top: 8px;
        font-size: 0.78rem;
    }
}
