/* ==========================================================================
   bada.news - Maritime Editorial Design
   Color Palette:
     #0b1926 - Deep maritime night (primary bg)
     #132d42 - Sonar blue (secondary bg for alternating bands)
     #2a4a5e - Depth-chart blue (separators, borders)
     #3a7ca5 - Signal blue (accents, links, tidal indicators)
     #5a8a9e - Weathered copper (timestamps, metadata)
     #8fa8b8 - Sea-mist (body text)
     #c8d6df - Pale sea-glass (display text, logotype)
     #d4e0e8 - Foam white (primary headlines)
     #1a5276 - Deep signal (hover states)
     #e8c96a - Lighthouse amber (breaking/urgent indicators)
   ========================================================================== */

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

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    background-color: #0b1926;
}

body {
    background-color: #0b1926;
    color: #8fa8b8;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(15px, 1.8vw, 18px);
    line-height: 1.72;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

/* Lighthouse beam sweep - ambient rotating light */
body::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 300vmax;
    height: 300vmax;
    transform: translate(-50%, -50%) rotate(0deg);
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent 179deg,
        rgba(232, 201, 106, 0.03) 180deg,
        rgba(232, 201, 106, 0.03) 182deg,
        transparent 183deg,
        transparent 360deg
    );
    animation: lighthouse-sweep 30s linear infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes lighthouse-sweep {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Fog-grain overlay */
#fog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.02;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

#fog-overlay svg {
    position: absolute;
    width: 0;
    height: 0;
}

/* Tidal gauge scroll indicator */
#tidal-gauge {
    position: fixed;
    right: 0;
    top: 0;
    width: 2px;
    height: 100vh;
    background-color: rgba(42, 74, 94, 0.15);
    z-index: 500;
}

#tidal-gauge-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 2px;
    height: 0%;
    background-color: rgba(58, 124, 165, 0.3);
    transition: height 0.15s ease-out;
}

#tidal-gauge-tick {
    position: absolute;
    right: 0;
    width: 10px;
    height: 2px;
    background-color: #3a7ca5;
    transition: bottom 0.15s ease-out;
    bottom: 0;
}

/* ============================
   Opening Section
   ============================ */
#opening {
    position: relative;
    width: 100vw;
    height: 100vh;
    background-color: #0b1926;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    scroll-snap-align: start;
}

#tideline {
    position: absolute;
    top: 61.8%;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent 0%,
        rgba(58, 124, 165, 0.6) 15%,
        rgba(58, 124, 165, 0.8) 50%,
        rgba(58, 124, 165, 0.6) 85%,
        transparent 100%
    );
    opacity: 0;
    transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#tideline.visible {
    opacity: 0.6;
    animation: tideline-pulse 6s ease-in-out 1.2s infinite;
}

@keyframes tideline-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

#logotype {
    position: absolute;
    top: calc(61.8% - 80px);
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-variant: small-caps;
    letter-spacing: 0.28em;
    font-size: clamp(24px, 4vw, 56px);
    color: #c8d6df;
    opacity: 0;
    transition: opacity 1.8s cubic-bezier(0.16, 1, 0.3, 1);
}

#logotype.visible {
    opacity: 1;
}

#dateline {
    position: absolute;
    top: calc(61.8% + 20px);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(11px, 1.2vw, 13px);
    color: #5a8a9e;
    letter-spacing: 0.12em;
    opacity: 0;
    transition: opacity 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

#dateline.visible {
    opacity: 1;
}

/* ============================
   Tidal Bands
   ============================ */
.tidal-snap {
    scroll-snap-align: start;
}

.tidal-band {
    position: relative;
    width: 100%;
    z-index: 2;
}

/* Fibonacci ratio 8:5:3:2:1 with base unit 12.5vh */
#band-1 {
    min-height: 100vh;
    background-color: #0b1926;
}

#band-2 {
    min-height: 62.5vh;
    background-color: #132d42;
}

#band-3 {
    min-height: 37.5vh;
    background-color: #0b1926;
}

#band-4 {
    min-height: 25vh;
    background-color: #132d42;
}

#band-5 {
    min-height: 12.5vh;
    background-color: #0b1926;
}

.band-content {
    padding: clamp(48px, 8vh, 120px) 12% clamp(48px, 8vh, 120px) 12%;
    max-width: 100%;
}

/* ============================
   Story blocks
   ============================ */
.story {
    margin-bottom: clamp(48px, 6vh, 96px);
}

.story:last-child {
    margin-bottom: 0;
}

.story-reveal .timestamp,
.story-reveal .headline,
.story-reveal .body-text {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1),
                transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.story-reveal.revealed .timestamp {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0s;
}

.story-reveal.revealed .headline {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.4s;
}

.story-reveal.revealed .body-text {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.7s;
}

/* Timestamp - maritime logbook style */
.timestamp {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(11px, 1.2vw, 13px);
    color: #5a8a9e;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

/* Headlines */
.headline {
    font-family: 'Source Serif 4', serif;
    color: #d4e0e8;
    margin-bottom: 16px;
    max-width: 65ch;
    line-height: 1.3;
}

.headline-primary {
    font-weight: 600;
    font-size: clamp(20px, 3vw, 40px);
    color: #d4e0e8;
}

.headline-secondary {
    font-weight: 400;
    font-size: clamp(16px, 2vw, 28px);
    color: #c8d6df;
}

/* Body text */
.body-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(15px, 1.8vw, 18px);
    line-height: 1.72;
    color: #8fa8b8;
    max-width: 65ch;
}

/* ============================
   Tideline separators
   ============================ */
.tideline-separator {
    width: 100%;
    height: 1px;
    background: linear-gradient(
        to right,
        #2a4a5e 0%,
        rgba(42, 74, 94, 0.6) 40%,
        rgba(42, 74, 94, 0.2) 70%,
        transparent 100%
    );
    z-index: 2;
    position: relative;
}

/* ============================
   SVG Wave Interstitials
   ============================ */
.wave-interstitial {
    width: 100%;
    padding: clamp(24px, 4vh, 60px) 0;
    position: relative;
    z-index: 2;
    overflow: hidden;
}

.wave-interstitial svg {
    width: 100%;
    height: 80px;
    display: block;
}

.wave-path {
    fill: none;
    stroke: #3a7ca5;
    stroke-width: 0.75;
    stroke-opacity: 0.15;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 3s ease-in-out;
}

.wave-interstitial.animating .wave-path {
    stroke-dashoffset: 0;
}

/* Staggered delays for cascading draw effect */
.wave-interstitial.animating .wave-path:nth-child(1) { transition-delay: 0s; }
.wave-interstitial.animating .wave-path:nth-child(2) { transition-delay: 0.3s; }
.wave-interstitial.animating .wave-path:nth-child(3) { transition-delay: 0.6s; }
.wave-interstitial.animating .wave-path:nth-child(4) { transition-delay: 0.9s; }
.wave-interstitial.animating .wave-path:nth-child(5) { transition-delay: 1.2s; }

/* ============================
   Lateral drift indicators (tide gauge per band)
   ============================ */
.tidal-band::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 0;
    width: 2px;
    height: 100%;
    background-color: rgba(58, 124, 165, 0.1);
}

/* ============================
   End mark
   ============================ */
#end-mark {
    padding: clamp(48px, 8vh, 120px) 12%;
    text-align: center;
    z-index: 2;
    position: relative;
}

.end-signal {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(11px, 1.2vw, 13px);
    color: #2a4a5e;
    letter-spacing: 0.2em;
}

/* ============================
   Links (signal blue with hover)
   ============================ */
a {
    color: #3a7ca5;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #1a5276;
}

/* ============================
   Breaking/Urgent indicator
   ============================ */
.breaking .timestamp::before {
    content: '\25CF';
    color: #e8c96a;
    margin-right: 8px;
    font-size: 8px;
    vertical-align: middle;
}

/* ============================
   Responsive: < 768px
   ============================ */
@media (max-width: 768px) {
    .band-content {
        padding-left: 6%;
        padding-right: 6%;
    }

    /* Equal height bands on mobile */
    #band-1,
    #band-2,
    #band-3,
    #band-4,
    #band-5 {
        min-height: auto;
    }

    /* Hide wave interstitials on mobile */
    .wave-interstitial {
        display: none;
    }

    /* Disable lighthouse beam on mobile */
    body::after {
        display: none;
    }

    /* Adjust logotype positioning */
    #logotype {
        top: calc(61.8% - 60px);
    }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    body::after {
        display: none;
    }

    .wave-interstitial {
        display: none;
    }

    #tideline {
        animation: none;
        opacity: 0.6;
    }

    .story-reveal .timestamp,
    .story-reveal .headline,
    .story-reveal .body-text {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ============================
   Selection styling
   ============================ */
::selection {
    background-color: rgba(58, 124, 165, 0.3);
    color: #d4e0e8;
}

/* ============================
   Scrollbar styling - hidden for editorial purity
   ============================ */
::-webkit-scrollbar {
    width: 0px;
}

body {
    scrollbar-width: none;
}
