:root {
    --paper: #f4f0e8;
    --surface: #fffdf8;
    --ink: #171713;
    --muted: #69675f;
    --line: #d4cec2;
    --accent: #e84a24;
    --teal: #146c60;
    --yellow: #efc44f;
    --blue: #3977c6;
    --shadow: 0 14px 32px rgba(23, 23, 19, 0.09);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--ink);
    background-color: var(--paper);
    background-image:
        linear-gradient(rgba(23, 23, 19, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(23, 23, 19, 0.035) 1px, transparent 1px);
    background-size: 32px 32px;
    font-family: "Manrope", sans-serif;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
    letter-spacing: 0;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
}

button {
    color: inherit;
}

.page-width {
    width: min(1380px, calc(100% - 64px));
    margin-inline: auto;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 100;
    padding: 10px 14px;
    color: #fff;
    background: var(--ink);
    transform: translateY(-150%);
}

.skip-link:focus {
    transform: translateY(0);
}

.color-rail {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    height: 5px;
}

.color-rail span:nth-child(1) {
    background: var(--ink);
}

.color-rail span:nth-child(2) {
    background: var(--accent);
}

.color-rail span:nth-child(3) {
    background: var(--yellow);
}

.color-rail span:nth-child(4) {
    background: var(--teal);
}

.masthead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 82px;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #fff;
    background: var(--ink);
    border-radius: 3px;
}

.edition {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 48px;
    min-height: 420px;
    padding-block: 72px 64px;
}

.eyebrow,
.control-label,
.search-control label {
    display: block;
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2,
p,
dl,
dd {
    margin-top: 0;
}

h1 {
    max-width: 820px;
    margin-bottom: 22px;
    font-size: 76px;
    line-height: 0.98;
    font-weight: 700;
}

h1 em {
    color: var(--accent);
    font-family: "Fraunces", serif;
    font-weight: 600;
}

.intro-summary {
    max-width: 630px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.7;
}

.overview {
    display: grid;
    grid-template-columns: repeat(2, 128px);
    margin-bottom: 5px;
    border-top: 1px solid var(--ink);
}

.overview div {
    display: flex;
    flex-direction: column-reverse;
    gap: 22px;
    padding: 18px 0 0;
}

.overview div + div {
    padding-left: 24px;
    border-left: 1px solid var(--line);
}

.overview dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.overview dd {
    margin-bottom: 0;
    font-family: "Fraunces", serif;
    font-size: 44px;
    line-height: 1;
}

.toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(244, 240, 232, 0.96);
    border-block: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.toolbar-inner {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 28px;
    padding-block: 18px;
}

.search-control {
    flex: 0 1 440px;
}

.search-control label,
.control-label {
    margin-bottom: 8px;
}

.search-field {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    min-height: 46px;
    padding: 0 13px;
    background: var(--surface);
    border: 1px solid var(--ink);
    border-radius: 5px;
}

.search-field:focus-within {
    outline: 3px solid rgba(232, 74, 36, 0.22);
    outline-offset: 2px;
}

.search-field svg {
    color: var(--muted);
}

.search-field input {
    width: 100%;
    height: 44px;
    padding: 0 10px;
    color: var(--ink);
    background: transparent;
    border: 0;
    outline: 0;
}

.search-field input::placeholder {
    color: #8a877e;
}

.search-field input::-webkit-search-cancel-button {
    display: none;
}

.clear-search {
    display: grid;
    width: 28px;
    height: 28px;
    padding: 0;
    place-items: center;
    font-size: 22px;
    line-height: 1;
    background: transparent;
    border: 0;
    border-radius: 3px;
    cursor: pointer;
}

.clear-search:hover {
    background: #ece7dc;
}

.filter-control {
    flex: 0 0 auto;
}

.filter-group {
    display: flex;
    min-height: 46px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--ink);
    border-radius: 5px;
}

.filter-button {
    min-width: 82px;
    padding: 0 15px;
    background: transparent;
    border: 0;
    border-right: 1px solid var(--line);
    cursor: pointer;
}

.filter-button:last-child {
    border-right: 0;
}

.filter-button:hover {
    background: #ece7dc;
}

.filter-button.is-active {
    color: #fff;
    background: var(--ink);
}

.projects-section {
    padding-block: 68px 88px;
}

.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--ink);
}

.section-heading h2 {
    margin-bottom: 0;
    font-family: "Fraunces", serif;
    font-size: 31px;
    font-weight: 600;
}

.section-heading p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 13px;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.project-card {
    display: flex;
    min-width: 0;
    overflow: hidden;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 4px solid var(--project-accent);
    border-radius: 7px;
    box-shadow: 0 1px 0 rgba(23, 23, 19, 0.04);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.project-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-4px);
}

.preview-link {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background: #ded8cd;
    border-bottom: 1px solid var(--line);
}

.preview-link::after {
    position: absolute;
    inset: 0;
    content: "";
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    transition: transform 350ms ease;
}

.project-card:hover .preview-image {
    transform: scale(1.025);
}

.preview-fallback {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    padding: 24px;
    color: var(--ink);
    font-family: "Fraunces", serif;
    font-size: 34px;
    text-align: center;
}

.preview-link.preview-failed .preview-fallback {
    display: grid;
}

.project-number,
.project-status {
    position: absolute;
    z-index: 2;
    top: 12px;
    padding: 7px 9px;
    color: var(--ink);
    background: rgba(255, 253, 248, 0.94);
    border: 1px solid rgba(23, 23, 19, 0.22);
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    backdrop-filter: blur(7px);
}

.project-number {
    left: 12px;
}

.project-status {
    right: 12px;
}

.project-status::before {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 6px;
    content: "";
    background: var(--teal);
    border-radius: 50%;
}

.project-status[data-status="In progress"]::before {
    background: var(--yellow);
}

.project-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 22px;
}

.project-type {
    margin-bottom: 9px;
    color: var(--project-accent);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.project-title {
    margin-bottom: 11px;
    font-family: "Fraunces", serif;
    font-size: 25px;
    line-height: 1.15;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.project-title a {
    text-decoration: none;
}

.project-title a:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}

.project-description {
    margin-bottom: 22px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}

.project-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.project-tags {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    gap: 6px;
}

.project-tag {
    padding: 4px 6px;
    color: var(--muted);
    background: #f1ece2;
    border-radius: 2px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
}

.project-open {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.project-open svg {
    transition: transform 160ms ease;
}

.project-open:hover svg {
    transform: translate(2px, -2px);
}

.empty-state {
    padding: 80px 24px;
    text-align: center;
    border-block: 1px solid var(--line);
}

.empty-state p {
    margin-bottom: 18px;
    font-family: "Fraunces", serif;
    font-size: 28px;
}

.empty-state button {
    padding: 11px 16px;
    color: #fff;
    background: var(--ink);
    border: 1px solid var(--ink);
    border-radius: 4px;
    cursor: pointer;
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 100px;
    color: var(--muted);
    border-top: 1px solid var(--ink);
    font-size: 12px;
}

.site-footer a {
    text-underline-offset: 3px;
}

.password-dialog {
    width: min(100% - 32px, 430px);
    padding: 0;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--ink);
    border-radius: 6px;
    box-shadow: var(--shadow);
}

.password-dialog::backdrop {
    background: rgba(23, 23, 19, 0.52);
    backdrop-filter: blur(3px);
}

.password-dialog form {
    padding: 30px;
}

.dialog-heading {
    margin-bottom: 24px;
}

.dialog-heading .eyebrow {
    margin-bottom: 8px;
}

.dialog-heading h2 {
    margin-bottom: 8px;
    font-family: "Fraunces", serif;
    font-size: 30px;
    font-weight: 600;
}

.dialog-copy {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 14px;
}

.password-dialog label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.password-dialog input {
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--ink);
    border-radius: 4px;
    outline: 0;
}

.password-dialog input:focus {
    outline: 3px solid rgba(232, 74, 36, 0.22);
    outline-offset: 2px;
}

.password-error {
    margin: 8px 0 0;
    color: #b1261b;
    font-size: 12px;
    font-weight: 700;
}

.dialog-actions {
    display: flex;
    justify-content: end;
    gap: 10px;
    margin-top: 24px;
}

.dialog-actions button {
    min-height: 42px;
    padding: 0 15px;
    border-radius: 4px;
    cursor: pointer;
}

.dialog-cancel {
    background: transparent;
    border: 1px solid var(--line);
}

.dialog-submit {
    color: #fff;
    background: var(--ink);
    border: 1px solid var(--ink);
}

:focus-visible {
    outline: 3px solid rgba(232, 74, 36, 0.5);
    outline-offset: 3px;
}

[hidden] {
    display: none !important;
}

@media (max-width: 1100px) {
    .toolbar-inner {
        align-items: stretch;
        flex-direction: column;
    }

    .search-control,
    .filter-control {
        width: 100%;
        flex-basis: auto;
    }

    .filter-group {
        width: 100%;
    }

    .filter-button {
        flex: 1;
    }

    .projects-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .page-width {
        width: min(100% - 32px, 1380px);
    }

    .masthead {
        min-height: 70px;
    }

    .edition {
        display: none;
    }

    .intro {
        grid-template-columns: 1fr;
        min-height: 0;
        padding-block: 58px 48px;
    }

    h1 {
        font-size: 50px;
    }

    .intro-summary {
        font-size: 16px;
    }

    .overview {
        width: 100%;
        grid-template-columns: repeat(2, 1fr);
    }

    .toolbar {
        position: static;
    }

    .filter-group {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .filter-button {
        min-height: 42px;
        min-width: 0;
        padding-inline: 8px;
        border-right: 1px solid var(--line);
        border-bottom: 1px solid var(--line);
        font-size: 11px;
    }

    .filter-button:nth-child(3) {
        border-right: 0;
    }

    .filter-button:nth-child(n + 4) {
        border-bottom: 0;
    }

    .projects-section {
        padding-block: 48px 68px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 430px) {
    .page-width {
        width: min(100% - 24px, 1380px);
    }

    .brand {
        gap: 9px;
        font-size: 10px;
    }

    .brand-mark {
        width: 34px;
        height: 34px;
    }

    h1 {
        font-size: 40px;
    }

    .overview dd {
        font-size: 38px;
    }

    .filter-group {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-button,
    .filter-button:nth-child(3),
    .filter-button:nth-child(n + 4) {
        border-right: 1px solid var(--line);
        border-bottom: 1px solid var(--line);
    }

    .filter-button:nth-child(even) {
        border-right: 0;
    }

    .filter-button:last-child {
        border-bottom: 0;
    }

    .project-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .project-open {
        min-height: 36px;
    }

    .site-footer {
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        gap: 8px;
    }

    .password-dialog form {
        padding: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}