@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Montserrat:wght@300;400;600&family=Dancing+Script:wght@700&display=swap');

/* Global Reset & Theme */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #0b0e14; /* Deep Cyber Midnight Blue background */
    color: #e6dfd5; /* Warm cream/parchment text */
    font-family: 'Montserrat', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.7;
}

h1, h2, h3, h4 {
    font-family: 'Playfair Display', serif;
    letter-spacing: 1px;
    color: #fff;
}

/* NAVIGATION BAR (Seamlessly integrated across dark pages) */
.nav-bar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center;     padding: 1.5rem 5%;     background: rgba(11, 14, 20, 0.95);     position: sticky;     top: 0;     width: 100%;     z-index: 100;     border-bottom: 1px solid #141c24;}
.nav-bar ul { display: flex; list-style: none; gap: 2rem; }.nav-bar a {     color: #c5a059; /* Vintage Dark Brass */    text-decoration: none;     font-size: 0.9rem;     font-weight: 600;     letter-spacing: 1px;     transition: 0.3s; }.nav-bar a:hover, .nav-bar a.active {     color: #fff;     text-shadow: 0 0 10px #00ffff; }.logo { display: flex; align-items: center; gap: 15px; color: #c5a059; }.logo span { font-family: 'Dancing Script', cursive; font-size: 2.2rem; }.avatar { width: 50px; height: 50px; border-radius: 50%; border: 2px solid #c5a059; object-fit: cover; }/* GLOW LINKS */.glow-link { transition: all 0.3s ease; cursor: pointer; }.glow-link:hover { color: #fff !important; text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff; }

/* HEADER */
.page-header-contact {
    text-align: center;
    padding: 6rem 5% 3rem 5%;
    background: linear-gradient(180deg, #121824 0%, #0b0e14 100%);
    border-bottom: 1px dashed #141c24;
}
.page-header-contact h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: #fff;
    text-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
    margin-bottom: 0.8rem;
    text-transform: uppercase;
}
.page-header-contact .tagline {
    font-size: 1.1rem;
    color: #00ffff;
    letter-spacing: 3px;
    font-weight: 600;
}

/* CONTAINER GRID */
.contact-container {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 4rem;
    max-width: 1200px;
    width: 90%;
    margin: 4rem auto;
    flex: 1;
    padding-bottom: 6rem;
}

/* TELEGRAPH PANEL (LEFT SIDE) */
.telegraph-panel {
    background: #0d121c;
    border: 1px solid #1a2433;
    border-left: 4px solid #c5a059; /* Vintage brass border */
    padding: 3rem;
    border-radius: 4px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.terminal-hud {
    display: flex;
    justify-content: space-between;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #5d6f85;
    border-bottom: 1px solid #1a2433;
    padding-bottom: 1rem;
}
.status-indicator {
    color: #00ffff;
    text-shadow: 0 0 5px #00ffff;
    font-weight: bold;
}

/* INPUT FORM */
.telegraph-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    font-weight: bold;
    color: #c5a059;
    letter-spacing: 1px;
}

.form-group input, .form-group textarea {
    background: #070910;
    border: 1px solid #1f2a3a;
    border-radius: 4px;
    padding: 1rem;
    color: #e6dfd5;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
}

.form-group input:focus, .form-group textarea:focus {
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #1a2433;
    padding-top: 1.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.system-stats {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #5d6f85;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.system-stats .cyan-val { color: #00ffff; font-weight: bold; }
.system-stats .gold-val { color: #c5a059; font-weight: bold; }

.transmit-btn {
    background: none;
    border: 1px solid #c5a059;
    color: #c5a059;
    padding: 1rem 2rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: bold;
    font-size: 0.9rem;
    letter-spacing: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: 0.3s;
}
.transmit-btn:hover {
    color: #00ffff;
    border-color: #00ffff;
    background: rgba(0, 255, 255, 0.05);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

/* SOUNDWAVE VIEWER */
.wave-viewer {
    background: #070910;
    border: 1px solid #1a2433;
    border-radius: 4px;
    padding: 1rem;
}
.wave-header {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #5d6f85;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}
.wave-viewer canvas {
    width: 100%;
    display: block;
    height: 80px;
}

/* INSTRUMENT PANEL (RIGHT SIDE) */
.instrument-panel {
    background: #0d121c;
    border: 1px solid #1a2433;
    padding: 3rem;
    border-radius: 4px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.panel-heading {
    border-bottom: 1px solid #1a2433;
    padding-bottom: 0.8rem;
    font-size: 1.3rem;
    color: #fff;
}

/* TELEGRAPH KEY WIDGET */
.telegraph-instrument {
    background: #070910;
    border: 1px solid #1a2433;
    padding: 2.5rem;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.key-and-light {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    width: 100%;
}

/* SIGNAL LIGHT */
.transmitting-light {
    width: 25px;
    height: 25px;
    background: #1a1e29;
    border: 2px solid #5d6f85;
    border-radius: 50%;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
    transition: 0.15s;
}
.transmitting-light.active {
    background: #00ffff;
    border-color: #ffffff;
}
.led-glow {
    position: absolute;
    top: -5px; left: -5px; right: -5px; bottom: -5px;
    border-radius: 50%;
    background: rgba(0, 255, 255, 0.4);
    filter: blur(5px);
    opacity: 0;
    transition: 0.15s;
}
.led-glow.active {
    opacity: 1;
}

/* THE BRASS TELEGRAPH KEY */
.telegraph-key-wrap {
    text-align: center;
    width: 100%;
}
.tap-caption {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    color: #5d6f85;
    margin-top: 1.5rem;
    letter-spacing: 1px;
}

.telegraph-key {
    width: 200px;
    height: 70px;
    position: relative;
    cursor: pointer;
    margin: 0 auto;
    user-select: none;
}

.telegraph-key .base {
    width: 160px;
    height: 12px;
    background: #1a1e29;
    border: 2px solid #3a4b5f;
    position: absolute;
    bottom: 0; left: 20px;
    border-radius: 4px;
}

.telegraph-key .lever {
    width: 100px;
    height: 8px;
    background: #c5a059; /* Brass Lever */
    border: 1px solid #9c763b;
    position: absolute;
    top: 30px; left: 35px;
    transform-origin: left center;
    transition: transform 0.08s ease;
    border-radius: 2px;
}
.telegraph-key.pressed .lever {
    transform: rotate(3deg);
}

.telegraph-key .knob {
    width: 32px;
    height: 32px;
    background: #111;
    border: 2px solid #c5a059;
    border-radius: 50%;
    position: absolute;
    top: 14px; right: 55px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: top 0.08s ease;
}
.telegraph-key.pressed .knob {
    top: 19px;
}

/* LIVE MORSE CONVERTER */
.morse-converter {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.morse-output-box {
    background: #070910;
    border: 1px solid #1a2433;
    padding: 1.5rem;
    border-radius: 4px;
    min-height: 100px;
    max-height: 150px;
    overflow-y: auto;
}

.morse-code-text {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    letter-spacing: 2px;
    color: #00ffff;
    word-break: break-all;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.4);
}

.morse-actions {
    display: flex;
    gap: 1.5rem;
}

.morse-btn {
    flex: 1;
    background: #c5a059;
    border: 1px solid #c5a059;
    color: #12100e;
    padding: 0.8rem 1.2rem;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: pointer;
    transition: 0.3s;
}
.morse-btn:hover {
    background: #00ffff;
    border-color: #00ffff;
    color: #0b0e14;
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.25);
}
.morse-btn.border-btn {
    background: none;
    border-color: #1a2433;
    color: #5d6f85;
}
.morse-btn.border-btn:hover {
    border-color: #c5a059;
    color: #c5a059;
}

/* SUCCESS TRANS-MODAL */
.transmission-modal {
    display: none; /* Controlled by JS */
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(5, 7, 10, 0.95);
    backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeInModal 0.3s ease;
}
@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    width: 90%;
    max-width: 550px;
    background: #0d121c;
    border: 2px solid #00ffff;
    box-shadow: 0 20px 50px rgba(0, 255, 255, 0.15);
    padding: 3rem;
    border-radius: 4px;
    animation: slideUpModal 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}
@keyframes slideUpModal {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-title {
    font-size: 1.8rem;
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0,255,255,0.4);
    text-align: center;
    margin-bottom: 1rem;
    text-transform: uppercase;
}
.modal-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #c5a059, transparent);
    width: 100%;
    margin-bottom: 2rem;
}
.modal-text {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #ccc;
    text-align: center;
    margin-bottom: 2rem;
}

.modal-stats {
    background: #070910;
    border: 1px solid #1a2433;
    padding: 1.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #5d6f85;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.modal-stats strong {
    color: #c5a059;
}
.modal-stats span {
    color: #fff;
}

.modal-close-btn {
    width: 100%;
    background: none;
    border: 1px solid #c5a059;
    color: #c5a059;
    padding: 1rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: bold;
    font-size: 0.9rem;
    letter-spacing: 2px;
    cursor: pointer;
    transition: 0.3s;
}
.modal-close-btn:hover {
    background: #c5a059;
    color: #0b0e14;
    box-shadow: 0 4px 15px rgba(197, 160, 89, 0.2);
}

/* FOOTER */
.contact-footer {
    border-top: 1px solid #1a2433;
    padding: 2.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: #5d6f85;
    background: #070910;
    margin-top: auto;
}

/* RESPONSIVE LAYOUTS */
@media (max-width: 900px) {
    .contact-container {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    .telegraph-panel, .instrument-panel {
        padding: 2rem;
    }
}
@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .page-header-contact h1 {
        font-size: 1.8rem;
    }
}

/* Bulletproof CSS Keyframe Page Transitions - Solves Flashing & Black screen bugs */
@keyframes pageFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

body {
    animation: pageFadeIn 0.4s ease-out forwards;
}

body.fade-out {
    opacity: 0 !important;
    transition: opacity 0.3s ease-in-out !important;
    animation: none !important;
}

/* ==========================================================================
   UNIFIED FLUID TYPOGRAPHY SYSTEM (Release v41)
   ========================================================================== */
html {
    font-size: 16px; /* Desktop browser baseline */
}

:root {
    --h1-size: clamp(1.8rem, 4.5vw, 3rem);
    --h2-size: clamp(1.4rem, 3.5vw, 2.2rem);
    --h3-size: clamp(1.1rem, 2.5vw, 1.5rem);
}

/* Standard Responsive Text Scaling */
@media (max-width: 850px) {
    html {
        font-size: 14px !important; /* Globally down-scales all REM dimensions by 12.5% */
    }
    body {
        line-height: 1.6 !important;
    }
}
@media (max-width: 450px) {
    html {
        font-size: 13.2px !important; /* Scale down by 17% for tiny devices */
    }
}

/* ==========================================================================
   PREMIUM MOBILE NAVIGATION RE-DESIGN - TELEGRAPH MIDNIGHT THEME (Release v41)
   ========================================================================== */
@media (max-width: 850px) {
    .nav-bar {
        flex-direction: column !important;
        gap: 1rem !important;
        padding: 1.2rem 4% !important;
        text-align: center !important;
        position: relative !important;
        width: 100% !important;
        box-sizing: border-box !important;
        background: #0b0e14 !important;
        border-bottom: 1px solid #141c24 !important;
    }
    .nav-bar ul {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.4rem !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        list-style: none !important;
    }
    .nav-bar li {
        width: 100% !important;
        margin: 0 !important;
    }
    .nav-bar a {
        font-size: 0.72rem !important;
        font-weight: 700 !important;
        padding: 0.65rem 0.2rem !important;
        text-align: center !important;
        border: 1px solid rgba(197, 160, 89, 0.15) !important;
        border-radius: 4px !important;
        background: rgba(197, 160, 89, 0.02) !important;
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
        letter-spacing: 0.5px !important;
        transition: 0.2s ease !important;
        white-space: nowrap !important;
        text-overflow: ellipsis !important;
        overflow: hidden !important;
        color: #c5a059 !important;
    }
    .nav-bar a.active {
        color: #fff !important;
        border-color: #c5a059 !important;
        background: rgba(197, 160, 89, 0.1) !important;
        text-shadow: 0 0 5px rgba(197, 160, 89, 0.5) !important;
    }
    .nav-bar a:hover {
        color: #fff !important;
        text-shadow: 0 0 10px #c5a059 !important;
    }
}