/* ============================================================
   renai.club — Digital Herbarium
   Palette: #0e3a4a #1a5566 #3a6e7a #3a8a8a #7ececa #e8f4f0 #f2f9f8 #b3927a #ffffff
   Fonts: Playfair Display"** (Google Fonts, weights 400 700 900)
   Source Serif 4"** (Google Fonts, weights 300 400)
   Space Mono"** (Google Fonts, weight 400)
   Space Mono. Leaf outlines are hand-traced in `stroke: #3a8a8a` pattern
   Playfair Display italic 14px `#1a5566` marginalia text
   Space Mono 12px label below each morphology cell
   Space Mono 13px: emergence date peak date senescence date
   Space Mono: "78% / ACTIVE" data ring label
   ============================================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.75;
    color: #1a5566;
    background: #f2f9f8;
    overflow-x: hidden;
}

/* ---- Leaf Vein SVG Pattern ---- */
.leaf-vein-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cpath d='M32 60 C20 44 14 28 20 10 Q32 4 44 10 C50 28 44 44 32 60Z' fill='none' stroke='%237ececa' stroke-width='0.5'/%3E%3Cline x1='32' y1='58' x2='32' y2='12' stroke='%237ececa' stroke-width='0.4'/%3E%3Cline x1='32' y1='44' x2='20' y2='32' stroke='%237ececa' stroke-width='0.3'/%3E%3Cline x1='32' y1='44' x2='44' y2='32' stroke='%237ececa' stroke-width='0.3'/%3E%3Cline x1='32' y1='30' x2='18' y2='20' stroke='%237ececa' stroke-width='0.3'/%3E%3Cline x1='32' y1='30' x2='46' y2='20' stroke='%237ececa' stroke-width='0.3'/%3E%3C/svg%3E");
    background-size: 64px 64px;
    background-repeat: repeat;
}

.leaf-vein-subtle {
    opacity: 0.03;
}

/* ---- Typography ---- */
h1, h2, h3 {
    font-family: 'Playfair Display', Georgia, serif;
}

.site-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(48px, 8vw, 96px);
    font-weight: 900;
    color: #e8f4f0;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 28px;
}

.site-subtitle {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 300;
    font-size: clamp(15px, 2.2vw, 20px);
    color: #7ececa;
    max-width: 520px;
    line-height: 1.65;
    margin-bottom: 56px;
}

.section-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(28px, 4vw, 48px);
    font-weight: 700;
    color: #0e3a4a;
    margin-bottom: 40px;
    line-height: 1.2;
}

.section-heading-light {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(24px, 3.5vw, 40px);
    font-weight: 400;
    font-style: italic;
    color: #e8f4f0;
    margin-bottom: 56px;
    line-height: 1.2;
    text-align: center;
}

.section-label {
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: #3a8a8a;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.archive-label {
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: #3a8a8a;
    text-transform: uppercase;
    margin-bottom: 32px;
}

/* ---- Layout ---- */
main,
section {
    position: relative;
}

.panel-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 120px 40px;
}

.panel-inner-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* ---- Opening Panel ---- */
.panel-opening {
    min-height: 100vh;
    background: #0e3a4a;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    overflow: hidden;
}

.opening-content {
    position: relative;
    z-index: 2;
    max-width: 1100px;
    margin: 0 auto;
    padding: 80px 40px;
    width: 100%;
}

/* Data Ring */
.data-ring-container {
    display: flex;
    align-items: center;
    margin-bottom: 64px;
}

.data-ring {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: conic-gradient(#7ececa 0% 78%, #1a5566 78% 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.data-ring-inner {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: #0e3a4a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.data-ring-label {
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: #7ececa;
    text-align: center;
    line-height: 1.4;
}

/* Scroll Cue */
.scroll-cue {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.chevron-icon {
    width: 24px;
    height: 24px;
    animation: pulse-down 2s ease-in-out infinite;
}

@keyframes pulse-down {
    0%, 100% { transform: translateY(0); opacity: 0.7; }
    50% { transform: translateY(8px); opacity: 1; }
}

/* ---- Field Notes Panel ---- */
.panel-field-notes {
    background: #f2f9f8;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: start;
}

.col-text p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 18px;
    line-height: 1.75;
    color: #1a5566;
    margin-bottom: 24px;
}

/* Annotation Cards */
.col-annotations {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.annotation-card {
    border: 1px solid #3a8a8a;
    padding: 20px 24px;
    background: #ffffff;
    transition: border-color 0.3s ease;
}

.annotation-card[data-uncertain] {
    cursor: pointer;
}

.annotation-card[data-uncertain]:hover {
    border-color: #b3927a;
}

.annotation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.annotation-id {
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: #3a6e7a;
    text-transform: uppercase;
}

.uncertainty-badge {
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 11px;
    color: #b3927a;
    border: 1px solid #b3927a;
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
}

.annotation-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 15px;
    font-style: italic;
    line-height: 1.65;
    color: #1a5566;
    margin-bottom: 12px;
}

.annotation-meta {
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: #3a8a8a;
    text-transform: uppercase;
}

/* ---- Phenology Chart Panel ---- */
.panel-phenology {
    min-height: 100vh;
    background: #0e3a4a;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.phenology-chart-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 64px;
    width: 100%;
}

.phenology-chart {
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: conic-gradient(
        #1a5566 0deg 60deg,
        #3a6e7a 60deg 120deg,
        #7ececa 120deg 210deg,
        #3a8a8a 210deg 300deg,
        #1a5566 300deg 360deg
    );
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.phenology-center-label {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: #0e3a4a;
    border: 1px solid #1a5566;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.pheno-year {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 22px;
    font-weight: 700;
    color: #e8f4f0;
}

.pheno-sublabel {
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 10px;
    letter-spacing: 0.12em;
    color: #3a8a8a;
    text-transform: uppercase;
}

/* Month labels are placed via JS */
.month-labels {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.month-label {
    position: absolute;
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 0.06em;
    color: #7ececa;
    transform: translate(-50%, -50%);
}

/* Phenology Data Rows */
.phenology-data {
    width: 100%;
    max-width: 560px;
}

.data-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    gap: 20px;
}

.data-row[data-uncertain] {
    cursor: pointer;
}

.data-row[data-uncertain]:hover .data-value {
    color: #b3927a;
}

.data-key {
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    color: #3a8a8a;
    text-transform: uppercase;
    white-space: nowrap;
}

.data-value {
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 13px;
    letter-spacing: 0.06em;
    color: #e8f4f0;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
}

.data-divider {
    border: none;
    border-top: 1px solid #1a5566;
    margin: 0;
}

/* ---- Leaf Morphology Grid ---- */
.panel-morphology {
    background: #f2f9f8;
}

.morphology-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    max-width: 860px;
    margin: 0 auto;
}

.morphology-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    border: 1px solid transparent;
    background: #ffffff;
    transition: border-color 0.3s ease;
}

.morphology-cell[data-uncertain] {
    cursor: pointer;
}

.morphology-cell[data-uncertain]:hover {
    border-color: #b3927a;
}

.leaf-svg-wrap {
    width: 80px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.leaf-svg {
    width: 100%;
    height: 100%;
}

.leaf-label {
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 0.06em;
    color: #3a6e7a;
    text-align: center;
    line-height: 1.6;
    text-transform: uppercase;
}

/* ---- Taxonomy Panel ---- */
.panel-taxonomy {
    min-height: 100vh;
    background: #0e3a4a;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.taxonomy-entries {
    width: 100%;
    max-width: 640px;
    text-align: left;
}

.taxonomy-entry {
    padding: 28px 0;
    cursor: default;
}

.taxonomy-entry[data-uncertain] {
    cursor: pointer;
}

.taxonomy-rank {
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: #3a8a8a;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.taxonomy-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 32px;
    font-weight: 700;
    color: #e8f4f0;
    font-style: italic;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.taxonomy-note {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 15px;
    font-weight: 300;
    color: #7ececa;
    line-height: 1.6;
}

.taxonomy-divider {
    border-top: 1px solid #1a5566;
    width: 100%;
}

/* ---- Restoration Notes / Closing Panel ---- */
.panel-restoration {
    background-image:
        repeating-linear-gradient(#c8dde0 1px, transparent 1px),
        repeating-linear-gradient(90deg, #c8dde0 1px, transparent 1px);
    background-size: 20px 20px;
    background-color: #ffffff;
    position: relative;
}

.restoration-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 32px;
    font-weight: 700;
    color: #0e3a4a;
    margin-bottom: 40px;
}

.restoration-content {
    max-width: 680px;
    margin-bottom: 56px;
}

.restoration-body {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 14px;
    font-style: italic;
    line-height: 1.9;
    color: #1a5566;
    margin-bottom: 20px;
}

.inline-badge {
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 10px;
    color: #b3927a;
    border: 1px solid #b3927a;
    padding: 1px 4px;
    border-radius: 3px;
}

.restoration-meta {
    display: flex;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
}

.restoration-meta-item {
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: #3a6e7a;
    text-transform: uppercase;
    line-height: 1.8;
    cursor: default;
}

.restoration-meta-item[data-uncertain] {
    cursor: pointer;
}

.restoration-meta-item strong {
    display: block;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 36px;
    font-weight: 700;
    color: #0e3a4a;
    letter-spacing: normal;
    text-transform: none;
    margin-top: 4px;
}

.restoration-meta-divider {
    width: 1px;
    height: 60px;
    background: #3a8a8a;
    opacity: 0.3;
    flex-shrink: 0;
}

/* ---- Footer ---- */
.site-footer {
    padding: 24px 40px;
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    color: #3a8a8a;
    text-transform: uppercase;
    border-top: 1px solid #c8dde0;
    text-align: center;
}

/* ---- Entry Animations ---- */
.animate-entry {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.animate-entry-stagger {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* ---- Shake-Error Animation ---- */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

.shake-active {
    animation: shake 0.4s ease-in-out;
}

/* ---- Opening Panel Animation ---- */
.opening-content .archive-label {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.8s 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.opening-content .site-title {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.8s 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.opening-content .site-subtitle {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.8s 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.opening-content .data-ring-container {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.8s 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.opening-content .scroll-cue {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.8s 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .panel-inner {
        padding: 80px 24px;
    }

    .two-col {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .morphology-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .phenology-chart {
        width: 280px;
        height: 280px;
    }

    .phenology-center-label {
        width: 160px;
        height: 160px;
    }

    .restoration-meta {
        gap: 24px;
    }

    .taxonomy-name {
        font-size: 24px;
    }
}

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

    .phenology-chart {
        width: 240px;
        height: 240px;
    }

    .phenology-center-label {
        width: 140px;
        height: 140px;
    }
}
