/* ============================
   simidiots.net — Styles
   Ocean Deep / HUD Overlay
   ============================ */

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

:root {
    --abyss: #0a1628;
    --midnight: #0b1a2e;
    --trench: #162d50;
    --bathyal: #0d2240;
    --specimen-glass: #2a5070;
    --annotation-ink: #4a7c9b;
    --bioluminescent: #5a8fa8;
    --reading-light: #94b8d0;
    --surface-glow: #c8dce8;
    --foam-white: #e8f0f5;
    --coral-accent: #d4856a;
    --sea-lavender: #8b6fad;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--abyss);
    color: var(--reading-light);
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    font-weight: 360;
    font-optical-sizing: auto;
    line-height: 1.72;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Opening Overlay --- */
#opening-overlay {
    position: fixed;
    inset: 0;
    background: var(--abyss);
    z-index: 1000;
    pointer-events: none;
    opacity: 1;
    transition: opacity 1200ms ease-out;
}

#opening-overlay.faded {
    opacity: 0;
}

/* --- Ocean Background --- */
#ocean-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: linear-gradient(
        170deg,
        var(--midnight) 0%,
        var(--trench) 40%,
        var(--bathyal) 70%,
        var(--midnight) 100%
    );
    background-size: 200% 200%;
    animation: oceanShift 30s ease-in-out infinite alternate;
}

@keyframes oceanShift {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

/* --- Bokeh Particles --- */
#bokeh-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.bokeh-particle {
    position: absolute;
    border-radius: 50%;
    will-change: transform, opacity;
    pointer-events: none;
    opacity: 0;
    transition: opacity 600ms ease-out;
}

.bokeh-particle.visible {
    opacity: 1;
}

/* --- HUD Frame --- */
#hud-frame {
    position: fixed;
    inset: 5vw;
    z-index: 10;
    pointer-events: none;
}

#hud-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#hud-lines .hud-line {
    stroke: var(--annotation-ink);
    stroke-opacity: 0.4;
    stroke-width: 1;
    stroke-dasharray: 2828;
    stroke-dashoffset: 2828;
    transition: stroke-dashoffset 800ms ease-out;
}

#hud-lines.drawn .hud-line {
    stroke-dashoffset: 0;
}

/* Corner Ornaments */
.corner-ornament {
    position: absolute;
    width: 40px;
    height: 40px;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 400ms ease-out, transform 400ms ease-out;
}

.corner-ornament.visible {
    opacity: 1;
    transform: scale(1);
}

.corner-ornament:hover path {
    stroke: var(--sea-lavender);
    transition: stroke 800ms ease;
}

.corner-ornament:hover circle {
    stroke: var(--sea-lavender);
    transition: stroke 800ms ease;
}

.top-left { top: -4px; left: -4px; }
.top-right { top: -4px; right: -4px; }
.bottom-left { bottom: -4px; left: -4px; }
.bottom-right { bottom: -4px; right: -4px; }

/* --- Top Navigation Bar --- */
#top-bar {
    position: fixed;
    top: 5vw;
    left: 5vw;
    right: 5vw;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 20;
    padding: 0 24px;
    opacity: 0;
    transition: opacity 600ms ease-out;
}

#top-bar.visible {
    opacity: 1;
}

#site-name {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1rem;
    font-weight: 300;
    font-variation-settings: 'WONK' 0, 'opsz' 72;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--surface-glow);
}

#site-name .char {
    display: inline-block;
    font-variation-settings: 'WONK' 1, 'opsz' 72;
    opacity: 0;
    transition: font-variation-settings 600ms ease-out, opacity 300ms ease-out;
}

#site-name .char.revealed {
    font-variation-settings: 'WONK' 0, 'opsz' 72;
    opacity: 1;
}

#nav-links {
    display: flex;
    gap: 28px;
}

#nav-links a {
    font-family: 'Recursive', monospace;
    font-variation-settings: 'CASL' 1, 'MONO' 1;
    font-size: clamp(0.72rem, 0.85vw, 0.82rem);
    color: var(--bioluminescent);
    text-decoration: none;
    background-image: linear-gradient(var(--annotation-ink), var(--annotation-ink));
    background-size: 0% 1px;
    background-repeat: no-repeat;
    background-position: left bottom;
    transition: background-size 300ms ease;
    padding-bottom: 2px;
}

#nav-links a:hover {
    background-size: 100% 1px;
}

/* --- Data Readouts --- */
.data-readout {
    position: fixed;
    z-index: 15;
    font-family: 'Recursive', monospace;
    font-variation-settings: 'CASL' 1, 'MONO' 1;
    font-size: clamp(0.65rem, 0.75vw, 0.75rem);
    color: var(--bioluminescent);
    opacity: 0;
    animation: readoutPulse 4s ease-in-out infinite;
    cursor: pointer;
    pointer-events: auto;
}

.data-readout.visible {
    opacity: 1;
}

@keyframes readoutPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.9; }
}

.data-readout.visible {
    animation: readoutPulse 4s ease-in-out infinite;
}

.readout-label {
    display: block;
    color: var(--annotation-ink);
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.readout-value {
    font-size: 1.1rem;
    color: var(--surface-glow);
    font-weight: 600;
}

.readout-value.scrambling {
    color: var(--coral-accent);
}

.readout-left {
    left: calc(5vw + 12px);
    bottom: calc(5vw + 60px);
}

.readout-right {
    right: calc(5vw + 12px);
    top: calc(5vw + 70px);
}

.readout-bottom {
    right: calc(5vw + 12px);
    bottom: calc(5vw + 60px);
}

/* --- Content Area --- */
#content-area {
    position: relative;
    z-index: 5;
    padding: calc(5vw + 60px) 5vw 5vw;
    max-width: 100vw;
}

/* --- Observation Cards --- */
.observation-card {
    margin-bottom: 15vh;
    opacity: 0;
    transform: scaleY(0.02);
    transform-origin: center top;
    transition: opacity 500ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.observation-card.morphed {
    opacity: 1;
    transform: scaleY(1);
}

.card-left {
    width: 55%;
    margin-left: calc(5vw + 20px);
}

.card-right {
    width: 45%;
    margin-left: auto;
    margin-right: calc(5vw + 20px);
}

.card-inner {
    background: rgba(10, 22, 40, 0.85);
    border: 1px solid var(--specimen-glass);
    border-radius: 8px;
    padding: 2.5rem 2.8rem;
    opacity: 0;
    transition: opacity 300ms ease-out 500ms;
}

.observation-card.morphed .card-inner {
    opacity: 1;
}

.card-heading {
    font-family: 'Fraunces', Georgia, serif;
    font-size: clamp(2.4rem, 6vw, 5.5rem);
    font-weight: 300;
    font-variation-settings: 'WONK' 0, 'opsz' 72;
    color: var(--surface-glow);
    letter-spacing: 0.02em;
    line-height: 1.15;
    margin-bottom: 1.2rem;
    transition: font-variation-settings 800ms ease-in-out;
    cursor: default;
}

.card-heading:hover {
    font-variation-settings: 'WONK' 1, 'opsz' 72;
}

.card-body {
    color: var(--reading-light);
    max-width: 38em;
    margin-bottom: 1.4rem;
}

.card-annotation {
    font-family: 'Recursive', monospace;
    font-variation-settings: 'CASL' 1, 'MONO' 1;
    font-size: clamp(0.72rem, 0.85vw, 0.82rem);
    color: var(--bioluminescent);
    opacity: 0.8;
}

/* --- Section Dividers --- */
.section-divider {
    display: flex;
    justify-content: center;
    margin: 4vh 0;
    opacity: 0.6;
}

.divider-ornament {
    width: 200px;
    height: 24px;
}

/* --- Specimen Drawers --- */
.specimen-drawer {
    margin: 8vh auto;
    width: calc(100% - 10vw - 40px);
    margin-left: calc(5vw + 20px);
}

.drawer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 24px;
    background: rgba(10, 22, 40, 0.7);
    border: 1px solid var(--specimen-glass);
    border-radius: 4px;
    cursor: pointer;
    transition: background 400ms ease, border-radius 400ms ease;
}

.drawer-bar:hover {
    background: rgba(10, 22, 40, 0.8);
}

.specimen-drawer.open .drawer-bar {
    background: rgba(10, 22, 40, 0.9);
    border-radius: 8px 8px 0 0;
}

.drawer-label {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 300;
    font-size: 1.1rem;
    font-variation-settings: 'WONK' 0, 'opsz' 48;
    color: var(--surface-glow);
    letter-spacing: 0.02em;
    transition: font-variation-settings 600ms ease;
}

.drawer-bar:hover .drawer-label {
    font-variation-settings: 'WONK' 1, 'opsz' 48;
}

.drawer-indicator {
    font-family: 'Recursive', monospace;
    font-size: 1.2rem;
    color: var(--annotation-ink);
    transition: transform 300ms ease;
}

.specimen-drawer.open .drawer-indicator {
    transform: rotate(45deg);
}

.drawer-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.specimen-drawer.open .drawer-content {
    max-height: 600px;
}

.drawer-inner {
    background: rgba(10, 22, 40, 0.9);
    border: 1px solid var(--specimen-glass);
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 2rem 2.4rem;
    display: grid;
    grid-template-columns: 1fr 180px;
    grid-template-rows: auto auto;
    gap: 1rem 2rem;
    opacity: 0;
    transition: opacity 400ms ease-out 200ms;
}

.specimen-drawer.open .drawer-inner {
    opacity: 1;
}

.drawer-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.4rem;
    font-weight: 300;
    font-variation-settings: 'WONK' 0, 'opsz' 48;
    color: var(--surface-glow);
    grid-column: 1 / -1;
    margin-bottom: 0.5rem;
}

.drawer-text {
    color: var(--reading-light);
    max-width: 38em;
}

.drawer-margin-note {
    font-family: 'Recursive', monospace;
    font-variation-settings: 'CASL' 1, 'MONO' 1;
    font-size: clamp(0.72rem, 0.85vw, 0.82rem);
    color: var(--bioluminescent);
    opacity: 0.8;
    line-height: 2;
    align-self: start;
    border-left: 1px solid var(--specimen-glass);
    padding-left: 16px;
}

.margin-label {
    color: var(--annotation-ink);
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
}

.bottom-spacer {
    height: 20vh;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .card-left, .card-right {
        width: calc(100% - 10vw);
        margin-left: 5vw;
        margin-right: 5vw;
    }

    .drawer-inner {
        grid-template-columns: 1fr;
    }

    .drawer-margin-note {
        border-left: none;
        border-top: 1px solid var(--specimen-glass);
        padding-left: 0;
        padding-top: 12px;
    }

    #nav-links {
        gap: 16px;
    }

    .data-readout {
        display: none;
    }
}
