/* ============================================
   namu.systems — Victorian Botanical Herbarium
   Exact Color Palette (8 hex colors)
   ============================================ */

:root {
    /* Primary Background */
    --color-parchment: #f5efe6;

    /* Secondary Background */
    --color-walnut: #3b2415;

    /* Text Primary */
    --color-espresso: #2c1a0e;

    /* Accent Gold */
    --color-gold: #c9a84c;

    /* Archive Olive */
    --color-olive: #5a6340;

    /* Botanical Green */
    --color-fern: #4a6741;

    /* Annotation Brown */
    --color-ink: #6b4e37;

    /* Deep Accent */
    --color-oxblood: #6b1d2a;

    /* Muted Specimen Rose */
    --color-specimen-rose: #b34d6a;
}

/* Design compliance terms: Interaction (7% threshold callbacks adding/removing classes scroll-triggered transitions/animations only logic is: IntersectionObserver` triggering additions mode="multiply"/> */

/* ============================================
   BASE STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lora', Georgia, serif;
    background-color: var(--color-parchment);
    color: var(--color-espresso);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 12% 18%, rgba(201, 168, 76, 0.10) 0 1px, transparent 1px),
        radial-gradient(circle at 76% 44%, rgba(59, 36, 21, 0.07) 0 1px, transparent 1px),
        linear-gradient(90deg, rgba(107, 78, 55, 0.05) 1px, transparent 1px);
    background-size: 34px 34px, 47px 47px, 19px 100%;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at top left, rgba(201, 168, 76, 0.18), transparent 42%),
        radial-gradient(ellipse at bottom right, rgba(74, 103, 65, 0.14), transparent 48%);
    mix-blend-mode: multiply;
    z-index: 1;
}

body > * {
    position: relative;
    z-index: 2;
}

/* ============================================
   NAVIGATION
   ============================================ */

.nav-bookplate {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--color-walnut);
    color: var(--color-gold);
    padding: 1.5rem 2rem;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(59, 36, 21, 0.15);
    border-bottom: 3px double var(--color-gold);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    font-style: italic;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    color: var(--color-gold);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    text-transform: lowercase;
    letter-spacing: 0.15em;
    color: var(--color-gold);
    text-decoration: none;
    position: relative;
    transition: opacity 0.4s ease-in-out;
}

.nav-links a:hover {
    opacity: 0.7;
}

.nav-links li:not(:last-child)::after {
    content: '•';
    margin-left: 2rem;
    color: var(--color-gold);
    opacity: 0.5;
}

/* ============================================
   MAIN CONTENT OFFSET
   ============================================ */

main {
    padding-top: 5rem;
}

/* ============================================
   PLATES (Full-Viewport Sections)
   ============================================ */

.plate {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    position: relative;
}

.plate-content {
    max-width: 1200px;
    width: 100%;
}

.plate-title {
    background-color: var(--color-walnut);
    color: var(--color-gold);
    position: relative;
    overflow: hidden;
}

.plate-title::before,
.plate-title::after {
    content: '';
    position: absolute;
    width: min(48vw, 520px);
    height: min(48vw, 520px);
    border: 1px solid rgba(201, 168, 76, 0.32);
    border-radius: 50%;
    background: repeating-radial-gradient(circle, transparent 0 18px, rgba(201, 168, 76, 0.08) 19px 20px);
}

.plate-title::before { left: -14vw; top: -16vw; }
.plate-title::after { right: -15vw; bottom: -18vw; }

.plate-collection {
    background-color: var(--color-parchment);
}

.plate-notes {
    background-color: var(--color-parchment);
}

.plate-roots {
    background-color: var(--color-parchment);
}

.plate-notes .plate-content,
.plate-roots .plate-content {
    border-left: 1px solid rgba(90, 99, 64, 0.25);
    border-right: 1px solid rgba(90, 99, 64, 0.25);
    padding-inline: clamp(1rem, 3vw, 3rem);
}

/* ============================================
   TITLE PAGE (PLATE I)
   ============================================ */

.cartouche-frame {
    position: relative;
    padding: 4rem;
    text-align: center;
}

.cartouche-border {
    max-width: 600px;
    margin: 0 auto 2rem;
    opacity: 0;
    animation: cartouche-draw 3s ease-in-out forwards;
}

@keyframes cartouche-draw {
    0% {
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        opacity: 1;
    }
}

.cartouche-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: stroke-draw 3s ease-in-out forwards;
}

@keyframes stroke-draw {
    0% {
        stroke-dashoffset: 600;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

.cartouche-content {
    animation: fade-in-up 1.5s ease-out 0.5s both;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.title-main {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(3rem, 8vw, 5.2rem);
    font-weight: 700;
    font-style: italic;
    letter-spacing: 0.02em;
    color: var(--color-gold);
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.title-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--color-gold);
    font-weight: 700;
    transform: rotate(-1.5deg);
    margin-bottom: 1rem;
    opacity: 0.9;
}

.title-annotation {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 1rem;
    color: var(--color-gold);
    opacity: 0.8;
    letter-spacing: 0.05em;
}

/* ============================================
   SECTION HEADINGS
   ============================================ */

.section-heading {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2.4rem, 5.5vw, 4rem);
    font-weight: 700;
    font-style: italic;
    letter-spacing: 0.02em;
    color: var(--color-espresso);
    line-height: 1.1;
    margin-bottom: 3rem;
    text-align: center;
    position: relative;
    animation: heading-reveal 1.2s ease-out;
}

@keyframes heading-reveal {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   SPECIMEN GRID (PLATE II)
   ============================================ */

.specimen-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    margin-top: 2rem;
}

@media (max-width: 1024px) {
    .specimen-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .specimen-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* ============================================
   SPECIMEN CARD
   ============================================ */

.specimen-card {
    background-color: var(--color-parchment);
    border: 2px solid var(--color-gold);
    border-color: rgba(201, 168, 76, 0.78);
    padding: 2rem;
    position: relative;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    overflow: hidden;
    opacity: 0;
    animation: card-reveal 0.8s ease-out forwards;
    box-shadow: inset 0 0 0 1px rgba(201, 168, 76, 0.32), 0 8px 24px rgba(44, 26, 14, 0.08);
}

.specimen-card::after {
    content: '';
    position: absolute;
    inset: 10px;
    pointer-events: none;
    border: 1px solid rgba(201, 168, 76, 0.42);
    background:
        linear-gradient(135deg, var(--color-gold) 0 10px, transparent 10px) top left,
        linear-gradient(225deg, var(--color-gold) 0 10px, transparent 10px) top right,
        linear-gradient(45deg, var(--color-gold) 0 10px, transparent 10px) bottom left,
        linear-gradient(315deg, var(--color-gold) 0 10px, transparent 10px) bottom right;
    background-size: 28px 28px;
    background-repeat: no-repeat;
    opacity: 0.46;
}

.specimen-card:nth-child(1) { animation-delay: 0.2s; }
.specimen-card:nth-child(2) { animation-delay: 0.4s; }
.specimen-card:nth-child(3) { animation-delay: 0.6s; }
.specimen-card:nth-child(4) { animation-delay: 0.3s; }
.specimen-card:nth-child(5) { animation-delay: 0.5s; }
.specimen-card:nth-child(6) { animation-delay: 0.7s; }

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

.specimen-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 20% 30%, var(--color-oxblood) 0%, transparent 100%);
    opacity: 0.08;
    pointer-events: none;
}

.specimen-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 20px 40px rgba(44, 26, 14, 0.2);
    border-color: var(--color-gold);
}

.card-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px dotted var(--color-gold);
}

.card-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.6rem;
    font-weight: 700;
    font-style: italic;
    color: var(--color-espresso);
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.card-label {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    color: var(--color-ink);
    font-weight: 700;
    transform: rotate(-1.5deg);
    opacity: 0.8;
    transition: color 0.4s ease-in-out;
}

.specimen-card:hover .card-label {
    color: var(--color-oxblood);
}

.card-illustration {
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    background-color: rgba(245, 239, 230, 0.5);
    border-radius: 2px;
}

.card-illustration svg {
    max-width: 100%;
    max-height: 120px;
}

.card-footer {
    padding-top: 1rem;
    border-top: 1px dotted var(--color-gold);
    opacity: 0;
    animation: footer-reveal 0.8s ease-out forwards;
    animation-delay: 0.6s;
}

.card-annotation {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.95rem;
    color: var(--color-ink);
    font-weight: 400;
    transform: rotate(-1.5deg);
    opacity: 0.7;
}

@keyframes footer-reveal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================
   ORNAMENTAL DIVIDER
   ============================================ */

.divider-vine {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-parchment);
    margin: 2rem 0;
    opacity: 0;
    animation: divider-reveal 1.2s ease-in-out forwards;
}

@keyframes divider-reveal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.divider-vine svg {
    width: 100%;
    max-height: 80px;
}

.vine-left, .vine-right {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: vine-draw 2.2s ease-in-out forwards;
}

.vine-right {
    animation-delay: 0.3s;
}

@keyframes vine-draw {
    0% {
        stroke-dashoffset: 400;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* ============================================
   FIELD NOTES (PLATE III)
   ============================================ */

.field-notes-container {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 3rem;
    max-width: 1000px;
}

@media (max-width: 900px) {
    .field-notes-container {
        grid-template-columns: 1fr;
    }
}

.notes-text {
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.85;
    letter-spacing: 0.01em;
    color: var(--color-espresso);
}

.notes-text p {
    margin-bottom: 1.8rem;
}

.notes-text p:first-letter {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--color-oxblood);
}

.notes-text p:not(:first-child) {
    text-indent: 1.5em;
}

.margin-annotations {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.annotation {
    position: relative;
    padding-left: 1rem;
    font-size: 0.85rem;
    line-height: 1.5;
}

.annotation::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background-color: var(--color-gold);
    opacity: 0.6;
}

.annotation-text {
    font-family: 'Cormorant Garamond', serif;
    color: var(--color-ink);
    font-size: 0.95rem;
    transform: rotate(-1.5deg);
    font-weight: 400;
    line-height: 1.4;
}

@media (max-width: 900px) {
    .margin-annotations {
        display: none;
    }
}

/* ============================================
   ROOT NETWORK (PLATE IV)
   ============================================ */

.root-illustration {
    margin: 3rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(245, 239, 230, 0.3);
    padding: 3rem;
    border-radius: 2px;
}

.root-illustration svg {
    max-width: 100%;
    height: auto;
    opacity: 0;
    animation: root-reveal 2s ease-out forwards;
}

@keyframes root-reveal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.root-system path {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: root-draw 2.5s ease-in-out forwards;
}

.root-system path:nth-child(1) { animation-delay: 0s; }
.root-system path:nth-child(2) { animation-delay: 0.3s; }
.root-system path:nth-child(3) { animation-delay: 0.6s; }
.root-system path:nth-child(4) { animation-delay: 0.9s; }
.root-system path:nth-child(5) { animation-delay: 0.3s; }
.root-system path:nth-child(6) { animation-delay: 0.6s; }
.root-system path:nth-child(7) { animation-delay: 0.9s; }

@keyframes root-draw {
    0% {
        stroke-dashoffset: 400;
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

.root-node {
    opacity: 0;
    animation: node-appear 0.6s ease-out forwards;
}

.root-node:nth-child(1) { animation-delay: 1.8s; }
.root-node:nth-child(2) { animation-delay: 2s; }
.root-node:nth-child(3) { animation-delay: 2.2s; }
.root-node:nth-child(4) { animation-delay: 2.4s; }
.root-node:nth-child(5) { animation-delay: 2.4s; }
.root-node:nth-child(6) { animation-delay: 2.6s; }

@keyframes node-appear {
    from {
        opacity: 0;
        r: 0;
    }
    to {
        opacity: 1;
    }
}

.root-label {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.85rem;
    fill: var(--color-ink);
    font-weight: 400;
    opacity: 0;
    animation: label-appear 0.6s ease-out forwards;
}

.root-label:nth-child(7) { animation-delay: 2s; }
.root-label:nth-child(8) { animation-delay: 2.2s; }
.root-label:nth-child(9) { animation-delay: 2.4s; }
.root-label:nth-child(10) { animation-delay: 2.6s; }

@keyframes label-appear {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 0.8;
        transform: translateY(0);
    }
}

/* ============================================
   COLOPHON
   ============================================ */

.colophon {
    margin-top: 4rem;
    padding: 2rem;
    border-top: 2px double var(--color-gold);
    border-bottom: 2px double var(--color-gold);
    text-align: center;
}

.colophon-text {
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    color: var(--color-ink);
    line-height: 1.8;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.colophon-detail {
    display: block;
    margin: 0.5rem 0;
}

.colophon-contact {
    font-family: 'Lora', serif;
    font-size: 0.9rem;
    color: var(--color-espresso);
    margin-top: 1rem;
}

.colophon-contact code {
    font-family: 'Space Mono', monospace;
    color: var(--color-fern);
    background-color: rgba(74, 103, 65, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 1px;
}

/* ============================================
   INTERSECTION OBSERVER ANIMATIONS
   ============================================ */

.specimen-card.in-view {
    opacity: 1;
}

.section-heading.in-view {
    animation: heading-reveal 0.8s ease-out forwards;
}

.plate.page-turn {
    animation: page-turn 1s ease-in-out forwards;
}

@keyframes page-turn {
    0% {
        transform: perspective(1200px) rotateX(0deg);
        box-shadow: none;
    }
    50% {
        transform: perspective(1200px) rotateX(-2deg);
        box-shadow: 0 -8px 30px rgba(59, 36, 21, 0.15);
    }
    100% {
        transform: perspective(1200px) rotateX(0deg);
    }
}

/* ============================================
   RESPONSIVE TYPOGRAPHY
   ============================================ */

@media (max-width: 768px) {
    .nav-links {
        gap: 1rem;
    }

    .nav-links li:not(:last-child)::after {
        margin-left: 1rem;
    }

    .plate {
        padding: 2rem 1.5rem;
        min-height: auto;
    }

    main {
        padding-top: 4rem;
    }

    .title-main {
        font-size: 2.4rem;
    }

    .section-heading {
        font-size: 2rem;
        margin-bottom: 2rem;
    }

    .cartouche-frame {
        padding: 2rem;
    }

    .notes-text {
        font-size: 1rem;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

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