/* ==========================================================================
   archetype.works — Victorian Specimen Cabinet
   Color Palette:
     Deep Ground (Burnt Umber Dark): #2A1810
     Panel Background (Aged Parchment): #F5E6D0
     Warm Accent Primary (Hammered Copper): #C47D4E
     Warm Accent Secondary (Terracotta Blush): #D4926B
     Text Primary (Walnut Ink): #3B2A1A
     Text Secondary (Faded Sepia): #7A6352
     Highlight Glow (Amber Candlelight): #E8A84C
     Botanical Line (Oxidized Copper): #6B8F71
     Deep Accent (Claret Wine): #6B2D3E
   Fonts: Playfair Display, Lora, Cormorant Garamond (all serif)
   ========================================================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: #2A1810;
    color: #3B2A1A;
    font-family: 'Lora', serif;
    font-weight: 400;
    line-height: 1.75;
    overflow-x: hidden;
}

/* Stipple texture overlay for the entire page */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background-image:
        radial-gradient(circle, #C47D4E 0.5px, transparent 0.5px);
    background-size: 12px 12px;
    opacity: 0.03;
}

/* --- Orrery Navigation (Left Rail) --- */
#orrery-nav {
    position: fixed;
    left: 0;
    top: 0;
    width: 64px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    z-index: 1000;
    padding: 20px 0;
}

.nav-line {
    position: absolute;
    top: 15%;
    bottom: 15%;
    width: 1px;
    background-color: #5C3D2E;
    z-index: -1;
}

.nav-medallion {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid #5C3D2E;
    background: #2A1810;
    cursor: pointer;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-medallion .medallion-ring {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid #7A6352;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-medallion.active {
    border-color: #E8A84C;
    box-shadow: 0 0 12px rgba(232, 168, 76, 0.4);
}

.nav-medallion.active .medallion-ring {
    background: #E8A84C;
    border-color: #E8A84C;
}

.nav-medallion:hover {
    box-shadow: 0 0 12px rgba(232, 168, 76, 0.4);
    border-color: #C47D4E;
}

.medallion-label {
    position: absolute;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: #F5E6D0;
    background: #3B2A1A;
    border: 1px solid #5C3D2E;
    padding: 4px 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.nav-medallion:hover .medallion-label {
    opacity: 1;
}

/* --- Sections --- */
.section-full {
    min-height: 100vh;
    padding: 40px 40px 40px 84px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Panel System --- */
.panel {
    position: relative;
    background: #F5E6D0;
    overflow: hidden;
    /* Stipple texture on panels */
    background-image:
        radial-gradient(circle, #7A6352 0.5px, transparent 0.5px);
    background-size: 14px 14px;
    background-color: #F5E6D0;
}

/* Orrery background watermark for large panels */
.panel-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    border-radius: 50%;
    border: 1px solid #C47D4E;
    opacity: 0.04;
    pointer-events: none;
}

.panel-primary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 1px solid #C47D4E;
    opacity: 0.04;
    pointer-events: none;
}

.panel-content {
    position: relative;
    z-index: 2;
    padding: 32px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* --- Panel Frame (Ornamental Borders) --- */
.panel-frame {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    pointer-events: none;
}

/* Outer rule */
.panel-primary .panel-frame::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid #5C3D2E;
}

/* Inner rule with gap */
.panel-primary .panel-frame::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 0.5px solid rgba(196, 125, 78, 0.6);
}

/* Secondary panels - simpler border */
.panel-secondary .panel-frame::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid #5C3D2E;
}

/* --- Corner Fleurons --- */
.corner-fleuron {
    position: absolute;
    width: 24px;
    height: 24px;
    color: rgba(196, 125, 78, 0.4);
    z-index: 3;
}

.corner-fleuron.top-left {
    top: -4px;
    left: -4px;
}

.corner-fleuron.top-right {
    top: -4px;
    right: -4px;
    transform: scaleX(-1);
}

.corner-fleuron.bottom-left {
    bottom: -4px;
    left: -4px;
    transform: scaleY(-1);
}

.corner-fleuron.bottom-right {
    bottom: -4px;
    right: -4px;
    transform: scale(-1, -1);
}

/* --- Specimen Labels --- */
.specimen-label {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #7A6352;
    display: inline-block;
    padding: 3px 10px;
    border: 1px solid #C47D4E;
    margin-bottom: 16px;
    clip-path: polygon(6px 0%, calc(100% - 6px) 0%, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0% calc(100% - 6px), 0% 6px);
}

/* --- Typography --- */
.site-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 3.2rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #3B2A1A;
    line-height: 1.1;
    margin-bottom: 16px;
}

.title-dot {
    color: #E8A84C;
}

.title-subtitle {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 1.1rem;
    color: #7A6352;
    line-height: 1.5;
}

.section-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #3B2A1A;
    margin-bottom: 24px;
}

.panel-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 0.06em;
    color: #3B2A1A;
    margin-bottom: 16px;
}

.panel-description {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: 0.95rem;
    color: #7A6352;
    line-height: 1.7;
    margin-top: auto;
}

.intro-text {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 1rem;
    color: #3B2A1A;
    line-height: 1.7;
}

/* --- Cabinet Opens Grid --- */
.cabinet-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 0.8fr;
    grid-template-rows: auto auto;
    gap: 20px;
    width: 100%;
    max-width: 1200px;
}

.title-panel {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
    min-height: 380px;
}

.compass-panel {
    grid-column: 2 / 4;
    grid-row: 1 / 2;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compass-panel .panel-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.intro-panel {
    min-height: 160px;
}

.intro-panel:nth-child(3) {
    grid-column: 1 / 2;
}
.intro-panel:nth-child(4) {
    grid-column: 2 / 3;
}
.intro-panel:nth-child(5) {
    grid-column: 3 / 4;
}

/* --- Compass Rose SVG --- */
.compass-rose-svg {
    width: 260px;
    height: 260px;
}

.compass-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.compass-rose-svg.animated .compass-path {
    animation: drawPath 2.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.compass-center {
    opacity: 0;
}

.compass-rose-svg.animated .compass-center {
    animation: fadeIn 0.5s ease 2.3s forwards;
}

/* --- Botanical Dividers --- */
.botanical-divider {
    padding: 20px 84px 20px 84px;
    overflow: hidden;
}

.divider-svg {
    width: 100%;
    height: 60px;
    display: block;
}

.divider-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
}

.botanical-divider.visible .divider-path {
    animation: drawPath 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* --- Specimen Plates Section --- */
.section-specimens {
    padding: 60px 40px 60px 84px;
}

.specimens-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 0.8fr;
    grid-template-rows: auto auto;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.specimen-large {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
    min-height: 500px;
}

.specimen-medium:nth-child(2) {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    min-height: 340px;
}

.specimen-medium:nth-child(3) {
    grid-column: 3 / 4;
    grid-row: 1 / 2;
    min-height: 340px;
}

.specimen-wide {
    grid-column: 2 / 4;
    grid-row: 2 / 3;
    min-height: 300px;
}

/* --- Botanical Illustrations --- */
.botanical-illustration {
    display: block;
    margin: 20px auto;
    max-width: 100%;
}

.rose-illustration {
    width: 200px;
    height: 200px;
}

.fern-illustration {
    width: 160px;
    height: 220px;
}

.pod-illustration {
    width: 150px;
    height: 200px;
}

.garland-illustration {
    width: 100%;
    height: auto;
    max-height: 100px;
}

.botanical-path {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
}

.panel.visible .botanical-path {
    animation: drawBotanical 3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.botanical-center {
    opacity: 0;
}

.panel.visible .botanical-center {
    animation: fadeIn 0.6s ease 2.8s forwards;
}

/* --- Field Journal Section --- */
.section-journal {
    padding: 80px 40px 80px 84px;
}

.journal-container {
    max-width: 1000px;
    margin: 0 auto;
}

.journal-page {
    background: #F5E6D0;
    background-image:
        radial-gradient(circle, #7A6352 0.5px, transparent 0.5px);
    background-size: 14px 14px;
    padding: 60px;
    border: 1px solid #5C3D2E;
    position: relative;
}

.journal-page::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 0.5px solid rgba(196, 125, 78, 0.6);
    pointer-events: none;
}

.journal-header {
    text-align: center;
    margin-bottom: 48px;
}

.journal-entry {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 32px;
    margin-bottom: 40px;
}

.marginalia {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 4px;
    border-right: 1px solid #C47D4E;
    padding-right: 20px;
}

.margin-note {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 0.8rem;
    font-style: italic;
    color: #7A6352;
    letter-spacing: 0.04em;
    line-height: 1.4;
}

.margin-date {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 0.7rem;
    color: #C47D4E;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.entry-content p {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.75;
    color: #3B2A1A;
    max-width: 42em;
    margin-bottom: 16px;
}

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

.entry-content p:first-child::first-letter {
    font-family: 'Playfair Display', serif;
    font-size: 2.4em;
    float: left;
    line-height: 0.8;
    margin-right: 6px;
    margin-top: 4px;
    color: #6B2D3E;
}

.journal-garland {
    text-align: center;
    padding: 16px 0;
    margin-bottom: 40px;
}

.garland-small {
    width: 300px;
    max-width: 100%;
    height: 30px;
}

.journal-garland.visible .divider-path {
    animation: drawPath 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* --- Archive Index Section --- */
.section-archive {
    padding: 80px 40px 80px 84px;
}

.archive-header {
    text-align: center;
    margin-bottom: 48px;
}

.archive-header .specimen-label {
    color: #D4926B;
    border-color: #D4926B;
}

.archive-header .section-heading {
    color: #F5E6D0;
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.index-card {
    position: relative;
    background: #F5E6D0;
    background-image:
        radial-gradient(circle, #7A6352 0.5px, transparent 0.5px);
    background-size: 14px 14px;
    min-height: 200px;
}

.card-frame {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid #5C3D2E;
    pointer-events: none;
    transition: border-color 0.3s ease;
}

.card-content {
    padding: 20px;
    position: relative;
    z-index: 2;
}

.card-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.04em;
    color: #3B2A1A;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.card-text {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: 0.88rem;
    color: #7A6352;
    line-height: 1.6;
    margin-bottom: 12px;
}

.card-meta {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #C47D4E;
}

.index-card:hover .card-frame {
    border-color: #6B2D3E;
}

.index-card:hover .card-title {
    color: #6B2D3E;
}

/* --- Cabinet Closes Section --- */
.section-closing {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 84px;
}

.closing-content {
    text-align: center;
}

.compass-rose-final {
    width: 180px;
    height: 180px;
    margin-bottom: 40px;
}

.compass-rose-final .compass-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
}

.closing-content.visible .compass-rose-final .compass-path {
    animation: drawPath 2.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.compass-rose-final .compass-center {
    opacity: 0;
}

.closing-content.visible .compass-rose-final .compass-center {
    animation: fadeIn 0.5s ease 2.3s forwards;
}

.closing-content.visible .compass-rose-final {
    animation: amberGlow 4s ease-in-out 2.8s infinite;
}

.closing-text {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 1.5rem;
    color: #F5E6D0;
    margin-bottom: 12px;
    letter-spacing: 0.04em;
}

.closing-domain {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #7A6352;
}

/* --- Animations --- */
@keyframes drawPath {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes drawBotanical {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes amberGlow {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(232, 168, 76, 0.2));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(232, 168, 76, 0.5));
    }
}

/* --- Reveal Animation --- */
[data-reveal] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-reveal].visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered delays for intro panels */
.intro-panel[data-delay="0"] {
    transition-delay: 0s;
}
.intro-panel[data-delay="1"] {
    transition-delay: 0.3s;
}
.intro-panel[data-delay="2"] {
    transition-delay: 0.6s;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    #orrery-nav {
        display: none;
    }

    .section-full,
    .section-specimens,
    .section-journal,
    .section-archive,
    .section-closing {
        padding-left: 24px;
        padding-right: 24px;
    }

    .botanical-divider {
        padding-left: 24px;
        padding-right: 24px;
    }

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

    .title-panel {
        grid-column: 1 / 3;
        grid-row: 1 / 2;
        min-height: auto;
    }

    .compass-panel {
        grid-column: 1 / 3;
        grid-row: 2 / 3;
        min-height: 280px;
    }

    .intro-panel:nth-child(3) {
        grid-column: 1 / 2;
    }
    .intro-panel:nth-child(4) {
        grid-column: 2 / 3;
    }
    .intro-panel:nth-child(5) {
        grid-column: 1 / 3;
    }

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

    .specimen-large {
        grid-column: 1 / 3;
        grid-row: 1 / 2;
        min-height: 400px;
    }

    .specimen-medium:nth-child(2) {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
    }

    .specimen-medium:nth-child(3) {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
    }

    .specimen-wide {
        grid-column: 1 / 3;
        grid-row: 3 / 4;
    }

    .archive-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .journal-entry {
        grid-template-columns: 120px 1fr;
        gap: 20px;
    }
}

@media (max-width: 640px) {
    .site-title {
        font-size: 2.2rem;
    }

    .section-heading {
        font-size: 1.6rem;
    }

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

    .title-panel {
        grid-column: 1 / 2;
        min-height: auto;
    }

    .compass-panel {
        grid-column: 1 / 2;
    }

    .intro-panel:nth-child(3),
    .intro-panel:nth-child(4),
    .intro-panel:nth-child(5) {
        grid-column: 1 / 2;
    }

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

    .specimen-large,
    .specimen-medium:nth-child(2),
    .specimen-medium:nth-child(3),
    .specimen-wide {
        grid-column: 1 / 2;
        grid-row: auto;
    }

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

    .journal-page {
        padding: 30px 20px;
    }

    .journal-entry {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .marginalia {
        border-right: none;
        border-bottom: 1px solid #C47D4E;
        padding-right: 0;
        padding-bottom: 12px;
        flex-direction: row;
        gap: 16px;
    }

    .section-closing {
        padding: 40px 24px;
    }
}
