/* --- 1. TYPOGRAPHY --- */

@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/cormorant-regular.woff2') format('woff2'),
         url('../fonts/cormorant-regular.woff') format('woff');
}

@font-face {
    font-family: 'DM Sans';
    src: url('../fonts/dm-sans-v17-latin-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'EB Garamond';
    src: url('../fonts/eb-garamond-v32-latin-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}


/* --- 2. DESIGN SYSTEM --- */

:root {
    /* Colours */
    --primary-navy: #011D57;
    --bg-ivory: #FCFBF4;
    --text-main: var(--primary-navy);
    --nav-bg: rgba(252, 251, 244, 0.7);
    --border-low: rgba(1, 29, 87, 0.08);
    --nav-hover-bg: rgba(1, 29, 87, 0.05);
    --color-success: #4CAF50;

    /* Typography */
    --system-fonts: "Cormorant Garamond", 'EB Garamond', "Times New Roman", serif;
    --ui-fonts: "DM Sans", sans-serif;

    /* Spacing */
    --space-xs:  8px;
    --space-sm:  12px;
    --space-md:  20px;
    --space-lg:  40px;
    --space-xl:  80px;
    --space-xxl: 120px;

    /* Border radius */
    --radius-pill:  40px;
    --radius-round: 50%;
    --radius-sm:    25px;

    /* Transitions */
    --transition-speed: 0.4s;
}

body.dark-mode {
    --primary-navy: #FCFBF4;
    --bg-ivory: #0E121B;
    --soft-yellow: #161B26;
    --text-main: #D4D9E1;
    --nav-bg: rgba(14, 18, 27, 0.75);
    --border-low: rgba(212, 217, 225, 0.1);
    --nav-hover-bg: rgba(252, 251, 244, 0.08);
}

.artist-statement {
    margin: var(--space-sm) auto 0 auto;
    font-family: var(--ui-fonts);
    font-size: clamp(0.8rem, 1vw, 1rem);
    letter-spacing: 2px;
    opacity: 0.7;
    text-align: center;
    max-width: 480px;
    line-height: 1.6;
    padding: 10px 10px 30px 10px;
}

.treaty-wrapper {
    text-align: center;
    padding: var(--space-md) 0;
}

.treaty-statement {
    margin: 0 auto;
    font-family: var(--system-fonts);
    font-size: clamp(1rem, 1.5vw, 1.5rem);
    letter-spacing: 4px;
    text-transform: uppercase;
    text-align: center;
    opacity: 1;
    max-width: 420px;
    display: inline-block;
    border-bottom: 2px solid var(--border-low);
    padding-bottom: var(--space-md);
}


/* --- 3. REDUCED MOTION --- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
    }
    html {
        scroll-behavior: auto;
    }
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--system-fonts);
    background-color: var(--bg-ivory);
    color: var(--text-main);
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

figure {
    margin: 0;
    font-size: inherit;
}


/* --- 4. LAYOUT --- */

.widescreen-frame {
    width: 100%;
    max-width: 3840px;
    margin: 0 auto;
    padding: var(--space-md) 5%;
    box-sizing: border-box;
    padding-bottom: calc(150px + env(safe-area-inset-bottom));
}


/* --- 5. FLOATING UI CONTROLS --- */

.ui-stack {
    position: fixed;
    right: var(--space-sm);
    bottom: calc(110px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    z-index: 1001;
}

.ui-button {
    width: 45px;
    height: 45px;
    border: 1px solid var(--border-low);
    border-radius: var(--radius-round);
    background-color: var(--bg-ivory);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
    color: var(--text-main);
    padding: 0;
    outline: none;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

body.dark-mode .ui-button {
    background-color: rgba(252, 251, 244, 0.2);
    border: 1px solid rgba(252, 251, 244, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 5px 25px rgba(252, 251, 244, 0.15);
    color: #FCFBF4;
}

#backToTop {
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.4s, visibility 0.4s, transform 0.4s;
}

#backToTop.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.icon-circle {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: var(--radius-round);
    border: 1px solid var(--text-main);
    transition: background 0.3s;
}

body.dark-mode .icon-circle {
    background-color: var(--text-main);
}

.arrow-up {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-top: 1px solid var(--text-main);
    border-left: 1px solid var(--text-main);
    transform: rotate(45deg);
    margin-top: 4px;
}

body.dark-mode .arrow-up {
    border-top-width: 1.5px;
    border-left-width: 1.5px;
    border-color: #FCFBF4;
}


/* --- HERO STRIP --- */

.hero-strip {
    width: 100%;
    /* Default height for wide screens */
    height: 22vh; 
    background-image: url('/img/hero/chris_sampson_current_028_crop3.webp');
    background-size: cover;
    background-position: center var(--hero-y, 32%);
    background-repeat: no-repeat;
    will-change: background-position;
}

@media (prefers-reduced-motion: reduce) {
    .hero-strip {
        background-attachment: scroll;
    }
}

@media (-webkit-touch-callout: none) {
    .hero-strip {
        background-attachment: scroll;
    }
}

@supports (-webkit-touch-callout: none) {
    .hero-strip {
        background-attachment: scroll;
    }
}

/* --- 6. HEADER & NAV --- */

.site-header {
    padding: clamp(30px, 5vw, 80px) 0 var(--space-md) 0;
    text-align: center;
}

.branding h1 {
    margin: 0;
    font-size: clamp(1.4rem, 2.5vw, 2.8rem);
    text-transform: uppercase;
    letter-spacing: 4px;
    font-weight: normal;
    text-shadow: 0 1px 8px var(--border-low);
}

.main-nav {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background-color: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-low);
    border-radius: var(--radius-pill);
    width: auto;
    max-width: 90vw;
    padding: clamp(6px, 0.5vw, 10px) clamp(8px, 0.8vw, 16px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

.main-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.main-nav a {
    text-decoration: none;
    color: var(--text-main);
    font-family: var(--ui-fonts);
    font-size: clamp(0.65rem, 0.8vw, 1.1rem);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.7;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    padding: 10px 15px;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.main-nav a:hover {
    opacity: 1;
    background-color: var(--nav-hover-bg);
    transform: translateY(-2px);
}

.main-nav a.active {
    opacity: 1;
    background-color: var(--border-low);
    font-weight: 600;
}


/* --- 7. PROJECT BLOCKS --- */

.project-section,
.about-section {
    padding-top: clamp(60px, 8vw, 160px);
    margin-bottom: clamp(80px, 10vw, 200px);
    max-width: 2400px;
    margin-left: auto;
    margin-right: auto;
    scroll-margin-top: var(--space-xxl);
    content-visibility: auto;
    contain-intrinsic-size: auto 1400px;
}

.gallery-block {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.info-square {
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 3.5 / 1;
    padding: 10px var(--space-md) 10px 10px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    background-color: rgba(255, 255, 255, 0.05);
    position: relative;
    transition: background-color var(--transition-speed);
    box-sizing: border-box;
}

.info-square::after {
    content: '';
    position: absolute;
    left: 10px;
    right: var(--space-md);
    bottom: 10px;
    height: 1px;
    background-color: var(--border-low);
    transition: background-color var(--transition-speed);
}

.info-square h2 {
    margin: 0;
    font-family: var(--system-fonts);
    font-size: 2.0rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.01em;
    text-align: right;
    padding-bottom: var(--space-xs);
    z-index: 1;
}

.block-details {
    padding: 5px 0 var(--space-md) 0;
    font-family: var(--ui-fonts);
}

.block-details h4 {
    margin: 0 0 5px 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.6;
}

.block-details p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.5;
}


/* --- 8. PHOTO CONTAINERS & SKELETON --- */

.photo-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    padding: 0;
    margin-bottom: 0;
    max-height: 1400px;
    max-width: 2560px;
}

.photo-container img {
    width: 100%;
    height: auto;
    display: block;
}

.skeleton {
    background-color: var(--border-low);
    animation: skeleton-breathe 3s ease-in-out infinite;
}

@keyframes skeleton-breathe {
    0%   { opacity: 1; }
    50%  { opacity: 0.35; }
    100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: none;
    }
}


/* --- 9. GALLERY COMPONENT --- */

.gallery-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    min-height: 400px;
}

.poster-fallback {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    object-position: left center;
}

.gallery-track {
    display: flex;
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.gallery-slide {
    flex: 0 0 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.gallery-slide img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 85vh;
    object-fit: contain;
    object-position: center center;
}

.gallery-slide figcaption {
    font-family: var(--ui-fonts);
    font-size: 0.75rem;
    opacity: 0.5;
    padding: var(--space-xs) 0 0 0;
    letter-spacing: 1px;
    text-align: center;
}

.gallery-tap {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    z-index: 2;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.gallery-tap.prev {
    left: 0;
    cursor: pointer;
}

.gallery-tap.next {
    right: 0;
    cursor: pointer;
}

.gallery-indicators {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
    padding: var(--space-sm) 0 4px 0;
}

.gallery-pip {
    display: block;
    width: 18px;
    height: 2px;
    background-color: var(--text-main);
    opacity: 0.2;
    border-radius: 2px;
    transition: opacity 0.3s, width 0.3s;
    border: none;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.gallery-pip.active {
    opacity: 0.8;
    width: 28px;
}


/* --- 10. COPY BUTTON --- */

.copy-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-main);
    opacity: 0.3;
    transition: opacity 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
}

.copy-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.copy-icon {
    width: 14px;
    height: 14px;
}

.copy-btn.copied {
    color: var(--color-success);
    opacity: 1;
}


/* --- 11. ABOUT SECTION --- */

.about-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    max-width: 1600px;
    margin: 0 auto;
}
.about-grid p {
    max-width: 85ch;
}
.profile-photo {
    width: 100%;
    max-width: 200px;
    align-self: center;
    border: 1px solid var(--border-low);
    padding: 10px;
}

.about-content {
    line-height: 1.8;
    font-size: 1.2rem;
}

.about-content h2 {
    margin-top: 0;
    font-size: clamp(2rem, 3vw, 4rem);
    font-weight: 500;
}

.about-list {
    list-style: none;
    padding: 0;
    margin: 30px 0 0 0;
    font-family: var(--ui-fonts);
    font-size: 0.9rem;
        max-width: 85ch;
}

.about-list li {
    margin-bottom: var(--space-sm);
    color: var(--text-main);
    opacity: 0.8;
}

.about-list .list-label {
    text-transform: uppercase;
    opacity: 0.5;
    margin-right: 10px;
    letter-spacing: 1px;
    font-weight: 500;
}

.profile-figure {
    margin: 0;
    align-self: center;
}

.profile-figure .profile-photo {
    align-self: unset;
}

.profile-credit {
    font-family: var(--ui-fonts);
    font-size: 0.75rem;
    opacity: 0.6;
    letter-spacing: 1px;
    text-align: left;
    padding-top: 6px;
    text-transform: uppercase;
}

.profile-credit a {
    color: var(--text-main);
    text-decoration: underline;
}

.profile-credit a:visited {
    color: var(--text-main);
}

.profile-credit a:hover {
    opacity: 0.6;
}

.external-icon {
    width: 12px;
    height: 12px;
    margin-left: 4px;
    vertical-align: middle;
    opacity: 0.8;
}

/* --- 12. FOOTER --- */

.site-footer {
    margin-top: 100px;
    padding: 60px 5% 140px 5%;
    border-top: 1px solid var(--border-low);
    font-family: var(--ui-fonts);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    max-width: 2000px;
    margin: 0 auto;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.footer-col h5 {
    margin: 0 0 5px 0;
    opacity: 0.5;
    font-weight: 500;
}

.footer-col a {
    text-decoration: none;
    color: var(--text-main);
    transition: opacity 0.3s;
    display: block;
}

.footer-col a:hover {
    opacity: 0.6;
}

.location-info {
    opacity: 0.7;
    line-height: 1.6;
}

.formerly {
    text-decoration: line-through;
    opacity: 0.5;
}


/* --- 13. RESPONSIVE QUERIES --- */

@media screen and (min-width: 1024px) {
    .project-section {
        display: grid;
        grid-template-columns: clamp(320px, 20vw, 500px) 1fr;
        column-gap: clamp(var(--space-lg), 5vw, var(--space-xxl));
        align-items: end;
    }
    .gallery-block {
        display: contents;
    }
    .info-square {
        grid-column: 1;
        width: clamp(320px, 20vw, 500px);
        height: clamp(320px, 20vw, 500px);
        aspect-ratio: auto;
        padding: clamp(var(--space-md), 2vw, 60px);
    }
    .info-square h2 {
        font-size: clamp(3rem, 3.5vw, 4.5rem);
    }
    .photo-container,
    .gallery-container,
    .gallery-indicators {
        grid-column: 2;
        width: 100%;
    }
    .block-details {
        grid-column: 2;
        margin-top: var(--space-md);
    }
    .about-grid {
        flex-direction: row;
        align-items: flex-start;
        gap: var(--space-xl);
    }
    .footer-grid {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }
    .footer-col.right {
        text-align: right;
    }
    .site-footer {
        font-size: 1.0rem;
    }
}

@media screen and (max-width: 430px) {
    .main-nav {
        width: 95%;
    }
    .main-nav ul {
        gap: 2px;
        justify-content: space-between;
    }
    .main-nav a {
        font-size: 0.62rem;
        padding: 4px 4px;
        letter-spacing: 0.7px;
    }
    .profile-photo {
        max-width: 160px;
    }
}

/* Fix for narrow screens (e.g., mobile phones) */
@media (max-width: 768px) {
    .hero-strip {
        height: 15vh; /* Much shorter on narrow screens */
    }
}