*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--bg);
    /* Built-in frosted gradient, used until a background image is uploaded. */
    background-image: var(--bg-image,
        radial-gradient(ellipse 45% 40% at 12% 18%, rgba(242, 243, 250, 0.95), transparent 70%),
        radial-gradient(ellipse 40% 55% at 52% 48%, rgba(146, 160, 228, 0.9), transparent 70%),
        radial-gradient(ellipse 35% 50% at 82% 58%, rgba(226, 229, 242, 0.85), transparent 70%),
        radial-gradient(ellipse 55% 55% at 6% 92%, rgba(38, 43, 78, 0.95), transparent 70%),
        radial-gradient(ellipse 50% 45% at 92% 8%, rgba(70, 76, 120, 0.8), transparent 70%),
        linear-gradient(135deg, #c8cce6, #6d75a9 58%, #9192b8));
    color: var(--text);
    font-family: var(--body-font);
    font-size: 1rem;
    line-height: 1.6;
}

body.bg-cover {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

body.bg-contain {
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

body.bg-repeat {
    background-repeat: repeat;
}

body.bg-fixed {
    background-attachment: fixed;
}

h1,
h2,
h3 {
    font-family: var(--heading-font);
    font-weight: 400;
    line-height: 1.2;
}

a {
    color: var(--accent);
}

img,
video {
    max-width: 100%;
    height: auto;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    user-select: none;
}

/* An invisible layer over protected images, so right-click and drag never reach the image itself. */
.protected {
    position: relative;
}

.protected::after {
    content: "";
    position: absolute;
    inset: 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Page shell: logo and menu on the left, glass panel on the right. */

.site {
    min-height: 100vh;
}

.site-brand {
    display: inline-block;
    color: inherit;
    text-decoration: none;
}

.site-logo {
    display: block;
    height: var(--logo-height);
    width: auto;
}

.site-title {
    font-family: var(--heading-font);
    font-size: 1.6rem;
    font-weight: 700;
}

.site-nav a {
    color: var(--text);
    font-family: var(--heading-font);
    font-weight: 300;
    text-transform: uppercase;
    text-decoration: none;
    text-underline-offset: 0.18em;
    text-decoration-thickness: 1px;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
    text-decoration-line: underline;
}

.site-nav a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

/* Frosted glass panel */

.glass {
    position: relative;
    background-color: var(--surface);
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 45%, rgba(255, 255, 255, 0.2));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(22, 26, 60, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    padding: clamp(1.25rem, 3vw, 2rem);
    scrollbar-width: thin;
    scrollbar-color: rgba(28, 31, 51, 0.35) transparent;
}

.glass > :first-child {
    margin-top: 0;
}

.site-badge {
    display: block;
    width: max-content;
}

.site-badge img,
img.site-badge {
    display: block;
    height: 28px;
    width: auto;
}

/* Social icons under the menu */

.site-social {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0.6rem 0 0;
    padding: 0;
    list-style: none;
}

.site-social a {
    display: block;
    color: var(--text);
    border-radius: 4px;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.site-social svg {
    display: block;
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.site-social a:hover {
    opacity: 0.7;
    transform: translateY(-1px);
}

.site-social a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* Build credit: deliberately faint, brighter on hover or keyboard focus. */

.site-credit {
    margin: 0;
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    opacity: 0.35;
    transition: opacity 0.2s ease;
}

.site-credit:hover,
.site-credit:focus-within {
    opacity: 0.85;
}

.site-credit a {
    color: inherit;
}

/* Gallery */

.gallery-panel {
    padding: clamp(0.75rem, 1.5vw, 1rem);
}

/* Without JavaScript the grid falls back to CSS columns. */
.masonry {
    columns: 4 200px;
    column-gap: 10px;
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 10px;
}

.masonry.is-laid-out {
    columns: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.masonry-column {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.masonry.is-laid-out .masonry-item {
    margin-bottom: 0;
}

.art-thumb {
    display: block;
    width: 100%;
    padding: 0;
    border: 1.5px solid var(--text);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.25);
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.art-thumb img {
    display: block;
    width: 100%;
    height: auto;
}

.art-thumb:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(22, 26, 60, 0.22);
}

.art-thumb:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .art-thumb {
        transition: none;
    }

    .art-thumb:hover {
        transform: none;
    }
}

/* Lightbox */

body.lightbox-open {
    overflow: hidden;
}

.lightbox {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 3.5rem clamp(0.25rem, 2vw, 1.5rem) 1.5rem;
    border: 0;
    background: transparent;
    color: #fff;
}

.lightbox[open] {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(0.25rem, 2vw, 1.5rem);
}

.lightbox::backdrop {
    background: rgba(10, 12, 28, 0.8);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.lightbox-figure {
    margin: 0;
    min-height: 0;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.lightbox-image img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 9rem);
    width: auto;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45);
}

.lightbox figcaption {
    max-width: 60ch;
    text-align: center;
}

.lightbox figcaption h2 {
    margin: 0;
    font-size: 1.15rem;
}

.lightbox figcaption p {
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
    opacity: 0.85;
}

.lightbox-nav,
.lightbox-close {
    display: grid;
    place-items: center;
    padding: 0;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    cursor: pointer;
    font-family: var(--heading-font);
    line-height: 1;
}

.lightbox-nav {
    width: clamp(2.25rem, 4vw, 3rem);
    height: clamp(2.25rem, 4vw, 3rem);
    font-size: 1.8rem;
}

.lightbox-nav[hidden] {
    visibility: hidden;
    display: grid;
}

.lightbox-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.6rem;
}

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

.lightbox-nav:focus-visible,
.lightbox-close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.lightbox-count {
    position: absolute;
    top: 1rem;
    left: 1rem;
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.85;
}

/* About */

.about {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "text photo";
    gap: 1.5rem;
}

.about-text {
    grid-area: text;
    max-width: 62ch;
}

.about-intro {
    margin: 0 0 1.25rem;
    font-size: 0.95rem;
    line-height: 1.45;
}

.about-photo {
    grid-area: photo;
    align-self: end;
    width: var(--about-photo-width);
    max-width: 40vw;
    height: auto;
    /* Sit on the bottom edge of the panel, like the mockup. */
    margin-bottom: calc(-1 * clamp(1.25rem, 3vw, 2rem));
}

.prose > :first-child {
    margin-top: 0;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote {
    margin: 0 0 1em;
}

.prose h2 {
    font-size: 1.35rem;
    margin: 1.5em 0 0.5em;
}

.prose h3 {
    font-size: 1.1rem;
    margin: 1.25em 0 0.4em;
}

.prose blockquote {
    padding-left: 1em;
    border-left: 2px solid var(--accent);
}

@media (max-width: 899px) {
    .about {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "photo" "text";
    }

    .about-photo {
        justify-self: center;
        width: min(var(--about-photo-width), 70%);
        max-width: none;
        margin-bottom: 0;
    }
}

/* Contact */

.contact-heading {
    margin: 0 0 1.1rem;
    font-size: 1.6rem;
    text-transform: uppercase;
    font-weight: 300;
}

.contact-intro,
.contact-thanks {
    margin: 0 0 1.1rem;
    font-size: 0.95rem;
}

.contact-form {
    max-width: 520px;
    padding-left: clamp(0rem, 2vw, 1.4rem);
}

.contact-field {
    margin-bottom: 0.7rem;
}

.contact-field label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.8rem;
    font-weight: 700;
}

.contact-required {
    font-weight: 400;
    font-size: 0.75rem;
    opacity: 0.6;
}

.contact-field input,
.contact-field textarea {
    width: 100%;
    font: inherit;
    font-size: 0.95rem;
    color: var(--text);
    padding: 0.35rem 0.6rem;
    background: rgba(255, 255, 255, 0.28);
    border: 1px solid rgba(28, 31, 51, 0.35);
    border-radius: 2px;
}

.contact-field textarea {
    min-height: 5.25rem;
    resize: vertical;
}

.contact-field .contact-input-short {
    max-width: 250px;
}

.contact-field input:focus,
.contact-field textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    background: rgba(255, 255, 255, 0.5);
}

.contact-field.has-error input,
.contact-field.has-error textarea {
    border-color: #a12626;
}

.contact-error {
    margin: 0.3rem 0 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: #8f1d1d;
}

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

.contact-submit {
    font: inherit;
    font-size: 0.85rem;
    padding: 0.3rem 0.9rem;
    color: var(--text);
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(28, 31, 51, 0.45);
    border-radius: 2px;
    cursor: pointer;
}

.contact-submit:hover {
    background: rgba(255, 255, 255, 0.7);
}

.contact-submit:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.contact-trap {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Home */

.home-hero {
    text-align: center;
    padding: 2rem 1rem;
}

.home-logo {
    display: block;
    width: var(--home-logo-width);
    max-width: 80vw;
    margin: 0 auto;
}

.home-title {
    margin: 0;
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 700;
}

.home-tagline {
    margin: clamp(3rem, 14vh, 9rem) 0 0;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Desktop */

@media (min-width: 900px) {
    /* The menu and panel are centered together, so the menu always sits beside the panel. */
    .site {
        display: grid;
        grid-template-columns: auto minmax(0, 940px);
        justify-content: center;
        column-gap: clamp(1.5rem, 3vw, 3rem);
        height: 100vh;
        padding: 0 clamp(1.5rem, 4vw, 3rem);
    }

    .site-side {
        grid-row: 1;
        grid-column: 1;
        position: relative;
        z-index: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .site-brand {
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 2;
    }

    .site-nav {
        display: flex;
        flex-direction: column;
    }

    .site-nav a {
        font-size: 1.45rem;
        line-height: 1.3;
        width: max-content;
    }

    .site-main {
        grid-row: 1;
        grid-column: 2;
        display: flex;
        justify-content: center;
        padding: 126px 0 56px;
        min-height: 0;
    }

    .site-main > .glass {
        width: 100%;
        height: 100%;
        overflow-y: auto;
    }

    /* The home page keeps the menu at the left edge and centers the logo on the whole screen. */
    .page-home .site {
        grid-template-columns: auto minmax(0, 1fr);
        justify-content: stretch;
        column-gap: 0;
        padding: 0 1.25rem;
    }

    .page-home .site-main {
        grid-column: 1 / -1;
        align-items: center;
        padding: 0;
    }

    .site-badge {
        position: fixed;
        left: 16px;
        bottom: 16px;
        z-index: 2;
    }

    .site-credit {
        position: fixed;
        right: 16px;
        bottom: 12px;
        z-index: 2;
    }
}

/* Phones and small tablets */

@media (max-width: 899px) {
    .site {
        display: flex;
        flex-direction: column;
    }

    .site-side {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem 1rem;
        padding: 12px 16px;
    }

    .site-logo {
        max-height: 64px;
    }

    .site-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem 1rem;
    }

    .site-nav a {
        font-size: 1.05rem;
    }

    .page-home .site-side {
        justify-content: center;
    }

    .site-main {
        flex: 1;
        padding: 0.5rem 16px 1.5rem;
    }

    .page-home .site-main {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .site-main > .glass {
        min-height: 60vh;
    }

    .site-footer {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.6rem;
        padding: 0 16px 16px;
    }

    .site-social {
        width: 100%;
        margin-top: 0.25rem;
    }

    .page-home .site-social {
        justify-content: center;
    }

    .site-social svg {
        width: 24px;
        height: 24px;
    }
}
