/* ============================================
   PPEBBL.com - Retro-Futuristic Botanical Folio
   Color Palette: Sepia-Nostalgic
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #1A1308;
    --bg-sidebar: #2C2416;
    --surface-card: #342B1E;
    --text-primary: #E8D5B0;
    --text-secondary: #C4A96A;
    --text-tertiary: #A89070;
    --accent-warm: #D4943A;
    --accent-botanical: #6B7F4A;
    --divider: #5A4A30;
    --glow-hover: #F0C868;
    --sidebar-width: 280px;
}

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

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
}

/* Paper grain texture */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.035;
    filter: url(#grain-filter);
}

/* --- Lamplight Glow --- */
#lamplight-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    background: radial-gradient(ellipse 60% 50% at 55% 50%, rgba(212, 148, 58, 0.04) 0%, transparent 70%);
}

/* --- Botanical Watermark --- */
#botanical-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-30%, -50%);
    width: 500px;
    height: 900px;
    pointer-events: none;
    z-index: 0;
    margin-left: calc(var(--sidebar-width) / 2);
}

#botanical-watermark svg {
    width: 100%;
    height: 100%;
}

/* --- Sidebar Navigation --- */
#sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--divider);
    z-index: 100;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 40px 0;
}

/* Sidebar grain texture */
#sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.02;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 2px,
        rgba(212, 148, 58, 0.1) 2px,
        rgba(212, 148, 58, 0.1) 3px
    );
}

#sidebar-header {
    padding: 0 24px 32px;
    border-bottom: 1px solid var(--divider);
    margin-bottom: 24px;
}

.sidebar-title {
    display: block;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: 22px;
    letter-spacing: 0.08em;
    color: var(--text-primary);
    text-transform: uppercase;
}

.sidebar-subtitle {
    display: block;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: 14px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

#sidebar-nav {
    list-style: none;
    padding: 0 16px;
    flex: 1;
}

.sidebar-item {
    position: relative;
    padding: 10px 12px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    border-radius: 2px;
}

.sidebar-item:hover {
    background-color: rgba(212, 148, 58, 0.06);
}

.sidebar-numeral {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.15em;
    color: var(--text-tertiary);
    margin-right: 12px;
    font-variant: small-caps;
    display: inline-block;
    width: 24px;
}

.sidebar-label {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-variant: small-caps;
}

.sidebar-item.active .sidebar-label {
    color: var(--glow-hover);
}

.sidebar-item.active .sidebar-numeral {
    color: var(--accent-warm);
}

/* Sidebar botanical icons */
.sidebar-icon {
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-item:hover .sidebar-icon {
    opacity: 0.4;
}

/* Sidebar active border animation */
.sidebar-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.sidebar-border rect {
    stroke-dasharray: 460;
    stroke-dashoffset: 460;
    transition: stroke-dashoffset 0.4s ease-in-out;
}

.sidebar-item.active .sidebar-border rect {
    stroke-dashoffset: 0;
}

/* --- Mobile Navigation --- */
#mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 48px;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--divider);
    z-index: 100;
    overflow-x: auto;
    white-space: nowrap;
    padding: 0 16px;
    align-items: center;
}

.mobile-nav-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0 16px;
    height: 48px;
    transition: color 0.3s ease;
}

.mobile-nav-item.active {
    color: var(--glow-hover);
    border-bottom: 2px solid var(--accent-warm);
}

/* --- Main Content --- */
#content {
    margin-left: var(--sidebar-width);
    position: relative;
    z-index: 1;
}

/* --- Plate (Section) --- */
.plate {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 12vh 40px;
}

.plate-inner {
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    position: relative;
}

/* --- Title Plate (Plate I) --- */
#plate-i {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#plate-i .plate-inner {
    max-width: 800px;
    text-align: center;
    position: relative;
}

.title-botanical {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 600px;
    opacity: 0.6;
    pointer-events: none;
}

.title-content {
    position: relative;
    z-index: 2;
}

.title-rule-top,
.title-rule-bottom {
    width: 200px;
    height: 1px;
    background-color: var(--text-secondary);
    margin: 0 auto 24px;
    opacity: 0;
    transform: scaleX(0);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.title-rule-bottom {
    margin: 24px auto 0;
}

.title-rule-top.visible,
.title-rule-bottom.visible {
    opacity: 1;
    transform: scaleX(1);
}

.site-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: 14vw;
    letter-spacing: 0.08em;
    color: var(--text-primary);
    text-transform: uppercase;
    line-height: 1;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.site-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.site-subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: 22px;
    color: var(--text-secondary);
    margin-top: 8px;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.8s ease 0.3s, transform 0.8s ease 0.3s;
}

.site-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Section Dividers --- */
.section-divider {
    display: flex;
    justify-content: center;
    padding: 0;
    margin-left: var(--sidebar-width);
}

.divider-svg {
    width: 300px;
    height: 30px;
}

/* --- Plate Number --- */
.plate-number {
    display: block;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.3em;
    color: var(--text-tertiary);
    text-transform: uppercase;
    font-variant: small-caps;
    margin-bottom: 12px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.plate-number.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Section Heading --- */
.section-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 42px;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    text-transform: uppercase;
    margin-bottom: 40px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease 0.2s, transform 0.6s ease 0.2s;
}

.section-heading.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Content Cards --- */
.content-card {
    position: relative;
    background-color: var(--surface-card);
    padding: 48px 40px;
    box-shadow: 0 8px 32px rgba(82, 62, 30, 0.3);
    margin-bottom: 40px;
}

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

/* --- Border Animation Container --- */
.border-animate-container {
    position: relative;
}

.border-animate-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.animate-border-rect {
    stroke-dasharray: 398;
    stroke-dashoffset: 398;
    transition: stroke-dashoffset 1.2s ease-in-out;
}

.border-animate-container.animated .animate-border-rect {
    stroke-dashoffset: 0;
}

/* --- Corner Ornaments --- */
.corner-ornament {
    position: absolute;
    width: 20px;
    height: 20px;
    z-index: 4;
    opacity: 0;
    transition: opacity 0.3s ease 1.4s;
}

.border-animate-container.animated .corner-ornament {
    opacity: 1;
}

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

.corner-tr {
    top: -4px;
    right: -4px;
}

.corner-bl {
    bottom: -4px;
    left: -4px;
}

.corner-br {
    bottom: -4px;
    right: -4px;
}

.corner-ornament svg {
    width: 100%;
    height: 100%;
}

/* --- Body Text --- */
.body-text {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.75;
    color: #D4C4A0;
    margin-bottom: 20px;
}

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

/* --- Pull Quote --- */
.pull-quote {
    position: relative;
    margin: 40px 0;
    padding: 24px 40px;
    text-align: center;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.pull-quote.visible {
    opacity: 1;
    transform: translateY(0);
}

.pull-quote-mark {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-size: 120px;
    color: var(--divider);
    line-height: 0;
    position: absolute;
}

.pull-quote-mark.open {
    top: 40px;
    left: 0;
}

.pull-quote-mark.close {
    bottom: -10px;
    right: 0;
}

.pull-quote-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: 22px;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* --- Botanical Illustrations --- */
.botanical-illustration {
    display: flex;
    justify-content: center;
    margin: 48px auto;
}

.plate-botanical {
    max-width: 300px;
}

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

.draw-path {
    stroke-dasharray: var(--path-length, 500);
    stroke-dashoffset: var(--path-length, 500);
    transition: stroke-dashoffset 2.5s ease-in-out;
}

.botanical-svg.drawn .draw-path {
    stroke-dashoffset: 0;
}

.botanical-fill {
    transition: opacity 0.8s ease 2.5s;
}

.botanical-svg.drawn .botanical-fill {
    opacity: 1 !important;
}

/* --- Specimens Grid --- */
.specimens-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    margin-bottom: 40px;
}

.specimen-card {
    background-color: var(--surface-card);
    padding: 28px 20px 24px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(82, 62, 30, 0.3);
}

.specimen-illustration {
    width: 100px;
    height: 120px;
    margin: 0 auto 16px;
}

.specimen-illustration .botanical-svg {
    width: 100%;
    height: 100%;
}

.specimen-name {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.specimen-caption {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.specimen-ref {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-size: 12px;
    color: var(--divider);
    letter-spacing: 0.1em;
}

/* --- Collections --- */
.collections-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.collection-item {
    background-color: var(--surface-card);
    padding: 32px 36px;
    box-shadow: 0 8px 32px rgba(82, 62, 30, 0.3);
}

.collection-content {
    position: relative;
    z-index: 2;
}

.collection-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.collection-desc {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
    color: #D4C4A0;
    margin-bottom: 12px;
}

.collection-date {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: 14px;
    color: var(--text-tertiary);
}

/* --- Appendix --- */
.appendix-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 22px;
    color: var(--text-secondary);
    margin: 32px 0 16px;
    letter-spacing: 0.02em;
}

/* --- Folio Footer --- */
.folio-footer {
    margin-top: 80px;
    text-align: center;
    padding-bottom: 40px;
}

.footer-rule {
    width: 120px;
    height: 1px;
    background-color: var(--divider);
    margin: 0 auto 24px;
}

.footer-text {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.2em;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.footer-note {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: 14px;
    color: var(--divider);
    margin-top: 8px;
}

.footer-ornament {
    margin-top: 24px;
}

.footer-ornament-svg {
    width: 60px;
    height: 30px;
}

/* --- Animate on Scroll (base state) --- */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Scrollbar Styling --- */
#sidebar::-webkit-scrollbar {
    width: 4px;
}

#sidebar::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar::-webkit-scrollbar-thumb {
    background-color: var(--divider);
    border-radius: 2px;
}

/* --- Responsive: Tablet --- */
@media (max-width: 1024px) {
    .specimens-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .site-title {
        font-size: 10vw;
    }

    .plate {
        padding: 10vh 32px;
    }
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    #sidebar {
        display: none;
    }

    #mobile-nav {
        display: flex;
    }

    #content {
        margin-left: 0;
        margin-top: 48px;
    }

    .section-divider {
        margin-left: 0;
    }

    #botanical-watermark {
        margin-left: 0;
    }

    .plate {
        padding: 8vh 20px;
        min-height: auto;
    }

    .plate-inner {
        max-width: 100%;
    }

    .site-title {
        font-size: 16vw;
    }

    .site-subtitle {
        font-size: 18px;
    }

    .section-heading {
        font-size: 32px;
    }

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

    .content-card {
        padding: 32px 24px;
    }

    .collection-item {
        padding: 24px 20px;
    }

    .pull-quote-mark {
        font-size: 80px;
    }

    .pull-quote-mark.open {
        top: 28px;
        left: -4px;
    }

    .pull-quote-mark.close {
        bottom: -16px;
        right: -4px;
    }

    .pull-quote {
        padding: 20px 28px;
    }

    .pull-quote-text {
        font-size: 18px;
    }

    /* Hide corner ornaments on mobile */
    .corner-ornament {
        display: none;
    }

    .title-botanical {
        opacity: 0.3;
    }
}

/* --- Responsive: Small Mobile --- */
@media (max-width: 480px) {
    .site-title {
        font-size: 18vw;
        letter-spacing: 0.04em;
    }

    .section-heading {
        font-size: 28px;
    }

    .content-card {
        padding: 24px 18px;
    }

    .body-text {
        font-size: 15px;
    }
}
