@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;900&family=Space+Mono:wght@400;700&display=swap');

:root {
    --primary-bg: #0a0e27;
    --primary-color: #e8f4f8;
    --accent: #00d4ff;
    --accent-glow: #0095ff;
    --border-radius: 12px;
    --shadow: 0 8px 32px rgba(0, 212, 255, 0.15);
    --shadow-strong: 0 12px 48px rgba(0, 212, 255, 0.25);
    --card-bg: #1a1f3a;
    --card-border: rgba(0, 212, 255, 0.2);
    --link: #00d4ff;
    --link-hover: #5ae4ff;
    --footer: #8b9dc3;
    --glow: 0 0 20px rgba(0, 212, 255, 0.4);
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0 15px;
    background: radial-gradient(ellipse at top, #1a1f3a 0%, #0a0e27 50%, #000000 100%);
    background-attachment: fixed;
    color: var(--primary-color);
    font-family: 'Space Mono', monospace;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.4), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(255, 255, 255, 0.3), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(255, 255, 255, 0.2), transparent),
        radial-gradient(1px 1px at 80% 10%, rgba(255, 255, 255, 0.3), transparent),
        radial-gradient(2px 2px at 90% 60%, rgba(255, 255, 255, 0.25), transparent),
        radial-gradient(1px 1px at 33% 80%, rgba(255, 255, 255, 0.2), transparent);
    background-size: 200% 200%, 180% 180%, 150% 150%, 220% 220%, 190% 190%, 160% 160%;
    background-position: 0% 0%, 100% 100%, 50% 50%, 100% 0%, 0% 100%, 50% 0%;
    pointer-events: none;
    opacity: 0.5;
    z-index: 1;
}

/* Container and Layout */
.site-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 15px;
    position: relative;
    z-index: 2;
}

.site-header {
    position: relative;
    text-align: center;
    margin-bottom: 40px;
    padding-top: 20px;
    animation: fadeInDown 0.8s ease-out;
}

/* Page load animations - staggered for smooth reveal */
.content-block__description p:nth-child(1) {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.content-block__description p:nth-child(2) {
    animation: fadeInUp 0.8s ease-out 0.3s both;
}

.content-block__description p:nth-child(3) {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.content-block__media {
    animation: fadeInUp 0.8s ease-out 0.5s both;
}

.iss-info {
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

.iss-map {
    animation: fadeInUp 0.8s ease-out 0.7s both;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.site-header__row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.site-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    font-weight: 900;
    margin: 0;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.6),
                 0 0 60px rgba(0, 212, 255, 0.3);
    animation: titlePulse 3s ease-in-out infinite;
    will-change: text-shadow;
}

.site-header__artwork {
    margin-top: 24px;
    text-align: center;
}

.artwork-image {
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: 400px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-strong),
                0 0 40px rgba(0, 212, 255, 0.2);
    border: 2px solid var(--card-border);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    animation: fadeInUp 0.8s ease-out 0.1s both;
}

.artwork-image:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-strong),
                0 0 60px rgba(0, 212, 255, 0.3);
    border-color: rgba(0, 212, 255, 0.5);
}

@keyframes titlePulse {
    0%, 100% {
        text-shadow: 0 0 30px rgba(0, 212, 255, 0.6),
                     0 0 60px rgba(0, 212, 255, 0.3);
    }
    50% {
        text-shadow: 0 0 40px rgba(0, 212, 255, 0.8),
                     0 0 80px rgba(0, 212, 255, 0.4);
    }
}

.content-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    margin-bottom: 20px;
}

.content-block__description {
    max-width: 680px;
    width: 100%;
    text-align: center;
}

.content-block__description p {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 20px;
    text-align: left;
    padding: 24px;
    background: linear-gradient(135deg, rgba(26, 31, 58, 0.95) 0%, rgba(26, 31, 58, 0.85) 100%);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow),
                inset 0 1px 0 rgba(0, 212, 255, 0.1);
    color: var(--primary-color);
    border: 1px solid var(--card-border);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.content-block__description p:last-child {
    margin-bottom: 0;
}

.content-block__description p:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-strong),
                inset 0 1px 0 rgba(0, 212, 255, 0.2);
    border-color: rgba(0, 212, 255, 0.4);
}

.content-block__description a {
    color: var(--link);
    text-decoration: none;
    word-break: break-word;
    font-weight: 700;
    position: relative;
    transition: color 0.2s ease;
}

.content-block__description a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-glow));
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.content-block__description a:hover {
    color: var(--link-hover);
}

.content-block__description a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

.wiggle-trigger {
    display: inline;
    background: none;
    border: none;
    color: var(--link);
    text-decoration: underline;
    font: inherit;
    cursor: pointer;
    padding: 0;
    margin: 0;
    transition: transform 0.2s ease, color 0.2s ease;
    font-weight: 700;
}

.wiggle-trigger:hover,
.wiggle-trigger:focus {
    color: var(--link-hover);
    animation: wiggle 0.5s ease;
    outline: none;
}

.wiggle-trigger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.content-block__media {
    max-width: 680px;
    width: 100%;
    text-align: center;
}

.content-block__media video {
    max-width: 100%;
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-strong),
                0 0 40px rgba(0, 212, 255, 0.2);
    background: #000;
    border: 2px solid var(--card-border);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.content-block__media video:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-strong),
                0 0 60px rgba(0, 212, 255, 0.3);
    border-color: rgba(0, 212, 255, 0.5);
}

.iss-map {
    height: 450px;
    max-width: 680px;
    width: 100%;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-strong),
                0 0 40px rgba(0, 212, 255, 0.15);
    margin-bottom: 20px;
    border: 2px solid var(--card-border);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    /* Improve map contrast and visibility */
    filter: contrast(1.15) brightness(1.1) saturate(1.2);
}

/* Enhance map tile contrast */
.iss-map .leaflet-container {
    background-color: #1a1f3a;
}

.iss-map .leaflet-tile-container img {
    filter: contrast(1.1) brightness(1.05);
}

.iss-map:hover {
    box-shadow: var(--shadow-strong),
                0 0 60px rgba(0, 212, 255, 0.25);
    border-color: rgba(0, 212, 255, 0.5);
}

.iss-info {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    max-width: 680px;
    width: 100%;
    color: var(--accent);
    text-align: center;
    margin-bottom: 16px;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(26, 31, 58, 0.6) 0%, rgba(26, 31, 58, 0.4) 100%);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    border: 1px solid var(--card-border);
    letter-spacing: 0.05em;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

/* Metadata display layout */
.iss-info__primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.iss-info__separator {
    color: var(--accent);
    opacity: 0.5;
}

.iss-info__metadata {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    font-size: 0.9rem;
}

.iss-info__meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}

.iss-info__meta-item i {
    color: var(--accent);
    font-size: 1rem;
}

/* France Pass Prediction */
.france-pass-info {
    max-width: 680px;
    width: 100%;
    background: linear-gradient(135deg, rgba(26, 31, 58, 0.6) 0%, rgba(26, 31, 58, 0.4) 100%);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    border: 1px solid var(--card-border);
    padding: 16px 20px;
    margin-bottom: 16px;
    font-family: 'Space Mono', monospace;
    transition: all 0.3s ease;
    animation: fadeInUp 0.8s ease-out 0.65s both;
}

.france-pass-info--active {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2) 0%, rgba(0, 149, 255, 0.1) 100%);
    border-color: var(--accent);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

.france-pass-info__current {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    color: var(--accent);
    text-align: center;
    justify-content: center;
}

.france-pass-info__current i {
    font-size: 1.5rem;
    animation: wiggle 1s ease-in-out infinite;
}

.france-pass-info__next {
    text-align: center;
}

.france-pass-info__label {
    font-size: 0.9rem;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.france-pass-info__countdown {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.france-pass-info__details {
    font-size: 0.85rem;
    color: var(--footer);
}

.france-pass-info__none {
    text-align: center;
    color: var(--footer);
    font-size: 0.9rem;
}

.france-pass-info__history {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--card-border);
}

.france-pass-info__history summary {
    cursor: pointer;
    color: var(--link);
    font-weight: 700;
    user-select: none;
    transition: color 0.2s ease;
}

.france-pass-info__history summary:hover {
    color: var(--link-hover);
}

.france-pass-info__history ul {
    list-style: none;
    padding: 12px 0 0 0;
    margin: 0;
}

.france-pass-info__history li {
    padding: 6px 0;
    font-size: 0.85rem;
    color: var(--primary-color);
    border-bottom: 1px solid rgba(0, 212, 255, 0.1);
}

.france-pass-info__history li:last-child {
    border-bottom: none;
}

/* Loading skeleton */
.iss-info--loading {
    min-height: 80px;
}

.iss-info__skeleton {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.skeleton-text {
    background: linear-gradient(90deg,
        rgba(0, 212, 255, 0.1) 25%,
        rgba(0, 212, 255, 0.2) 50%,
        rgba(0, 212, 255, 0.1) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text--lg {
    width: 300px;
    height: 20px;
}

.skeleton-text--sm {
    width: 400px;
    height: 16px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.iss-info:not(.iss-info--loading) .iss-info__skeleton {
    display: none;
}

.site-footer {
    color: var(--footer);
    margin-top: 3rem;
    padding-bottom: 2rem;
    font-size: 0.9rem;
    position: relative;
    z-index: 2;
    text-align: center;
}

.site-footer a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-footer a:hover {
    color: var(--link-hover);
}

.site-home-link {
    font-size: 1.2rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: bold;
    background: linear-gradient(135deg, rgba(26, 31, 58, 0.95) 0%, rgba(26, 31, 58, 0.85) 100%);
    backdrop-filter: blur(10px);
    padding: 0.5em 0.7em;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow),
                inset 0 1px 0 rgba(0, 212, 255, 0.2);
    border: 1px solid var(--card-border);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.site-home-link:hover {
    background: var(--accent);
    color: #0a0e27;
    box-shadow: var(--shadow-strong),
                0 0 30px rgba(0, 212, 255, 0.5);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.site-home-link i {
    font-size: 1em;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive breakpoints */
@media screen and (max-width: 1024px) {
    .site-title {
        font-size: 2.5rem;
    }

    .artwork-image {
        max-height: 350px;
    }
}

@media screen and (max-width: 768px) {
    body {
        padding: 0 12px;
    }

    .site-container {
        padding: 16px 12px;
    }

    .site-header {
        margin-bottom: 32px;
        padding-top: 20px;
    }

    .site-title {
        font-size: 2rem;
        letter-spacing: 0.08em;
    }

    .site-header__artwork {
        margin-top: 20px;
    }

    .artwork-image {
        max-height: 300px;
    }

    .site-home-link {
        font-size: 1rem;
        padding: 0.6em 0.8em;
    }

    .content-block {
        gap: 24px;
    }

    .content-block__description p {
        font-size: 0.95rem;
        padding: 18px;
        line-height: 1.6;
    }

    .iss-map {
        height: 350px;
    }

    .iss-info {
        font-size: 1rem;
        padding: 10px 16px;
    }

    .iss-info__metadata {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    /* Hide scale bar on mobile to save space */
    .leaflet-control-scale {
        display: none;
    }

    .france-pass-info__countdown {
        font-size: 1.4rem;
    }

    .site-footer {
        font-size: 0.85rem;
        margin-top: 2rem;
    }
}

@media screen and (max-width: 480px) {
    body {
        padding: 0 8px;
    }

    .site-container {
        padding: 12px 8px;
    }

    .site-header {
        margin-bottom: 24px;
        padding-top: 20px;
    }

    .site-title {
        font-size: 1.6rem;
        letter-spacing: 0.06em;
    }

    .site-header__artwork {
        margin-top: 16px;
    }

    .artwork-image {
        max-height: 250px;
        border-radius: 8px;
    }

    .site-home-link {
        font-size: 0.9rem;
        padding: 0.5em 0.7em;
        gap: 0.3em;
    }

    .content-block {
        gap: 20px;
    }

    .content-block__description p {
        font-size: 0.9rem;
        padding: 16px;
        line-height: 1.6;
    }

    .iss-map {
        height: 280px;
        border-radius: 8px;
    }

    .iss-info {
        font-size: 0.9rem;
        padding: 10px 14px;
        letter-spacing: 0.03em;
    }

    .iss-info__metadata {
        grid-template-columns: 1fr;
    }

    .content-block__media video {
        border-radius: 8px;
    }

    .site-footer {
        font-size: 0.8rem;
        margin-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .artwork-image:hover {
        transform: none;
        box-shadow: var(--shadow-strong),
                    0 0 40px rgba(0, 212, 255, 0.2);
        border-color: var(--card-border);
    }

    .content-block__media video:hover {
        transform: none;
    }

    .content-block__description p:hover {
        transform: none;
        box-shadow: var(--shadow),
                    inset 0 1px 0 rgba(0, 212, 255, 0.1);
        border-color: var(--card-border);
    }

    .iss-map:hover {
        box-shadow: var(--shadow-strong),
                    0 0 40px rgba(0, 212, 255, 0.15);
        border-color: var(--card-border);
    }

    /* Make interactive elements more touch-friendly */
    .site-home-link {
        min-height: 44px;
        min-width: 44px;
    }

    .content-block__description a {
        padding: 4px 2px;
        margin: -4px -2px;
    }

    .wiggle-trigger {
        padding: 6px 4px;
        margin: -6px -4px;
        min-height: 32px;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .site-title {
        animation: none;
        text-shadow: 0 0 30px rgba(0, 212, 255, 0.6),
                     0 0 60px rgba(0, 212, 255, 0.3);
    }

    .wiggle-trigger:hover {
        animation: none;
    }
}

/* Print styles */
@media print {
    body::before {
        display: none;
    }

    .site-home-link {
        display: none;
    }

    .content-block__description p,
    .iss-info {
        box-shadow: none;
        border: 1px solid #333;
    }

    .iss-map {
        break-inside: avoid;
    }
}

/* Zoom to ISS custom control styling */
.leaflet-control-custom a {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent) !important;
    text-decoration: none;
    font-size: 16px;
}

.leaflet-control-custom a:hover {
    background: var(--accent) !important;
    color: var(--primary-bg) !important;
}

/* Leaflet Map Custom Theme - Space Style */
/* Based on research from: https://dev.to/deepakdevanand/leaflet-map-dark-theme-5ej0 */

/* Map container background */
.iss-map .leaflet-container {
    background: var(--primary-bg) !important;
}

/* Dark theme for map tiles using CSS filters */
.leaflet-tile-container .leaflet-tile {
    filter: brightness(0.4) invert(1) hue-rotate(180deg) saturate(0.8) contrast(1.3) brightness(0.6) !important;
}

/* Zoom controls styling */
.leaflet-bar a,
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
    background: linear-gradient(135deg, rgba(26, 31, 58, 0.95) 0%, rgba(26, 31, 58, 0.85) 100%) !important;
    backdrop-filter: blur(10px) !important;
    color: var(--accent) !important;
    border: 1px solid var(--card-border) !important;
    box-shadow: var(--shadow), inset 0 1px 0 rgba(0, 212, 255, 0.1) !important;
    font-weight: 700 !important;
    transition: all 0.3s ease !important;
}

.leaflet-bar a:hover,
.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
    background: var(--accent) !important;
    color: var(--primary-bg) !important;
    box-shadow: var(--shadow-strong), 0 0 30px rgba(0, 212, 255, 0.5) !important;
    border-color: var(--accent) !important;
}

.leaflet-bar {
    border: none !important;
    box-shadow: none !important;
}

/* Attribution styling */
.leaflet-control-attribution {
    background: linear-gradient(135deg, rgba(26, 31, 58, 0.9) 0%, rgba(26, 31, 58, 0.8) 100%) !important;
    backdrop-filter: blur(10px) !important;
    color: var(--primary-color) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: 8px !important;
    padding: 6px 12px !important;
    font-family: 'Space Mono', monospace !important;
    font-size: 0.7rem !important;
    box-shadow: var(--shadow) !important;
}

.leaflet-control-attribution a {
    color: var(--link) !important;
    text-decoration: none !important;
    transition: color 0.2s ease !important;
}

.leaflet-control-attribution a:hover {
    color: var(--link-hover) !important;
}

/* Popup styling */
.leaflet-popup-content-wrapper {
    background: linear-gradient(135deg, rgba(26, 31, 58, 0.95) 0%, rgba(26, 31, 58, 0.9) 100%) !important;
    backdrop-filter: blur(10px) !important;
    color: var(--primary-color) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: 8px !important;
    box-shadow: var(--shadow-strong) !important;
    font-family: 'Space Mono', monospace !important;
}

.leaflet-popup-tip {
    background: rgba(26, 31, 58, 0.95) !important;
}

.leaflet-popup-close-button {
    color: var(--accent) !important;
    font-size: 18px !important;
    font-weight: 700 !important;
}

.leaflet-popup-close-button:hover {
    color: var(--link-hover) !important;
}