/* okurairi.net - Light-Academia Archival Retrieval */

:root {
    --library-umber: #7A6B5A;
    --folio-cream: #F5F0E8;
    --manuscript-gold: #B8972E;
    --reading-linen: #FAF7F2;
    --binding-brown: #3D3028;
    --verdigris: #5A8A78;
    --shelf-dust: #A69880;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    background: var(--reading-linen);
    color: var(--library-umber);
    font-family: 'Spectral', serif;
    font-weight: 400;
    font-size: 16.5px;
    line-height: 1.75;
    overflow-x: hidden;
}

::selection { background: var(--manuscript-gold); color: var(--reading-linen); }

/* === Catalog Entry (Hero) === */
.catalog-entry {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 40px 20px;
}

.site-title {
    font-family: 'Spectral', serif;
    font-weight: 500;
    font-size: clamp(2rem, 4.5vw, 3.5rem);
    color: var(--binding-brown);
    letter-spacing: 0.02em;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.site-title.visible { opacity: 1; }

.catalog-ref {
    font-family: 'Fira Mono', monospace;
    font-size: 12px;
    line-height: 1.4;
    color: var(--library-umber);
    letter-spacing: 0.04em;
    min-height: 18px;
}

.cursor {
    animation: blink-cursor 0.8s step-end infinite;
    color: var(--library-umber);
}

@keyframes blink-cursor {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.chevron-divider {
    width: 200px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.chevron-divider.visible { opacity: 1; }

.chevron-svg {
    width: 100%;
    height: auto;
}

/* === Text Pages === */
.text-page {
    position: relative;
    padding: 80px 20px;
    display: flex;
    justify-content: center;
}

.margin-rule {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--shelf-dust);
    opacity: 0.15;
}

.margin-rule.left { left: calc(50% - 330px); }
.margin-rule.right { right: calc(50% - 330px); }

.page-content {
    max-width: 640px;
    width: 100%;
}

.page-heading {
    font-family: 'Spectral', serif;
    font-weight: 500;
    font-size: clamp(2rem, 4.5vw, 3.5rem);
    color: var(--binding-brown);
    margin-bottom: 24px;
    letter-spacing: 0.01em;
}

.page-body {
    font-family: 'Spectral', serif;
    font-weight: 400;
    font-size: 16.5px;
    line-height: 1.75;
    color: var(--library-umber);
    margin-bottom: 20px;
}

.page-body em {
    font-style: italic;
    color: var(--binding-brown);
}

/* === Marginalia === */
.marginalia {
    position: absolute;
}

.marginalia.left-margin { left: calc(50% - 390px); }
.marginalia.right-margin { right: calc(50% - 390px); }

.margin-note {
    font-family: 'Caveat', cursive;
    font-size: 12px;
    color: var(--shelf-dust);
    opacity: 0.2;
    white-space: nowrap;
}

/* === Illustration Plates === */
.plate-page {
    background: var(--folio-cream);
    padding: 80px 20px;
    display: flex;
    justify-content: center;
    /* Shelf grain texture */
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 8px,
            rgba(166, 152, 128, 0.03) 8px,
            rgba(166, 152, 128, 0.03) 9px,
            transparent 9px,
            transparent 18px,
            rgba(166, 152, 128, 0.02) 18px,
            rgba(166, 152, 128, 0.02) 19px
        );
}

.plate-content {
    max-width: 480px;
    width: 100%;
    text-align: center;
}

.plate-illustration {
    margin-bottom: 32px;
}

.botanical-svg {
    width: 100%;
    max-width: 300px;
    height: auto;
}

/* SVG stroke drawing */
.draw-stroke {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 2s ease;
}

.draw-stroke.drawn {
    stroke-dashoffset: 0;
}

.plate-caption {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.caption-line {
    font-family: 'Fira Mono', monospace;
    font-size: 12px;
    line-height: 1.4;
    color: var(--library-umber);
    letter-spacing: 0.04em;
}

.caption-line.latin {
    font-family: 'Spectral', serif;
    font-style: italic;
    font-weight: 300;
    font-size: 14px;
    color: var(--verdigris);
}

/* === Sharp-Angle Dividers === */
.angle-divider {
    display: flex;
    justify-content: center;
    padding: 24px 20px;
}

.angle-svg {
    width: 100%;
    max-width: 640px;
    height: auto;
}

/* === Stagger Animation === */
.stagger-item {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.stagger-item.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Calculate stagger delays via nth-child */
.stagger-group .stagger-item:nth-child(1) { transition-delay: 0s; }
.stagger-group .stagger-item:nth-child(2) { transition-delay: 0.15s; }
.stagger-group .stagger-item:nth-child(3) { transition-delay: 0.3s; }
.stagger-group .stagger-item:nth-child(4) { transition-delay: 0.45s; }
.stagger-group .stagger-item:nth-child(5) { transition-delay: 0.6s; }

/* === Colophon === */
.colophon {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.colophon .page-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.colophon-text {
    font-family: 'Spectral', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--binding-brown);
    letter-spacing: 0.01em;
}

.colophon-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-line {
    font-family: 'Fira Mono', monospace;
    font-size: 12px;
    color: var(--library-umber);
    letter-spacing: 0.06em;
}

/* === Responsive === */
@media (max-width: 768px) {
    .marginalia { display: none; }
    .margin-rule { display: none; }
    .text-page { padding: 60px 24px; }
    .plate-page { padding: 60px 24px; }
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
    .stagger-item {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .draw-stroke {
        stroke-dasharray: none;
        stroke-dashoffset: 0;
        transition: none;
    }
    .site-title { opacity: 1; transition: none; }
    .chevron-divider { opacity: 1; transition: none; }
    .cursor { animation: none; }
}
