/* Font Faces */
@font-face {
    font-family: 'Tonka';
    src: url('../fonts/Tonka-Regular.woff2') format('woff2'),
         url('../fonts/Tonka-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tonka', sans-serif;
    font-weight: 400;
}

body {
    font-family: 'Tonka', sans-serif;
    background-color: #fff;
    color: #000;
    line-height: 1.6;
    overflow-x: hidden;
    padding-left: 60px;
    padding-right: 60px;
    font-weight: 400;
}

/* Initial state - page starts at hero with white text */
body:not(.at-grid):not(.at-info) header,
body:not(.at-grid):not(.at-info) header *,
body:not(.at-grid):not(.at-info) header h1,
body:not(.at-grid):not(.at-info) header .nav-link,
body:not(.at-grid):not(.at-info) .side-nav-btn {
    color: #fff;
}

body:not(.at-grid):not(.at-info) .side-nav-btn::after {
    background-color: #fff;
}

h1, h2, h3, h4, h5, h6, p, a, button, span, div, nav, header, label, input, textarea {
    font-family: 'Tonka', sans-serif !important;
    font-weight: 400 !important;
    font-size: 12px !important;
}

a {
    color: #000;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

a:hover {
    opacity: 0.6;
}

a.project-card:hover {
    opacity: 1;
}

/* Vertical Side Navigation */
.side-nav {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding: 0 20px;
}

.side-nav-btn {
    background: none;
    border: none;
    color: #fff;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: opacity 0.3s ease;
    padding: 0;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: nowrap;
    position: relative;
}

.side-nav-btn:hover,
.side-nav-btn.active {
    opacity: 1;
}

.side-nav-btn::after {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 0;
    background-color: #fff;
    transition: height 0.3s ease;
}

.side-nav-btn.active::after,
.side-nav-btn:hover::after {
    height: 100%;
}

/* Right Side Navigation */
.side-nav-right {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding: 0 20px;
}

.side-nav-right .side-nav-btn {
    transform: rotate(0deg);
}

.side-nav-right .side-nav-btn::after {
    left: auto;
    right: 100%;
    margin-right: 4px;
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px 0;
    z-index: 100;
    background-color: transparent;
    box-sizing: border-box;
}

header::before {
    content: '';
    display: block;
    width: 100%;
    max-width: 1920px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    height: 1px;
    top: 0;
}

.header-left,
.header-right {
    flex: 1;
    padding: 0;
}

.header-left {
    text-align: left;
    padding-left: calc(60px + 32px);
    margin-left: calc((100vw - 1920px) / 2);
}

.header-right {
    text-align: right;
    padding-right: calc(60px + 32px);
    margin-right: calc((100vw - 1920px) / 2);
}

@media (max-width: 1920px) {
    .header-left {
        margin-left: 0;
    }

    .header-right {
        margin-right: 0;
    }
}

.header-left .nav-link,
.header-right .nav-link {
    display: inline-block;
}

.header-center {
    flex: 1;
    text-align: center;
}

.header-title-link {
    display: inline-block;
    text-decoration: none;
}

.header-title-link:hover {
    opacity: 1;
}

.header-center h1 {
    font-weight: 400;
    letter-spacing: 2.5px;
}

.header-right {
    text-align: right;
}

.nav-link {
    letter-spacing: 1.5px;
    text-transform: uppercase;
    position: relative;
}

/* Project Grid */
.project-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 24px;
    row-gap: 24px;
    padding: 80px 32px 80px;
    max-width: 1920px;
    margin: 0 auto;
}

.project-card {
    position: relative;
    counter-increment: project-counter;
    display: block;
    min-width: 0;
    padding-top: 22px;
}

/* Reset anchor tag styles for project cards */
a.project-card {
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
    overflow: visible;
    min-width: 0;
}

.project-card.large {
    grid-column: span 2;
    grid-row: span 2;
}

.project-number {
    letter-spacing: 1px;
    display: inline-block;
    flex-shrink: 0;
    margin-right: 16px;
}

.project-number::before {
    content: counter(project-counter, decimal-leading-zero);
}

.project-title {
    display: flex;
    align-items: baseline;
    gap: 0;
    padding-left: 16px;
}

/* Project Caption Above Image */
.project-caption {
    margin-bottom: 10px;
    pointer-events: none;
    line-height: 1.6;
}

.caption-title {
    font-weight: 400;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #000;
    display: inline;
}

.caption-subtitle {
    font-weight: 400;
    letter-spacing: 1px;
    color: #000;
    display: inline;
}

.caption-subtitle::before {
    content: " ";
    margin: 0 3px;
}

/* Media Container */
.media-container {
    position: relative;
    width: 100%;
    padding-bottom: 50%; /* 2:1 aspect ratio */
    overflow: hidden;
}

.project-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover !important;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 0s ease;
    z-index: 1;
    display: block;
}

.project-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover !important;
    opacity: 0;
    transition: none;
    z-index: 2;
    pointer-events: none;
}

.project-card:hover .project-image {
    opacity: 1;
}

.project-card:hover .project-video.loaded {
    opacity: 1;
}

.project-video.loaded ~ .project-image {
    opacity: 0;
}

/* Project info styles */
.project-info {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
    color: #000;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.project-info h3 {
    font-family: 'Tonka', sans-serif;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.15em;
    margin: 0;
    text-transform: uppercase;
    display: inline;
}

.project-info h3::before {
    content: " ";
    white-space: pre;
}

.project-info p {
    font-family: 'Tonka', sans-serif;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.1em;
    margin: 0;
    opacity: 0.7;
    display: inline;
    margin-left: 8px;
}

/* Filter Hidden State */
.project-card.hidden {
    display: none;
}

/* Information Page */
.info-page {
    display: none;
    background-color: #fff;
    min-height: 100vh;
}

.info-page.active {
    display: block;
}

/* Keep main navigation visible on info page */

/* Info page uses same header/nav as main page - no separate elements needed */

.info-content {
    max-width: 1920px;
    margin: 0 auto;
    padding: 120px 32px 80px;
}

/* Full-width image (legacy - kept for compatibility) */
.info-image-full {
    width: 100%;
    margin-bottom: 80px;
}

.info-image-full img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
    user-select: none;
}

/* Image in right column */
.info-image {
    width: 100%;
    margin-bottom: 40px;
}

.info-image img {
    width: 100%;
    max-width: 75ch;
    height: auto;
    display: block;
    pointer-events: none;
    user-select: none;
}

/* Two-column layout for content rows */
.info-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 80px;
    margin-bottom: 80px;
    align-items: start;
}

/* Left column - labels */
.info-label h2 {
    font-weight: 400;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* Right column - content */
.info-detail p {
    line-height: 1.6;
    margin-bottom: 20px;
    max-width: 75ch;
}

.info-detail a {
    text-decoration: underline;
    text-decoration-color: rgba(0, 0, 0, 0.3);
    text-underline-offset: 2px;
}

.info-detail a:hover {
    text-decoration-color: rgba(0, 0, 0, 0.8);
}

/* Contact columns */
.contact-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 35px;
    max-width: 75ch;
}

/* Contact items */
.contact-item {
    margin-bottom: 40px;
}

.contact-item:last-child {
    margin-bottom: 0;
}

.contact-title {
    font-weight: 400;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 12px;
    opacity: 1;
}

.contact-item p {
    line-height: 1.8;
    margin-bottom: 6px;
}

/* Footer Row */
.info-footer {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 80px;
    margin-top: 80px;
    padding-bottom: 40px;
    align-items: start;
}

.footer-credit {
    text-align: left;
}

.footer-credit p {
    line-height: 1.6;
    color: #000;
}

.footer-links {
    display: flex;
    flex-direction: row;
    gap: 20px;
    justify-content: flex-start;
}

.social-btn {
    background: none;
    border: none;
    color: #000;
    text-decoration: none;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: opacity 0.3s ease;
    padding: 0;
    align-self: flex-start;
}

.social-btn:hover {
    opacity: 0.6;
}

/* Video Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    background-color: #fff;
    z-index: 300;
    display: flex;
    flex-direction: column;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.close-btn {
    background: none;
    border: none;
    color: #000;
    letter-spacing: 1.5px;
    transition: opacity 0.3s ease;
    text-transform: uppercase;
    padding: 0;
}

.close-btn:hover {
    opacity: 0.6;
}

.modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 40px calc(60px + 32px) 80px;
    overflow-y: auto;
}

.video-wrapper {
    max-width: 1920px;
    margin: 0 auto;
    width: 100%;
}

.video-container {
    width: 100%;
    margin-bottom: 24px;
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.modal-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
    margin-bottom: 32px;
    gap: 20px;
}

.modal-nav .nav-btn:first-child {
    justify-self: start;
}

.modal-nav .close-btn {
    justify-self: center;
}

.modal-nav .nav-btn:last-child {
    justify-self: end;
}

.nav-btn {
    pointer-events: auto;
    background: none;
    border: none;
    color: #000;
    letter-spacing: 1.5px;
    transition: opacity 0.3s ease;
    text-transform: uppercase;
}

.nav-btn:hover {
    opacity: 0.6;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.modal-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    width: 100%;
    margin-bottom: 24px;
}

.modal-info h2 {
    font-weight: 400;
    letter-spacing: 2px;
    color: #000;
    text-align: left;
}

.modal-info p {
    opacity: 0.6;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #000;
    text-align: right;
}

/* Modal Details Section */
.modal-details {
    margin-top: 60px;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px 60px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-item.detail-full {
    grid-column: span 2;
}

.detail-item h3 {
    font-weight: 400;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 12px;
    color: #000;
}

.detail-item p {
    line-height: 1.6;
    color: #000;
    max-width: 75ch;
}

.project-still {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 20px;
}

/* Responsive Design */

/* Tablet */
@media screen and (max-width: 1024px) {
    .project-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media screen and (max-width: 768px) {
    body {
        padding-left: 0;
        padding-right: 0;
    }

    .side-nav {
        display: none;
    }

    header {
        padding: 16px 16px 6px 16px;
        flex-wrap: wrap;
    }

    /* Hero section removed - no offset needed */
    main {
        margin-top: 0 !important;
    }

    body.archive-page main {
        margin-top: 0 !important;
    }

    .video-background iframe {
        width: 140vw !important; /* Zoom in 40% */
        height: 78.75vw !important; /* 16:9 aspect ratio * 1.4 */
        min-width: 248.89vh !important; /* 16:9 aspect ratio * 1.4 */
        min-height: 140vh !important; /* Zoom in 40% */
    }

    .header-center {
        order: -1;
        flex: 100%;
        margin-bottom: 16px;
    }

    .header-left,
    .header-right {
        flex: auto;
    }

    .filter-nav {
        padding: 100px 20px 40px;
        gap: 20px;
    }

    .project-grid {
        grid-template-columns: 1fr;
        padding: 70px 20px 60px;
        gap: 16px;
    }

    .project-card {
        aspect-ratio: 16 / 9;
        display: block;
    }

    .project-card.large {
        grid-column: span 1;
        grid-row: span 1;
    }

    /* Ensure images/videos fill the card properly */
    .project-card .project-image,
    .project-card .project-video {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /* Project info on top */
    .project-card .project-info {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        padding: 16px;
        z-index: 10;
    }

    /* Mobile landscape - reduce side padding */
    @media (max-width: 926px) and (max-height: 428px) {
        .project-grid {
            padding: 70px 8px 60px 8px;
        }
    }

    .info-content {
        padding: 100px 20px 60px;
    }

    .info-row {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-bottom: 60px;
    }

    .info-image-full {
        margin-bottom: 60px;
    }

    .info-label h2 {
        margin-bottom: 16px;
    }

    .contact-item {
        margin-bottom: 32px;
    }

    .contact-columns {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .info-footer {
        grid-template-columns: 1fr;
        gap: 40px;
        margin-top: 60px;
    }

    .footer-links {
        flex-direction: column;
        gap: 20px;
    }

    .modal-nav {
        grid-template-columns: 1fr auto 1fr;
        gap: 12px;
        text-align: center;
    }

    .modal-nav .nav-btn:first-child {
        justify-self: start;
        text-align: left;
    }

    .modal-nav .close-btn {
        justify-self: center;
    }

    .modal-nav .nav-btn:last-child {
        justify-self: end;
        text-align: right;
    }

    .modal-content {
        padding: 0 20px 60px;
    }

    .details-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .detail-item.detail-full {
        grid-column: span 1;
    }
}


/* Counter Reset */
.project-grid {
    counter-reset: project-counter;
}

/* Removed zoom transforms - now using contain instead of cover */

/* Hero Section with Full-Screen Video */
.hero-section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.video-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.video-background iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 140vw;
    height: 78.75vw; /* 16:9 aspect ratio * 1.4 */
    min-width: 248.89vh; /* 16:9 aspect ratio * 1.4 */
    min-height: 140vh;
    transform: translate(-50%, -50%);
    pointer-events: none;
    border: none;
}

/* Main Content positioning */
html {
    margin: 0;
    padding: 0;
}

body {
    padding-top: 0;
    margin: 0;
}

main {
    margin-top: 0;
}

/* Header scroll transitions */
body.at-hero header {
    background-color: transparent !important;
}

body.at-hero header,
body.at-hero header *,
body.at-hero header h1,
body.at-hero header .nav-link,
body.at-hero .side-nav-btn,
body.at-hero .side-nav .side-nav-btn,
body.at-hero .side-nav-right .side-nav-btn {
    color: #fff !important;
    mix-blend-mode: normal !important;
}

body.at-hero .side-nav-btn::after {
    background-color: #fff !important;
}

/* Hide filter button underlines when at hero */
body.at-hero .main-side-nav .side-nav-btn.active::after,
body.at-hero .main-side-nav .side-nav-btn:hover::after {
    height: 0 !important;
}

/* Hide filter button underlines when info page is active */
body.at-info .main-side-nav .side-nav-btn.active::after,
body.at-info .main-side-nav .side-nav-btn:hover::after {
    height: 0 !important;
}

/* Info page header styles */
body.at-info header {
    background-color: #fff !important;
}

body.at-info header,
body.at-info header *,
body.at-info header h1,
body.at-info header .nav-link,
body.at-info .side-nav-btn {
    color: #000 !important;
}

body.at-info .side-nav-btn::after {
    background-color: #000 !important;
}

body.at-grid header {
    background-color: #fff !important;
}

body.at-grid header,
body.at-grid header *,
body.at-grid header h1,
body.at-grid header .nav-link,
body.at-grid .side-nav-btn,
body.at-grid .side-nav .side-nav-btn,
body.at-grid .side-nav-right .side-nav-btn {
    color: #000 !important;
}

body.at-grid .side-nav-btn::after {
    background-color: #000 !important;
}

/* Show filter button underlines when at grid */
body.at-grid .main-side-nav .side-nav-btn.active::after,
body.at-grid .main-side-nav .side-nav-btn:hover::after {
    height: 100% !important;
}

/* Smooth transition for header */
header {
    transition: background-color 0.3s ease;
}

header,
header *,
header h1,
header .nav-link,
.side-nav-btn,
.side-nav .side-nav-btn,
.side-nav-right .side-nav-btn {
    transition: color 0.8s ease;
}

.side-nav-btn::after {
    transition: background-color 0.8s ease, height 0.3s ease;
}

/* Mobile Menu */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    padding: 0;
    width: 14px;
    height: 9px;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10000;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger-btn span {
    display: block;
    width: 100%;
    height: 1px;
    background-color: #000;
    transition: all 0.3s ease;
}

.hamburger-btn.active span:nth-child(1) {
    transform: translateY(4px) rotate(45deg);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
    transform: translateY(-4px) rotate(-45deg);
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    background-color: #fff;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    visibility: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-menu.active {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.mobile-menu-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 60px;
}

.mobile-menu-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* Tighter spacing for filter buttons */
.mobile-menu-section.mobile-menu-filters {
    gap: 8px;
}

.mobile-menu-btn {
    background: none;
    border: none;
    color: #000;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: opacity 0.3s ease;
    padding: 16px 32px;
    text-align: center;
    font-size: 12px;
    position: relative;
    z-index: 1;
}

.mobile-menu-btn:hover {
    opacity: 0.6;
}

/* Mobile Menu Responsive */
@media screen and (max-width: 768px) {
    .hamburger-btn {
        display: flex;
    }

    .mobile-menu {
        display: block;
    }

    .header-left,
    .header-right {
        display: none;
    }

    .side-nav-right {
        display: none;
    }

    /* Adjust header for hamburger on mobile */
    .header-center {
        padding-left: 0;
        padding-right: 50px;
        text-align: left;
        position: relative;
    }

    .header-center h1 {
        text-align: left;
    }

    /* Align hamburger with title baseline */
    .hamburger-btn {
        top: 24px;
        transform: none;
        z-index: 10001;
    }

    /* Ensure header stays above menu */
    header {
        z-index: 10000;
    }

    /* Hero header state */
    body.at-hero .hamburger-btn span {
        background-color: #fff;
    }

    body.at-grid .hamburger-btn span {
        background-color: #000;
    }

    body.at-info .hamburger-btn span {
        background-color: #000;
    }

    /* When menu is open, keep hamburger and title black */
    body.menu-open .hamburger-btn span {
        background-color: #000 !important;
    }

    body.menu-open header,
    body.menu-open header *,
    body.menu-open header h1 {
        color: #000 !important;
    }

    /* Prevent scrolling when menu or modal is open */
    body.menu-open,
    body.modal-open {
        position: fixed !important;
        width: 100% !important;
        overflow: hidden !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Hide header when video modal is open on mobile */
    body.modal-open header {
        display: none;
    }
}
