/* ============================================
   DIPLOMACY.BAR - Signals Intelligence Station
   Muted-vintage palette / Z-pattern layout
   ============================================ */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #F2EDE4;
    color: #2C2924;
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(15px, 1.8vw, 18px);
    letter-spacing: 0.02em;
    line-height: 1.65;
}

/* --- CONSOLE LAYOUT (Single Viewport) --- */
#console-layout {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 24px 32px 16px;
    position: relative;
}

/* ========== Z-PATTERN TOP ROW ========== */
.z-top-row {
    display: flex;
    align-items: stretch;
    gap: 24px;
    flex: 0 0 auto;
    height: 160px;
}

/* --- Station Identifier (Top-Left Anchor) --- */
.station-id {
    width: 280px;
    min-width: 280px;
    background: #2C2924;
    position: relative;
    padding: 4px;
}

.station-id-inner {
    background: #1A1816;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 16px;
    position: relative;
}

.station-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(22px, 3vw, 32px);
    letter-spacing: 0.12em;
    line-height: 1.2;
    text-transform: uppercase;
    color: #F2EDE4;
    margin-bottom: 6px;
}

.station-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8B7D6B;
    opacity: 0.7;
    margin-bottom: 4px;
}

.station-class {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #C4943A;
    opacity: 0.8;
}

/* --- Indicator Strip (Top-Right) --- */
.indicator-strip {
    flex: 1;
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.indicator-module {
    flex: 1;
    border: none;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 12px 8px;
    cursor: default;
    transition: background 0.3s ease;
}

.indicator-module:hover {
    background: #2C2924;
}

.indicator-module:hover .indicator-label,
.indicator-module:hover .indicator-value {
    color: #F2EDE4;
}

.indicator-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8B7D6B;
    opacity: 0.7;
    margin-bottom: 6px;
    transition: color 0.3s ease;
}

.indicator-value {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #2C2924;
    transition: color 0.3s ease;
}

/* ========== BORDER ANIMATION SYSTEM ========== */
/* Outer border - draws clockwise from top-left */
.border-anim-outer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.border-anim-outer::before,
.border-anim-outer::after {
    content: '';
    position: absolute;
    border-color: #8B7D6B;
    border-style: solid;
}

/* Top + Right edges */
.border-anim-outer::before {
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-width: 1px 1px 0 0;
    animation: drawTopRight 600ms ease-out 0.2s forwards;
}

/* Bottom + Left edges */
.border-anim-outer::after {
    bottom: 0;
    right: 0;
    width: 0;
    height: 0;
    border-width: 0 0 1px 1px;
    animation: drawBottomLeft 600ms ease-out 0.4s forwards;
}

@keyframes drawTopRight {
    0% { width: 0; height: 0; }
    50% { width: 100%; height: 0; }
    100% { width: 100%; height: 100%; }
}

@keyframes drawBottomLeft {
    0% { width: 0; height: 0; }
    50% { width: 100%; height: 0; }
    100% { width: 100%; height: 100%; }
}

/* Inner border for briefing panel (double border) */
.border-anim-inner {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    pointer-events: none;
}

.border-anim-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-color: #6B6256;
    border-style: solid;
    border-width: 1px 1px 0 0;
    animation: drawTopRight 600ms ease-out 1.2s forwards;
}

.border-anim-inner::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 0;
    border-color: #6B6256;
    border-style: solid;
    border-width: 0 0 1px 1px;
    animation: drawBottomLeft 600ms ease-out 1.4s forwards;
}

/* Indicator hover border - fast draw */
.indicator-module .border-anim-outer::before {
    animation: drawTopRight 400ms ease-out 0.3s forwards;
}
.indicator-module .border-anim-outer::after {
    animation: drawBottomLeft 400ms ease-out 0.5s forwards;
}

/* Station ID pulsing border */
.station-id > .border-anim-outer::before,
.station-id > .border-anim-outer::after {
    border-color: #C4943A;
}

.station-id {
    animation: stationPulse 8s ease-in-out infinite;
}

@keyframes stationPulse {
    0%, 90%, 100% { box-shadow: none; }
    95% { box-shadow: 0 0 8px rgba(196, 148, 58, 0.15); }
}

/* ========== Z DIAGONAL VOID ========== */
.z-void {
    flex: 0 0 auto;
    height: 120px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.void-rule {
    position: absolute;
    top: 50%;
    left: 10%;
    width: 80%;
    height: 1px;
    background: #8B7D6B;
    opacity: 0.4;
    transform: translateY(-50%);
}

/* Crosshair at center */
.crosshair {
    position: relative;
    width: 60px;
    height: 60px;
    z-index: 1;
}

.crosshair-h {
    position: absolute;
    top: 50%;
    left: 0;
    width: 60px;
    height: 1px;
    background: #6B6256;
    opacity: 0.4;
    transform: translateY(-50%);
}

.crosshair-v {
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 60px;
    background: #6B6256;
    opacity: 0.4;
    transform: translateX(-50%);
}

/* ========== Z-PATTERN BOTTOM ROW ========== */
.z-bottom-row {
    flex: 1;
    display: flex;
    gap: 24px;
    min-height: 0;
}

/* --- Briefing Panel (Lower-Left) --- */
.briefing-panel {
    flex: 0 0 55%;
    position: relative;
    padding: 32px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.briefing-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    padding: 8px 0;
}

.briefing-content h2 {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(18px, 2.5vw, 28px);
    letter-spacing: 0.12em;
    line-height: 1.2;
    text-transform: uppercase;
    color: #2C2924;
    margin-bottom: 16px;
}

.briefing-content p {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(14px, 1.6vw, 17px);
    line-height: 1.65;
    letter-spacing: 0.02em;
    color: #2C2924;
    margin-bottom: 12px;
}

/* Corner Brackets */
.corner-bracket {
    position: absolute;
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.corner-bracket::before,
.corner-bracket::after {
    content: '';
    position: absolute;
    background: #8B7D6B;
}

/* Top-left */
.cb-tl {
    top: 8px;
    left: 8px;
}
.cb-tl::before {
    top: 0; left: 0;
    width: 0; height: 1px;
    animation: bracketH 600ms ease-out 0.8s forwards;
}
.cb-tl::after {
    top: 0; left: 0;
    width: 1px; height: 0;
    animation: bracketV 600ms ease-out 0.8s forwards;
}

/* Top-right */
.cb-tr {
    top: 8px;
    right: 8px;
}
.cb-tr::before {
    top: 0; right: 0;
    width: 0; height: 1px;
    animation: bracketH 600ms ease-out 0.9s forwards;
}
.cb-tr::after {
    top: 0; right: 0;
    width: 1px; height: 0;
    animation: bracketV 600ms ease-out 0.9s forwards;
}

/* Bottom-left */
.cb-bl {
    bottom: 8px;
    left: 8px;
}
.cb-bl::before {
    bottom: 0; left: 0;
    width: 0; height: 1px;
    animation: bracketH 600ms ease-out 1.0s forwards;
}
.cb-bl::after {
    bottom: 0; left: 0;
    width: 1px; height: 0;
    animation: bracketV 600ms ease-out 1.0s forwards;
}

/* Bottom-right */
.cb-br {
    bottom: 8px;
    right: 8px;
}
.cb-br::before {
    bottom: 0; right: 0;
    width: 0; height: 1px;
    animation: bracketH 600ms ease-out 1.1s forwards;
}
.cb-br::after {
    bottom: 0; right: 0;
    width: 1px; height: 0;
    animation: bracketV 600ms ease-out 1.1s forwards;
}

@keyframes bracketH {
    from { width: 0; }
    to { width: 20px; }
}

@keyframes bracketV {
    from { height: 0; }
    to { height: 20px; }
}

/* --- Waveform Bars --- */
.waveform-bars {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    height: 44px;
    padding-top: 8px;
}

.wf-bar {
    width: 2px;
    background: #8B7D6B;
    animation: waveformPulse 2s ease-in-out infinite;
}

.wf-bar:nth-child(even) {
    background: #C4943A;
}

.wf-bar:nth-child(1)  { height: 12px; animation-delay: 0s; }
.wf-bar:nth-child(2)  { height: 20px; animation-delay: 0.08s; }
.wf-bar:nth-child(3)  { height: 32px; animation-delay: 0.16s; }
.wf-bar:nth-child(4)  { height: 40px; animation-delay: 0.24s; }
.wf-bar:nth-child(5)  { height: 28px; animation-delay: 0.32s; }
.wf-bar:nth-child(6)  { height: 16px; animation-delay: 0.40s; }
.wf-bar:nth-child(7)  { height: 8px;  animation-delay: 0.48s; }
.wf-bar:nth-child(8)  { height: 24px; animation-delay: 0.56s; }
.wf-bar:nth-child(9)  { height: 36px; animation-delay: 0.64s; }
.wf-bar:nth-child(10) { height: 40px; animation-delay: 0.72s; }
.wf-bar:nth-child(11) { height: 30px; animation-delay: 0.80s; }
.wf-bar:nth-child(12) { height: 18px; animation-delay: 0.88s; }
.wf-bar:nth-child(13) { height: 10px; animation-delay: 0.96s; }
.wf-bar:nth-child(14) { height: 22px; animation-delay: 1.04s; }
.wf-bar:nth-child(15) { height: 34px; animation-delay: 1.12s; }
.wf-bar:nth-child(16) { height: 38px; animation-delay: 1.20s; }
.wf-bar:nth-child(17) { height: 26px; animation-delay: 1.28s; }
.wf-bar:nth-child(18) { height: 14px; animation-delay: 1.36s; }
.wf-bar:nth-child(19) { height: 8px;  animation-delay: 1.44s; }
.wf-bar:nth-child(20) { height: 20px; animation-delay: 1.52s; }
.wf-bar:nth-child(21) { height: 32px; animation-delay: 1.60s; }
.wf-bar:nth-child(22) { height: 40px; animation-delay: 1.68s; }
.wf-bar:nth-child(23) { height: 28px; animation-delay: 1.76s; }
.wf-bar:nth-child(24) { height: 16px; animation-delay: 1.84s; }

@keyframes waveformPulse {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.4); }
}

/* ========== SECONDARY PANEL (Lower-Right) ========== */
.secondary-panel {
    flex: 1;
    position: relative;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    overflow: hidden;
}

/* --- Diplomatic Radar --- */
.radar-container {
    position: relative;
    width: 200px;
    height: 200px;
    flex: 0 0 auto;
}

.radar-circle {
    position: absolute;
    border-radius: 50%;
    border: 1px solid #8B7D6B;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.radar-outer {
    width: 200px;
    height: 200px;
    opacity: 1;
}

.radar-mid {
    width: 120px;
    height: 120px;
    opacity: 0.6;
}

.radar-inner {
    width: 60px;
    height: 60px;
    opacity: 0.3;
}

.radar-sweep {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1px;
    height: 100px;
    background: #C4943A;
    transform-origin: 0 0;
    animation: radarSweep 60s linear infinite;
    opacity: 0.7;
}

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

/* --- UTC Clock --- */
.utc-clock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.clock-value {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 18px;
    letter-spacing: 0.1em;
    color: #C4943A;
}

/* --- Teletype Feed --- */
.teletype-container {
    flex: 1;
    width: 100%;
    max-width: 240px;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

.teletype-feed {
    width: 100%;
    height: 100%;
    background: #1A1816;
    overflow: hidden;
    position: relative;
    padding: 8px 10px;
}

.teletype-scroll {
    animation: teletypeScroll 60s linear infinite;
}

.teletype-scroll p {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8B7D6B;
    opacity: 0.6;
    line-height: 1.8;
    white-space: nowrap;
}

@keyframes teletypeScroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

/* Blinking cursor */
.teletype-cursor {
    position: absolute;
    bottom: 8px;
    right: 10px;
    width: 2px;
    height: 14px;
    background: #C4943A;
    animation: cursorBlink 1s step-end infinite;
}

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

/* ========== HUD READOUTS ========== */
.hud-readout {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8B7D6B;
    opacity: 0.5;
    position: absolute;
}

.readout-lat {
    top: 8px;
    left: 16px;
    color: #8B7D6B;
}

.readout-freq {
    top: 12px;
    right: 16px;
    color: #8B7D6B;
}

.readout-status {
    bottom: 12px;
    right: 12px;
    color: #C4943A;
    opacity: 0.7;
}

/* ========== CLASSIFIED STRIP ========== */
.classified-strip {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    padding: 8px 0 0;
}

.classified-tag {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #8C3A3A;
    opacity: 0.8;
    padding: 4px 12px;
    border: 1px solid #8C3A3A;
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 768px) {
    html, body {
        overflow-y: auto;
        overflow-x: hidden;
    }

    #console-layout {
        height: auto;
        min-height: 100vh;
        padding: 16px;
    }

    .z-top-row {
        flex-direction: column;
        height: auto;
    }

    .station-id {
        width: 100%;
        min-width: unset;
        height: 120px;
    }

    .indicator-strip {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .indicator-module {
        padding: 10px;
    }

    .z-void {
        height: 60px;
    }

    .z-bottom-row {
        flex-direction: column;
    }

    .briefing-panel {
        flex: 0 0 auto;
    }

    .secondary-panel {
        flex: 0 0 auto;
        min-height: 500px;
    }

    .radar-container {
        width: 160px;
        height: 160px;
    }

    .radar-outer {
        width: 160px;
        height: 160px;
    }

    .radar-mid {
        width: 96px;
        height: 96px;
    }

    .radar-inner {
        width: 48px;
        height: 48px;
    }

    .radar-sweep {
        height: 80px;
    }

    .teletype-container {
        max-width: 100%;
        min-height: 200px;
    }
}
