/* gur.al - Coastal Monitoring Array HUD */
/* Colors: #0b1a1f #4a7c8a #5de8b5 #9b6fc0 #d4e4e8 #c8a87d #e8a832 #1a3a4a */
/* Fonts: Cormorant Garamond, IBM Plex Mono, Silkscreen */

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

html {
    font-size: 16px;
    scroll-behavior: auto;
}

body {
    background: #0b1a1f;
    color: #d4e4e8;
    font-family: 'IBM Plex Mono', monospace;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* ===== CRT SCANLINE OVERLAY ===== */
#scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        transparent 0px,
        transparent 2px,
        rgba(11, 26, 31, 0.15) 2px,
        rgba(11, 26, 31, 0.15) 4px
    );
    pointer-events: none;
    z-index: 1000;
}

/* ===== COORDINATE GRID OVERLAY ===== */
#coordinate-grid {
    position: fixed;
    top: 48px;
    left: 64px;
    right: 48px;
    bottom: 32px;
    background:
        repeating-linear-gradient(
            90deg,
            rgba(74, 124, 138, 0.08) 0px,
            rgba(74, 124, 138, 0.08) 1px,
            transparent 1px,
            transparent 64px
        ),
        repeating-linear-gradient(
            0deg,
            rgba(74, 124, 138, 0.08) 0px,
            rgba(74, 124, 138, 0.08) 1px,
            transparent 1px,
            transparent 64px
        );
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.3s steps(4);
}

/* ===== HUD FRAME ===== */
#hud-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
}

#hud-frame > * {
    pointer-events: auto;
}

/* Top Bar */
#hud-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: #0b1a1f;
    border-bottom: 1px dashed #4a7c8a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 0 72px;
    z-index: 101;
}

#hud-domain {
    font-family: 'Silkscreen', cursive;
    font-size: 10px;
    color: #5de8b5;
    letter-spacing: 0.2em;
}

#hud-timestamp {
    font-family: 'Silkscreen', cursive;
    font-size: 10px;
    color: #4a7c8a;
    padding-right: 56px;
}

/* Left Rail */
#hud-left {
    position: absolute;
    top: 48px;
    left: 0;
    width: 64px;
    bottom: 32px;
    background: #0b1a1f;
    border-right: 1px dashed #4a7c8a;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 8px;
    gap: 12px;
    z-index: 101;
}

.gauge-mini {
    width: 40px;
    height: 48px;
    border: 1px solid #4a7c8a;
    background: #0b1a1f;
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: 2px;
}

.gauge-mini .gauge-bar {
    width: 100%;
    height: 20%;
    background: #5de8b5;
    transition: height 0.3s steps(8);
}

#zone-indicator {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-bottom: 16px;
}

.zone-dot {
    width: 8px;
    height: 8px;
    background: #1a3a4a;
    display: block;
}

.zone-dot.active {
    background: #5de8b5;
}

/* Right Rail */
#hud-right {
    position: absolute;
    top: 48px;
    right: 0;
    width: 48px;
    bottom: 32px;
    background: #0b1a1f;
    border-left: 1px dashed #4a7c8a;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 101;
    overflow: hidden;
}

#hud-vertical-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: #4a7c8a;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 0.15em;
    padding-top: 24px;
    white-space: nowrap;
}

#depth-scale {
    flex: 1;
    width: 24px;
    margin-top: 16px;
    background: repeating-linear-gradient(
        0deg,
        #4a7c8a 0px,
        #4a7c8a 1px,
        transparent 1px,
        transparent 20px
    );
    opacity: 0.5;
}

/* Bottom Bar */
#hud-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: #0b1a1f;
    border-top: 1px dashed #4a7c8a;
    display: flex;
    align-items: center;
    padding: 0 16px 0 72px;
    z-index: 101;
}

#hud-coords {
    font-family: 'Silkscreen', cursive;
    font-size: 10px;
    color: #4a7c8a;
}

/* ===== VIEWPORT ===== */
#viewport {
    position: absolute;
    top: 48px;
    left: 64px;
    right: 48px;
    bottom: 32px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 10;
    scrollbar-width: none;
}

#viewport::-webkit-scrollbar {
    display: none;
}

/* ===== ZONES ===== */
.zone {
    width: 100%;
    min-height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
}

.zone-content {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 100%;
    position: relative;
    z-index: 2;
}

/* ===== SILKSCREEN TEXT ===== */
.silkscreen-text {
    font-family: 'Silkscreen', cursive;
    font-size: 10px;
    color: #4a7c8a;
}

/* ===== ZONE 1: INITIALIZATION ===== */
#zone-1 .zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0;
}

#boot-cursor {
    font-size: 10px;
    color: #4a7c8a;
    animation: blink 1s steps(1) infinite;
    opacity: 0;
}

#boot-cursor.visible {
    opacity: 1;
}

#boot-cursor.hidden {
    display: none;
}

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

#boot-message {
    font-size: 10px;
    color: #4a7c8a;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    opacity: 0;
    margin-top: 16px;
}

#boot-message.typing {
    opacity: 1;
    animation: typewriter 2s steps(48) forwards;
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 480px; }
}

#main-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 8rem);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #d4e4e8;
    margin-top: 32px;
    opacity: 0;
    transition: opacity 0.5s steps(5);
}

#main-title.visible {
    opacity: 1;
}

#main-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.9rem;
    color: #4a7c8a;
    margin-top: 16px;
    opacity: 0;
    transition: opacity 0.5s steps(5);
}

#main-subtitle.visible {
    opacity: 1;
}

/* ===== ZONE 2: AURORA CATALOG ===== */
.zone-headline {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.6rem);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #d4e4e8;
    grid-column: 1 / 5;
    margin-bottom: 24px;
}

#aurora-bars {
    grid-column: 1 / 8;
    display: grid;
    grid-template-columns: repeat(50, 1fr);
    gap: 2px;
    height: 200px;
    align-items: flex-end;
}

#aurora-bars .bar {
    width: 100%;
    background: #5de8b5;
    border-radius: 0;
    opacity: 0;
    transform-origin: bottom;
}

#aurora-bars .bar.violet {
    background: #9b6fc0;
}

#aurora-bars .bar.animate {
    opacity: 1;
    animation: barGrow 0.6s steps(8) forwards;
}

@keyframes barGrow {
    from { height: 0; }
}

.zone-body-text {
    grid-column: 1 / 7;
    margin-top: 32px;
}

.zone-body-text p {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    line-height: 1.75;
    color: #d4e4e8;
    margin-bottom: 16px;
}

/* ===== ZONE 3: SIGNAL ARCHIVE ===== */
#zone-3 .zone-headline {
    grid-column: 1 / 5;
}

#archive-grid {
    grid-column: 1 / 8;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.archive-card {
    aspect-ratio: 4/3;
    background: #1a3a4a;
    border: 1px solid #4a7c8a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    cursor: crosshair;
    transition: border-color 0.2s steps(3);
    position: relative;
    overflow: hidden;
}

.archive-card:hover {
    border-color: #5de8b5;
}

.archive-card:hover .card-label {
    opacity: 0;
}

.archive-card:hover::after {
    content: attr(data-phrase);
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 500;
    font-size: 0.85rem;
    color: #c8a87d;
    text-align: center;
    animation: fadeInStep 0.3s steps(4) forwards;
}

@keyframes fadeInStep {
    from { opacity: 0; }
    to { opacity: 1; }
}

.card-label {
    font-size: 10px;
    color: #4a7c8a;
    transition: opacity 0.2s steps(3);
}

.card-viz {
    width: 64px;
    height: 40px;
    position: relative;
}

/* Zigzag pattern */
.viz-zigzag {
    background: linear-gradient(135deg, #5de8b5 25%, transparent 25%) -8px 0,
                linear-gradient(225deg, #5de8b5 25%, transparent 25%) -8px 0,
                linear-gradient(315deg, #5de8b5 25%, transparent 25%),
                linear-gradient(45deg, #5de8b5 25%, transparent 25%);
    background-size: 16px 16px;
    background-color: transparent;
    opacity: 0.6;
}

/* Dots pattern */
.viz-dots {
    background-image: radial-gradient(circle, #9b6fc0 2px, transparent 2px);
    background-size: 12px 12px;
    opacity: 0.6;
}

/* Bars pattern */
.viz-bars {
    background: repeating-linear-gradient(
        90deg,
        #5de8b5 0px,
        #5de8b5 4px,
        transparent 4px,
        transparent 8px
    );
    opacity: 0.6;
}

/* Arcs pattern */
.viz-arcs {
    background: repeating-radial-gradient(
        circle at 50% 100%,
        transparent 0px,
        transparent 6px,
        #9b6fc0 6px,
        #9b6fc0 8px
    );
    opacity: 0.6;
}

/* ===== ZONE 4: COASTAL DRIFT ===== */
.pixel-wave-divider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 16px;
    background: repeating-linear-gradient(
        90deg,
        #4a7c8a 0px, #4a7c8a 4px,
        transparent 4px, transparent 8px,
        #4a7c8a 8px, #4a7c8a 12px,
        transparent 12px, transparent 16px
    );
    opacity: 0.4;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='16'%3E%3Cpath d='M0 8 Q8 0 16 8 Q24 16 32 8' stroke='white' fill='none' stroke-width='16'/%3E%3C/svg%3E");
    mask-size: 32px 16px;
    mask-repeat: repeat-x;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='16'%3E%3Cpath d='M0 8 Q8 0 16 8 Q24 16 32 8' stroke='white' fill='none' stroke-width='16'/%3E%3C/svg%3E");
    -webkit-mask-size: 32px 16px;
    -webkit-mask-repeat: repeat-x;
}

.zone-4-layout {
    display: grid !important;
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
}

.zone-4-col-left {
    grid-column: 2 / 5;
}

.zone-4-col-left p,
.zone-4-col-right p {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    line-height: 1.75;
    color: #d4e4e8;
    margin-bottom: 24px;
}

.zone-4-divider {
    grid-column: 5 / 6;
    width: 4px;
    background: #9b6fc0;
    justify-self: center;
    min-height: 100%;
}

.zone-4-col-right {
    grid-column: 6 / 8;
}

.italic-callout {
    font-family: 'Cormorant Garamond', serif !important;
    font-style: italic;
    font-weight: 500;
    font-size: 1.1rem !important;
    color: #c8a87d !important;
    margin-top: 16px;
}

/* ===== ZONE 5: TERMINATION ===== */
.zone-5-content {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 16px;
}

.end-label {
    font-size: 10px;
    color: #4a7c8a;
}

#end-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #d4e4e8;
}

#typewriter-final {
    font-size: 10px;
    color: #4a7c8a;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    margin-top: 32px;
}

#typewriter-final.typing {
    animation: typewriterFinal 2.5s steps(44) forwards;
}

@keyframes typewriterFinal {
    from { width: 0; }
    to { width: 440px; }
}

/* ===== SIGNAL CONSTELLATION DOTS ===== */
.signal-dots {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.signal-dot {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #5de8b5;
    opacity: 0.3;
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.4; }
}

/* ===== GAUGE CLUSTERS ===== */
.gauge-cluster {
    position: absolute;
    top: 32px;
    right: 32px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 3;
}

.gc-circular {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #4a7c8a;
    overflow: hidden;
    position: relative;
}

.gc-circular-fill {
    width: 100%;
    height: 100%;
    background: conic-gradient(
        #5de8b5 0%,
        #5de8b5 25%,
        transparent 25%,
        transparent 100%
    );
    opacity: 0.6;
    transition: background 0.5s steps(8);
}

.gc-circular-fill.gc-full {
    background: conic-gradient(
        #5de8b5 0%,
        #5de8b5 100%
    );
}

.gc-fill-bar {
    width: 40px;
    height: 8px;
    background: #1a3a4a;
    border: 1px solid #4a7c8a;
    overflow: hidden;
}

.gc-fill-inner {
    height: 100%;
    width: 30%;
    background: #5de8b5;
    transition: width 0.5s steps(8);
}

.gc-fill-inner.gc-full {
    width: 100%;
}

.gc-readout {
    font-size: 10px;
    color: #5de8b5;
    text-align: right;
}

.gc-sparkline {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 24px;
}

.gc-sparkline span {
    width: 3px;
    background: #5de8b5;
    opacity: 0.6;
    display: block;
}

/* ===== HUD BOOT ANIMATION ===== */
#hud-frame {
    clip-path: inset(0 0 0 0);
}

#hud-frame.booting {
    animation: hudBoot 1.5s steps(20) forwards;
}

@keyframes hudBoot {
    0% {
        clip-path: inset(50% 50% 50% 50%);
    }
    100% {
        clip-path: inset(0 0 0 0);
    }
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
    #hud-left { width: 40px; }
    #hud-right { width: 32px; }
    #hud-top { padding-left: 48px; height: 40px; }
    #hud-bottom { padding-left: 48px; height: 28px; }
    #viewport { top: 40px; left: 40px; right: 32px; bottom: 28px; }
    #coordinate-grid { top: 40px; left: 40px; right: 32px; bottom: 28px; }

    .gauge-mini { width: 28px; height: 36px; }
    .gauge-cluster { top: 16px; right: 16px; }

    #archive-grid { grid-template-columns: repeat(2, 1fr); }
    .zone-4-layout { display: flex !important; flex-direction: column; gap: 24px; }
    .zone-4-divider { width: 100%; height: 4px; min-height: 4px; }

    #main-title { font-size: clamp(2.5rem, 10vw, 5rem); }

    #hud-vertical-text { font-size: 8px; }
    .zone { padding: 32px 16px; }
}
