@font-face {
    font-family: "Poppins";
    src: url("../fonts/poppins-light.woff2") format("woff2");
    font-style: normal;
    font-weight: 300;
    font-display: swap;
}

@font-face {
    font-family: "Poppins";
    src: url("../fonts/poppins-regular.woff2") format("woff2");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Poppins";
    src: url("../fonts/poppins-medium.woff2") format("woff2");
    font-style: normal;
    font-weight: 500;
    font-display: swap;
}

:root {
    color-scheme: dark;
    --background: #1a1a1a;
    --contrast: #111111;
    --text: #ffffff;
    --line: rgba(255, 255, 255, .2);
    --page-padding: clamp(30px, 5vw, 50px);
    --wide: 1340px;
    --content: 760px;
    --header-height: 94px;
    --font-body: clamp(1.125rem, 1.05rem + .3vw, 1.375rem);
    --font-heading-1: clamp(1.875rem, 1.9rem + 1.2vw, 3rem);
    --font-heading-2: clamp(1.5rem, 1.45rem + .9vw, 2rem);
    --font-heading-3: calc(var(--font-body) * 1.25);
    --font-heading-4: calc(var(--font-body) * 1.125);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: "Poppins", sans-serif;
    font-size: var(--font-body);
    font-weight: 300;
    line-height: 1.4;
    letter-spacing: -.1px;
}

button,
a {
    font: inherit;
}

a {
    color: inherit;
    text-underline-offset: .2em;
}

a:hover {
    text-decoration: none;
}

.site-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100svh;
}

.site-content {
    flex: 1;
    min-width: 0;
}

.site-header,
.site-footer {
    flex-shrink: 0;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    font-weight: 400;
    line-height: 1.125;
}

h1 {
    font-size: var(--font-heading-1);
}

/* FocusOnNavigate focuses the heading for screen readers after navigation. */
h1:focus {
    outline: none;
}

h2 {
    font-size: var(--font-heading-2);
}

h3 {
    font-size: var(--font-heading-3);
}

h4 {
    font-size: var(--font-heading-4);
}

.site-header {
    position: sticky;
    z-index: 50;
    top: 0;
    width: 100%;
    background: rgba(26, 26, 26, .9);
    backdrop-filter: blur(8px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 12px 30px;
}

.brand {
    display: flex;
    flex-shrink: 0;
}

.brand img,
.loading-screen img {
    filter: invert(1);
}

.brand img {
    display: block;
    width: min(170px, 45vw);
    height: auto;
}

.main-nav {
    display: flex;
    gap: 1.2rem;
    align-items: center;
    font-size: clamp(1rem, .95rem + .2vw, 1.125rem);
}

.main-nav a {
    text-decoration: none;
}

.main-nav a:hover,
.main-nav a.active {
    text-decoration: underline;
}

.menu-toggle {
    display: none;
    flex-shrink: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    appearance: none;
    color: var(--text);
    cursor: pointer;
    background: transparent;
}

.menu-toggle span {
    display: block;
    flex-shrink: 0;
    width: 24px;
    height: 2px;
    background: currentColor;
}

.menu-toggle[aria-expanded="true"] span:first-child {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:last-child {
    transform: translateY(-7px) rotate(-45deg);
}

.menu-toggle:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

.section-padding {
    padding: clamp(70px, 10vw, 140px) var(--page-padding);
}

.wide-content {
    max-width: var(--wide);
    margin: 0 auto;
}

.content-column {
    max-width: var(--content);
    margin: 0 auto;
}

.intro {
    padding-top: clamp(55px, 7vw, 90px);
    padding-bottom: clamp(55px, 7vw, 90px);
    text-align: center;
}

.intro h1 {
    max-width: var(--wide);
    margin: 0 auto;
    font-size: var(--font-heading-3);
    line-height: 1.5;
}

.intro > p {
    max-width: var(--wide);
    margin: 1.25rem auto 0;
}

/* Give every home-page descendant an effective layer; component rules below
   retain sticky/fixed/absolute positioning where required. */
:where(#main-content *) {
    position: relative;
    z-index: 1;
}

.hero {
    position: sticky;
    z-index: 0;
    top: var(--header-height);
    width: 100%;
}

@media (min-width: 1500px) {
    main:has(> .hero) {
        margin-top: calc(-1 * var(--header-height));
    }

    .hero {
        top: 0;
    }
}

.hero img {
    z-index: 0;
    display: block;
    width: 100%;
    height: auto;
}

.hero ~ section {
    position: relative;
    z-index: 1;
}

.hero ~ section:not(.section-contrast) {
    background: var(--background);
}

.section-contrast {
    background: var(--contrast);
}

.portfolio-section h2 {
    margin-bottom: 55px;
}

.section-copy {
    max-width: 1040px;
    margin: 0 300px 55px 0;
}

.photo-strip {
    border-radius: 16px;
    display: flex;
    width: 100%;
    height: 500px;
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overflow-anchor: none;
    overscroll-behavior-x: contain;
    touch-action: pan-y pinch-zoom;
}

.photo-strip.is-animating { scroll-snap-type: none; }

.photo-strip::-webkit-scrollbar { display: none; }

.carousel-leading,
.carousel-originals,
.carousel-trailing { display: contents; }

.carousel-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.carousel-dots {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    width: calc(var(--dot-slots, 5) * 24px);
    height: 44px;
    overflow: hidden;
}

.carousel-dots[hidden] { display: none; }
.carousel-dot-visual { position: absolute; inset: 0; pointer-events: none; }
.carousel-dot-marker {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border-radius: 50%;
    background: #fff;
    will-change: transform;
}

.carousel-arrow,
.carousel-dot {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 36px;
    height: 44px;
    padding: 0;
    border: 0;
    color: var(--text);
    background: transparent;
    cursor: pointer;
}

.carousel-arrow { font-size: 2rem; line-height: 1; }
.carousel-arrow:disabled { opacity: .3; cursor: default; }
.carousel-dot { width: 24px; }
.carousel-dot:disabled { cursor: default; }
.carousel-arrow:focus-visible,
.carousel-dot:focus-visible,
.photo-strip:focus-visible,
.photo-strip .photo-tile:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
.photo-strip .photo-tile:not(.is-active) { cursor: pointer; }

.preview-carousel .photo-tile,
.preview-carousel .carousel-arrow,
.preview-carousel .carousel-dot {
    -webkit-tap-highlight-color: transparent;
}

.carousel-arrow:not(:disabled):active { opacity: .65; }
.carousel-dot:not(:disabled):active { background: rgba(255, 255, 255, .08); }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.photo-strip .photo-tile {
    flex: 0 0 auto;
    height: 500px;
    scroll-snap-align: center;
}

.photo-strip .photo-tile img {
    width: auto;
    height: 100%;
}

.photo-gallery .photo-tile {
    display: block;
    padding: 0;
    border: 0;
    cursor: zoom-in;
    background: transparent;
}

.photo-gallery img {
    display: block;
}

.section-link {
    margin: 42px 0 32px;
    text-align: right;
    font-size: clamp(1rem, .95rem + .2vw, 1.125rem);
}

.portfolio-section hr,
.site-footer::before {
    display: block;
    height: 1px;
    margin: 0;
    border: 0;
    background: var(--line);
    content: "";
}

.contact-section {
    text-align: center;
}

.contact-section .content-column {
    max-width: 900px;
}

.contact-section h2 {
    margin-bottom: 55px;
}

.contact-section p {
    margin: 0 auto 1.5rem;
    line-height: 1.65;
}

.category-page,
.legal-page {
    padding: clamp(60px, 7vw, 90px) var(--page-padding);
}

.category-page > .wide-content,
.legal-page > .content-column {
    width: 100%;
}

.category-page h1,
.legal-page h1 {
    margin-bottom: 45px;
    font-size: var(--font-heading-1);
}

.category-page .lead {
    max-width: 1040px;
    margin: 0 0 65px;
}

.photo-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
}

/* Extend only gallery images; intro and contact retain the normal page padding. */
.category-page > .photo-grid[data-gallery-layout] {
    width: calc(100% + var(--page-padding) + var(--page-padding) - 24px);
    margin-inline: calc(12px - var(--page-padding));
}

.photo-grid .photo-tile {
    flex: 0 0 auto;
    max-width: 100%;
}

/* Only full galleries reserve their calculated rows while HTML is still arriving.
   The inline variable fallbacks keep tiles visible and bounded if JavaScript fails. */
.photo-grid[data-gallery-layout] {
    align-content: flex-start;
}

.photo-grid img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.lightbox {
    position: fixed;
    z-index: 100;
    touch-action: none;
    overscroll-behavior: none;
    inset: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    place-items: center;
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    /* Reserve room for the close button and respect device safe areas. */
    padding: max(78px, 5vw, env(safe-area-inset-top, 0px))
             max(24px, 5vw, env(safe-area-inset-right, 0px))
             max(78px, 5vw, env(safe-area-inset-bottom, 0px))
             max(24px, 5vw, env(safe-area-inset-left, 0px));
    overflow: hidden;
    color: var(--text);
    cursor: zoom-out;
    background: rgba(0, 0, 0, .94);
}

.lightbox:not([open]) {
    display: none;
}

.lightbox::backdrop {
    background: transparent;
}

.lightbox img {
    display: block;
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: max(18px, env(safe-area-inset-top, 0px));
    right: max(25px, env(safe-area-inset-right, 0px));
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    color: #fff;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    background: transparent;
}

#main-content .lightbox-close {
    z-index: 2;
}

.site-footer {
    padding: 0 0 30px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    padding: 30px var(--page-padding) 0;
}

.footer-inner nav {
    display: flex;
    gap: 1.2rem;
    font-size: clamp(1rem, .95rem + .2vw, 1.125rem);
}

.loading-screen {
    position: fixed;
    inset: 0;
    display: grid;
    place-content: center;
    gap: 28px;
    background: var(--background);
}

.loading-screen img {
    width: min(132.61px, 28.7322vw);
}

.loading-screen span {
    width: 80px;
    height: 1px;
    margin: auto;
    animation: loading 1.2s ease-in-out infinite alternate;
    background: #fff;
    transform-origin: left;
}

@keyframes loading {
    from { transform: scaleX(.15); opacity: .3; }
    to { transform: scaleX(1); opacity: 1; }
}

#blazor-error-ui {
    position: fixed;
    z-index: 200;
    right: 20px;
    bottom: 20px;
    display: none;
    padding: 14px 50px 14px 18px;
    color: #111;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .4);
    font-size: .9rem;
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: 7px;
    right: 10px;
    border: 0;
    color: #111;
    background: none;
    font-size: 1.3rem;
}

@media (max-width: 800px) {
    :root {
        --header-height: 78px;
    }

    .header-inner {
        padding: 8px 24px;
    }

    .brand img {
        width: min(145px, 45vw);
    }

    .menu-toggle {
        display: flex;
    }

    .main-nav {
        position: fixed;
        top: var(--header-height);
        right: 0;
        left: 0;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 20px var(--page-padding) 30px;
        background: #1a1a1a;
        box-shadow: 0 16px 24px rgba(0, 0, 0, .3);
    }

    .main-nav.is-open {
        display: flex;
    }

    .main-nav a {
        padding: 10px 0;
    }

    .intro br {
        display: none;
    }

    .section-copy {
        margin-right: 0;
    }

    .photo-strip,
    .photo-strip .photo-tile {
        height: 360px;
    }

    .footer-inner {
        gap: 30px;
    }
}

@media (max-width: 560px) {
    :root {
        --font-body: 1rem;
        --font-heading-1: 1.875rem;
        --font-heading-2: 1.5rem;
    }

    .main-nav,
    .footer-inner nav,
    .section-link {
        font-size: 1rem;
    }

    .section-padding {
        padding-top: 70px;
        padding-bottom: 70px;
    }

    .portfolio-section h2,
    .contact-section h2 {
        margin-bottom: 35px;
    }

    .section-copy {
        margin-bottom: 40px;
    }

    .photo-strip,
    .photo-strip .photo-tile {
        height: 290px;
    }

    .footer-inner,
    .footer-inner nav {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .loading-screen span { animation: none; }
}
