/* =====================================================
   lungless.dev - Styles
   Skeuomorphic instrument panel + organic-flow layout
   ===================================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #F5E8D5;
    color: #3A2818;
    font-family: 'Merriweather', Georgia, serif;
    font-weight: 400;
    font-size: clamp(14px, 1vw, 17px);
    line-height: 1.75;
    overflow-x: hidden;
}

/* --- Typography --- */
h2 {
    font-family: 'Hanken Grotesk', 'Arial', sans-serif;
    font-weight: 600;
    font-size: clamp(24px, 3.5vw, 44px);
    color: #3A2818;
    margin-bottom: 0.75em;
    line-height: 1.2;
}

p {
    margin-bottom: 1.25em;
}

p strong {
    font-weight: 700;
    color: #6B4A2A;
}

/* =====================================================
   INSTRUMENT PANEL HEADER
   ===================================================== */
#instrument-panel {
    position: relative;
    width: 100%;
    height: 120px;
    overflow: hidden;
    z-index: 10;
}

.panel-bar {
    position: relative;
    width: 100%;
    height: 100%;
    /* Wood grain texture via CSS gradient */
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 3px,
            rgba(58, 40, 24, 0.04) 3px,
            rgba(58, 40, 24, 0.04) 4px
        ),
        repeating-linear-gradient(
            87deg,
            transparent,
            transparent 7px,
            rgba(58, 40, 24, 0.03) 7px,
            rgba(58, 40, 24, 0.03) 8px
        ),
        linear-gradient(180deg, #7a5a36 0%, #6B4A2A 30%, #5d3f22 70%, #4e3419 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    padding: 0 40px;
    /* Slide down animation */
    transform: translateY(-100%);
    animation: panelSlideDown 100ms ease-out 0ms forwards;
}

@keyframes panelSlideDown {
    to { transform: translateY(0); }
}

/* Glass overlay on panel */
.glass-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0) 60%);
    pointer-events: none;
}

/* --- Brass Rivets --- */
.rivet {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #e8c85a, #C4A040 50%, #9a7830 100%);
    box-shadow:
        inset 0 1px 2px rgba(255,255,255,0.4),
        inset 0 -1px 2px rgba(0,0,0,0.3),
        0 1px 3px rgba(0,0,0,0.4);
    flex-shrink: 0;
    transform: scale(0);
    animation: rivetPop 200ms ease-out forwards;
}

.rivet-1 { animation-delay: 100ms; }
.rivet-2 { animation-delay: 150ms; }
.rivet-3 { animation-delay: 200ms; }
.rivet-4 { animation-delay: 250ms; }

@keyframes rivetPop {
    0% { transform: scale(0); }
    70% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* --- Decorative Dials --- */
.dial {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.dial-face {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 45%, #f0e8d8 0%, #d8cbb8 60%, #bfb09a 100%);
    border: 2px solid #C4A040;
    box-shadow:
        inset 0 2px 6px rgba(0,0,0,0.15),
        0 1px 3px rgba(0,0,0,0.3);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dial-label {
    font-family: 'Overpass Mono', monospace;
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: #6B4A2A;
    position: absolute;
    bottom: 12px;
}

.dial-needle {
    position: absolute;
    width: 2px;
    height: 18px;
    background: #3A2818;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(-25deg);
    border-radius: 1px;
}

.dial-left .dial-needle {
    animation: needleWobble1 4s ease-in-out infinite;
}

.dial-right .dial-needle {
    animation: needleWobble2 5s ease-in-out infinite;
}

@keyframes needleWobble1 {
    0%, 100% { transform: translateX(-50%) rotate(-25deg); }
    30% { transform: translateX(-50%) rotate(-15deg); }
    60% { transform: translateX(-50%) rotate(-30deg); }
}

@keyframes needleWobble2 {
    0%, 100% { transform: translateX(-50%) rotate(10deg); }
    40% { transform: translateX(-50%) rotate(25deg); }
    70% { transform: translateX(-50%) rotate(5deg); }
}

/* --- Central Gauge --- */
.gauge {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gauge-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px double #C4A040;
    box-shadow:
        inset 0 0 8px rgba(0,0,0,0.2),
        0 0 6px rgba(196,160,64,0.3);
    /* Draw border animation */
    clip-path: circle(0% at 50% 0%);
    animation: gaugeDrawBorder 400ms ease-out 300ms forwards;
}

@keyframes gaugeDrawBorder {
    to { clip-path: circle(75% at 50% 50%); }
}

.gauge-inner {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 40%, #F5E8D5 0%, #e8dcc8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.logotype {
    font-family: 'Hanken Grotesk', 'Arial', sans-serif;
    font-weight: 700;
    font-size: 11px;
    color: #3A2818;
    letter-spacing: 0.02em;
    opacity: 0;
    animation: logotypeFadeIn 300ms ease-out 700ms forwards;
}

@keyframes logotypeFadeIn {
    to { opacity: 1; }
}

/* =====================================================
   ORGANIC-FLOW MAIN CONTENT
   ===================================================== */
#organic-flow {
    padding: 60px 20px 80px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

/* --- Flow Blocks --- */
.flow-block {
    margin-left: var(--flow-offset, 5%);
    width: var(--flow-width, 70%);
    margin-bottom: 60px;
    position: relative;
}

/* --- Border-Animate Box --- */
.border-animate-box {
    padding: 30px 35px;
    position: relative;
    background:
        /* Top border */
        linear-gradient(#C4A040, #C4A040) top left / 0% 2px no-repeat,
        /* Right border */
        linear-gradient(#C4A040, #C4A040) top right / 2px 0% no-repeat,
        /* Bottom border */
        linear-gradient(#C4A040, #C4A040) bottom right / 0% 2px no-repeat,
        /* Left border */
        linear-gradient(#C4A040, #C4A040) bottom left / 2px 0% no-repeat;
    background-color: transparent;
    transition:
        background-size 800ms ease;
}

.border-animate-box.animate-in {
    background:
        linear-gradient(#C4A040, #C4A040) top left / 100% 2px no-repeat,
        linear-gradient(#C4A040, #C4A040) top right / 2px 100% no-repeat,
        linear-gradient(#C4A040, #C4A040) bottom right / 100% 2px no-repeat,
        linear-gradient(#C4A040, #C4A040) bottom left / 2px 100% no-repeat;
    background-color: transparent;
    /* Using individual transition delays for sequential drawing */
    transition:
        background-size 800ms ease;
}

/* Sequential border drawing: We use pseudo-elements for precise per-side control */
.border-animate-box::before,
.border-animate-box::after {
    content: '';
    position: absolute;
    pointer-events: none;
}

/* We override the approach: use 4 background layers with transition delays via JS class */

/* --- Bio Illustrations (SVG) --- */
.bio-illustration {
    margin-bottom: 15px;
}

.bio-illustration.float-left {
    float: left;
    margin-right: 25px;
    margin-bottom: 10px;
    shape-outside: margin-box;
}

.bio-illustration.float-right {
    float: right;
    margin-left: 25px;
    margin-bottom: 10px;
    shape-outside: margin-box;
}

.section-content {
    overflow: hidden;
}

.section-content::after {
    content: '';
    display: table;
    clear: both;
}

/* =====================================================
   TROPICAL FISH EASTER EGGS
   ===================================================== */
#fish-tank {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.tropical-fish {
    position: absolute;
    right: -60px;
    animation: swimAcross 12s linear forwards, swimBob 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes swimAcross {
    0% { right: -60px; }
    100% { right: calc(100% + 60px); }
}

@keyframes swimBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* Fish color variants */
.fish-coral svg { fill: #E87060; }
.fish-teal svg { fill: #408888; }
.fish-gold svg { fill: #C4A040; }

/* =====================================================
   FOOTER
   ===================================================== */
#site-footer {
    padding: 0 20px 30px;
}

.footer-panel {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 16px 30px;
    /* Wood texture like header */
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 3px,
            rgba(58, 40, 24, 0.04) 3px,
            rgba(58, 40, 24, 0.04) 4px
        ),
        linear-gradient(180deg, #7a5a36 0%, #6B4A2A 50%, #5d3f22 100%);
    border-radius: 6px;
}

.footer-rivet {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #e8c85a, #C4A040 50%, #9a7830 100%);
    box-shadow:
        inset 0 1px 1px rgba(255,255,255,0.3),
        inset 0 -1px 1px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.footer-text {
    font-family: 'Overpass Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.05em;
    color: #F5E8D5;
    text-align: center;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
    .flow-block {
        margin-left: 3% !important;
        width: 94% !important;
    }

    .border-animate-box {
        padding: 20px;
    }

    .bio-illustration {
        float: none !important;
        display: block;
        margin: 0 auto 20px !important;
        shape-outside: none !important;
    }

    .bio-illustration.float-left,
    .bio-illustration.float-right {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    #instrument-panel {
        height: 100px;
    }

    .dial {
        width: 45px;
        height: 45px;
    }

    .gauge {
        width: 70px;
        height: 70px;
    }

    .gauge-inner {
        width: 60px;
        height: 60px;
    }

    .logotype {
        font-size: 9px;
    }

    .panel-bar {
        gap: 15px;
        padding: 0 15px;
    }
}

@media (max-width: 480px) {
    .dial {
        display: none;
    }

    .rivet-2, .rivet-3 {
        display: none;
    }
}
