* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #bfbfbf;
    --bg-secondary: #b2b2b2;
    --text-primary: #1a1915;
    --text-secondary: #7a7571;
    --accent: #b8860b;
    --border: #e5e3e0;
    --transition: cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DIN Next', 'DIN', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #bfbfbf;
    color: var(--text-primary);
    line-height: 1.7;
    letter-spacing: 0.3px;
}

/* Typography */
h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 400;
    letter-spacing: -0.015em;
    margin-bottom: 2rem;
    line-height: 1.1;
}

h2 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 400;
    letter-spacing: -0.01em;
    margin-bottom: 2.5rem;
    line-height: 1.2;
}

h3 {
    font-size: 0.95rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

h4 {
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

/* Header */
header {
    padding: 1.8rem 3rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: rgba(191, 191, 191, 0.98);
    backdrop-filter: blur(10px);
    z-index: 100;
}

/* Hide header/footer while the project modal's dark backdrop is up, so they don't show through dimmed */
body.modal-open header,
body.modal-open footer {
    visibility: hidden;
}

/* Lock background scroll while the modal is open (iOS Safari needs position:fixed,
   not just overflow:hidden, or touch scrolls leak through to the page behind) */
body.modal-open {
    position: fixed;
    left: 0;
    right: 0;
    overflow: hidden;
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    /* Menu sits level with the middle of the name + tagline block */
    align-items: center;
    gap: 4rem;
    position: relative;
}

.logo-block {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    margin-top: -1.5px; /* makes up for the space around the line, so the header stays the same height */
}

/* Line between the name and tagline, as wide as both and drawn exactly like
   the page's other strokes (e.g. under the header). The margins were measured
   on screen, not calculated: they leave equal space between the line and the
   letters above and below (10px; 7.5px on phones). They're in px because
   text and lines are rounded to the nearest screen pixel, so check a
   screenshot after changing them or the name/tagline sizes. */
.logo-block::before {
    content: '';
    order: 1;
    margin: 2.3px 0 4.6px;
    border-top: 1px solid var(--border);
}

/* Name and tagline are the same width. The name's size and spacing get them
   almost equal; justifying makes both edges line up in whatever font the
   visitor's device uses. */
.logo,
.tagline {
    white-space: nowrap;
    text-align: justify;
    text-align-last: justify;
    text-justify: inter-character;
}

.logo {
    font-size: 1.2rem;
    line-height: 1.87rem; /* fixed, so the name's size doesn't change the header height */
    font-weight: 500;
    letter-spacing: 0.155em;
    margin-right: -0.155em; /* cancels the space after the last letter */
    text-decoration: none;
    color: var(--text-primary);
}

.tagline {
    order: 2; /* below the line */
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    margin-right: -0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

/* Desktop Navigation */
nav {
    display: flex;
    gap: 3rem;
    font-size: 0.9rem;
}

nav a {
    text-decoration: none;
    color: var(--text-secondary);
    transition: color 0.3s var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 400;
}

nav a:hover,
nav a.active {
    color: var(--accent);
}

/* Narrow windows and tablets: the menu closes up so it fits beside the name */
@media (min-width: 769px) and (max-width: 1000px) {
    .header-content {
        gap: 1.5rem;
    }

    header nav {
        gap: clamp(1rem, calc(1rem + (100vw - 769px) * 0.14), 3rem);
    }
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 6px;
    background: none;
    border: none;
    /* Real tap target is much bigger than the visible icon (24x18px was too
       small to reliably hit on a real phone); negative margin cancels the
       padding out again so the icon's visual position/layout is unchanged. */
    padding: 13px;
    margin: -13px;
}

.hamburger span {
    width: 24px;
    height: 2px;
    background-color: var(--text-primary);
    transition: all 0.3s var(--transition);
}

.hamburger.active span:nth-child(1) {
    /* Move to the middle bar first, then rotate, so both bars cross at the centre */
    transform: translateY(8px) rotate(45deg);
}

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

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

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    background: #bfbfbf;
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    animation: slideDown 0.3s var(--transition);
    z-index: 99;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-menu.active {
    display: flex;
}

.mobile-menu a {
    text-decoration: none;
    color: var(--text-secondary);
    transition: color 0.3s var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 400;
    font-size: 0.9rem;
}

.mobile-menu a:hover,
.mobile-menu a.active {
    color: var(--accent);
}

/* Main */
main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 3rem 3rem 2rem;
}

/* Hero Section */
.hero {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4rem 0 6rem;
    margin-bottom: 8rem;
    border-bottom: 1px solid var(--border);
}

.hero-eyebrow {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-secondary);
    font-weight: 400;
}

.hero-name {
    font-size: clamp(4rem, 10vw, 10rem);
    font-weight: 400;
    line-height: 0.95;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0;
    align-self: flex-start;
}

.hero-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.hero-discipline {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
    max-width: 400px;
}

.hero-location {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 2.5rem;
    margin-bottom: 0;
}

.project-card {
    cursor: pointer;
    transition: all 0.4s var(--transition);
}

.project-card-image {
    position: relative;
    width: 100%;
    height: 320px;
    background: #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.project-card-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 50%);
    pointer-events: none;
}

.project-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-card-title {
    position: absolute;
    z-index: 1;
    left: 1rem;
    bottom: 1rem;
    max-width: 60%;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #f0efec;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
    margin: 0;
}

.project-card-date {
    position: absolute;
    z-index: 1;
    right: 1rem;
    bottom: 1rem;
    font-size: 0.8rem;
    color: rgba(240, 239, 236, 0.85);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
    margin: 0;
}

/* Modal / Project Detail */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.35);
    z-index: 200;
    animation: fadeIn 0.3s var(--transition);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #f0f0f0;
    width: 92%;
    max-width: 1300px;
    height: 86vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.4s var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
}

@keyframes slideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    background: none;
    border: none;
    transition: color 0.3s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Two-column inner layout: sidebar spans both rows on the left;
   gallery pins above the scrollable main column on the right */
.modal-inner {
    display: grid;
    grid-template-columns: 320px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "sidebar gallery"
        "sidebar main";
    flex: 1;
    overflow: hidden;
}

/* Left sidebar */
.modal-sidebar {
    grid-area: sidebar;
    padding: 4rem 3rem;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal-sidebar h2 {
    font-size: 1.35rem;
    font-weight: 500;
    line-height: 1.35;
    margin-bottom: 2rem;
}

/* Meta (Location / Date / Role) */
#modalMeta {
    margin-bottom: 0;
}

.meta-item {
    margin-bottom: 1.25rem;
}

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

.meta-item h4 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    font-weight: 400;
}

.meta-item p {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.5;
}

.meta-item p a {
    color: var(--text-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.3s;
}

.meta-item p a:hover {
    color: var(--accent);
}

/* Right main content */
.modal-main {
    grid-area: main;
    padding: 4rem 4rem 5rem 3.5rem;
    overflow-y: auto;
    padding-right: 5rem;
    overscroll-behavior: contain;
}

.modal-description {
    font-size: 1rem;
    line-height: 1.9;
    color: var(--text-primary);
    margin-bottom: 3rem;
    max-width: 680px;
}

/* Gallery carousel */
.modal-gallery {
    grid-area: gallery;
    padding: 4rem 5rem 1.5rem 3.5rem;
}

.carousel-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 3/2;
    overflow: hidden;
    background: #e8e8e8;
}

.carousel-track {
    display: flex;
    height: 100%;
    transition: transform 0.4s var(--transition);
}

.carousel-slide {
    flex: 0 0 100%;
    height: 100%;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    /* No visible box: the hit area stays 44px so it's easy to tap */
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.75rem;
    font-weight: 300;
    line-height: 1;
    color: #fff;
    /* Soft shadow keeps the white "+" readable over bright photos */
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
    transition: color 0.3s;
    z-index: 2;
}

.carousel-arrow:hover {
    color: var(--accent);
}

.carousel-arrow--prev {
    left: 0.75rem;
}

.carousel-arrow--next {
    right: 0.75rem;
}

.carousel-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.25rem;
}

.carousel-counter {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    font-variant-numeric: tabular-nums;
}

.carousel-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.carousel-dot {
    width: 20px;
    height: 3px;
    border: none;
    padding: 0;
    background: var(--border);
    cursor: pointer;
    transition: background 0.3s;
}

.carousel-dot.active {
    background: var(--accent);
}

/* Nested Tabs */
.discipline-tabs {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    padding-bottom: 2rem;
}

.tab-button {
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    transition: all 0.3s var(--transition);
    position: relative;
    font-weight: 400;
}

.tab-button:hover {
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--accent);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s var(--transition);
}

.tab-content.active {
    display: block;
}

.tab-content p {
    line-height: 1.9;
    max-width: 900px;
}

/* Related Projects */
.related-projects {
    margin-top: 5rem;
    padding-top: 4rem;
    border-top: 1px solid var(--border);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 3rem;
    margin-top: 3rem;
}

.related-card {
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s var(--transition);
}

.related-card:hover {
    transform: translateY(-4px);
}

.related-card-image {
    width: 100%;
    height: 240px;
    background: #e8e8e8;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: rgba(0, 0, 0, 0.08);
}

.related-card h4 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}

.related-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Footer */
footer {
    border-top: 1px solid var(--border);
    padding: 3rem;
    margin-top: 4rem;
    background: var(--bg-secondary);
}

.footer-content {
    max-width: 1600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 4rem;
}

.footer-section h4 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.footer-section p,
.footer-section a {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
    margin-bottom: 1rem;
}

.footer-section a:hover {
    color: var(--accent);
}

.footer-rights {
    max-width: 1600px;
    margin: 2rem auto 0;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    /* Phones: a slim bar, since it stays stuck to the top while scrolling */
    header {
        padding: 1.375rem 1.5rem;
    }

    .header-content {
        gap: 0;
        align-items: center;
    }

    .logo-block {
        margin-top: -1px;
    }

    .logo-block::before {
        margin: 0.15px 0 3.05px;
    }

    .logo {
        font-size: 1rem;
        line-height: 1.615rem;
    }

    .tagline {
        font-size: 0.58rem;
    }

    nav {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    main {
        padding: 3rem 1.5rem;
    }

    .hero {
        margin-bottom: 4rem;
    }

    h1 {
        margin-bottom: 1.5rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
        margin-bottom: 5rem;
    }

    .project-card-image {
        height: auto;
        aspect-ratio: 16/9;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-inner {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        grid-template-areas:
            "gallery"
            "sidebar"
            "main";
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .modal-gallery {
        padding: 1.5rem 1.5rem 0;
    }

    .modal-sidebar {
        padding: 1.5rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-y: visible;
    }

    .modal-main {
        padding: 1.5rem;
        overflow-y: visible;
    }

    #modalMeta {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 1rem 1.5rem;
    }

    .modal-description {
        margin-bottom: 2rem;
    }

    .related-projects {
        margin-top: 3rem;
        padding-top: 2.5rem;
    }

    .carousel-arrow {
        font-size: 1.5rem;
    }

    .carousel-arrow--prev {
        left: 0.5rem;
    }

    .carousel-arrow--next {
        right: 0.5rem;
    }

    .discipline-tabs {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 2rem;
        padding-bottom: 1rem;
    }

    footer {
        padding: 3rem 1.5rem;
        margin-top: 4rem;
    }

    .footer-rights {
        margin-top: 2.5rem;
        padding-top: 1.5rem;
    }
}

/* Text for search engines and screen readers that isn't shown visually */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
