/* ============================================
   PARALIGM.COM - SUBMARINE CONTROL ROOM STYLES
   Navy-Metallic Palette Implementation
   ============================================ */

/* Color Palette - Exact from DESIGN.md */
:root {
    --abyss-navy: #071525;
    --deep-navy: #0B1A2E;
    --mid-navy: #0F2035;
    --steel-blue: #4A6B8A;
    --brushed-chrome: #8899AA;
    --pale-steel: #D0D8E0;
    --naval-brass: #C0A050;
    --beacon-white: #F0F0F0;

    /* Signal Flag Colors */
    --signal-red: #BF2C2C;
    --signal-yellow: #E8C547;
    --signal-blue: #2B2D8E;
    --signal-white: #F0F0F0;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: "Source Sans 3", sans-serif;
    background-color: var(--abyss-navy);
    color: var(--pale-steel);
}

body {
    overflow-x: hidden;
    overflow-y: auto;
}

/* Grid Container - per DESIGN.md spec */
.grid-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 4px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 4px;
    min-height: 100vh;
}

/* ============================================
   MODULE BASE STYLES
   ============================================ */

.module {
    border: 2px solid var(--steel-blue);
    border-radius: 0;
    background-color: var(--deep-navy);
    position: relative;
    overflow: hidden;
    transition: transform 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 300ms ease;
}

.module:hover {
    border-color: var(--brushed-chrome);
    transform: scale(1.01);
}

/* ============================================
   MODULE A: THE BRIDGE (HERO)
   50vh height, spans 1-12
   ============================================ */

.module-a {
    grid-column: 1 / 13;
    height: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--deep-navy);
}

.domain-name {
    font-family: "Varela Round", sans-serif;
    font-size: clamp(2.5rem, 8vw, 5.5rem);
    font-weight: 400;
    letter-spacing: 0.03em;
    color: var(--pale-steel);
    text-align: center;
    position: relative;
    z-index: 2;
}

/* ============================================
   MODULE B: THE LOGBOOK
   Spans columns 1-7, auto height
   Left border: 4px naval brass
   Two-column text layout
   ============================================ */

.module-b {
    grid-column: 1 / 8;
    background-color: var(--mid-navy);
    border-left: 4px solid var(--naval-brass);
    border-right: 2px solid var(--steel-blue);
    border-top: 2px solid var(--steel-blue);
    border-bottom: 2px solid var(--steel-blue);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.module-b p {
    font-family: "Source Sans 3", sans-serif;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.75;
    color: var(--pale-steel);
    column-count: 2;
    column-gap: 2rem;
}

/* ============================================
   MODULE C: THE PORTHOLE
   Spans columns 8-12, square aspect ratio
   Circular with thick border (8px)
   ============================================ */

.module-c {
    grid-column: 8 / 13;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.porthole {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 8px solid var(--steel-blue);
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 30% 30%, rgba(136, 153, 170, 0.1), transparent);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.module-c:hover {
    transform: scale(1.08);
}

.module-c:hover .porthole {
    transform-origin: center;
}

/* ============================================
   MODULE D: SIGNAL FLAGS
   Spans columns 1-4, 30vh height
   2x2 grid of colored rectangles
   ============================================ */

.module-d {
    grid-column: 1 / 5;
    height: 30vh;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.signal-flags-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    width: 100%;
    height: 80%;
}

.flag {
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--beacon-white);
    font-family: "Varela Round", sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transition: transform 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    border: none;
    border-radius: 0;
}

.flag:hover {
    transform: scale(1.05);
}

.flag span {
    display: block;
}

.flag-red {
    background-color: var(--signal-red);
}

.flag-yellow {
    background-color: var(--signal-yellow);
    color: var(--deep-navy);
}

.flag-blue {
    background-color: var(--signal-blue);
}

.flag-white {
    background-color: var(--signal-white);
    color: var(--deep-navy);
}

/* ============================================
   MODULE E: THE COMPASS
   Spans columns 5-12, 30vh height
   SVG compass rose rotating 360deg/60s
   ============================================ */

.module-e {
    grid-column: 5 / 13;
    height: 30vh;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.compass-rose {
    width: 180px;
    height: 180px;
    animation: compassSpin 60s linear infinite;
}

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

.compass-label {
    font-family: "Varela Round", sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--naval-brass);
}

/* ============================================
   MODULE F: THE DEPTH GAUGE (FOOTER)
   Spans columns 1-12, 15vh height
   Fathom scale with glowing marker
   ============================================ */

.module-f {
    grid-column: 1 / 13;
    height: 15vh;
    background-color: var(--abyss-navy);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.depth-gauge-container {
    width: 100%;
    position: relative;
    max-width: 600px;
}

.depth-gauge-svg {
    width: 100%;
    height: auto;
}

.depth-marker {
    position: absolute;
    top: 0;
    left: 5%;
    width: 3px;
    height: 20px;
    background-color: #00FF00;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.8);
    z-index: 10;
}

.depth-label {
    font-family: "Source Sans 3", sans-serif;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.75;
    color: var(--pale-steel);
    text-align: center;
}

/* ============================================
   BUBBLE ANIMATIONS
   Rising spheres with surface tension edge
   Each module has unique bubble animations
   ============================================ */

.bubbles {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    overflow: hidden;
}

/* Bubble pseudo-elements - each module has unique timing */
.bubbles::before,
.bubbles::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: bubbleRise ease-in infinite;
}

/* Module A - The Bridge */
.bubbles-a::before {
    width: 6px;
    height: 6px;
    left: 15%;
    animation-duration: 8s;
    animation-delay: 0s;
}

.bubbles-a::after {
    width: 10px;
    height: 10px;
    left: 45%;
    animation-duration: 12s;
    animation-delay: 2s;
}

/* Module B - The Logbook (15% opacity, subtle) */
.bubbles-b::before {
    width: 5px;
    height: 5px;
    left: 10%;
    animation-duration: 10s;
    animation-delay: 0s;
    opacity: 0.15;
}

.bubbles-b::after {
    width: 4px;
    height: 4px;
    left: 20%;
    animation-duration: 8s;
    animation-delay: 1s;
    opacity: 0.15;
}

/* Module C - The Porthole (visible, prominent) */
.bubbles-c::before {
    width: 8px;
    height: 8px;
    left: 30%;
    animation-duration: 15s;
    animation-delay: 0s;
}

.bubbles-c::after {
    width: 12px;
    height: 12px;
    left: 65%;
    animation-duration: 18s;
    animation-delay: 3s;
}

/* Module D - Signal Flags (15% opacity, subtle) */
.bubbles-d::before {
    width: 5px;
    height: 5px;
    left: 20%;
    animation-duration: 10s;
    animation-delay: 0s;
    opacity: 0.15;
}

.bubbles-d::after {
    width: 4px;
    height: 4px;
    left: 75%;
    animation-duration: 8s;
    animation-delay: 1s;
    opacity: 0.15;
}

/* Module E - The Compass (15% opacity, subtle) */
.bubbles-e::before {
    width: 5px;
    height: 5px;
    left: 25%;
    animation-duration: 11s;
    animation-delay: 0.5s;
    opacity: 0.15;
}

.bubbles-e::after {
    width: 4px;
    height: 4px;
    left: 80%;
    animation-duration: 9s;
    animation-delay: 1.5s;
    opacity: 0.15;
}

/* Module F - The Depth Gauge (15% opacity, subtle) */
.bubbles-f::before {
    width: 5px;
    height: 5px;
    left: 15%;
    animation-duration: 10s;
    animation-delay: 0s;
    opacity: 0.15;
}

.bubbles-f::after {
    width: 4px;
    height: 4px;
    left: 70%;
    animation-duration: 8s;
    animation-delay: 1s;
    opacity: 0.15;
}

/* Bubble Rise Animation - physics-based ease-in */
@keyframes bubbleRise {
    0% {
        transform: translateY(100%) scale(1);
        opacity: 0.6;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(-100vh) scale(1.1);
        opacity: 0;
    }
}

/* ============================================
   RESPONSIVE DESIGN - Mobile first
   Below 768px: single column layout
   ============================================ */

@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: 1fr;
    }

    .module-a,
    .module-b,
    .module-c,
    .module-d,
    .module-e,
    .module-f {
        grid-column: 1 / -1 !important;
    }

    .module-a {
        height: 40vh;
    }

    .module-c {
        aspect-ratio: auto;
        height: 250px;
    }

    .porthole {
        border-radius: 24px;
    }

    .module-b p {
        column-count: 1;
    }

    .module-d,
    .module-e {
        height: auto;
        min-height: 200px;
    }

    .signal-flags-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .compass-rose {
        width: 150px;
        height: 150px;
    }

    .module-f {
        height: auto;
        min-height: 120px;
    }
}

/* ============================================
   INTERACTION STATES
   ============================================ */

.flag:focus {
    outline: 2px solid var(--naval-brass);
    outline-offset: 2px;
}

a {
    color: inherit;
}

/* Ensure all text is readable */
h1, h2, h3, p {
    color: var(--pale-steel);
}
