/* ============================================================
   bada.casa — House of the Sea
   Anti-design HUD-overlay / fixed-viewport navigational cockpit
   Typography reference: ("A house where the sea lives. / 바다가 사는 집." IBM Plex Mono" IBM Plex Mono" (Google Fonts Interaction Model:** Model* Interval` every 3 seconds
   ============================================================ */

:root {
    --abyssal-black: #0a0e14;
    --storm-indigo: #1a2744;
    --basalt-gray: #3d5a5e;
    --verdigris: #5da397;
    --seafoam: #c4d8d2;
    --deep-lichen: #5a7a72;
    --muted-sage: #8fa8a0;
    --sonar-phosphor: #39ff8e;
    --driftwood: #a08b6e;

    --font-display: 'Avenir Next', 'Helvetica Neue', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', 'SFMono-Regular', 'Menlo', 'Monaco', monospace;
    --font-ko: 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;

    --bezel: 1px solid rgba(93, 163, 151, 0.25);
}

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

html, body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: var(--abyssal-black);
    color: var(--muted-sage);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.65;
    letter-spacing: 0.03em;
}

/* ------------------------------------------------------------
   Radar Canvas — full viewport animated sea
   ------------------------------------------------------------ */
.radar-canvas {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 85%, rgba(26, 39, 68, 0.6) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 15%, rgba(61, 90, 94, 0.35) 0%, transparent 55%),
        linear-gradient(160deg, #0a0e14 0%, #0f1626 35%, #1a2744 60%, #141f30 85%, #0a0e14 100%);
    background-size: 200% 200%, 200% 200%, 100% 100%;
    animation: sea-drift 28s ease-in-out infinite alternate;
    overflow: hidden;
    z-index: 0;
}

@keyframes sea-drift {
    0%   { background-position: 0% 0%, 100% 100%, 0 0; }
    50%  { background-position: 25% 40%, 65% 60%, 0 0; }
    100% { background-position: 60% 20%, 30% 75%, 0 0; }
}

/* Radar sweep — conic gradient rotating from bottom-left */
.radar-sweep {
    position: absolute;
    left: -50vw;
    bottom: -50vh;
    width: 200vw;
    height: 200vh;
    background: conic-gradient(
        from 0deg at 25% 75%,
        transparent 0deg,
        transparent 340deg,
        rgba(57, 255, 142, 0.015) 345deg,
        rgba(57, 255, 142, 0.06) 355deg,
        rgba(57, 255, 142, 0.10) 360deg,
        rgba(57, 255, 142, 0.06) 5deg,
        rgba(57, 255, 142, 0.015) 15deg,
        transparent 20deg,
        transparent 360deg
    );
    animation: radar-sweep 8s linear infinite;
    mix-blend-mode: screen;
    pointer-events: none;
}

@keyframes radar-sweep {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Sonar rings */
.sonar-rings {
    position: absolute;
    left: 25%;
    bottom: 25%;
    width: 0;
    height: 0;
    pointer-events: none;
}

.ring {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid rgba(93, 163, 151, 0.15);
}

.ring-1 { width: 14vmin;  height: 14vmin;  opacity: 0.75; }
.ring-2 { width: 26vmin;  height: 26vmin;  opacity: 0.55; }
.ring-3 { width: 42vmin;  height: 42vmin;  opacity: 0.42; }
.ring-4 { width: 62vmin;  height: 62vmin;  opacity: 0.3;  }
.ring-5 { width: 88vmin;  height: 88vmin;  opacity: 0.22; }
.ring-6 {
    width: 120vmin; height: 120vmin;
    opacity: 0.15;
    animation: sonar-pulse 4s ease-out infinite;
}

@keyframes sonar-pulse {
    0%   { transform: translate(-50%, -50%) scale(1);   opacity: 0.25; border-color: rgba(93, 163, 151, 0.22); }
    70%  { transform: translate(-50%, -50%) scale(1.12); opacity: 0.05; border-color: rgba(93, 163, 151, 0.08); }
    100% { transform: translate(-50%, -50%) scale(1.14); opacity: 0;    border-color: rgba(93, 163, 151, 0);    }
}

/* Depth contour lines — organic bathymetric shapes */
.depth-contours {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.5;
}

.contour {
    position: absolute;
    border: 1px solid rgba(26, 39, 68, 0.55);
    border-radius: 62% 38% 55% 45% / 48% 62% 38% 52%;
}

.contour.c1 { top: 12%; left: 44%; width: 38vw; height: 46vh; border-radius: 58% 42% 60% 40% / 52% 48% 52% 48%; transform: rotate(-8deg); }
.contour.c2 { top: 28%; left: 55%; width: 28vw; height: 32vh; border-radius: 40% 60% 45% 55% / 60% 40% 55% 45%; transform: rotate(6deg); opacity: 0.6; }
.contour.c3 { top: 42%; left: 10%; width: 30vw; height: 36vh; border-radius: 55% 45% 40% 60% / 42% 58% 42% 58%; transform: rotate(-12deg); }
.contour.c4 { top: 55%; left: 62%; width: 22vw; height: 24vh; border-radius: 48% 52% 58% 42% / 50% 50% 45% 55%; transform: rotate(18deg); opacity: 0.4; }

/* 바다 watermark — drifting ghost of Korean text */
.watermark {
    position: absolute;
    top: 18%;
    left: -6%;
    font-family: var(--font-ko);
    font-weight: 900;
    font-size: clamp(8rem, 25vw, 20rem);
    color: rgba(93, 163, 151, 0.04);
    letter-spacing: -0.02em;
    line-height: 1;
    user-select: none;
    pointer-events: none;
    animation: watermark-drift 60s ease-in-out infinite alternate;
    white-space: nowrap;
}

@keyframes watermark-drift {
    0%   { transform: translateX(0) translateY(0); }
    50%  { transform: translateX(6vw) translateY(-1.5vh); }
    100% { transform: translateX(12vw) translateY(1vh); }
}

/* ------------------------------------------------------------
   Viewport wrapper — contains floating panels
   ------------------------------------------------------------ */
.viewport {
    position: relative;
    width: 100vw;
    height: 100vh;
    z-index: 10;
    padding: 0;
}

/* ------------------------------------------------------------
   Navigation tick marks (rotated 90° on the left edge)
   ------------------------------------------------------------ */
.nav-ticks {
    position: absolute;
    left: 18px;
    top: 8vh;
    bottom: 12vh;
    width: 32px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    z-index: 40;
    pointer-events: auto;
}

.tick {
    background: transparent;
    border: none;
    color: var(--deep-lichen);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    padding: 12px 0;
    cursor: pointer;
    position: relative;
    transform: rotate(-90deg);
    white-space: nowrap;
    transition: color 0.3s ease;
}

.tick span { display: inline-block; }

.tick::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -18px;
    width: 1px;
    height: 10px;
    background: var(--verdigris);
    opacity: 0.45;
    transform: translateX(-50%);
}

.tick::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 2px;
    width: 0;
    height: 1px;
    background: var(--verdigris);
    transition: width 0.4s cubic-bezier(0.25, 0.1, 0, 1.02);
}

.tick:hover { color: var(--seafoam); }
.tick:hover::after { width: 100%; }

.tick.active {
    color: var(--sonar-phosphor);
    text-shadow: 0 0 8px rgba(57, 255, 142, 0.35);
}

.tick.active::before {
    background: var(--sonar-phosphor);
    opacity: 1;
    height: 14px;
    box-shadow: 0 0 6px rgba(57, 255, 142, 0.8);
}

/* ------------------------------------------------------------
   HUD Panels — shared styles
   ------------------------------------------------------------ */
.hud-panel {
    position: absolute;
    background: rgba(10, 14, 20, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: var(--bezel);
    padding: 28px 30px 26px;
    opacity: 0.6;
    transform: scale(0.97);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 12;
    overflow: hidden;
}

.hud-panel.active {
    opacity: 1;
    transform: scale(1);
    border-color: rgba(93, 163, 151, 0.45);
    z-index: 25;
    box-shadow: 0 0 0 1px rgba(93, 163, 151, 0.08),
                0 18px 60px rgba(0, 0, 0, 0.55),
                inset 0 0 40px rgba(57, 255, 142, 0.02);
}

/* Corner brackets */
.corner {
    position: absolute;
    width: 12px;
    height: 12px;
    pointer-events: none;
}
.corner.tl { top: 6px;    left: 6px;    border-top: 1px solid var(--verdigris); border-left: 1px solid var(--verdigris); }
.corner.tr { top: 6px;    right: 6px;   border-top: 1px solid var(--verdigris); border-right: 1px solid var(--verdigris); }
.corner.bl { bottom: 6px; left: 6px;    border-bottom: 1px solid var(--verdigris); border-left: 1px solid var(--verdigris); }
.corner.br { bottom: 6px; right: 6px;   border-bottom: 1px solid var(--verdigris); border-right: 1px solid var(--verdigris); }

.hud-panel.active .corner { border-color: var(--sonar-phosphor); box-shadow: 0 0 4px rgba(57, 255, 142, 0.35); }

/* Panel label strip */
.panel-label {
    display: flex;
    gap: 18px;
    align-items: baseline;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--deep-lichen);
    border-bottom: 1px dashed rgba(93, 163, 151, 0.22);
    padding-bottom: 10px;
    margin-bottom: 18px;
}

.pl-index { color: var(--verdigris); }
.pl-title { color: var(--seafoam); flex: 1; }
.pl-coord { color: var(--deep-lichen); font-size: 9px; }

/* ------------------------------------------------------------
   Panel 1 — Identity (top-left, largest)
   ------------------------------------------------------------ */
.panel-identity {
    top: 8%;
    left: 5%;
    width: 46%;
    height: 52%;
    min-height: 340px;
}

.wordmark {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.8rem, 4.4vw, 3.4rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--seafoam);
    margin: 8px 0 4px -4px;
    line-height: 1.05;
}

.wordmark .dot {
    color: var(--sonar-phosphor);
    text-shadow: 0 0 10px rgba(57, 255, 142, 0.5);
    animation: dot-blink 2.6s steps(2, end) infinite;
}

@keyframes dot-blink {
    0%, 70%  { opacity: 1; }
    72%, 80% { opacity: 0.3; }
    82%, 100%{ opacity: 1; }
}

.subline {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: clamp(0.9rem, 1.4vw, 1.05rem);
    color: var(--muted-sage);
    margin: 14px 0 18px;
    letter-spacing: 0.05em;
}

.subline .ko {
    font-family: var(--font-ko);
    font-weight: 400;
    color: var(--deep-lichen);
    letter-spacing: 0.04em;
    font-size: 0.92em;
}

.body {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: clamp(0.78rem, 1.1vw, 0.9rem);
    color: var(--muted-sage);
    max-width: 52ch;
    margin-bottom: 12px;
    letter-spacing: 0.02em;
}

.meta-row {
    position: absolute;
    bottom: 22px;
    left: 30px;
    right: 30px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--deep-lichen);
    border-top: 1px solid rgba(93, 163, 151, 0.12);
    padding-top: 12px;
}

.meta.pulse {
    color: var(--sonar-phosphor);
    animation: signal-pulse 1.8s ease-in-out infinite;
}

@keyframes signal-pulse {
    0%, 100% { opacity: 1;   text-shadow: 0 0 6px rgba(57, 255, 142, 0.35); }
    50%      { opacity: 0.45; text-shadow: 0 0 2px rgba(57, 255, 142, 0.15); }
}

/* ------------------------------------------------------------
   Panel 2 — Systems (top-right)
   ------------------------------------------------------------ */
.panel-systems {
    top: 14%;
    right: 26%;
    width: 34%;
    height: 32%;
    min-height: 220px;
}

.systems-list {
    list-style: none;
    font-family: var(--font-mono);
    font-size: clamp(0.78rem, 1.05vw, 0.88rem);
    color: var(--muted-sage);
    letter-spacing: 0.04em;
}

.systems-list li {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 5px 0;
    border-bottom: 1px dashed rgba(93, 163, 151, 0.1);
}

.systems-list li:last-child { border-bottom: none; }

.sys-k {
    color: var(--seafoam);
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 0.78rem;
}

.sys-dot {
    flex: 1;
    color: var(--deep-lichen);
    overflow: hidden;
    white-space: nowrap;
    font-size: 0.8rem;
    opacity: 0.6;
}

.sys-v {
    color: var(--verdigris);
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.78rem;
}

.sys-note {
    margin-top: 16px;
    font-family: var(--font-display);
    font-weight: 300;
    font-style: italic;
    font-size: 0.72rem;
    color: var(--deep-lichen);
    letter-spacing: 0.02em;
}

/* ------------------------------------------------------------
   Panel 3 — Depth sounder (right edge, narrow vertical)
   ------------------------------------------------------------ */
.panel-depth {
    top: 10%;
    right: 3%;
    width: 22%;
    height: 62%;
    min-height: 360px;
    padding: 22px 18px 22px 22px;
}

.panel-label.vertical {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 14px;
}

.panel-label.vertical .pl-title { font-size: 9px; }

.depth-log {
    list-style: none;
    height: calc(100% - 68px);
    overflow-y: auto;
    padding-right: 6px;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--muted-sage);
    scrollbar-width: thin;
    scrollbar-color: var(--verdigris) var(--abyssal-black);
}

.depth-log::-webkit-scrollbar { width: 4px; }
.depth-log::-webkit-scrollbar-track { background: rgba(10, 14, 20, 0.8); }
.depth-log::-webkit-scrollbar-thumb { background: var(--verdigris); border-radius: 0; }

.depth-log li {
    display: grid;
    grid-template-columns: 60px 48px 1fr;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px dotted rgba(93, 163, 151, 0.1);
    letter-spacing: 0.04em;
}

.depth-log .t { color: var(--deep-lichen); font-size: 0.7rem; }
.depth-log .d { color: var(--verdigris); font-weight: 500; }
.depth-log .n { color: var(--muted-sage); font-size: 0.7rem; font-style: italic; opacity: 0.8; }

/* ------------------------------------------------------------
   Panel 4 — Transmission (bottom-left)
   ------------------------------------------------------------ */
.panel-transmission {
    bottom: 13vh;
    left: 9%;
    width: 32%;
    height: 26%;
    min-height: 180px;
}

.tx-log {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted-sage);
    letter-spacing: 0.02em;
}

.tx-line {
    padding: 3px 0;
    border-bottom: 1px dashed rgba(93, 163, 151, 0.08);
    display: flex;
    gap: 10px;
    align-items: baseline;
}

.tx-line:last-child { border-bottom: none; }

.tx-t { color: var(--deep-lichen); font-size: 0.7rem; min-width: 40px; }
.tx-c { color: var(--verdigris); font-size: 0.7rem; letter-spacing: 0.14em; min-width: 36px; }

.tx-link {
    color: var(--seafoam);
    text-decoration: none;
    position: relative;
    display: inline-block;
    padding-bottom: 2px;
}

.tx-link::after {
    content: '';
    position: absolute;
    left: 0; bottom: -3px;
    width: 0;
    height: 1px;
    background: var(--verdigris);
    transition: width 0.4s cubic-bezier(0.25, 0.1, 0, 1.02);
}

.tx-link:hover { color: var(--driftwood); }
.tx-link:hover::after { width: 100%; background: var(--driftwood); }

.tx-footer {
    position: absolute;
    left: 30px;
    right: 30px;
    bottom: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.22em;
    color: var(--deep-lichen);
    text-transform: uppercase;
    border-top: 1px solid rgba(93, 163, 151, 0.12);
    padding-top: 10px;
}

.tx-sig {
    color: var(--sonar-phosphor);
    letter-spacing: 0.05em;
    animation: signal-pulse 1.4s ease-in-out infinite;
    text-shadow: 0 0 4px rgba(57, 255, 142, 0.4);
}

/* ------------------------------------------------------------
   Circuit traces — PCB-style lines between panels
   ------------------------------------------------------------ */
.circuit-trace {
    position: absolute;
    pointer-events: none;
    z-index: 5;
    opacity: 0.3;
}

.trace-a {
    top: 34%;
    left: 51%;
    width: 3px;
    height: 120px;
    background: linear-gradient(180deg, var(--verdigris) 0%, transparent 100%);
}

.trace-b {
    top: 46%;
    left: 51%;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--verdigris) 0%, transparent 100%);
}

.trace-c {
    bottom: 28%;
    left: 40%;
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, var(--verdigris) 100%);
}

.solder {
    position: absolute;
    width: 5px;
    height: 5px;
    background: var(--verdigris);
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(93, 163, 151, 0.6);
    z-index: 6;
    opacity: 0.7;
}

.solder.s1 { top: 34%; left: calc(51% - 1px); }
.solder.s2 { top: calc(46% - 1px); left: calc(51% + 58px); }
.solder.s3 { bottom: calc(28% - 1px); left: 40%; }
.solder.s4 { bottom: calc(28% - 1px); left: calc(40% + 78px); }

/* ------------------------------------------------------------
   Tidal footer — persistent status bar
   ------------------------------------------------------------ */
.tidal-footer {
    position: fixed;
    left: 0; right: 0;
    bottom: 0;
    height: 8vh;
    min-height: 48px;
    background: rgba(10, 14, 20, 0.85);
    border-top: 1px solid rgba(93, 163, 151, 0.22);
    display: flex;
    align-items: center;
    padding: 0 28px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--deep-lichen);
    z-index: 50;
    gap: 24px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.tf-left, .tf-right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 240px;
}

.tf-right { justify-content: flex-end; }

.tf-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.tf-label { color: var(--verdigris); font-size: 9px; }
.tf-value { color: var(--seafoam); font-size: 10px; }

.cursor {
    color: var(--sonar-phosphor);
    margin-left: 4px;
    font-size: 11px;
    animation: cursor-blink 1s steps(2, end) infinite;
    text-shadow: 0 0 6px rgba(57, 255, 142, 0.6);
}

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

/* Waveform visualizer — 24 bars */
.waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 20px;
}

.waveform span {
    display: inline-block;
    width: 3px;
    height: 4px;
    background: var(--sonar-phosphor);
    box-shadow: 0 0 3px rgba(57, 255, 142, 0.4);
    animation: wave-bar 1.2s ease-in-out infinite;
}

@keyframes wave-bar {
    0%, 100% { height: 4px; }
    50%      { height: 16px; }
}

/* ------------------------------------------------------------
   Responsive tuning for smaller viewports
   ------------------------------------------------------------ */
@media (max-width: 900px) {
    .panel-identity     { width: 86%;  left: 6%; top: 6%; height: 42%; }
    .panel-systems      { width: 70%;  right: 6%; top: 50%; height: 22%; }
    .panel-depth        { display: none; }
    .panel-transmission { width: 86%;  left: 6%; bottom: 14vh; height: 20%; }
    .nav-ticks          { display: none; }
    .watermark          { font-size: 14rem; }
    .tf-left, .tf-right { min-width: 140px; }
    .tf-left .tf-value  { font-size: 9px; letter-spacing: 0.1em; }
}

@media (max-width: 560px) {
    .tidal-footer       { padding: 0 12px; gap: 8px; }
    .tf-left, .tf-right { min-width: 0; }
    .hud-panel          { padding: 18px 18px 16px; }
    .wordmark           { font-size: 1.8rem; }
}
