/* ========================================
   double-standard.org — Abyssal Chart
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
    --midnight-abyss: #0A1628;
    --bathyal-blue: #0D1F38;
    --sonar-teal: #164B60;
    --phosphor-cyan: #93C4D6;
    --instrument-amber: #D4943A;
    --compass-cream: #C9D6DF;
    --flare-coral: #C75D3A;
    --polished-slate: #384B5F;
    --deepest: #091220;

    --font-display: 'Stint Ultra Expanded', serif;
    --font-body: 'Source Serif 4', serif;
    --font-mono: 'Space Mono', monospace;

    --scroll-offset: 0;
}

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

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

body {
    background: linear-gradient(180deg, #0D1F38 0%, #0A1628 40%, #091220 100%);
    color: var(--compass-cream);
    font-family: var(--font-body);
    font-weight: 380;
    font-size: 17px;
    line-height: 1.72;
    overflow-x: hidden;
    min-height: 700vh;
}

/* --- Star Field (Plane 0) --- */
#star-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    animation: starFieldRotate 600s linear infinite;
}

@keyframes starFieldRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Polaris Marker (Fixed, top-right) --- */
#polaris-marker {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    opacity: 0.6;
    animation: polarisRotate 300s linear infinite;
    transition: opacity 2s ease;
}

@keyframes polarisRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Depth Gauge (Fixed, left edge) --- */
#depth-gauge {
    position: fixed;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    height: 60vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.depth-gauge-line {
    width: 1px;
    height: 100%;
    background: var(--phosphor-cyan);
    opacity: 0.3;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.depth-gauge-reading {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.depth-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.15em;
    color: var(--phosphor-cyan);
    opacity: 0.5;
}

.depth-value {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.03em;
    color: var(--phosphor-cyan);
    opacity: 0.7;
}

.depth-gauge-ticks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.depth-tick {
    position: absolute;
    left: -6px;
    width: 13px;
    height: 1px;
    background: var(--phosphor-cyan);
    opacity: 0.4;
}

.depth-tick::after {
    content: attr(data-depth);
    position: absolute;
    left: 18px;
    top: -6px;
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--phosphor-cyan);
    opacity: 0.4;
    white-space: nowrap;
}

/* --- Depth Zones --- */
.depth-zone {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

/* --- Zone: Surface --- */
.zone-surface {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.site-title {
    font-family: var(--font-display);
    font-size: clamp(48px, 8vw, 96px);
    font-weight: 400;
    font-variant: small-caps;
    letter-spacing: 0.12em;
    line-height: 1.05;
    color: var(--compass-cream);
    text-align: center;
    margin-bottom: 32px;
}

.subtitle-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2em;
}

.subtitle {
    font-family: var(--font-mono);
    font-size: clamp(14px, 2vw, 20px);
    letter-spacing: 0.03em;
    color: var(--phosphor-cyan);
    opacity: 0.7;
    display: inline;
}

.typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: var(--flare-coral);
    margin-left: 2px;
    animation: cursorBlink 0.8s step-end infinite;
    vertical-align: text-bottom;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- Sonar Ping (Surface) --- */
.sonar-ping {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 1px;
    background: var(--phosphor-cyan);
    opacity: 0;
}

.sonar-ping.active {
    animation: sonarPing 1.2s ease-out forwards;
}

@keyframes sonarPing {
    from {
        width: 0;
        opacity: 1;
    }
    to {
        width: 80vw;
        opacity: 0.3;
    }
}

/* --- Sonar Dividers --- */
.sonar-divider {
    position: relative;
    width: 100%;
    padding: 60px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.sonar-line {
    width: 0;
    height: 1px;
    background: var(--phosphor-cyan);
    transition: none;
}

.sonar-line.active {
    animation: sonarPing 1.2s ease-out forwards;
}

.depth-reading {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--phosphor-cyan);
    opacity: 0;
    transition: opacity 0.8s ease 0.6s;
}

.depth-reading.visible {
    opacity: 0.5;
}

/* --- Content Layout --- */
.zone-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 80px;
}

.centered-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cols-3-10 .content-panel,
.cols-3-10 .duotone-image-frame {
    max-width: 720px;
    width: 100%;
}

/* Drifting content (Mesopelagic) */
.drifting-content {
    display: flex;
    flex-direction: column;
}

.cols-2-8 .content-panel {
    max-width: 680px;
    width: 100%;
}

.shifted-right {
    align-self: flex-end;
    margin-right: 0;
}

.cols-4-11 {
    max-width: 680px;
}

/* Asymmetric content (Bathypelagic) */
.asymmetric-content {
    display: flex;
    flex-direction: column;
}

.shifted-left {
    align-self: flex-start;
}

/* Full width (Abyssal) */
.full-width-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 40px;
}

/* --- Content Panels --- */
.content-panel {
    position: relative;
    padding: 48px;
    margin-bottom: 48px;
    background: var(--bathyal-blue);
    border: 1px solid rgba(147, 196, 214, 0.15);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.content-panel.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Panel variants */
.epipelagic-panel {
    background: var(--bathyal-blue);
    border-color: rgba(147, 196, 214, 0.15);
}

.mesopelagic-panel {
    background: rgba(13, 31, 56, 0.85);
    border-color: rgba(147, 196, 214, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.bathypelagic-panel {
    background: rgba(10, 22, 40, 0.9);
}

.heavy-border {
    border-width: 2px;
    border-color: var(--sonar-teal);
}

.abyssal-panel {
    background: rgba(9, 18, 32, 0.9);
    border-color: rgba(147, 196, 214, 0.08);
    max-width: 900px;
    width: 100%;
}

.abyssal-panel.sparse {
    padding: 80px 48px;
}

/* --- Panel Sonar Arcs --- */
.panel-sonar-arc {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 0.5px solid var(--sonar-teal);
    border-radius: 50%;
    opacity: 0.3;
}

.panel-sonar-arc.top-left {
    top: -10px;
    left: -10px;
    clip-path: polygon(0 0, 50% 0, 50% 50%, 0 50%);
}

.panel-sonar-arc.top-right {
    top: -10px;
    right: -10px;
    clip-path: polygon(50% 0, 100% 0, 100% 50%, 50% 50%);
}

.panel-sonar-arc.bottom-left {
    bottom: -10px;
    left: -10px;
    clip-path: polygon(0 50%, 50% 50%, 50% 100%, 0 100%);
}

.panel-sonar-arc.bottom-right {
    bottom: -10px;
    right: -10px;
    clip-path: polygon(50% 50%, 100% 50%, 100% 100%, 50% 100%);
}

/* --- Section Headlines --- */
.section-headline {
    font-family: var(--font-display);
    font-size: clamp(36px, 7vw, 96px);
    font-weight: 400;
    font-variant: small-caps;
    letter-spacing: 0.08em;
    line-height: 1.05;
    color: var(--compass-cream);
    margin-bottom: 32px;
}

.large-headline {
    font-size: clamp(42px, 9vw, 120px);
}

.amber-text {
    color: var(--instrument-amber);
}

/* --- Body Text --- */
.body-text {
    font-family: var(--font-body);
    font-weight: 380;
    font-size: 17px;
    line-height: 1.72;
    max-width: 62ch;
    color: var(--compass-cream);
    margin-bottom: 24px;
    transition: font-weight 800ms cubic-bezier(0.16, 1, 0.3, 1);
}

.body-text.emphasized {
    font-weight: 600;
}

.thin-weight {
    font-weight: 340;
}

.large-body {
    font-size: 24px;
    line-height: 1.65;
}

/* --- Amber Highlights --- */
.amber-highlight {
    color: var(--instrument-amber);
    font-weight: 500;
}

/* --- Annotations --- */
.annotation {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.03em;
    color: var(--phosphor-cyan);
    opacity: 0.7;
}

.annotation-right {
    position: relative;
    margin-top: 16px;
    padding-left: 24px;
    border-left: 1px solid rgba(147, 196, 214, 0.2);
}

.annotation-marker {
    color: var(--flare-coral);
    margin-right: 8px;
}

.annotation-inline {
    margin-top: 20px;
    padding: 12px 16px;
    background: rgba(10, 22, 40, 0.4);
    border-left: 2px solid var(--sonar-teal);
}

.annotation-text {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    letter-spacing: 0.03em;
}

/* --- Duotone Image Frame --- */
.duotone-image-frame {
    position: relative;
    width: 100%;
    max-width: 720px;
    margin-bottom: 48px;
    clip-path: polygon(2% 0%, 100% 3%, 98% 100%, 0% 97%);
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.duotone-image-frame.revealed {
    opacity: 1;
    transform: translateY(0);
}

.duotone-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--midnight-abyss);
    mix-blend-mode: luminosity;
    opacity: 0.5;
    z-index: 1;
}

.institutional-facade {
    display: block;
    width: 100%;
    height: auto;
    filter: grayscale(100%) brightness(0.7) contrast(1.2);
}

/* --- Constellation Lines --- */
.constellation-lines {
    width: 100%;
    height: 200px;
    margin: 24px 0;
    opacity: 0.4;
}

/* --- Typewriter Blocks --- */
.typewriter-block {
    padding: 32px 0;
    display: flex;
    align-items: center;
}

.typewriter-text {
    font-family: var(--font-mono);
    font-size: clamp(16px, 2.5vw, 24px);
    letter-spacing: 0.03em;
    color: var(--phosphor-cyan);
    white-space: nowrap;
    overflow: hidden;
}

.typewriter-final {
    justify-content: center;
    padding: 80px 0;
}

.typewriter-final .typewriter-text {
    font-size: clamp(20px, 3vw, 32px);
    color: var(--compass-cream);
}

/* --- Nova Burst --- */
.nova-burst-container {
    position: relative;
    margin-bottom: 48px;
}

.nova-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(212, 148, 58, 0.3) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.nova-burst.active {
    opacity: 1;
}

.nova-burst-large {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(212, 148, 58, 0.25) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.nova-burst-large.active {
    opacity: 1;
}

/* --- Compass Rose --- */
.compass-rose-container {
    padding: 80px 0 120px;
    display: flex;
    justify-content: center;
    opacity: 0.4;
    animation: compassSpin 120s linear infinite;
}

@keyframes compassSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Polaris dimming at depth --- */
body.deep-zone #polaris-marker {
    opacity: 0.2;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .zone-content {
        padding: 24px 24px 24px 56px;
    }

    .content-panel {
        padding: 28px 24px;
    }

    .site-title {
        font-size: clamp(32px, 10vw, 60px);
    }

    .section-headline {
        font-size: clamp(24px, 6vw, 48px);
    }

    .annotation-right {
        position: relative;
    }

    .shifted-right,
    .shifted-left {
        align-self: stretch;
    }

    #depth-gauge {
        left: 12px;
    }

    #polaris-marker {
        top: 12px;
        right: 12px;
    }

    #polaris-marker svg {
        width: 40px;
        height: 40px;
    }

    .compass-rose-container svg {
        width: 200px;
        height: 200px;
    }

    .full-width-content {
        padding: 24px 16px 24px 48px;
    }
}

@media (max-width: 480px) {
    .site-title {
        letter-spacing: 0.06em;
    }

    .typewriter-text {
        font-size: 14px;
    }

    .body-text {
        font-size: 15px;
    }

    .large-body {
        font-size: 19px;
    }
}

/* --- Selection --- */
::selection {
    background: var(--sonar-teal);
    color: var(--compass-cream);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--midnight-abyss);
}

::-webkit-scrollbar-thumb {
    background: var(--polished-slate);
    border-radius: 2px;
}
