/* =============================================
   bada.news - Deep Ocean News Portal
   ============================================= */

/* --- Palette tokens (from DESIGN.md) --- */
:root {
    --sunlit-surface: #e8f4f8;
    --caustic-aqua: #87ceeb;
    --photic-blue: #b8e6f0;
    --mesopelagic-teal: #1b4965;
    --bathypelagic-slate: #1b3a4b;
    --midnight-ink: #0d2137;
    --abyssal-navy: #0a1628;
    --hadal-black: #080f1a;
    --bioluminescent-cyan: #00f5d4;
    --sonar-blue: #00b4d8;
    --signal-turquoise: #5fa8d3;
    --specimen-cream: #f0ead2;
    --ink-dark: #2b2d42;
    --coral-accent: #ff6b6b;
    --steel-border: #1a3a4a;
    --porthole-silver: #8d99ae;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    line-height: 1.75;
    color: #2b2d42;
    background: #e8f4f8;
    overflow-x: hidden;
}

/* --- Typography --- */
h1, h2, h3, h4 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    line-height: 1.2;
}

.zone-tag {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #00b4d8;
    display: block;
}

.meta-mono,
.anno-date,
.anno-author,
.anno-zone,
.specimen-number,
.specimen-class,
.specimen-date,
.archive-meta,
.gauge-item,
.gauge-divider,
.depth-label,
.depth-readout,
.card-back-meta,
.hex-depth {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #5fa8d3;
}

/* --- Depth Gauge (left edge) --- */
#depth-gauge {
    position: fixed;
    left: 16px;
    top: 0;
    bottom: 0;
    width: 40px;
    z-index: 100;
    pointer-events: none;
}

.depth-line {
    position: absolute;
    left: 19px;
    top: 0;
    width: 2px;
    height: 0;
    background: #00b4d8;
    transition: height 2s ease-in-out;
}

.depth-line.active {
    height: 100%;
}

.depth-marker {
    position: absolute;
    left: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.depth-marker.visible {
    opacity: 1;
    transform: translateX(0);
}

.depth-marker[data-depth="0"] { top: 5%; }
.depth-marker[data-depth="1"] { top: 20%; }
.depth-marker[data-depth="2"] { top: 40%; }
.depth-marker[data-depth="3"] { top: 60%; }
.depth-marker[data-depth="4"] { top: 80%; }
.depth-marker[data-depth="5"] { top: 95%; }

.depth-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00b4d8;
    display: block;
}

.depth-label {
    font-size: 0.65rem;
    white-space: nowrap;
}

/* --- Zone Navigator (right edge) --- */
#zone-nav {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.zone-nav-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(0, 180, 216, 0.3);
    z-index: -1;
}

.zone-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1.5px solid #00b4d8;
    background: transparent;
    cursor: pointer;
    transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    padding: 0;
}

.zone-dot:hover {
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(0, 245, 212, 0.4);
}

.zone-dot.active {
    background: #00f5d4;
    border-color: #00f5d4;
    box-shadow: 0 0 12px rgba(0, 245, 212, 0.5);
}

/* --- Mobile Depth Bar --- */
#mobile-depth-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 180, 216, 0.15);
    z-index: 100;
}

.depth-progress {
    height: 100%;
    width: 0%;
    background: #00b4d8;
    transition: width 0.3s ease;
}

#mobile-depth-bar .depth-readout {
    position: absolute;
    right: 10px;
    top: 6px;
    font-size: 0.6rem;
    color: #5fa8d3;
    background: rgba(8, 15, 26, 0.7);
    padding: 2px 6px;
    border-radius: 2px;
}

/* --- Ocean Wrapper --- */
#ocean {
    position: relative;
    width: 100%;
}

/* --- Ocean Zones (common) --- */
.ocean-zone {
    position: relative;
    min-height: 100vh;
    padding: 80px 80px 80px 80px;
    overflow: hidden;
    transition: background-color 1.5s ease;
}

.zone-header {
    text-align: center;
    margin-bottom: 60px;
    padding-top: 20px;
}

.zone-header .zone-tag {
    margin-bottom: 12px;
}

.zone-title {
    font-size: clamp(1.8rem, 4vw, 3rem);
    letter-spacing: -0.02em;
}

/* ===== SURFACE ZONE ===== */
#surface {
    background: #e8f4f8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding-top: 40px;
}

/* Caustic light layers */
.caustic-layer {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.5s ease;
}

.caustic-layer.active {
    opacity: 0.6;
}

.caustic-1 {
    background:
        radial-gradient(ellipse at 20% 30%, rgba(135, 206, 235, 0.15), transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(184, 230, 240, 0.12), transparent 50%);
    animation: caustic-drift-1 8s ease-in-out infinite;
}

.caustic-2 {
    background:
        radial-gradient(ellipse at 60% 20%, rgba(135, 206, 235, 0.15), transparent 55%),
        radial-gradient(ellipse at 30% 70%, rgba(184, 230, 240, 0.1), transparent 60%);
    animation: caustic-drift-2 8s ease-in-out 2.6s infinite;
}

.caustic-3 {
    background:
        radial-gradient(ellipse at 45% 50%, rgba(135, 206, 235, 0.12), transparent 50%),
        radial-gradient(ellipse at 80% 40%, rgba(184, 230, 240, 0.1), transparent 55%);
    animation: caustic-drift-3 8s ease-in-out 5.2s infinite;
}

@keyframes caustic-drift-1 {
    0%, 100% { background-position: 0% 0%, 100% 100%; }
    50% { background-position: 30% 20%, 70% 80%; }
}

@keyframes caustic-drift-2 {
    0%, 100% { background-position: 100% 0%, 0% 100%; }
    50% { background-position: 60% 30%, 40% 70%; }
}

@keyframes caustic-drift-3 {
    0%, 100% { background-position: 50% 50%, 50% 50%; }
    50% { background-position: 20% 70%, 80% 30%; }
}

.surface-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* --- Porthole --- */
.porthole {
    position: relative;
    border-radius: 50%;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
}

.porthole-hero {
    width: min(80vw, 500px);
    height: min(80vw, 500px);
    transform: scale(0);
    transition: transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.porthole-hero.active {
    transform: scale(1);
}

.porthole-rim {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8d99ae, #2b2d42, #8d99ae);
    z-index: -1;
}

.porthole-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(232, 244, 248, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15%;
    text-align: center;
    overflow: hidden;
}

.porthole-inner .zone-tag {
    margin-bottom: 16px;
    font-size: 0.7rem;
}

.porthole-fog {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at center, transparent 50%, rgba(232, 244, 248, 0.4) 80%, rgba(232, 244, 248, 0.7) 100%);
    pointer-events: none;
    animation: fog-pulse 6s ease-in-out infinite;
}

@keyframes fog-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

#hero-headline {
    font-size: clamp(1.2rem, 3vw, 2.2rem);
    color: #2b2d42;
    letter-spacing: -0.02em;
    min-height: 3em;
    text-shadow: 0 0 40px rgba(0, 245, 212, 0.15);
}

#hero-headline .cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: #00b4d8;
    margin-left: 2px;
    animation: blink-cursor 0.8s step-end infinite;
    vertical-align: text-bottom;
}

@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.hero-meta {
    margin-top: 16px;
    display: flex;
    gap: 20px;
}

.hero-meta .meta-mono {
    font-size: 0.65rem;
}

/* --- Sonar Excerpt --- */
.sonar-excerpt {
    max-width: 680px;
    margin-top: 60px;
    text-align: center;
}

.excerpt-line {
    font-size: clamp(1rem, 1.15rem, 1.25rem);
    color: #2b2d42;
    margin-bottom: 16px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.excerpt-line.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Sonar Ring Divider --- */
.sonar-ring-divider {
    position: relative;
    width: 60px;
    height: 60px;
    margin: 60px auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sonar-ring-divider .sonar-ring {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #00b4d8;
    opacity: 0;
    animation: sonar-expand 4s ease-out infinite;
}

.sonar-ring-divider .sonar-ring:nth-child(2) {
    animation-delay: 1.3s;
}

.sonar-ring-divider .sonar-ring:nth-child(3) {
    animation-delay: 2.6s;
}

@keyframes sonar-expand {
    0% {
        transform: scale(0);
        opacity: 0.4;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

/* --- Urgent / breaking indicator (Coral Accent, used sparingly) --- */
.breaking-tag {
    color: #ff6b6b;
    border: 1px solid #ff6b6b;
    padding: 2px 8px;
    font-family: 'Josefin Sans', sans-serif;
    font-size: 0.6rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

/* ===== TWILIGHT ZONE ===== */
#twilight {
    background: linear-gradient(180deg, #1b4965 0%, #1b3a4b 100%);
    padding-bottom: 100px;
}

#twilight .zone-title {
    color: #e8f4f8;
    text-shadow: 0 0 40px rgba(0, 245, 212, 0.15);
}

/* --- Honeycomb Grid --- */
.honeycomb-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 940px;
    margin: 0 auto;
    gap: 8px;
}

.hex-cell {
    width: 280px;
    height: 310px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: rgba(27, 73, 101, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease;
    position: relative;
}

.hex-cell.visible {
    opacity: 1;
    transform: translateY(0);
}

.hex-cell::before {
    content: '';
    position: absolute;
    inset: 2px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(180deg, rgba(27, 73, 101, 0.9), rgba(27, 58, 75, 0.95));
    z-index: 0;
    transition: box-shadow 0.3s ease;
}

.hex-cell:hover::before {
    box-shadow: inset 0 0 30px rgba(0, 245, 212, 0.15);
}

.hex-cell:hover {
    filter: drop-shadow(0 0 20px rgba(0, 245, 212, 0.3));
}

.hex-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 50px 30px 40px;
}

.hex-category {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: 0.65rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #00b4d8;
    display: block;
    margin-bottom: 12px;
}

.hex-headline {
    font-size: 1rem;
    font-weight: 700;
    color: #b8e6f0;
    line-height: 1.35;
    transition: color 0.3s ease;
}

.hex-cell:hover .hex-headline {
    color: #ffffff;
}

.hex-depth {
    display: block;
    margin-top: 14px;
    font-size: 0.65rem;
    color: #5fa8d3;
}

/* Sonar pulse background */
.sonar-pulse-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sonar-pulse {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(0, 180, 216, 0.15);
    animation: sonar-bg-pulse 4s ease-out infinite;
}

@keyframes sonar-bg-pulse {
    0% { transform: scale(0); opacity: 0.3; }
    100% { transform: scale(20); opacity: 0; }
}

/* ===== MIDNIGHT ZONE ===== */
#midnight {
    background: #0d2137;
    padding-bottom: 100px;
}

#midnight .zone-title {
    color: #e8f4f8;
    text-shadow: 0 0 40px rgba(0, 245, 212, 0.15);
}

/* Bioluminescent Particles */
.particles-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.bio-particle {
    position: absolute;
    border-radius: 50%;
    background: #00f5d4;
    will-change: transform, opacity;
}

/* Depth Strata Lines */
.depth-strata {
    position: relative;
    width: 100%;
}

.strata-line {
    width: 100%;
    height: 1px;
    background: rgba(95, 168, 211, 0.12);
}

/* Editorial Article */
.editorial-article {
    max-width: 680px;
    margin: 0 auto 60px;
    position: relative;
    padding-left: 0;
}

.article-annotation {
    position: absolute;
    left: -180px;
    top: 0;
    width: 150px;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.anno-date,
.anno-author,
.anno-zone {
    display: block;
    font-size: 0.65rem;
    line-height: 1.6;
}

.article-headline {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    color: #e8f4f8;
    letter-spacing: -0.02em;
    margin-bottom: 24px;
    text-shadow: 0 0 40px rgba(0, 245, 212, 0.15);
}

.article-body {
    font-size: clamp(1rem, 1.15rem, 1.25rem);
    color: #b8e6f0;
    margin-bottom: 20px;
    line-height: 1.75;
}

/* ===== ABYSSAL ZONE ===== */
#abyssal {
    background: #0a1628;
    padding-bottom: 100px;
}

#abyssal .zone-title {
    color: #e8f4f8;
    text-shadow: 0 0 40px rgba(0, 245, 212, 0.15);
}

/* Specimen Grid */
.specimen-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 1000px;
    margin: 0 auto;
    perspective: 1200px;
}

.specimen-grid .specimen-card:nth-child(2) { margin-top: 40px; }
.specimen-grid .specimen-card:nth-child(4) { margin-top: 20px; }
.specimen-grid .specimen-card:nth-child(5) { margin-top: 50px; }
.specimen-grid .specimen-card:nth-child(6) { margin-top: 10px; }

.specimen-card {
    height: 380px;
    cursor: pointer;
    position: relative;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.specimen-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 4px;
    padding: 28px;
    display: flex;
    flex-direction: column;
}

.card-front {
    background: #f0ead2;
    border: 1px solid #1a3a4a;
}

.card-back {
    background: #1b3a4b;
    border: 1px solid #1a3a4a;
    transform: rotateY(180deg);
    justify-content: center;
}

.specimen-creature {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 50px;
    height: 50px;
}

.creature-svg {
    width: 100%;
    height: 100%;
}

.specimen-number {
    color: #1a3a4a;
    font-size: 0.7rem;
    margin-bottom: 10px;
    display: block;
}

.specimen-class {
    color: #1a3a4a;
    font-size: 0.65rem;
    margin-bottom: 8px;
    display: block;
}

.specimen-date {
    color: #1a3a4a;
    font-size: 0.65rem;
    margin-bottom: 20px;
    display: block;
    opacity: 0.7;
}

.specimen-excerpt {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 0.9rem;
    color: #2b2d42;
    line-height: 1.6;
    margin-top: auto;
}

.card-back-title {
    font-size: 1.1rem;
    color: #e8f4f8;
    margin-bottom: 16px;
    text-shadow: 0 0 40px rgba(0, 245, 212, 0.15);
}

.card-back-text {
    font-size: 0.9rem;
    color: #b8e6f0;
    line-height: 1.65;
    margin-bottom: 20px;
}

.card-back-meta {
    color: #5fa8d3;
    font-size: 0.65rem;
    margin-top: auto;
}

/* Sonar pulse on card flip */
.specimen-card .sonar-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border-radius: 50%;
    border: 1px solid #00b4d8;
    pointer-events: none;
    z-index: 10;
    animation: sonar-burst 0.8s ease-out forwards;
}

@keyframes sonar-burst {
    0% { transform: scale(0); opacity: 0.6; }
    100% { transform: scale(8); opacity: 0; }
}

/* ===== HADAL ZONE ===== */
#hadal {
    background: #080f1a;
    padding-bottom: 60px;
}

#hadal .zone-title {
    color: #e8f4f8;
    text-shadow: 0 0 40px rgba(0, 245, 212, 0.15);
}

/* Archive Links */
.archive-links {
    max-width: 700px;
    margin: 0 auto 80px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.archive-link {
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    padding: 12px 0;
    position: relative;
    overflow: hidden;
}

.archive-sonar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: rgba(0, 180, 216, 0.08);
    transition: width 1.5s ease-out;
}

.archive-link.visible .archive-sonar {
    width: 100%;
}

.archive-text {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 1rem;
    color: #b8e6f0;
    position: relative;
    z-index: 1;
    transition: color 0.3s ease;
    flex: 1;
}

.archive-link:hover .archive-text {
    color: #ffffff;
}

.archive-meta {
    position: relative;
    z-index: 1;
    white-space: nowrap;
    font-size: 0.65rem;
}

/* Colophon / Footer */
.colophon {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    padding-top: 40px;
}

.pressure-gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.gauge-line {
    width: 200px;
    height: 1px;
    background: rgba(0, 180, 216, 0.3);
}

.gauge-readout {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.gauge-item {
    font-size: 0.7rem;
    color: #5fa8d3;
}

.gauge-item strong {
    color: #00b4d8;
    font-weight: 400;
}

.gauge-divider {
    color: rgba(95, 168, 211, 0.4);
    font-size: 0.7rem;
}

.colophon-text {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 0.85rem;
    color: rgba(184, 230, 240, 0.4);
    margin-top: 8px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    #depth-gauge {
        display: none;
    }

    #mobile-depth-bar {
        display: block;
    }

    #zone-nav {
        right: 8px;
        gap: 14px;
    }

    .zone-dot {
        width: 10px;
        height: 10px;
    }

    .ocean-zone {
        padding: 60px 20px;
    }

    .porthole-hero {
        width: min(90vw, 350px);
        height: min(90vw, 350px);
    }

    .honeycomb-grid {
        flex-direction: column;
        align-items: center;
    }

    .hex-cell {
        clip-path: none;
        border-radius: 12px;
        width: 100%;
        max-width: 400px;
        height: auto;
        min-height: 180px;
    }

    .hex-cell::before {
        clip-path: none;
        border-radius: 12px;
    }

    .hex-content {
        padding: 24px 20px;
    }

    .specimen-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
    }

    .specimen-grid .specimen-card:nth-child(n) {
        margin-top: 0;
    }

    .article-annotation {
        position: static;
        width: 100%;
        text-align: left;
        flex-direction: row;
        gap: 12px;
        margin-bottom: 16px;
        flex-wrap: wrap;
    }

    .editorial-article {
        padding-left: 0;
    }

    .hero-meta {
        flex-direction: column;
        gap: 6px;
    }

    .gauge-readout {
        flex-direction: column;
        gap: 6px;
    }

    .gauge-divider {
        display: none;
    }
}

@media (max-width: 1100px) and (min-width: 769px) {
    .article-annotation {
        position: static;
        width: 100%;
        text-align: left;
        flex-direction: row;
        gap: 16px;
        margin-bottom: 16px;
    }

    .specimen-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
