/* ================================================
   main.css — Sudibase Tech × Astronomy
   Complements style.css
   ================================================ */

/* ── Canvas cosmos ────────────────────────────── */
#cosmos-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* ── Nebula CSS overlays ─────────────────────── */
.nebula-overlay {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.nebula {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    mix-blend-mode: screen;
    will-change: transform;
}

.nebula-1 {
    width: 600px; height: 400px;
    top: -100px; left: -150px;
    background: radial-gradient(ellipse, rgba(80, 0, 160, 0.18) 0%, transparent 70%);
}

.nebula-2 {
    width: 500px; height: 500px;
    top: 30vh; right: -200px;
    background: radial-gradient(ellipse, rgba(0, 80, 200, 0.14) 0%, transparent 70%);
}

.nebula-3 {
    width: 700px; height: 300px;
    bottom: 10vh; left: 20%;
    background: radial-gradient(ellipse, rgba(0, 180, 220, 0.08) 0%, transparent 70%);
}

/* ── HERO overrides ──────────────────────────── */
.hero {
    background: transparent;
}

/* ── Glitch ──────────────────────────────────── */
#glitch-title {
    position: relative;
    display: block;
}

#glitch-title.glitching::before,
#glitch-title.glitching::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--cyan) 0%, var(--purple) 50%, var(--pink) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#glitch-title.glitching::before {
    animation: glitch-1 0.35s steps(2) forwards;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

#glitch-title.glitching::after {
    animation: glitch-2 0.35s steps(2) forwards;
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

@keyframes glitch-1 {
    0%   { transform: translate(-3px, 2px); opacity: 0.8; }
    33%  { transform: translate(3px, -1px); opacity: 0.6; }
    66%  { transform: translate(-2px, 3px); opacity: 0.8; }
    100% { transform: translate(0, 0);       opacity: 0; }
}

@keyframes glitch-2 {
    0%   { transform: translate(3px, -2px); opacity: 0.6; }
    33%  { transform: translate(-3px, 1px); opacity: 0.8; }
    66%  { transform: translate(2px, -3px); opacity: 0.6; }
    100% { transform: translate(0, 0);       opacity: 0; }
}

/* ── COSMOS CARDS ─────────────────────────────── */
.cosmos-section {
    padding: 5rem 2rem 4rem;
    max-width: 1300px;
    margin: 0 auto;
}

.cosmos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.cosmos-card {
    position: relative;
    border-radius: 16px;
    padding: 2rem 1.5rem;
    border: 1px solid rgba(0, 245, 255, 0.1);
    background: rgba(5, 14, 28, 0.7);
    backdrop-filter: blur(12px);
    overflow: hidden;
    cursor: default;
    /* Reveal animation */
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease,
                border-color 0.3s, box-shadow 0.3s;
}

.cosmos-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Cursor-tracking gradient */
.cosmos-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle 180px at var(--mx, 50%) var(--my, 50%),
        rgba(0, 245, 255, 0.07) 0%,
        transparent 70%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.cosmos-card:hover::after { opacity: 1; }

.cosmos-card__bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse 60% 50% at 80% 20%,
        hsla(var(--card-hue, 190), 80%, 60%, 0.06) 0%,
        transparent 70%
    );
    pointer-events: none;
}

.cosmos-card:hover {
    border-color: rgba(0, 245, 255, 0.3);
    box-shadow:
        0 0 30px rgba(0, 245, 255, 0.08),
        0 20px 50px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255,255,255,0.05);
    transform: translateY(-6px) !important;
}

.cosmos-card__glyph {
    position: absolute;
    top: 1rem; right: 1.2rem;
    font-size: 0.8rem;
    color: rgba(0, 245, 255, 0.3);
}

.cosmos-card__icon {
    font-size: 2.4rem;
    margin-bottom: 1rem;
    display: block;
    filter: drop-shadow(0 0 12px rgba(0, 245, 255, 0.4));
}

.cosmos-card__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #e8f4ff;
    margin-bottom: 0.3rem;
}

.cosmos-card__sub {
    font-size: 0.78rem;
    font-family: var(--font-mono);
    color: var(--text-dim);
    letter-spacing: 0.05em;
}

/* ── Constellation SVG divider ───────────────── */
.constellation-divider {
    padding: 0 2rem;
    max-width: 1300px;
    margin: 0 auto;
    overflow: hidden;
}

.constellation-divider svg {
    width: 100%;
    height: 80px;
}

/* ── LAB SECTION ──────────────────────────────── */
.lab-section {
    padding: 5rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.lab-header {
    margin-bottom: 3.5rem;
}

.lab-orbs {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.orb {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 1.5rem 1.2rem;
    border-radius: 50%;
    width: 110px;
    height: 110px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    position: relative;
    cursor: default;
    /* Reveal */
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.5s ease, transform 0.5s ease;
    animation: orb-float 4s ease-in-out infinite;
}

.orb.revealed {
    opacity: 1;
    transform: scale(1);
}

@keyframes orb-float {
    0%, 100% { transform: scale(1)    translateY(0px); }
    50%       { transform: scale(1.03) translateY(-5px); }
}

.orb:hover {
    border-color: rgba(0, 245, 255, 0.5);
    box-shadow: 0 0 30px rgba(0, 245, 255, 0.2), 0 0 60px rgba(0, 245, 255, 0.08);
}

.orb__icon {
    font-size: 1.6rem;
    filter: drop-shadow(0 0 8px rgba(0, 245, 255, 0.5));
}

.orb span {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--text-dim);
    letter-spacing: 0.05em;
    text-align: center;
}

/* ── APOD SECTION ─────────────────────────────── */
.apod-section {
    padding: 4rem 2rem 6rem;
    max-width: 1200px;
    margin: 0 auto;
}

.apod-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    padding: 3rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: rgba(5, 14, 28, 0.8);
    backdrop-filter: blur(16px);
    /* Reveal */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.apod-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

.apod-card__sub {
    color: var(--text-dim);
    font-size: 0.95rem;
    line-height: 1.65;
    margin: 0.75rem 0 2rem;
}

.apod-date {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--cyan);
    letter-spacing: 0.1em;
    margin: 0.4rem 0 2rem;
}

.apod-card__right {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Vidéo embed responsive */
.apod-video-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.apod-video-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Vidéo MP4 directe */
.apod-video {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    display: block;
}

/* Image APOD */
.apod-img-link { display: block; }

.apod-img {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    transition: transform 0.4s, box-shadow 0.4s;
}

.apod-img:hover {
    transform: scale(1.02);
    box-shadow: 0 30px 80px rgba(0,0,0,0.7), 0 0 40px rgba(0,245,255,0.1);
}

/* Animated planet rings */
.apod-placeholder {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(0, 245, 255, 0.2);
    animation: ring-pulse 3s ease-out infinite;
}

.ring-1 { width: 80px;  height: 80px;  }
.ring-2 { width: 130px; height: 130px; }
.ring-3 { width: 190px; height: 190px; }

@keyframes ring-pulse {
    0%   { opacity: 0.8; transform: scale(0.95); }
    50%  { opacity: 0.3; transform: scale(1.0);  }
    100% { opacity: 0.8; transform: scale(0.95); }
}

.apod-star {
    font-size: 3rem;
    color: #fff8d0;
    text-shadow: 0 0 30px rgba(255, 230, 80, 0.8), 0 0 60px rgba(255, 200, 50, 0.4);
    animation: star-glow 2.5s ease-in-out infinite alternate;
    position: relative;
    z-index: 1;
}

@keyframes star-glow {
    from { text-shadow: 0 0 20px rgba(255, 230, 80, 0.6), 0 0 40px rgba(255, 200, 50, 0.3); }
    to   { text-shadow: 0 0 40px rgba(255, 230, 80, 1.0), 0 0 80px rgba(255, 200, 50, 0.6); }
}

/* ── RESPONSIVE ───────────────────────────────── */
@media (max-width: 1024px) {
    .cosmos-grid { grid-template-columns: repeat(2, 1fr); }
    .apod-card   { grid-template-columns: 1fr; gap: 2.5rem; }
}

@media (max-width: 640px) {
    .cosmos-grid { grid-template-columns: 1fr; }
    .lab-orbs    { gap: 1rem; }
    .orb         { width: 90px; height: 90px; }
    .apod-card   { padding: 2rem 1.5rem; }
    .apod-placeholder { width: 160px; height: 160px; }
    .ring-3 { width: 150px; height: 150px; }
}
