:root {
    --bg: #dad4d8;
    --panel: #f3edf2;
    --panel-2: #ebe3ea;
    --line: #b2a2ae;
    --ink: #1a1719;
    --muted: #615964;
    --accent: #462168;
    --accent-2: #705194;
    --accent-soft: #d5c6e3;
    --title-link: #462168;
    color-scheme: light;
}

html[data-theme="dark"] {
    --bg: #1a1719;
    --panel: #221d24;
    --panel-2: #302734;
    --line: #615964;
    --ink: #ebe3ea;
    --muted: #b2a2ae;
    --accent: #b28ed9;
    --accent-2: #d0b7eb;
    --accent-soft: #3b185d;
    --title-link: #ffffff;
    color-scheme: dark;
}

/* Self-hosted title/brand typeface — see mdb/website/static/fonts/quantico/OFL.txt */
@font-face {
    font-family: "Quantico";
    src: url("fonts/quantico/Quantico-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Quantico";
    src: url("fonts/quantico/Quantico-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--bg);
    font-family: "Space Grotesk", "Trebuchet MS", monospace;
    line-height: 1.55;
}

.bg-layer {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(95rem 28rem at 7% -10%, color-mix(in srgb, var(--accent) 35%, transparent), transparent),
        radial-gradient(90rem 34rem at 96% 2%, color-mix(in srgb, var(--accent-2) 28%, transparent), transparent),
        repeating-linear-gradient(
            135deg,
            color-mix(in srgb, var(--panel-2) 55%, transparent) 0,
            color-mix(in srgb, var(--panel-2) 55%, transparent) 2px,
            transparent 2px,
            transparent 16px
        );
    opacity: 0.75;
}

.shell {
    max-width: 1080px;
    margin: 0 auto;
    padding: calc(1.1rem + env(safe-area-inset-top)) calc(1.1rem + env(safe-area-inset-right)) 1.1rem calc(1.1rem + env(safe-area-inset-left));
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: color-mix(in srgb, var(--panel) 90%, transparent);
    backdrop-filter: blur(3px);
    margin-bottom: 1rem;
}

.brand {
    font-family: "Quantico", "Trebuchet MS", sans-serif;
    font-size: clamp(1.5rem, 3vw, 2rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.brand a {
    color: var(--ink);
    text-decoration: none;
}

.meta {
    color: var(--muted);
    font-size: 0.9rem;
}

.theme-toggle {
    border: 1px solid var(--line);
    background: var(--accent-soft);
    color: var(--ink);
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
}

.layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nav-shell {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: color-mix(in srgb, var(--panel) 94%, transparent);
    padding: 0.4rem;
}

.nav-shell ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.nav-shell li {
    animation: fade-slide 0.5s ease both;
}

.nav-shell li:nth-child(2) {
    animation-delay: 0.06s;
}

.nav-shell li:nth-child(3) {
    animation-delay: 0.12s;
}

.nav-shell a {
    display: block;
    text-decoration: none;
    color: var(--ink);
    background: var(--panel-2);
    border: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    font-weight: 600;
}

.nav-shell a:hover {
    background: var(--accent);
    color: #ffffff;
}

.nav-shell a.is-active {
    background: var(--accent);
    color: #ffffff;
    border-color: color-mix(in srgb, var(--accent) 80%, var(--line));
}

.content {
    min-width: 0;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 10%, transparent);
    animation: reveal-up 0.45s ease both;
}

h1 {
    font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
    color: var(--accent);
    line-height: 1.15;
    margin-top: 0;
    margin-bottom: 0.15rem;
}

h2 {
    font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
    color: var(--accent);
    line-height: 1.15;
    margin-top: 0;
    margin-bottom: 0.15rem;
}

h3 {
    font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
    color: var(--accent);
    line-height: 1.15;
    font-size: 1.15rem;
    margin: 1.25rem 0 0.4rem;
}

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

.mono {
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-size: 0.9rem;
    color: var(--muted);
}

.kicker {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0.1rem 0 0;
}

.row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.5rem;
    margin: 0.35rem 0;
}

.row strong {
    color: var(--muted);
    font-weight: 700;
}

.row span {
    overflow-wrap: anywhere;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.65rem;
}

.stat-card {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.7rem;
}

.stat-value {
    display: block;
    font-family: "Cormorant Garamond", "Georgia", serif;
    font-size: 1.6rem;
}

.stat-label {
    color: var(--muted);
    font-size: 0.85rem;
}

.card-summary {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-header {
    margin-bottom: 0.4rem;
}

.card-header h2 {
    margin-bottom: 0.15rem;
}

.card-header h1 {
    color: var(--title-link);
    text-decoration: none;
}

.card-header h2 a {
    color: var(--title-link);
    text-decoration: none;
}

.card-header h2 a:hover {
    text-decoration: underline;
}

.card-meta {
    margin: 0;
    font-size: 0.9rem;
    color: var(--accent-2);
}

.card-institutions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    margin: 0.5rem 0 0;
    padding-top: 0.45rem;
    border-top: 1px dashed var(--line);
    font-size: 0.8rem;
    color: var(--muted);
}

.card-institution-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--line);
    text-underline-offset: 0.15em;
    font-family: var(--mono-font, monospace);
}

.card-institution-link:hover {
    text-decoration-color: currentColor;
}

.card-institution-sep {
    color: var(--muted);
}


.card-tagline {
    margin: 0.2rem 0 0.4rem;
    font-size: 0.95rem;
    color: var(--accent-2);
}

.work-tagline {
    margin: 0.2rem 0 0.6rem;
    font-size: 1.05rem;
    color: var(--accent-2);
}

.section-divider {
    border: none;
    border-top: 1px solid var(--line);
    margin: 1.25rem 0 1rem;
}

.back-link {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
}

.back-link a {
    color: var(--muted);
    text-decoration: none;
}

.back-link a:hover {
    color: var(--accent);
}

.site-footer {
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.85rem;
    padding: 1.5rem 0 0.5rem;
}

.site-footer a {
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--muted) 40%, transparent);
}

.site-footer a:hover {
    color: var(--ink);
    border-bottom-color: var(--ink);
}

.site-footer-right {
    text-align: right;
}

.about-portrait {
    margin: 0 0 1rem;
    text-align: center;
}

.about-portrait img {
    display: block;
    width: 100%;
    max-width: 420px;
    max-height: 420px;
    object-fit: cover;
    object-position: center;
    border-radius: 12px;
    margin: 0 auto;
}

.about-portrait figcaption {
    margin-top: 0.4rem;
    color: var(--muted);
    font-size: 0.8rem;
}

.card {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:has(a):hover {
    box-shadow: 0 12px 32px color-mix(in srgb, var(--accent) 18%, transparent);
    transform: translateY(-2px);
}

.link-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.5rem 0;
}

.link-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem 0.25rem 0.55rem;
    border-radius: 999px;
    background: var(--accent-soft);
    border: 1px solid var(--line);
    color: var(--ink);
    text-decoration: none;
    font-size: 0.8rem;
    font-family: var(--mono-font, monospace);
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.link-pill svg {
    display: block;
    flex-shrink: 0;
}

.link-pill span {
    overflow-wrap: anywhere;
}

.link-pill:hover {
    background: var(--accent);
    color: #ffffff;
}

.cta-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.25rem 0 0.25rem;
}

.cta-buttons--centered {
    justify-content: center;
    margin: 0 0 1.25rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.65rem 1.4rem;
    border-radius: 999px;
    border: 2px solid var(--accent);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
}

.btn-secondary:hover {
    background: var(--accent-soft);
    transform: translateY(-2px);
}

.nav-toggle {
    display: none;
}

@media (max-width: 500px) {
    .nav-toggle {
        display: block;
        width: 100%;
        text-align: left;
        background: none;
        border: 1px solid var(--line);
        border-radius: 8px;
        color: var(--ink);
        cursor: pointer;
        font-size: 0.95rem;
        padding: 0.4rem 0.75rem;
        margin-bottom: 0.5rem;
    }

    .nav-shell:not(.is-open) nav {
        display: none;
    }
}

ul.clean {
    margin: 0;
    padding: 0;
    list-style: none;
}

.index-thumb-link {
    display: block;
    margin: -1rem -1rem 0.75rem;
}

.index-thumb {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    object-position: center;
    display: block;
    border-bottom: 1px solid var(--line);
    background: var(--line);
    border-radius: 12px 12px 0 0;
}

.index-thumb--gif {
    object-fit: none;
    object-position: center;
}

.carousel {
    position: relative;
}

.carousel-track {
    position: relative;
    overflow: hidden;
}

.carousel-slide {
    display: none;
    margin: 0;
}

.carousel-slide.active {
    display: block;
}

.carousel-slide img {
    display: block;
    width: 100%;
    max-height: 520px;
    object-fit: contain;
    border-radius: 8px;
    background: color-mix(in srgb, var(--ink) 8%, transparent);
}

.carousel-slide figcaption {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 0.4rem;
    text-align: center;
}

.carousel-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.75rem;
}

.carousel-btn {
    background: var(--accent-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem 0.75rem;
    line-height: 1.5;
    min-width: 2.75rem;
    min-height: 2.75rem;
}

.carousel-btn:hover {
    background: var(--accent);
    color: #ffffff;
}

.carousel-counter {
    font-size: 0.85rem;
    color: var(--muted);
    min-width: 3rem;
    text-align: center;
}

@keyframes reveal-up {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-slide {
    from {
        opacity: 0;
        transform: translateX(-4px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 780px) {
    .topbar {
        align-items: flex-start;
        justify-content: space-between;
    }

    .theme-toggle {
        flex-shrink: 0;
        margin-left: auto;
    }

    .nav-shell {
        position: sticky;
        top: 0.5rem;
        z-index: 50;
    }

    .nav-shell a {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 2.75rem;
    }

    .row {
        grid-template-columns: 1fr;
    }

    .card-summary {
        display: none;
    }

    .mono {
        font-size: 0.95rem;
    }

    .card-institutions {
        font-size: 0.85rem;
    }
}

@media (max-width: 780px) {
    /* Work page: gallery above the body text on mobile only */
    .work-article {
        display: flex;
        flex-direction: column;
    }

    .work-article > .index-thumb-link { order: 1; }
    .work-article > .media-credit { order: 2; }
    .work-article > .card-header { order: 3; }
    .work-article > .link-pills { order: 4; }
    .work-article > .work-media { order: 5; }
    .work-article > .work-body { order: 6; }
}

@media (min-width: 781px) {
    .layout {
        display: grid;
        grid-template-columns: minmax(150px, 240px) 1fr;
        align-items: start;
    }

    .nav-shell {
        position: sticky;
        top: 1rem;
    }

    .nav-shell ul {
        flex-direction: column;
    }

    .nav-shell a {
        border-radius: 10px;
    }

    .topbar {
        align-items: center;
    }
}
.media-credit {
    margin: 0.25rem 0 0.75rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.collaborator-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.25rem 0;
}

.collaborator-table td {
    padding: 0.4rem 0.6rem 0.4rem 0;
    vertical-align: baseline;
}

.collaborator-name {
    text-align: left;
}

.collaborator-role {
    text-align: right;
    color: var(--muted);
}

.show-list {
    margin: 0.25rem 0;
}

.show-item {
    padding: 0.6rem 0;
    border-top: 1px dashed var(--line);
}

.show-item:first-child {
    border-top: none;
    padding-top: 0;
}

.show-line {
    margin: 0;
    white-space: normal;
}

.card-related a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--line);
    text-underline-offset: 0.15em;
}

.card-related a:hover {
    text-decoration-color: currentColor;
}

.video-embed {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    border-radius: 8px;
    overflow: hidden;
    background: color-mix(in srgb, var(--ink) 8%, transparent);
}

.video-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.work-pager {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0;
}

.work-pager-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    max-width: 48%;
}

.work-pager-link:hover {
    color: var(--accent);
}

.work-pager-next {
    text-align: right;
    margin-left: auto;
}

.lightbox-trigger {
    cursor: zoom-in;
}

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    z-index: 1000;
    padding: calc(1.25rem + env(safe-area-inset-top)) calc(0.75rem + env(safe-area-inset-right)) calc(1.25rem + env(safe-area-inset-bottom)) calc(0.75rem + env(safe-area-inset-left));
    overscroll-behavior: contain;
}

.lightbox[hidden] {
    display: none;
}

.lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    max-height: 76dvh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-caption {
    color: #ffffff;
    font-size: 0.9rem;
    text-align: center;
    max-width: 90%;
    overflow-wrap: anywhere;
    margin: 0;
}

.lightbox-close {
    position: absolute;
    top: calc(0.5rem + env(safe-area-inset-top));
    right: calc(0.75rem + env(safe-area-inset-right));
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    min-width: 2.75rem;
    min-height: 2.75rem;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.5rem 1rem;
    min-width: 2.75rem;
    min-height: 2.75rem;
}

.lightbox-nav:hover {
    color: var(--accent);
}

.lightbox-prev {
    left: 0.5rem;
}

.lightbox-next {
    right: 0.5rem;
}

.nav-shell a:active,
.card:has(a):active,
.link-pill:active,
.carousel-btn:active {
    transform: translateY(1px);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }

    .card,
    .nav-shell li {
        animation: none;
    }
}

/* Stack collaborator rows on mobile so long roles cannot force horizontal scroll.
   Kept at the end of the file so it wins over the base .collaborator-* rules above. */
@media (max-width: 780px) {
    .collaborator-table,
    .collaborator-table tbody,
    .collaborator-table tr,
    .collaborator-table td {
        display: block;
        width: auto;
    }

    .collaborator-table tr {
        padding: 0.45rem 0;
        border-top: 1px dashed var(--line);
    }

    .collaborator-table tr:first-child {
        border-top: none;
        padding-top: 0;
    }

    .collaborator-table td {
        padding: 0;
    }

    .collaborator-name {
        font-weight: 600;
    }

    .collaborator-role {
        white-space: normal;
        overflow-wrap: anywhere;
    }
}
