/* ==========================================
   prototype.bar — Botanical HUD Stylesheet
   ========================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #1A0F14;
    color: #E8DDD0;
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.02em;
    overflow-x: hidden;
    /* Grid underlay */
    background-image:
        linear-gradient(#8B6F47 1px, transparent 1px),
        linear-gradient(90deg, #8B6F47 1px, transparent 1px);
    background-size: 60px 60px;
    background-position: center center;
}

/* Grid underlay via pseudo-element for opacity control */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(#8B6F47 1px, transparent 1px),
        linear-gradient(90deg, #8B6F47 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
}

/* Remove the body background-image since we use pseudo */
body {
    background-image: none;
}

/* ==========================================
   HUD Frame
   ========================================== */
.hud-frame {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
}

/* HUD Border Lines */
.hud-border {
    position: absolute;
    background: #8B6F47;
    opacity: 0.4;
}

.hud-border-top {
    top: 8vmin;
    left: 8vmin;
    right: 8vmin;
    height: 1px;
}

.hud-border-bottom {
    bottom: 8vmin;
    left: 8vmin;
    right: 8vmin;
    height: 1px;
}

.hud-border-left {
    top: 8vmin;
    left: 8vmin;
    bottom: 8vmin;
    width: 1px;
}

.hud-border-right {
    top: 8vmin;
    right: 8vmin;
    bottom: 8vmin;
    width: 1px;
}

/* Corner Brackets */
.corner-bracket {
    position: fixed;
    animation: hud-pulse 3s ease-in-out infinite;
    opacity: 0.5;
    z-index: 101;
}

.corner-bracket.top-left {
    top: calc(8vmin - 20px);
    left: calc(8vmin - 20px);
}

.corner-bracket.top-right {
    top: calc(8vmin - 20px);
    right: calc(8vmin - 20px);
}

.corner-bracket.bottom-left {
    bottom: calc(8vmin - 20px);
    left: calc(8vmin - 20px);
}

.corner-bracket.bottom-right {
    bottom: calc(8vmin - 20px);
    right: calc(8vmin - 20px);
}

@keyframes hud-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* HUD Readouts */
.hud-readout {
    position: fixed;
    z-index: 101;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #8B6F47;
    opacity: 0.6;
}

.hud-top-left {
    top: calc(8vmin + 8px);
    left: calc(8vmin + 12px);
}

.hud-top-right {
    top: calc(8vmin + 8px);
    right: calc(8vmin + 12px);
}

.hud-bottom-left {
    bottom: calc(8vmin + 8px);
    left: calc(8vmin + 12px);
}

.hud-bottom-right {
    bottom: calc(8vmin + 8px);
    right: calc(8vmin + 12px);
}

/* Scanning Line */
.scanning-line {
    position: fixed;
    left: 8vmin;
    right: 8vmin;
    height: 1px;
    background: #6B1B2B;
    opacity: 0.15;
    animation: scan-descend 20s linear infinite;
    z-index: 99;
}

@keyframes scan-descend {
    0% { top: 8vmin; }
    100% { top: calc(100vh - 8vmin); }
}

/* Crosshair Reticle */
.crosshair {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    z-index: 99;
    opacity: 0.15;
}

.crosshair-h {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: #8B6F47;
    transform: translateY(-50%);
}

.crosshair-v {
    position: absolute;
    left: 50%;
    top: 0;
    height: 100%;
    width: 1px;
    background: #8B6F47;
    transform: translateX(-50%);
}

/* Counter blur effect */
#catalogue-counter {
    transition: filter 0.3s ease;
}

#catalogue-counter.counting {
    filter: blur(2px);
}

/* ==========================================
   Telemetry Strip
   ========================================== */
.telemetry-strip {
    position: fixed;
    top: calc(8vmin + 2px);
    right: calc(8vmin + 2px);
    bottom: calc(8vmin + 2px);
    width: 3.5rem;
    z-index: 50;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 1rem 0.4rem;
    overflow-y: auto;
    scrollbar-width: none;
}

.telemetry-strip::-webkit-scrollbar {
    display: none;
}

.telemetry-bar {
    height: 2px;
    background: #6B1B2B;
    margin: 2px 0;
    border-radius: 0;
}

/* ==========================================
   Specimen Field (Main Content)
   ========================================== */
.specimen-field {
    position: relative;
    z-index: 10;
    padding: calc(8vmin + 3rem) calc(8vmin + 2rem);
    padding-right: calc(8vmin + 5rem);
    max-width: 100vw;
}

/* ==========================================
   Specimen Plate
   ========================================== */
.specimen-plate {
    position: relative;
    background: #2D1520;
    border: 1px solid rgba(139, 111, 71, 0.15);
    padding: clamp(2rem, 4vw, 4rem);
    margin-bottom: clamp(2rem, 4vh, 4rem);
    opacity: 0;
    transform: translateY(3rem);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.specimen-plate:hover {
    box-shadow: 0 0 30px rgba(107, 27, 43, 0.15);
}

.specimen-plate:hover .annotation-label {
    opacity: 0.9 !important;
}

/* Folio Number */
.folio-number {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2rem;
    height: 2rem;
    border: 1px solid #8B6F47;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    font-weight: 400;
    color: #8B6F47;
    opacity: 0.7;
}

/* Plate Grid */
.plate-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 4rem;
}

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

/* ==========================================
   Botanical Illustrations
   ========================================== */
.plate-illustration {
    position: relative;
}

.botanical-drawing {
    position: relative;
    width: 100%;
    height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* --- Specimen I: Rosa Prototypica --- */
.stem {
    position: absolute;
    width: 6px;
    height: 55%;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(to right, #3A5F3A, #2A4F2A);
    clip-path: polygon(40% 0%, 60% 0%, 53% 100%, 47% 100%);
}

.leaf {
    position: absolute;
    background: #3A5F3A;
    border-left: 1px solid rgba(139, 111, 71, 0.3);
}

.leaf-1 {
    width: 50px;
    height: 22px;
    border-radius: 60% 40% 60% 40%;
    top: 35%;
    left: calc(50% + 6px);
    transform: rotate(-25deg);
    opacity: 0.8;
}

.leaf-2 {
    width: 45px;
    height: 20px;
    border-radius: 60% 40% 60% 40%;
    top: 45%;
    right: calc(50% + 6px);
    transform: rotate(25deg) scaleX(-1);
    opacity: 0.7;
}

.leaf-3 {
    width: 40px;
    height: 18px;
    border-radius: 60% 40% 60% 40%;
    top: 55%;
    left: calc(50% + 6px);
    transform: rotate(-20deg);
    opacity: 0.6;
}

.leaf-4 {
    width: 42px;
    height: 19px;
    border-radius: 60% 40% 60% 40%;
    top: 62%;
    right: calc(50% + 6px);
    transform: rotate(20deg) scaleX(-1);
    opacity: 0.75;
}

.flower-head {
    position: absolute;
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
}

.flower-ring {
    position: absolute;
    border-radius: 50%;
}

.flower-ring.outer {
    width: 50px;
    height: 50px;
    box-shadow: 0 0 0 2px #9B4B5E;
}

.flower-ring.middle {
    width: 32px;
    height: 32px;
    box-shadow: 0 0 0 2px #6B1B2B;
}

.flower-center {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #8B6F47;
}

.roots {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 60px;
}

.root {
    position: absolute;
    border-bottom: 1px solid rgba(184, 168, 153, 0.4);
    border-left: 1px solid rgba(184, 168, 153, 0.4);
}

.root-1 {
    width: 30px;
    height: 40px;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 0 0 0 40%;
}

.root-2 {
    width: 25px;
    height: 35px;
    top: 5px;
    left: 20%;
    border-radius: 0 0 0 50%;
    transform: rotate(-15deg);
}

.root-3 {
    width: 25px;
    height: 30px;
    top: 5px;
    right: 20%;
    border-left: none;
    border-right: 1px solid rgba(184, 168, 153, 0.4);
    border-radius: 0 0 50% 0;
    transform: rotate(15deg);
}

/* Annotation */
.annotation-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.annotation-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 0.8s ease 0.4s;
}

.specimen-plate.visible .annotation-line {
    stroke-dashoffset: 0;
}

.annotation-label {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    font-style: italic;
    color: #B8A899;
    opacity: 0.5;
    letter-spacing: 0.1em;
    transition: opacity 0.4s ease;
}

/* Marginal Notes */
.marginal-note {
    display: block;
    margin-top: 1.5rem;
    font-style: italic;
    font-size: 0.75rem;
    font-weight: 300;
    color: #B8A899;
    opacity: 0.5;
    line-height: 1.5;
}

/* --- Specimen II: Helianthos Digitalis --- */
.drawing-2 .stem-tall {
    position: absolute;
    width: 8px;
    height: 65%;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(to right, #3A5F3A, #2A4F2A);
    clip-path: polygon(38% 0%, 62% 0%, 54% 100%, 46% 100%);
}

.drawing-2 .leaf-broad-1 {
    width: 70px;
    height: 30px;
    border-radius: 50% 50% 50% 50%;
    top: 40%;
    left: calc(50% + 8px);
    transform: rotate(-30deg);
    opacity: 0.8;
}

.drawing-2 .leaf-broad-2 {
    width: 65px;
    height: 28px;
    border-radius: 50% 50% 50% 50%;
    top: 52%;
    right: calc(50% + 8px);
    transform: rotate(30deg) scaleX(-1);
    opacity: 0.7;
}

.flower-compound {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 70px;
}

.petal {
    position: absolute;
    width: 25px;
    height: 10px;
    background: #9B4B5E;
    border-radius: 50%;
    left: 50%;
    top: 50%;
    transform-origin: 0 50%;
}

.petal-1 { transform: translate(0, -50%) rotate(0deg); }
.petal-2 { transform: translate(0, -50%) rotate(72deg); }
.petal-3 { transform: translate(0, -50%) rotate(144deg); }
.petal-4 { transform: translate(0, -50%) rotate(216deg); }
.petal-5 { transform: translate(0, -50%) rotate(288deg); }

.flower-compound .flower-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #8B6F47;
    z-index: 2;
}

.drawing-2 .roots-deep .root-deep-1 {
    width: 3px;
    height: 50px;
    top: 0;
    left: 45%;
    border-left: 1px solid rgba(184, 168, 153, 0.4);
    border-bottom: 1px solid rgba(184, 168, 153, 0.4);
    border-radius: 0 0 0 60%;
}

.drawing-2 .roots-deep .root-deep-2 {
    width: 3px;
    height: 45px;
    top: 0;
    left: 55%;
    border-right: 1px solid rgba(184, 168, 153, 0.4);
    border-bottom: 1px solid rgba(184, 168, 153, 0.4);
    border-radius: 0 0 60% 0;
}

/* --- Specimen III: Vaccinium Spectrale --- */
.drawing-3 .stem-branch {
    position: absolute;
    width: 5px;
    height: 50%;
    top: 22%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(to right, #3A5F3A, #2A4F2A);
    clip-path: polygon(40% 0%, 60% 0%, 55% 100%, 45% 100%);
}

.drawing-3 .stem-branch-left {
    position: absolute;
    width: 4px;
    height: 25%;
    top: 22%;
    left: calc(50% - 30px);
    background: linear-gradient(to right, #3A5F3A, #2A4F2A);
    transform: rotate(30deg);
    transform-origin: bottom center;
    clip-path: polygon(35% 0%, 65% 0%, 55% 100%, 45% 100%);
}

.drawing-3 .stem-branch-right {
    position: absolute;
    width: 4px;
    height: 25%;
    top: 22%;
    right: calc(50% - 30px);
    background: linear-gradient(to right, #3A5F3A, #2A4F2A);
    transform: rotate(-30deg);
    transform-origin: bottom center;
    clip-path: polygon(35% 0%, 65% 0%, 55% 100%, 45% 100%);
}

.drawing-3 .leaf-small-1 {
    width: 28px; height: 12px;
    border-radius: 60% 40% 60% 40%;
    top: 32%; left: calc(50% + 5px);
    transform: rotate(-20deg); opacity: 0.8;
}
.drawing-3 .leaf-small-2 {
    width: 25px; height: 11px;
    border-radius: 60% 40% 60% 40%;
    top: 40%; right: calc(50% + 5px);
    transform: rotate(20deg) scaleX(-1); opacity: 0.7;
}
.drawing-3 .leaf-small-3 {
    width: 22px; height: 10px;
    border-radius: 60% 40% 60% 40%;
    top: 26%; left: calc(50% - 50px);
    transform: rotate(-35deg); opacity: 0.75;
}
.drawing-3 .leaf-small-4 {
    width: 22px; height: 10px;
    border-radius: 60% 40% 60% 40%;
    top: 26%; right: calc(50% - 50px);
    transform: rotate(35deg) scaleX(-1); opacity: 0.7;
}
.drawing-3 .leaf-small-5 {
    width: 30px; height: 13px;
    border-radius: 60% 40% 60% 40%;
    top: 50%; left: calc(50% + 5px);
    transform: rotate(-15deg); opacity: 0.65;
}

.berry-cluster {
    position: absolute;
    top: 14%;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 40px;
}

.berry {
    position: absolute;
    border-radius: 50%;
    background: #6B1B2B;
}

.berry-1 { width: 12px; height: 12px; top: 5px; left: 24px; }
.berry-2 { width: 10px; height: 10px; top: 0; left: 14px; opacity: 0.8; }
.berry-3 { width: 10px; height: 10px; top: 0; left: 36px; opacity: 0.8; }
.berry-4 { width: 9px; height: 9px; top: 15px; left: 16px; opacity: 0.7; }
.berry-5 { width: 9px; height: 9px; top: 15px; left: 35px; opacity: 0.7; }

.drawing-3 .roots-fibrous {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 50px;
}

.root-f1 { width: 20px; height: 35px; top: 0; left: 30%; border-radius: 0 0 0 50%; }
.root-f2 { width: 18px; height: 30px; top: 0; left: 50%; border-radius: 0 0 0 45%; }
.root-f3 { width: 15px; height: 25px; top: 5px; left: 15%;
    border-left: none; border-right: 1px solid rgba(184, 168, 153, 0.4);
    border-bottom: 1px solid rgba(184, 168, 153, 0.4);
    border-radius: 0 0 45% 0;
}
.root-f4 { width: 15px; height: 28px; top: 3px; left: 65%;
    border-left: none; border-right: 1px solid rgba(184, 168, 153, 0.4);
    border-bottom: 1px solid rgba(184, 168, 153, 0.4);
    border-radius: 0 0 50% 0;
}

/* --- Specimen IV: Filicis Temporalis --- */
.drawing-4 .stem-thick {
    position: absolute;
    width: 10px;
    height: 50%;
    top: 25%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(to right, #3A5F3A, #2A4F2A);
    clip-path: polygon(35% 0%, 65% 0%, 55% 100%, 45% 100%);
}

.frond {
    position: absolute;
    background: #3A5F3A;
    border-left: 1px solid rgba(139, 111, 71, 0.3);
}

.frond-1 {
    width: 55px; height: 8px;
    border-radius: 70% 30% 70% 30%;
    top: 30%; left: calc(50% + 8px);
    transform: rotate(-40deg); opacity: 0.85;
}
.frond-2 {
    width: 50px; height: 7px;
    border-radius: 70% 30% 70% 30%;
    top: 30%; right: calc(50% + 8px);
    transform: rotate(40deg) scaleX(-1); opacity: 0.8;
}
.frond-3 {
    width: 60px; height: 9px;
    border-radius: 70% 30% 70% 30%;
    top: 38%; left: calc(50% + 8px);
    transform: rotate(-35deg); opacity: 0.9;
}
.frond-4 {
    width: 55px; height: 8px;
    border-radius: 70% 30% 70% 30%;
    top: 38%; right: calc(50% + 8px);
    transform: rotate(35deg) scaleX(-1); opacity: 0.75;
}
.frond-5 {
    width: 45px; height: 7px;
    border-radius: 70% 30% 70% 30%;
    top: 46%; left: calc(50% + 8px);
    transform: rotate(-30deg); opacity: 0.7;
}
.frond-6 {
    width: 40px; height: 6px;
    border-radius: 70% 30% 70% 30%;
    top: 46%; right: calc(50% + 8px);
    transform: rotate(30deg) scaleX(-1); opacity: 0.65;
}

.spore-cluster {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 30px;
}

.spore {
    position: absolute;
    border-radius: 50%;
    background: #9B4B5E;
    opacity: 0.6;
}

.spore-1 { width: 6px; height: 6px; top: 5px; left: 22px; }
.spore-2 { width: 5px; height: 5px; top: 2px; left: 12px; }
.spore-3 { width: 5px; height: 5px; top: 2px; left: 33px; }
.spore-4 { width: 4px; height: 4px; top: 12px; left: 18px; }
.spore-5 { width: 4px; height: 4px; top: 12px; left: 30px; }
.spore-6 { width: 3px; height: 3px; top: 18px; left: 24px; }
.spore-7 { width: 3px; height: 3px; top: 8px; left: 8px; opacity: 0.4; }

.rhizome {
    position: absolute;
    bottom: 8%;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 8px;
    background: linear-gradient(to right, transparent, #2A4F2A, #3A5F3A, #2A4F2A, transparent);
    border-radius: 4px;
    opacity: 0.6;
}

/* ==========================================
   Specimen Text
   ========================================== */
.specimen-name {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(2rem, 4.5vw, 3.5rem);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #E8DDD0;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.specimen-description {
    color: #E8DDD0;
    margin-bottom: 1.25rem;
}

.specimen-description:last-child {
    margin-bottom: 0;
}

/* ==========================================
   Interstitial Dividers
   ========================================== */
.interstitial {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin: clamp(3rem, 8vh, 6rem) 0;
    position: relative;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: #8B6F47;
    opacity: 0.25;
}

.divider-numeral {
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid #8B6F47;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    font-weight: 400;
    color: #8B6F47;
    opacity: 0.6;
    flex-shrink: 0;
}

.divider-endcap {
    position: absolute;
    opacity: 0.5;
}

.divider-endcap.left {
    left: 0;
}

.divider-endcap.right {
    right: 0;
}

/* ==========================================
   Telemetry Bar Animations (generated via JS)
   ========================================== */
@keyframes bar-flux-1 { 0% { width: 30%; } 100% { width: 80%; } }
@keyframes bar-flux-2 { 0% { width: 50%; } 100% { width: 95%; } }
@keyframes bar-flux-3 { 0% { width: 20%; } 100% { width: 60%; } }
@keyframes bar-flux-4 { 0% { width: 40%; } 100% { width: 70%; } }
@keyframes bar-flux-5 { 0% { width: 60%; } 100% { width: 100%; } }
@keyframes bar-flux-6 { 0% { width: 25%; } 100% { width: 55%; } }
@keyframes bar-flux-7 { 0% { width: 45%; } 100% { width: 85%; } }
@keyframes bar-flux-8 { 0% { width: 35%; } 100% { width: 75%; } }

/* ==========================================
   Illustration fade-in delay
   ========================================== */
.plate-illustration {
    opacity: 0;
    transition: opacity 0.6s ease 0.4s;
}

.specimen-plate.visible .plate-illustration {
    opacity: 1;
}

/* ==========================================
   Selection color
   ========================================== */
::selection {
    background: #6B1B2B;
    color: #E8DDD0;
}
