/* ============================================
   lupin.day - Botanical HUD Monitoring System
   Palette: Burgundy-Cream
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 1vw, 17px);
    line-height: 1.7;
    color: #3A1520;
    background-color: #F5E0D5;
    overflow-x: hidden;
    position: relative;
}

/* --- Botanical Background Layer --- */
.botanical-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    animation: fadeInBotanical 800ms ease-out forwards;
}

@keyframes fadeInBotanical {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lupine-svg {
    position: absolute;
}

.lupine-svg path[stroke="#5A7A50"] {
    stroke: #5A7A50;
}

.lupine-left {
    left: 5%;
    top: 10%;
    width: 180px;
    height: 540px;
    opacity: 0.6;
}

.lupine-right {
    right: 5%;
    top: 5%;
    width: 200px;
    height: 600px;
    opacity: 0.55;
}

.lupine-center {
    left: 50%;
    top: 25%;
    transform: translateX(-50%);
    width: 140px;
    height: 450px;
    opacity: 0.3;
}

/* --- Waveform Layer --- */
.waveform-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.waveform {
    position: absolute;
    width: 100%;
    height: 40px;
}

.waveform-top {
    top: 45%;
}

.waveform-bottom {
    top: 75%;
}

.waveform-separator {
    width: 90%;
    max-width: 800px;
    margin: 30px auto;
    height: 30px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.waveform-separator.visible {
    opacity: 1;
    transform: translateY(0);
}

.waveform-separator svg {
    width: 100%;
    height: 100%;
}

/* --- Scanline Overlay --- */
.scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(114, 47, 55, 0.015) 3px,
        rgba(114, 47, 55, 0.015) 4px
    );
}

/* --- Hero Viewport --- */
.hero-viewport {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    overflow: hidden;
}

/* --- HUD Panels --- */
.hud-panel {
    position: relative;
    background: rgba(245, 224, 213, 0.85);
    border: 1px solid rgba(114, 47, 55, 0.6);
    transform: rotate(var(--panel-rotation, 0deg));
    padding: 20px 24px;
    opacity: 0;
}

.hud-panel.animate-in {
    animation: panelSlideIn 600ms cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* --- HUD Corner Brackets --- */
.hud-bracket {
    position: absolute;
    width: 12px;
    height: 12px;
    pointer-events: none;
}

.hud-bracket::before,
.hud-bracket::after {
    content: '';
    position: absolute;
    background: #722F37;
}

.hud-bracket-tl {
    top: -1px;
    left: -1px;
}
.hud-bracket-tl::before {
    top: 0;
    left: 0;
    width: 12px;
    height: 1.5px;
    transform-origin: left;
    transform: scaleX(0);
}
.hud-bracket-tl::after {
    top: 0;
    left: 0;
    width: 1.5px;
    height: 12px;
    transform-origin: top;
    transform: scaleY(0);
}

.hud-bracket-tr {
    top: -1px;
    right: -1px;
}
.hud-bracket-tr::before {
    top: 0;
    right: 0;
    width: 12px;
    height: 1.5px;
    transform-origin: right;
    transform: scaleX(0);
}
.hud-bracket-tr::after {
    top: 0;
    right: 0;
    width: 1.5px;
    height: 12px;
    transform-origin: top;
    transform: scaleY(0);
}

.hud-bracket-bl {
    bottom: -1px;
    left: -1px;
}
.hud-bracket-bl::before {
    bottom: 0;
    left: 0;
    width: 12px;
    height: 1.5px;
    transform-origin: left;
    transform: scaleX(0);
}
.hud-bracket-bl::after {
    bottom: 0;
    left: 0;
    width: 1.5px;
    height: 12px;
    transform-origin: bottom;
    transform: scaleY(0);
}

.hud-bracket-br {
    bottom: -1px;
    right: -1px;
}
.hud-bracket-br::before {
    bottom: 0;
    right: 0;
    width: 12px;
    height: 1.5px;
    transform-origin: right;
    transform: scaleX(0);
}
.hud-bracket-br::after {
    bottom: 0;
    right: 0;
    width: 1.5px;
    height: 12px;
    transform-origin: bottom;
    transform: scaleY(0);
}

/* Bracket draw animation */
.hud-panel.animate-in .hud-bracket::before,
.hud-panel.animate-in .hud-bracket::after {
    animation: bracketDraw 300ms ease-out forwards;
    animation-delay: 600ms;
}

@keyframes bracketDraw {
    to {
        transform: scaleX(1) scaleY(1);
    }
}

/* --- Panel Slide-in Animations (from edges) --- */
@keyframes panelSlideIn {
    from {
        opacity: 0;
        transform: rotate(var(--panel-rotation, 0deg)) translateX(var(--slide-from, -40px));
    }
    to {
        opacity: 1;
        transform: rotate(var(--panel-rotation, 0deg)) translateX(0);
    }
}

/* Hero panel positions */
.hud-logotype {
    position: absolute;
    top: 40px;
    left: 40px;
    --slide-from: -60px;
    z-index: 10;
}

.hud-status {
    position: absolute;
    top: 40px;
    right: 40px;
    --slide-from: 60px;
    text-align: right;
    z-index: 10;
}

.hud-readout-bl {
    position: absolute;
    bottom: 50px;
    left: 40px;
    --slide-from: -60px;
    z-index: 10;
}

/* --- Reticule Crosshair --- */
.reticule-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    opacity: 0;
    animation: fadeInReticule 1000ms ease-out 400ms forwards;
}

@keyframes fadeInReticule {
    from { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* --- Typography --- */
.logotype {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(28px, 4vw, 48px);
    color: #3A1520;
    letter-spacing: 0.02em;
    line-height: 1.2;
    margin-bottom: 6px;
}

.panel-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: clamp(22px, 3vw, 40px);
    color: #3A1520;
    margin-bottom: 16px;
    line-height: 1.3;
}

.panel-body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 1vw, 17px);
    color: #3A1520;
    line-height: 1.7;
    margin-bottom: 16px;
}

.hud-data {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: rgba(114, 47, 55, 0.8);
    display: block;
    line-height: 1.8;
}

.hud-data-highlight {
    color: #D4A848;
}

/* --- Content Section --- */
.content-section {
    position: relative;
    z-index: 2;
    padding: 60px 20px 80px;
    max-width: 900px;
    margin: 0 auto;
}

.content-panel {
    margin-bottom: 20px;
    --slide-from: 0px;
}

.content-panel:nth-child(odd) {
    --slide-from: -40px;
}

.content-panel:nth-child(even) {
    --slide-from: 40px;
}

.panel-data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(114, 47, 55, 0.15);
}

.panel-data-row .hud-data {
    display: inline;
}

/* --- Metrics Grid --- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 16px;
}

.metric-item {
    text-align: center;
}

.metric-value {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(28px, 3vw, 42px);
    color: #722F37;
    display: block;
    line-height: 1.2;
}

.metric-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.06em;
    color: rgba(114, 47, 55, 0.6);
    text-transform: uppercase;
    display: block;
    margin-top: 4px;
}

/* --- Log Entries --- */
.log-entries {
    margin-bottom: 12px;
}

.log-entry {
    display: flex;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(114, 47, 55, 0.1);
    align-items: baseline;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-timestamp {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: #D4A848;
    white-space: nowrap;
    flex-shrink: 0;
}

.log-message {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(13px, 0.9vw, 15px);
    color: #3A1520;
    line-height: 1.5;
}

/* --- Species Grid --- */
.species-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.species-card {
    text-align: center;
    padding: 16px 8px;
    border: 1px solid rgba(114, 47, 55, 0.15);
    background: rgba(245, 224, 213, 0.5);
    transition: border-color 0.3s ease, background 0.3s ease;
}

.species-card:hover {
    border-color: #C87088;
    background: rgba(245, 224, 213, 0.9);
}

.species-icon {
    width: 60px;
    height: 80px;
    margin: 0 auto 10px;
}

.species-icon svg {
    width: 100%;
    height: 100%;
}

.species-name {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 15px;
    color: #3A1520;
    display: block;
    margin-bottom: 4px;
    font-style: italic;
}

.species-card .hud-data {
    font-size: 9px;
    text-align: center;
}

/* --- Footer --- */
.footer-panel {
    position: relative;
    z-index: 2;
    max-width: 900px;
    margin: 0 auto 60px;
    padding: 20px 24px;
    --panel-rotation: 0deg;
    --slide-from: 0px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.footer-content .hud-data {
    display: inline;
}

/* --- Glitch Effect --- */
@keyframes glitchShake {
    0% {
        transform: rotate(var(--panel-rotation, 0deg)) translateX(0);
        clip-path: none;
    }
    25% {
        transform: rotate(var(--panel-rotation, 0deg)) translateX(2px);
        clip-path: inset(30% 0 60% 0);
    }
    50% {
        transform: rotate(var(--panel-rotation, 0deg)) translateX(-1px);
        clip-path: inset(10% 0 80% 0);
    }
    75% {
        transform: rotate(var(--panel-rotation, 0deg)) translateX(2px);
        clip-path: inset(50% 0 30% 0);
    }
    100% {
        transform: rotate(var(--panel-rotation, 0deg)) translateX(0);
        clip-path: none;
    }
}

.hud-panel.glitching {
    animation: glitchShake 0.15s steps(2) forwards;
}

/* Glitch scanline flash */
.hud-panel.glitching::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: #FFFFFF;
    animation: scanlineFlash 0.15s linear forwards;
    z-index: 100;
}

@keyframes scanlineFlash {
    from { top: 0; opacity: 0.8; }
    to { top: 100%; opacity: 0; }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hud-logotype {
        top: 20px;
        left: 20px;
    }

    .hud-status {
        top: 20px;
        right: 20px;
        padding: 12px 16px;
    }

    .hud-readout-bl {
        bottom: 30px;
        left: 20px;
    }

    .content-section {
        padding: 40px 16px 60px;
    }

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

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

    .lupine-left {
        width: 120px;
        height: 360px;
        left: 2%;
    }

    .lupine-right {
        width: 130px;
        height: 400px;
        right: 2%;
    }

    .lupine-center {
        display: none;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .panel-data-row {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .hud-logotype {
        top: 16px;
        left: 16px;
        padding: 14px 18px;
    }

    .hud-status {
        top: 16px;
        right: 16px;
        padding: 10px 14px;
    }

    .hud-readout-bl {
        bottom: 20px;
        left: 16px;
        padding: 10px 14px;
    }

    .hud-panel {
        padding: 16px 18px;
    }

    .logotype {
        font-size: 24px;
    }

    .species-grid {
        grid-template-columns: 1fr 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr 1fr;
    }

    .log-entry {
        flex-direction: column;
        gap: 2px;
    }
}
