/* The Shane Bodimer Collection */

:root {
    --paper: #f5f3ee;
    --ink: #1b1a18;
    --muted: #6f6a61;
    --rule: #d9d3c7;
    --stage-hi: #fbfaf7;
    --stage-lo: #e7e3da;

    --serif: 'EB Garamond', Garamond, 'Times New Roman', serif;
    --sans: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;

    --max: 1200px;
    --gutter: clamp(16px, 4vw, 48px);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 1.1875rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-variant-numeric: oldstyle-nums;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    text-decoration-color: var(--muted);
    overflow-wrap: anywhere;
}

a:hover {
    text-decoration-color: var(--ink);
}

/* Small caps label text, used for all the "museum label" bits */
.catalog-no,
.wordmark,
dt,
.stage-hint,
.fig-no,
.card-meta,
.count,
.colophon {
    font-family: var(--sans);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-variant-numeric: lining-nums;
}

/* ---------------------------------------------------------------- Masthead */

.masthead {
    max-width: var(--max);
    margin: 0 auto;
    padding: 20px var(--gutter);
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ink);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--sans);
    font-style: italic;
    font-weight: 500;
    font-size: 17px;
    letter-spacing: 0;
    text-decoration: none;
}

.wordmark {
    color: var(--muted);
    text-decoration: none;
}

.wordmark:hover {
    color: var(--ink);
}

/* -------------------------------------------------------------------- Hero */

.hero {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 var(--gutter);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: clamp(32px, 5vw, 72px);
    align-items: end;
}

.stage {
    position: relative;
    height: min(76vh, 760px);
    min-height: 420px;
    background: radial-gradient(
        ellipse 70% 60% at 50% 42%,
        var(--stage-hi) 0%,
        var(--stage-lo) 100%
    );
}

.stage model-viewer {
    width: 100%;
    height: 100%;
    background: transparent;
    --poster-color: transparent;
    --progress-bar-color: var(--ink);
    --progress-bar-height: 1px;
}

.stage model-viewer:focus-visible {
    outline: 1px solid var(--ink);
    outline-offset: -1px;
}

.stage-empty .stage-hint {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
}

.card-image {
    position: relative;
}

.fig-placeholder {
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(
        ellipse 70% 60% at 50% 42%,
        var(--stage-hi) 0%,
        var(--stage-lo) 100%
    );
    font-family: var(--sans);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.card-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--sans);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.stage-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 5vw, 64px);
}

.stage-photo img {
    max-height: 100%;
    width: auto;
    box-shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.35);
}

.stage-hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 16px;
    margin: 0;
    text-align: center;
    color: var(--muted);
    pointer-events: none;
    transition: opacity 0.6s;
}

.stage-hint.hidden {
    opacity: 0;
}

.hint-touch {
    display: none;
}

@media (pointer: coarse) {
    .hint-fine {
        display: none;
    }
    .hint-touch {
        display: inline;
    }
}

.ar-button {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 9px 16px;
    border: 1px solid var(--ink);
    border-radius: 999px;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    cursor: pointer;
}

/* ------------------------------------------------------------------- Label */

.label {
    padding-bottom: 4px;
}

.catalog-no {
    margin: 0 0 14px;
    color: var(--muted);
}

.label h1 {
    margin: 0;
    font-size: clamp(2.5rem, 4.6vw, 3.6rem);
    font-style: italic;
    font-weight: 500;
    line-height: 1.02;
    letter-spacing: -0.01em;
}

.common-name {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 1.25rem;
}

.label dl {
    margin: 32px 0 0;
    border-top: 1px solid var(--ink);
}

.label dl > div {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 12px;
    padding: 11px 0 10px;
    border-bottom: 1px solid var(--rule);
}

.label dt {
    color: var(--muted);
    padding-top: 0.45em;
}

.label dd {
    margin: 0;
    font-size: 1.0625rem;
    line-height: 1.4;
}

/* ---------------------------------------------------------------- Chapters */

.chapter {
    max-width: var(--max);
    margin: clamp(72px, 10vw, 128px) auto 0;
    padding: 0 var(--gutter);
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    column-gap: clamp(32px, 6vw, 96px);
    align-items: start;
}

.chapter h2 {
    grid-column: 1 / -1;
    margin: 0 0 28px;
    padding-top: 20px;
    border-top: 1px solid var(--ink);
    font-size: clamp(1.625rem, 2.6vw, 2.125rem);
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.005em;
}

.prose p {
    margin: 0 0 1.1em;
    max-width: 34em;
}

.prose p:last-child {
    margin-bottom: 0;
}

.figures {
    display: grid;
    gap: 40px;
}

.chapter.flip {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
}

.chapter.flip .prose {
    grid-column: 2;
    grid-row: 2;
}

.chapter.flip .figures {
    grid-column: 1;
    grid-row: 2;
}

figure {
    margin: 0;
}

figure img {
    width: 100%;
    background: var(--stage-lo);
}

figcaption {
    margin-top: 12px;
    font-family: var(--sans);
    font-size: 0.75rem;
    line-height: 1.55;
    color: var(--muted);
}

.fig-caption,
.fig-credit {
    display: block;
}

.fig-caption {
    color: var(--ink);
}

.fig-no {
    margin-right: 6px;
    font-size: 0.625rem;
    font-weight: 600;
}

/* ------------------------------------------------------------------ Footer */

.colophon {
    max-width: var(--max);
    margin: clamp(96px, 12vw, 160px) auto 0;
    padding: 24px var(--gutter) calc(48px + env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
    border-top: 1px solid var(--rule);
}

.colophon a {
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
}

.colophon a:hover {
    text-decoration: underline;
}

/* ------------------------------------------------------------- Index page */

.index-intro {
    max-width: var(--max);
    margin: clamp(48px, 9vw, 112px) auto clamp(40px, 6vw, 72px);
    padding: 0 var(--gutter);
}

.index-intro h1 {
    margin: 0;
    font-size: clamp(2.75rem, 7vw, 5rem);
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.015em;
}

.count {
    margin: 16px 0 0;
    color: var(--muted);
}

.grid {
    list-style: none;
    max-width: var(--max);
    margin: 0 auto clamp(96px, 12vw, 160px);
    padding: 0 var(--gutter) env(safe-area-inset-bottom);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 56px clamp(24px, 3vw, 40px);
}

.card {
    display: block;
    text-decoration: none;
}

.card-image {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: radial-gradient(
        ellipse 70% 60% at 50% 42%,
        var(--stage-hi) 0%,
        var(--stage-lo) 100%
    );
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.card:hover .card-image img {
    transform: scale(1.03);
}

.card-text {
    display: flex;
    flex-direction: column;
    padding-top: 16px;
    border-top: 1px solid var(--ink);
    margin-top: 16px;
}

.card .catalog-no {
    margin: 0 0 6px;
}

.card-title {
    font-size: 1.625rem;
    font-style: italic;
    font-weight: 500;
    line-height: 1.1;
}

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

.card-meta {
    margin-top: 10px;
    color: var(--muted);
}

/* ------------------------------------------------------------------ Mobile */

@media (max-width: 860px) {
    body {
        font-size: 1.125rem;
    }

    .masthead {
        padding-top: 14px;
        padding-bottom: 14px;
    }

    .hero {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0;
    }

    .stage {
        height: 66svh;
        min-height: 360px;
        max-height: 640px;
    }

    .label {
        padding: 28px var(--gutter) 0;
    }

    .label dl {
        margin-top: 24px;
    }

    .chapter,
    .chapter.flip {
        grid-template-columns: 1fr;
        margin-top: 64px;
    }

    .chapter.flip .prose,
    .chapter.flip .figures {
        grid-column: auto;
        grid-row: auto;
    }

    .chapter h2 {
        margin-bottom: 20px;
    }

    .figures {
        margin-top: 32px;
        gap: 32px;
    }

    .colophon {
        margin-top: 80px;
        flex-direction: column;
        gap: 10px;
    }

    .grid {
        gap: 48px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}
