/* ========================================
   rollup.quest — Botanical Specimen Dashboard
   A Luxurious Cottagecore Herbarium Ledger
   ======================================== */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.72;
    letter-spacing: 0.015em;
    color: #4A3F35;
    background: linear-gradient(
        180deg,
        #FDF6EC 0%,
        #FDF6EC 20%,
        #F5E6D0 40%,
        #F7D1D5 60%,
        #FDF6EC 75%,
        #F5E6D0 90%,
        #5E4B6D22 100%
    );
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Linen Texture Overlay --- */
#linen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M0 20h40M20 0v40' stroke='%233D2B1F' stroke-width='0.3' opacity='0.03'/%3E%3C/svg%3E");
    background-size: 40px 40px;
}

/* --- Vine Border --- */
#vine-border {
    position: fixed;
    top: 16px;
    left: 16px;
    width: calc(100% - 32px);
    height: calc(100% - 32px);
    z-index: 100;
    pointer-events: none;
}

#vine-main {
    stroke-dasharray: var(--vine-length, 8000);
    stroke-dashoffset: var(--vine-length, 8000);
    transition: stroke-dashoffset 0.1s linear;
}

.vine-leaf {
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    transition: stroke-dashoffset 0.4s ease;
}

.vine-leaf.visible {
    stroke-dashoffset: 0;
}

/* --- Compass Rose Navigation --- */
#compass-rose {
    position: fixed;
    top: 28px;
    right: 28px;
    z-index: 200;
    width: 60px;
    height: 60px;
}

.compass-body {
    position: relative;
    width: 60px;
    height: 60px;
}

.compass-svg {
    width: 60px;
    height: 60px;
    animation: compass-rotate 60s linear infinite;
    cursor: pointer;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

@keyframes compass-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.compass-labels {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#compass-rose:hover .compass-labels {
    opacity: 1;
    pointer-events: auto;
}

#compass-rose:hover .compass-svg {
    animation-play-state: paused;
}

.compass-label {
    position: absolute;
    font-family: 'Caveat', cursive;
    font-size: 0.95rem;
    color: #8B6F3A;
    text-decoration: none;
    white-space: nowrap;
    padding: 4px 10px;
    background: rgba(253, 246, 236, 0.92);
    border-radius: 8px;
    border: 1px solid rgba(212, 168, 85, 0.3);
    transition: color 0.2s ease, background 0.2s ease;
}

.compass-label:hover {
    color: #3D2B1F;
    background: rgba(253, 246, 236, 1);
}

.compass-n { top: -12px; left: 50%; transform: translateX(-50%); }
.compass-e { top: 50%; right: -20px; transform: translateY(-50%); }
.compass-s { bottom: -12px; left: 50%; transform: translateX(-50%); }
.compass-w { top: 50%; left: -20px; transform: translateY(-50%); }

/* --- Hero Section --- */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 60px 40px;
}

.hero-content {
    text-align: center;
    opacity: 0;
    animation: hero-fade-in 1.2s ease 0.4s forwards;
}

@keyframes hero-fade-in {
    to { opacity: 1; }
}

.hero-title {
    font-family: 'Fraunces', serif;
    font-size: clamp(3rem, 7vw, 5.5rem);
    font-weight: 500;
    font-variation-settings: 'SOFT' 100, 'WONK' 1;
    color: #3D2B1F;
    line-height: 1.1;
    margin-bottom: 0.3em;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-family: 'Caveat', cursive;
    font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    color: #8B6F3A;
    letter-spacing: 0.08em;
    margin-bottom: 2em;
}

.hero-illustration {
    margin: 0 auto 3em;
    width: 300px;
    height: 200px;
}

.hero-illustration .wild-rose .draw-path {
    stroke-dasharray: var(--path-length);
    stroke-dashoffset: var(--path-length);
    animation: draw-path 2s ease forwards;
    animation-delay: 0.8s;
}

@keyframes draw-path {
    to { stroke-dashoffset: 0; }
}

.scroll-indicator {
    width: 30px;
    height: 30px;
    margin: 0 auto;
    animation: bob 2s ease-in-out infinite;
}

.scroll-indicator svg {
    width: 30px;
    height: 30px;
    opacity: 0.6;
}

@keyframes bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

/* --- Dashboard Sections --- */
.dashboard-section {
    padding: 80px 40px;
    position: relative;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

/* --- Specimen Panels --- */
.specimen-panel {
    background: linear-gradient(165deg, #FDF6EC 0%, #F5E6D0 100%);
    border-radius: 12px;
    padding: 28px 24px 24px;
    position: relative;
    box-shadow: 0 4px 16px rgba(61, 43, 31, 0.08), 0 1px 3px rgba(61, 43, 31, 0.05);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                grid-column-end 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                grid-row-end 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    /* SVG wobble border simulation */
    border: 1.5px solid rgba(61, 43, 31, 0.1);
}

.specimen-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Pressed flower silhouette behind panel title */
.specimen-panel::before {
    content: '';
    position: absolute;
    top: 10px;
    right: 15px;
    width: 80px;
    height: 100px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 100'%3E%3Cpath d='M40,90 C38,70 42,50 40,35 M40,35 C30,28 20,22 25,15 C30,18 38,25 40,35 M40,35 C50,28 60,22 55,15 C50,18 42,25 40,35 M40,50 C28,45 18,48 15,40 C22,38 32,42 40,50 M40,50 C52,45 62,48 65,40 C58,38 48,42 40,50' fill='none' stroke='%23E8B4B8' stroke-width='2'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.07;
    pointer-events: none;
}

/* Rose blush hover state for panels — #E8B4B8 Damask Rose */
.specimen-panel:hover {
    border-color: #E8B4B8;
    box-shadow: 0 6px 20px rgba(61, 43, 31, 0.1), 0 1px 4px rgba(232, 180, 184, 0.15);
}

/* Moss shadow dark accents — #4A5D48 Moss Underside */
.finale-section {
    background: linear-gradient(180deg, transparent 0%, #4A5D4810 50%, #5E4B6D18 100%);
}

/* Panel sizing variants */
.panel-wide {
    grid-column: span 6;
}

.panel-tall {
    grid-column: span 4;
    grid-row: span 2;
}

.panel-standard {
    grid-column: span 4;
}

.panel-feature {
    grid-column: span 8;
}

/* Expanded panel state */
.specimen-panel.expanded {
    grid-column: span 12 !important;
    grid-row: span 2;
    z-index: 10;
}

.specimen-panel.expanded .panel-expanded-content {
    max-height: 600px;
    opacity: 1;
    margin-top: 1.2em;
    transition: max-height 0.6s ease, opacity 0.4s ease 0.2s, margin-top 0.3s ease;
}

/* --- Drawer Pull --- */
.drawer-pull {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 16px;
    cursor: pointer;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pull-knob {
    width: 24px;
    height: 12px;
    border-radius: 6px 6px 3px 3px;
    background: radial-gradient(circle at 40% 35%, #D4A855, #8B6F3A, #5C4A2A);
    box-shadow: inset 0 1px 2px rgba(212, 168, 85, 0.4), 0 2px 4px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.drawer-pull:hover .pull-knob {
    transform: scale(1.1);
    box-shadow: inset 0 1px 2px rgba(212, 168, 85, 0.5), 0 3px 6px rgba(0, 0, 0, 0.2);
}

/* --- Panel Header Line --- */
.panel-header-line {
    width: 100%;
    height: 2px;
    margin-bottom: 16px;
    overflow: visible;
}

.panel-header-line .draw-path {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 0.6s ease;
}

.specimen-panel.visible .panel-header-line .draw-path {
    stroke-dashoffset: 0;
}

/* --- Panel Typography --- */
.panel-title {
    font-family: 'Fraunces', serif;
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    font-weight: 500;
    font-variation-settings: 'SOFT' 100, 'WONK' 1;
    color: #3D2B1F;
    line-height: 1.2;
    margin-bottom: 0.15em;
}

.panel-annotation {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    color: #8B6F3A;
    letter-spacing: 0.04em;
    margin-bottom: 0.8em;
}

/* Secondary heading color */
.panel-title .secondary-heading {
    color: #6B5744;
}

.panel-body {
    color: #4A3F35;
}

.panel-body p {
    margin-bottom: 0.8em;
}

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

/* Secondary text color for notes */
.panel-body .secondary {
    color: #7A6B5D;
}

/* --- Expanded Content (hidden by default) --- */
.panel-expanded-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease;
    margin-top: 0;
    border-top: 1px solid rgba(212, 168, 85, 0.2);
    padding-top: 1em;
}

.panel-expanded-content p {
    margin-bottom: 0.8em;
    color: #7A6B5D;
}

/* --- Panel Botanical Illustrations --- */
.panel-illustration {
    display: block;
    margin: 1em auto 0;
    max-width: 200px;
    height: auto;
}

.panel-illustration .draw-path {
    stroke-dasharray: var(--path-length);
    stroke-dashoffset: var(--path-length);
    transition: stroke-dashoffset 1.5s ease;
}

.specimen-panel.expanded .panel-illustration .draw-path {
    stroke-dashoffset: 0;
}

/* --- Interstitial Sections --- */
.interstitial-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 80px 40px;
    background: linear-gradient(180deg, transparent 0%, #F7D1D522 30%, #FDF6EC 60%, #8FA98B15 100%);
}

.interstitial-content {
    text-align: center;
    max-width: 600px;
}

.interstitial-illustration {
    display: block;
    width: 60vw;
    max-width: 500px;
    height: auto;
    margin: 0 auto 2em;
}

.interstitial-illustration .draw-path {
    stroke-dasharray: var(--path-length);
    stroke-dashoffset: var(--path-length);
    transition: stroke-dashoffset 0.15s linear;
}

.interstitial-annotation {
    font-family: 'Caveat', cursive;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    color: #8B6F3A;
    letter-spacing: 0.04em;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.interstitial-annotation.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Finale Section --- */
.finale-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    position: relative;
}

.finale-panel {
    max-width: 700px;
    width: 100%;
    background: linear-gradient(165deg, #FDF6EC 0%, #F5E6D0 100%);
    border-radius: 16px;
    padding: 48px 40px;
    position: relative;
    box-shadow: 0 8px 32px rgba(61, 43, 31, 0.1), 0 2px 8px rgba(61, 43, 31, 0.06);
    border: 1.5px solid rgba(61, 43, 31, 0.1);
    text-align: center;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.finale-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

.finale-title {
    font-family: 'Fraunces', serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 500;
    font-variation-settings: 'SOFT' 100, 'WONK' 1;
    color: #3D2B1F;
    margin-bottom: 0.2em;
    text-shadow: 0 1px 0 rgba(107, 87, 68, 0.05);
}

/* Secondary heading variant — warm umber #6B5744 */
.panel-feature .panel-title {
    color: #6B5744;
}

.finale-annotation {
    font-family: 'Caveat', cursive;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    color: #8B6F3A;
    letter-spacing: 0.04em;
    margin-bottom: 1.5em;
    animation: gentle-pulse 4s ease-in-out infinite;
}

@keyframes gentle-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.finale-body {
    color: #4A3F35;
    margin-bottom: 2em;
}

.finale-body p {
    margin-bottom: 1em;
}

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

.finale-illustration {
    margin: 2em auto 0;
    width: 120px;
    height: 160px;
}

.seed-pod-final {
    width: 120px;
    height: 160px;
    opacity: 0.6;
}

/* --- Botanical SVG Draw Animations --- */
.botanical-svg .draw-path {
    stroke-dasharray: var(--path-length, 500);
    stroke-dashoffset: var(--path-length, 500);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .panel-wide {
        grid-column: span 6;
    }
    .panel-tall {
        grid-column: span 6;
        grid-row: span 2;
    }
    .panel-standard {
        grid-column: span 6;
    }
    .panel-feature {
        grid-column: span 12;
    }
}

@media (max-width: 768px) {
    .dashboard-section {
        padding: 40px 20px;
    }

    .dashboard-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 16px;
    }

    .panel-wide,
    .panel-tall,
    .panel-standard,
    .panel-feature {
        grid-column: span 6;
    }

    .panel-tall {
        grid-row: span 1;
    }

    .specimen-panel.expanded {
        grid-column: span 6 !important;
    }

    #vine-border {
        top: 8px;
        left: 8px;
        width: calc(100% - 16px);
        height: calc(100% - 16px);
    }

    .hero-section {
        padding: 40px 20px;
    }

    .hero-illustration {
        width: 220px;
        height: 150px;
    }

    .interstitial-illustration {
        width: 80vw;
    }

    #compass-rose {
        top: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }

    .compass-svg {
        width: 48px;
        height: 48px;
    }

    .finale-panel {
        padding: 32px 24px;
    }
}

@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .panel-wide,
    .panel-tall,
    .panel-standard,
    .panel-feature {
        grid-column: span 1;
    }

    .specimen-panel.expanded {
        grid-column: span 1 !important;
    }

    .compass-labels {
        display: none;
    }
}

/* --- Undulating section divider --- */
.dashboard-section::before {
    content: '';
    display: block;
    width: 60%;
    max-width: 500px;
    height: 2px;
    margin: 0 auto 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 500 4'%3E%3Cpath d='M0,2 C50,0 100,4 150,2 C200,0 250,4 300,2 C350,0 400,4 450,2 C475,1 500,2 500,2' fill='none' stroke='%23D4A855' stroke-width='1' opacity='0.4'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* --- Gutter vine tendril pattern --- */
.dashboard-grid {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='200'%3E%3Cpath d='M12,0 C14,20 10,40 12,60 C14,80 10,100 12,120 C14,140 10,160 12,180 C13,190 12,200 12,200' fill='none' stroke='%238FA98B' stroke-width='0.5' opacity='0.08'/%3E%3C/svg%3E");
    background-size: 24px 200px;
}
