:root {
    --walnut: #3b2416;
    --walnut-dark: #21140d;
    --mahogany: #5a2f24;
    --parchment: #eadbb9;
    --paper: #f4ead2;
    --brass: #b08d57;
    --brass-light: #dbc287;
    --ink: #221c18;
    --green: #344b3a;
    --burgundy: #6a3538;
    --overlay: rgba(18, 14, 11, 0.74);
    --shadow: rgba(12, 7, 4, 0.42);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--walnut-dark);
}

body {
    margin: 0;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    background:
        radial-gradient(circle at 50% 0, rgba(176, 141, 87, 0.15), transparent 34rem),
        radial-gradient(circle at 10% 40%, rgba(50, 32, 22, 0.55), transparent 30rem),
        linear-gradient(135deg, #120e0c, #2c1b14 52%, #0d0b0a);
}

body.home-page {
    min-height: 100svh;
    overflow: hidden;
}

button,
a {
    font: inherit;
}

a {
    color: inherit;
}

img {
    max-width: 100%;
}

.page-shell {
    min-height: 100svh;
    overflow: hidden;
    transition: filter 220ms ease, transform 220ms ease;
}

.page-shell.is-muted {
    filter: blur(5px) brightness(0.54) saturate(0.82);
    transform: scale(0.992);
    pointer-events: none;
}

.site-header {
    position: absolute;
    top: clamp(0.45rem, 1.4svh, 1.05rem);
    left: 50%;
    z-index: 3;
    width: min(92vw, 58rem);
    transform: translateX(-50%);
    color: var(--paper);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.kicker,
.descriptor,
.classification,
.article-label,
.caption {
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.kicker {
    margin: 0 0 0.12rem;
    color: var(--brass-light);
    font-size: clamp(0.68rem, 1.2vw, 0.82rem);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.site-header h1 {
    margin-bottom: 0.08rem;
    font-size: clamp(1.75rem, 3.5vw, 3.35rem);
    line-height: 0.92;
    font-weight: 500;
    text-shadow: 0 0.22rem 0.7rem rgba(0, 0, 0, 0.55);
}

.subtitle {
    margin-bottom: 0.2rem;
    color: #f6edce;
    font-size: clamp(0.9rem, 2vw, 1.32rem);
}

.descriptor {
    display: none;
    margin-bottom: 0;
    color: rgba(244, 234, 210, 0.76);
    font-size: clamp(0.58rem, 1.1vw, 0.75rem);
}

.home-scene {
    position: relative;
    min-height: 100svh;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 18%, rgba(255,255,255,0.08), transparent 33%),
        linear-gradient(180deg, rgba(18,14,11,0.1), rgba(18,14,11,0.42)),
        url("../assets/generated/bookshelf-room-generated-bobbles-iteration11.webp") center / cover no-repeat;
}

.home-scene::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 54%, transparent 42%, rgba(0,0,0,0.32) 100%),
        linear-gradient(180deg, rgba(0,0,0,0.18), transparent 15%, transparent 72%, rgba(0,0,0,0.32));
}

.bookshelf {
    position: absolute;
    inset: 0;
    z-index: 2;
}

.shelf {
    position: absolute;
    overflow: hidden;
    border: 0;
    border-radius: 6px;
    color: var(--paper);
    cursor: pointer;
    background: transparent;
    box-shadow: none;
    isolation: isolate;
}

.shelf::before {
    content: "";
    position: absolute;
    inset: 5% 3% 18%;
    border-radius: 38%;
    background:
        radial-gradient(ellipse at 50% 65%, rgba(255,255,255,0.34), transparent 65%),
        linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    filter: blur(3px);
    opacity: 0;
    transition: opacity 180ms ease;
}

.shelf:hover::before,
.shelf:focus-visible::before {
    opacity: 1;
}

.shelf-music {
    left: 13%;
    right: 10%;
    top: 14%;
    height: 25%;
}

.shelf-presidents {
    left: 13%;
    right: 10%;
    top: 37.4%;
    height: 24.8%;
}

.shelf-randoms {
    left: 13%;
    right: 10%;
    top: 61%;
    height: 27%;
}

.shelf:focus-visible,
.icon-button:focus-visible,
.article-nav a:focus-visible,
.home-link:focus-visible,
.thumbnail:focus-visible {
    outline: 3px solid var(--brass-light);
    outline-offset: 3px;
}

.specimen-row {
    position: absolute;
    inset: 15% 8% 15%;
    display: flex;
    align-items: flex-end;
    justify-content: space-evenly;
    gap: clamp(0.24rem, 1vw, 0.92rem);
    pointer-events: none;
    z-index: 1;
    transform: perspective(54rem) rotateY(-2.5deg) rotateX(1deg);
    transform-origin: 50% 100%;
    mix-blend-mode: normal;
}

.specimen-row::after {
    content: "";
    position: absolute;
    left: 4%;
    right: 2%;
    bottom: 0.05rem;
    height: 0.72rem;
    z-index: -1;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.58), transparent 68%);
    filter: blur(3px);
    opacity: 0.72;
}

.shelf-bobble {
    position: relative;
    z-index: 1;
    flex: 0 1 auto;
    width: auto;
    max-width: clamp(2.35rem, 4.25vw, 3.65rem);
    height: 68%;
    object-fit: contain;
    filter:
        sepia(0.16)
        saturate(0.92)
        brightness(0.74)
        contrast(1.08)
        drop-shadow(0.12rem 0.5rem 0.13rem rgba(0,0,0,0.58))
        drop-shadow(0 0 0.32rem rgba(253,205,129,0.06));
    opacity: 0.94;
    transform-origin: 50% 90%;
    transition: transform 180ms ease;
}

.shelf-bobble.is-wide {
    max-width: clamp(3.2rem, 6.2vw, 5.35rem);
}

.shelf-bobble:nth-child(odd) {
    transform: rotateY(-5deg);
}

.shelf-bobble:nth-child(even) {
    transform: rotateY(3deg);
}

.shelf:hover .shelf-bobble,
.shelf:focus-visible .shelf-bobble {
    transform: translateY(-3px) rotate(-1deg) rotateY(-2deg);
}

.more-marker {
    align-self: center;
    padding: 0.18rem 0.38rem;
    border: 1px solid rgba(219, 194, 135, 0.55);
    border-radius: 999px;
    background: rgba(34, 28, 24, 0.54);
    color: var(--paper);
    font-size: clamp(0.56rem, 1vw, 0.72rem);
    filter: brightness(0.82);
}

.plaque {
    position: absolute;
    left: 50%;
    bottom: 0.18rem;
    transform: translateX(-50%);
    z-index: 2;
    min-width: 9rem;
    padding: 0.26rem 1.1rem;
    border: 1px solid #775b30;
    border-radius: 3px;
    color: #21140d;
    background:
        linear-gradient(120deg, rgba(118,91,50,0.95), rgba(217,189,118,0.98) 38%, rgba(152,113,61,0.96) 64%, rgba(228,204,138,0.98));
    box-shadow: inset 0 1px rgba(255,255,255,0.45), 0 0.2rem 0.45rem rgba(0,0,0,0.36);
    font-size: clamp(0.72rem, 1.35vw, 0.98rem);
    font-variant: small-caps;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.shelf:hover .plaque,
.shelf:focus-visible .plaque,
.book-link:hover,
.book-link:focus-visible {
    box-shadow:
        inset 0 1px rgba(255,255,255,0.58),
        0 0 0.65rem rgba(255,255,255,0.82),
        0 0 1.7rem rgba(255,255,255,0.42);
}

.article-nav {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}

.home-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.55rem clamp(0.78rem, 2vw, 1.2rem);
    border: 1px solid rgba(219, 194, 135, 0.68);
    border-radius: 4px;
    color: var(--paper);
    background: rgba(52, 75, 58, 0.5);
    text-decoration: none;
    text-align: center;
    box-shadow: inset 0 1px rgba(255,255,255,0.08), 0 0.35rem 0.75rem rgba(0,0,0,0.25);
}

.book-link {
    position: absolute;
    top: 66.8%;
    display: block;
    width: 5.2%;
    height: 25.2%;
    min-height: 0;
    border-color: transparent;
    border-radius: 4px;
    background: transparent;
    pointer-events: auto;
    transform: rotate(-1deg);
    box-shadow: none;
}

.book-stalking {
    left: 6.7%;
}

.book-care {
    left: 11.4%;
    width: 4.6%;
    transform: rotate(0.5deg);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: grid;
    place-items: center;
    padding: clamp(0.75rem, 3vw, 2rem);
    background: var(--overlay);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal {
    position: relative;
    width: min(1180px, 97vw);
    max-height: min(840px, 94svh);
    padding: clamp(0.8rem, 2vw, 1.4rem);
    border: 1px solid rgba(219, 194, 135, 0.74);
    border-radius: 8px;
    color: var(--ink);
    background:
        linear-gradient(rgba(244, 234, 210, 0.9), rgba(234, 219, 185, 0.92)),
        repeating-linear-gradient(90deg, transparent 0 0.35rem, rgba(59,36,22,0.035) 0.35rem 0.7rem);
    box-shadow: 0 1.5rem 3.8rem rgba(0, 0, 0, 0.58);
}

.modal-stage {
    display: grid;
    grid-template-columns: 3.2rem minmax(0, 1fr) 3.2rem;
    align-items: center;
    gap: clamp(0.45rem, 1.5vw, 1rem);
}

.specimen-card {
    margin: 0;
    display: grid;
    grid-template-columns: minmax(22rem, 1.22fr) minmax(15rem, 0.78fr);
    gap: clamp(1rem, 3vw, 2rem);
    align-items: center;
}

.specimen-image-case {
    display: grid;
    place-items: center;
    min-height: min(65svh, 40rem);
    border-radius: 7px;
    background:
        radial-gradient(ellipse at 50% 78%, rgba(176,141,87,0.33), transparent 40%),
        linear-gradient(180deg, rgba(255,255,255,0.16), rgba(52,75,58,0.18));
    box-shadow: inset 0 0 0 1px rgba(90,47,36,0.2);
}

.specimen-image-case img {
    max-height: min(62svh, 38rem);
    width: 100%;
    object-fit: contain;
    opacity: 1;
    filter: drop-shadow(0 0.75rem 0.42rem rgba(0,0,0,0.28));
    transition: opacity 120ms ease;
}

.specimen-image-case img.is-loading {
    opacity: 0;
}

.specimen-card h2 {
    margin-bottom: 0.35rem;
    font-size: clamp(1.8rem, 4vw, 3.4rem);
    line-height: 0.98;
    font-weight: 500;
}

.slide-count,
.classification {
    margin-bottom: 0.55rem;
    color: var(--burgundy);
    font-size: 0.78rem;
}

.slide-count {
    letter-spacing: 0.04em;
}

.specimen-card p:not(.slide-count):not(.classification) {
    font-size: clamp(1rem, 1.8vw, 1.18rem);
    line-height: 1.58;
}

.icon-button {
    min-width: 44px;
    min-height: 44px;
    border: 1px solid rgba(90,47,36,0.3);
    border-radius: 999px;
    color: var(--paper);
    background: var(--mahogany);
    cursor: pointer;
}

.carousel-button {
    font-size: 2.2rem;
    line-height: 1;
}

.close-button {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 1;
    font-size: 1.55rem;
}

.thumbnail-strip {
    display: flex;
    justify-content: center;
    gap: 0.42rem;
    margin-top: 0.8rem;
    overflow-x: auto;
}

.thumbnail {
    flex: 0 0 auto;
    width: 3.1rem;
    height: 3.1rem;
    border: 1px solid rgba(90,47,36,0.26);
    border-radius: 4px;
    background: rgba(255,255,255,0.32);
    cursor: pointer;
}

.thumbnail[aria-current="true"] {
    border-color: var(--burgundy);
    box-shadow: 0 0 0 2px rgba(106,53,56,0.22);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.article-page {
    min-height: 100svh;
    background:
        linear-gradient(rgba(244,234,210,0.92), rgba(234,219,185,0.94)),
        repeating-linear-gradient(90deg, #eadbb9 0 0.45rem, #e3d2aa 0.45rem 0.9rem);
}

.article-header,
.article-main,
.article-footer {
    width: min(1120px, calc(100% - 2rem));
    margin-inline: auto;
}

.article-header {
    padding: 1rem 0 0.75rem;
}

.home-link {
    color: var(--paper);
    width: fit-content;
}

.article-hero {
    display: grid;
    grid-template-columns: minmax(18rem, 0.9fr) minmax(20rem, 1.1fr);
    gap: clamp(1rem, 3vw, 2.4rem);
    align-items: center;
    padding: clamp(1rem, 3vw, 2rem) 0;
}

.article-label {
    color: var(--burgundy);
    font-size: 0.78rem;
}

.article-hero h1 {
    margin-bottom: 0.75rem;
    font-size: clamp(2.25rem, 5vw, 5rem);
    line-height: 0.95;
    font-weight: 500;
}

.article-hero p {
    font-size: clamp(1.05rem, 1.8vw, 1.28rem);
    line-height: 1.55;
}

.article-hero img,
.article-section img {
    width: 100%;
    display: block;
    border: 1px solid rgba(90,47,36,0.22);
    border-radius: 7px;
    box-shadow: 0 0.8rem 1.8rem rgba(59,36,22,0.23);
}

.article-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(17rem, 0.82fr);
    gap: clamp(1rem, 3vw, 2rem);
    align-items: start;
    padding: clamp(1.6rem, 4vw, 3rem) 0;
    border-top: 1px solid rgba(90,47,36,0.22);
}

.article-section:nth-child(even) figure {
    order: -1;
}

.article-section h2 {
    margin-bottom: 0.75rem;
    color: var(--green);
    font-size: clamp(1.55rem, 3vw, 2.4rem);
    line-height: 1;
}

.article-section p,
.article-section li,
.curator-note {
    font-size: clamp(1rem, 1.3vw, 1.12rem);
    line-height: 1.72;
}

.article-section ul,
.article-section ol {
    padding-left: 1.25rem;
}

.article-section li + li {
    margin-top: 0.4rem;
}

.article-section figure {
    margin: 0;
}

.caption {
    margin-top: 0.55rem;
    color: rgba(34,28,24,0.7);
    font-size: 0.72rem;
    line-height: 1.5;
}

.curator-note {
    margin: 1rem 0 2rem;
    padding: 1rem 1.2rem;
    border-left: 0.28rem solid var(--brass);
    background: rgba(255,255,255,0.24);
}

.article-footer {
    padding: 1rem 0 2rem;
    color: rgba(34,28,24,0.72);
}

.article-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-bottom: 1rem;
}

@media (max-width: 760px) {
    body.home-page {
        overflow: hidden;
    }

    .page-shell {
        min-height: 100svh;
    }

    .descriptor,
    .nav-long {
        display: none;
    }

    .nav-short {
        display: inline;
    }

    .site-header {
        top: 0.55rem;
        width: min(94vw, 29rem);
    }

    .site-header h1 {
        font-size: clamp(1.35rem, 8vw, 2.05rem);
        line-height: 0.95;
    }

    .subtitle {
        font-size: clamp(0.78rem, 3.8vw, 1rem);
    }

    .kicker {
        font-size: 0.58rem;
    }

    .home-scene {
        background-position: left center;
    }

    .shelf-music,
    .shelf-presidents,
    .shelf-randoms {
        left: 0;
        right: 0;
    }

    .shelf-music {
        top: 15.2%;
        height: 23.2%;
    }

    .shelf-presidents {
        top: 38.8%;
        height: 23.2%;
    }

    .shelf-randoms {
        top: 62.2%;
        height: 25.4%;
    }

    .specimen-row {
        inset: 18% 5% 20%;
        gap: clamp(0.24rem, 1.8vw, 0.62rem);
        transform: perspective(32rem) rotateY(-3deg) rotateX(1deg);
    }

    .shelf-bobble {
        max-width: clamp(2rem, 9vw, 2.9rem);
        height: 64%;
    }

    .shelf-bobble.is-wide {
        max-width: clamp(2.65rem, 14vw, 4.2rem);
    }

    .plaque {
        min-width: 7.1rem;
        bottom: 0.25rem;
    }

    .book-link {
        top: 66.8%;
        width: 6.6%;
        height: 24.8%;
        padding: 0.18rem 0.28rem;
        font-size: clamp(0.54rem, 3.2vw, 0.74rem);
    }

    .book-stalking {
        left: 31%;
    }

    .book-care {
        left: 40.5%;
        width: 8%;
    }

    .shelf-randoms .plaque {
        left: 72%;
    }

    .modal-stage,
    .specimen-card,
    .article-hero,
    .article-section {
        grid-template-columns: 1fr;
    }

    .modal-stage {
        grid-template-columns: 1fr 1fr;
    }

    .specimen-card {
        grid-column: 1 / -1;
        order: -1;
    }

    .specimen-image-case {
        min-height: 50svh;
    }

    .specimen-image-case img {
        max-height: 49svh;
    }

    .carousel-button {
        width: 100%;
    }

    .article-section:nth-child(even) figure {
        order: 0;
    }
}

@media (max-height: 720px) and (min-width: 761px) {
    .descriptor {
        display: none;
    }

    .page-shell {
        grid-template-rows: minmax(5.2rem, 15svh) minmax(0, 1fr) minmax(3.7rem, 10svh);
    }

    .site-header h1 {
        font-size: clamp(1.7rem, 4vw, 3.2rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
