/* Terminus font */
@font-face {
    font-family: 'Terminus';
    src: url('/fonts/terminus.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Hidden radio button controls for view state */
.view-control {
    display: none;
}

/* Starship Bridge View */
body {
    font-family: 'Terminus', monospace, sans-serif;
    background: radial-gradient(ellipse at center, #0a1628 0%, #050a15 50%, #000000 100%);
    color: #d4e4f5;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Animated stars in background - Layer 1: Distant stars */
body::before {
    content: '';
    position: absolute;
    width: 300%;
    height: 300%;
    top: -100%;
    left: -100%;
    background-image:
        radial-gradient(3px 3px at 15% 25%, rgba(255, 255, 255, 1), transparent),
        radial-gradient(2px 2px at 35% 45%, rgba(200, 220, 255, 1), transparent),
        radial-gradient(2px 2px at 55% 15%, rgba(255, 240, 220, 1), transparent),
        radial-gradient(1px 1px at 75% 35%, rgba(255, 255, 255, 0.9), transparent),
        radial-gradient(3px 3px at 85% 65%, rgba(220, 230, 255, 1), transparent),
        radial-gradient(2px 2px at 25% 75%, rgba(255, 250, 240, 1), transparent),
        radial-gradient(1px 1px at 45% 85%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(2px 2px at 65% 55%, rgba(240, 245, 255, 1), transparent),
        radial-gradient(1px 1px at 10% 60%, rgba(255, 255, 255, 0.9), transparent),
        radial-gradient(2px 2px at 90% 20%, rgba(255, 255, 255, 1), transparent),
        radial-gradient(1px 1px at 50% 40%, rgba(200, 210, 255, 0.8), transparent),
        radial-gradient(2px 2px at 70% 80%, rgba(255, 245, 235, 1), transparent),
        radial-gradient(1px 1px at 30% 10%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(3px 3px at 80% 50%, rgba(230, 240, 255, 1), transparent),
        radial-gradient(1px 1px at 20% 90%, rgba(255, 255, 255, 0.9), transparent),
        radial-gradient(2px 2px at 60% 30%, rgba(255, 250, 245, 1), transparent);
    background-size: 250% 250%, 220% 220%, 280% 280%, 240% 240%, 260% 260%, 230% 230%, 270% 270%, 245% 245%, 235% 235%, 265% 265%, 255% 255%, 275% 275%, 225% 225%, 290% 290%, 215% 215%, 285% 285%;
    animation: twinkle 40s ease-in-out infinite, drift 120s linear infinite;
    opacity: 1;
    pointer-events: none;
}

/* Layer 2: Closer, brighter stars */
body::after {
    content: '';
    position: absolute;
    width: 250%;
    height: 250%;
    top: -75%;
    left: -75%;
    background-image:
        radial-gradient(3px 3px at 22% 18%, rgba(255, 255, 255, 1), transparent),
        radial-gradient(4px 4px at 48% 62%, rgba(220, 235, 255, 1), transparent),
        radial-gradient(2px 2px at 68% 38%, rgba(255, 245, 235, 1), transparent),
        radial-gradient(3px 3px at 12% 72%, rgba(255, 255, 255, 1), transparent),
        radial-gradient(4px 4px at 82% 28%, rgba(235, 245, 255, 1), transparent),
        radial-gradient(2px 2px at 38% 88%, rgba(255, 250, 240, 1), transparent),
        radial-gradient(3px 3px at 58% 12%, rgba(255, 255, 255, 1), transparent),
        radial-gradient(2px 2px at 92% 52%, rgba(245, 250, 255, 1), transparent),
        radial-gradient(4px 4px at 28% 42%, rgba(255, 255, 255, 1), transparent),
        radial-gradient(3px 3px at 72% 68%, rgba(230, 240, 255, 1), transparent);
    background-size: 200% 200%, 180% 180%, 220% 220%, 190% 190%, 210% 210%, 195% 195%, 185% 185%, 205% 205%, 175% 175%, 215% 215%;
    animation: twinkleBright 30s ease-in-out infinite reverse, drift 90s linear infinite reverse;
    opacity: 1;
    pointer-events: none;
    z-index: 1;
}

@keyframes twinkle {
    0%, 100% {
        opacity: 1;
    }
    25% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.8;
    }
    75% {
        opacity: 0.3;
    }
}

@keyframes twinkleBright {
    0%, 100% {
        opacity: 1;
    }
    33% {
        opacity: 0.5;
    }
    66% {
        opacity: 0.9;
    }
}

@keyframes drift {
    0% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-8%, -6%) rotate(1deg); }
    66% { transform: translate(-4%, -10%) rotate(-1deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

.atmosphere {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* Title Overlay */
/* Sector Navigator - Tactical control panel */
.sector-navigator {
    position: absolute;
    top: 12%;
    left: 3%;
    display: flex;
    gap: 12px;
    z-index: 100;
    animation: fadeIn 2s ease-out 0.5s backwards;
}

.sector-btn {
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(77, 184, 255, 0.4);
    border-radius: 3px;
    color: rgba(160, 196, 224, 0.7);
    font-size: 0.75em;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-weight: normal;
    user-select: none;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.sector-btn:hover {
    border-color: rgba(77, 184, 255, 0.7);
    color: rgba(160, 196, 224, 1);
    box-shadow: 0 0 10px rgba(77, 184, 255, 0.3);
}

/* Active sector button states */
#view-world:checked ~ .atmosphere .sector-navigator label[for="view-world"],
#view-usa:checked ~ .atmosphere .sector-navigator label[for="view-usa"],
#view-europe:checked ~ .atmosphere .sector-navigator label[for="view-europe"] {
    border: 2px solid #ff3333;
    color: #ff3333;
    background: rgba(255, 51, 51, 0.1);
    box-shadow:
        0 0 15px rgba(255, 51, 51, 0.5),
        inset 0 0 10px rgba(255, 51, 51, 0.2);
    font-weight: bold;
    padding: 7px 15px; /* Adjust for border width */
}

.title-overlay {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 100;
    animation: fadeInDown 2s ease-out;
}

.title-overlay h1 {
    font-size: 3em;
    color: #4db8ff;
    text-shadow:
        0 0 10px rgba(77, 184, 255, 0.8),
        0 0 20px rgba(77, 184, 255, 0.6),
        0 0 30px rgba(77, 184, 255, 0.4),
        2px 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 8px;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1em;
    color: #a0c4e0;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    letter-spacing: 2px;
    opacity: 0.9;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Navigation Console Frame - Tight viewport window */
.earth-container {
    position: relative;
    width: 90%;
    max-width: 1600px;
    height: 75vh;
    max-height: 800px;
    background: rgba(0, 0, 0, 0.6);
    border: 3px solid #4db8ff;
    border-radius: 4px;
    box-shadow:
        0 0 20px rgba(77, 184, 255, 0.4),
        inset 0 0 30px rgba(77, 184, 255, 0.1);
    overflow: visible;
    animation: screenBoot 1.5s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5%;
}

@keyframes screenBoot {
    0% {
        opacity: 0;
        border-color: transparent;
        box-shadow: none;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
        border-color: #4db8ff;
    }
}

/* Corner brackets for starship UI - tight to edge */
.earth-container::before,
.earth-container::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #4db8ff;
    z-index: 10;
    pointer-events: none;
    transition: box-shadow 0.3s ease;
}

/* Bracket pulse during view transition */
#view-world:checked ~ .atmosphere .earth-container::before,
#view-world:checked ~ .atmosphere .earth-container::after,
#view-usa:checked ~ .atmosphere .earth-container::before,
#view-usa:checked ~ .atmosphere .earth-container::after,
#view-europe:checked ~ .atmosphere .earth-container::before,
#view-europe:checked ~ .atmosphere .earth-container::after {
    animation: bracketPulse 0.6s ease-out;
}

@keyframes bracketPulse {
    0%, 100% {
        box-shadow: 0 0 0 rgba(77, 184, 255, 0);
    }
    50% {
        box-shadow: 0 0 15px rgba(77, 184, 255, 0.8);
    }
}

.earth-container::before {
    top: 4px;
    left: 4px;
    border-right: none;
    border-bottom: none;
}

.earth-container::after {
    top: 4px;
    right: 4px;
    border-left: none;
    border-bottom: none;
}

/* Flat World Map - Equirectangular Projection */
.earth-sphere {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 2px;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;

    /* Ocean base */
    background:
        /* Subtle water texture */
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(255, 255, 255, 0.02) 3px,
            rgba(255, 255, 255, 0.02) 6px
        ),
        /* Ocean gradient - realistic blue tones */
        linear-gradient(180deg,
            #1a4d6d 0%,
            #2563a8 15%,
            #2e7bc4 35%,
            #3a8dd4 50%,
            #2e7bc4 65%,
            #2563a8 85%,
            #1a4d6d 100%);

    box-shadow:
        inset 0 0 50px rgba(0, 0, 0, 0.3),
        0 0 30px rgba(77, 184, 255, 0.3);
}

/* Map Layer System - Three stacked views */
.map-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transition: opacity 0.6s ease-in-out, transform 0.6s ease-in-out, visibility 0.6s;
    overflow: visible;
    pointer-events: none;
}

/* Active map layer */
#view-world:checked ~ .atmosphere .map-world,
#view-usa:checked ~ .atmosphere .map-usa,
#view-europe:checked ~ .atmosphere .map-europe {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    pointer-events: auto;
}

/* World Map Layer */
.map-world::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/images/travel/world-map.svg');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
    opacity: 0.9;

    /* Apply cyan/earth tones to the SVG */
    filter:
        hue-rotate(180deg)
        saturate(0.6)
        brightness(0.7)
        contrast(1.1);
}

/* USA Map Layer */
.map-usa::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/images/travel/usa.svg');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
    opacity: 0.9;

    /* Apply cyan/earth tones to the SVG */
    filter:
        hue-rotate(180deg)
        saturate(0.6)
        brightness(0.7)
        contrast(1.1);
}

/* Europe Map Layer */
.map-europe::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/images/travel/europe.svg');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
    opacity: 0.9;

    /* Apply cyan/earth tones to the SVG */
    filter:
        hue-rotate(180deg)
        saturate(0.6)
        brightness(0.7)
        contrast(1.1);
}

/* Latitude/Longitude Grid Overlay - Applied to all layers */
.map-layer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(0deg, rgba(77, 184, 255, 0.1) 0px, transparent 1px, transparent 11.11%, rgba(77, 184, 255, 0.1) calc(11.11% + 1px)),
        repeating-linear-gradient(90deg, rgba(77, 184, 255, 0.1) 0px, transparent 1px, transparent 10%, rgba(77, 184, 255, 0.1) calc(10% + 1px));
    pointer-events: none;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

/* Grid pulse effect during transition */
#view-world:checked ~ .atmosphere .map-world::after,
#view-usa:checked ~ .atmosphere .map-usa::after,
#view-europe:checked ~ .atmosphere .map-europe::after {
    animation: gridPulse 0.6s ease-out;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

.cloud-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    /* Very subtle cloud patterns - reduced for map clarity */
    background:
        radial-gradient(ellipse 120px 70px at 22% 28%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 100px 60px at 48% 42%, rgba(255, 255, 255, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse 110px 65px at 68% 34%, rgba(255, 255, 255, 0.13) 0%, transparent 50%),
        radial-gradient(ellipse 90px 55px at 18% 58%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse 105px 60px at 78% 52%, rgba(255, 255, 255, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse 95px 58px at 58% 68%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);

    pointer-events: none;
    mix-blend-mode: screen;
    opacity: 0.4;
}

/* Destination Markers - Use data attributes for real coordinates */
.destination-marker {
    position: absolute;
    width: 10px;
    height: 10px;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 20;
    transition: all 0.3s ease;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
}

/* Marker visibility based on active view and region */
/* World view - show only world markers */
#view-world:checked ~ .atmosphere .map-world .destination-marker.region-world {
    opacity: 1;
    visibility: visible;
}

/* USA view - show only USA markers */
#view-usa:checked ~ .atmosphere .map-usa .destination-marker.region-usa {
    opacity: 1;
    visibility: visible;
}

/* Europe view - show only Europe markers */
#view-europe:checked ~ .atmosphere .map-europe .destination-marker.region-europe {
    opacity: 1;
    visibility: visible;
}

/* Calculate position from lat/lon using inline styles */
.marker-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    transform: translate(-50%, -50%);
    background: #ff3333;
    border-radius: 50%;
    box-shadow:
        0 0 4px #ff3333,
        0 0 8px #ff3333,
        0 0 12px rgba(255, 51, 51, 0.4);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Expanding ring on pulse */
.marker-pulse::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    border: 2px solid #ff3333;
    border-radius: 50%;
    animation: ripple 3s ease-out infinite;
}

@keyframes ripple {
    0% {
        width: 100%;
        height: 100%;
        opacity: 0.8;
    }
    50% {
        width: 150%;
        height: 150%;
        opacity: 0.4;
    }
    100% {
        width: 200%;
        height: 200%;
        opacity: 0;
    }
}

/* Location Label */
.marker-label {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #ff3333;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9em;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    border: 1px solid #ff3333;
    box-shadow: 0 0 10px rgba(255, 51, 51, 0.3);
}

.destination-marker:hover .marker-label {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

/* Photo Preview Thumbnails */
.preview-thumbnails {
    position: absolute;
    top: -84px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 30;
}

.destination-marker:hover .preview-thumbnails {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

.preview-thumbnails img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #ff3333;
    box-shadow:
        0 0 15px rgba(255, 51, 51, 0.5),
        0 4px 8px rgba(0, 0, 0, 0.6);
    transition: transform 0.3s ease;
}

.preview-thumbnails img:nth-child(1) {
    animation: floatUp 0.5s ease-out 0.1s backwards;
}

.preview-thumbnails img:nth-child(2) {
    animation: floatUp 0.5s ease-out 0.2s backwards;
}

.preview-thumbnails img:nth-child(3) {
    animation: floatUp 0.5s ease-out 0.3s backwards;
}

@keyframes floatUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.preview-thumbnails img:hover {
    transform: scale(1.15);
    z-index: 5;
}

/* Hover effect on marker */
.destination-marker:hover .marker-pulse {
    transform: translate(-50%, -50%) scale(1.3);
    box-shadow:
        0 0 8px #ff3333,
        0 0 16px #ff3333,
        0 0 24px rgba(255, 51, 51, 0.5);
}

/* Camera Legend */
.camera-legend {
    position: absolute;
    bottom: 5%;
    right: 5%;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #4db8ff;
    box-shadow: 0 0 15px rgba(77, 184, 255, 0.3);
    display: flex;
    gap: 20px;
    z-index: 100;
    animation: fadeIn 2s ease-out 1s backwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #a0c4e0;
    font-size: 0.9em;
}

.icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
}

.icon.ricoh {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.6);
}

.icon.iphone {
    background: linear-gradient(135deg, #4ecdc4, #44a3d5);
    box-shadow: 0 0 8px rgba(78, 205, 196, 0.6);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .earth-container {
        width: 95%;
        height: 65vh;
        padding: 0.6%;
    }

    .title-overlay h1 {
        font-size: 2.5em;
    }

    .sector-navigator {
        top: 11%;
        left: 2%;
        gap: 8px;
    }

    .sector-btn {
        padding: 7px 12px;
        font-size: 0.7em;
        letter-spacing: 1.5px;
    }

    #view-world:checked ~ .atmosphere .sector-navigator label[for="view-world"],
    #view-usa:checked ~ .atmosphere .sector-navigator label[for="view-usa"],
    #view-europe:checked ~ .atmosphere .sector-navigator label[for="view-europe"] {
        padding: 6px 11px;
    }
}

@media (max-width: 768px) {
    .atmosphere {
        padding: 30px 15px;
    }

    .title-overlay {
        top: 3%;
    }

    .title-overlay h1 {
        font-size: 2em;
        letter-spacing: 4px;
    }

    .sector-navigator {
        top: 10%;
        left: 50%;
        transform: translateX(-50%);
        gap: 6px;
    }

    .sector-btn {
        padding: 6px 10px;
        font-size: 0.65em;
        letter-spacing: 1px;
    }

    #view-world:checked ~ .atmosphere .sector-navigator label[for="view-world"],
    #view-usa:checked ~ .atmosphere .sector-navigator label[for="view-usa"],
    #view-europe:checked ~ .atmosphere .sector-navigator label[for="view-europe"] {
        padding: 5px 9px;
    }

    .earth-container {
        width: 95%;
        height: 60vh;
        padding: 0.7%;
    }

    .preview-thumbnails {
        top: -100px;
    }

    .preview-thumbnails img {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .title-overlay {
        top: 2%;
    }

    .title-overlay h1 {
        font-size: 1.5em;
        letter-spacing: 2px;
    }

    .sector-navigator {
        top: 9%;
        gap: 5px;
    }

    .sector-btn {
        padding: 5px 8px;
        font-size: 0.6em;
        letter-spacing: 0.5px;
    }

    #view-world:checked ~ .atmosphere .sector-navigator label[for="view-world"],
    #view-usa:checked ~ .atmosphere .sector-navigator label[for="view-usa"],
    #view-europe:checked ~ .atmosphere .sector-navigator label[for="view-europe"] {
        padding: 4px 7px;
    }

    .earth-container {
        width: 98%;
        height: 55vh;
        padding: 0.8%;
        border-width: 2px;
    }

    .preview-thumbnails {
        top: -80px;
        gap: 6px;
    }

    .preview-thumbnails img {
        width: 50px;
        height: 50px;
    }

    .earth-container::before,
    .earth-container::after {
        width: 15px;
        height: 15px;
    }
}
