/* Dream Atlas — a night sky of floating dream-islands */
.atlas {
    position: relative;
    overflow: hidden;
    min-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.atlas__sky {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.atlas__sky .star {
    position: absolute;
    border-radius: 50%;
    background: #e0def4;
    opacity: 0.5;
    animation: atlas-twinkle 4s ease-in-out infinite;
}

@keyframes atlas-twinkle {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.7; }
}

.atlas__header {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: var(--space-xl) 0 var(--space-md);
}

.atlas__title {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--font-display);
    font-size: var(--font-size-2xl);
}

.atlas__title-icon {
    width: 2rem;
    height: 2rem;
    color: var(--color-accent);
}

.atlas__subtitle {
    color: var(--color-text-muted);
    max-width: 560px;
    margin: var(--space-sm) auto 0;
}

/* The map itself */
.atlas__map {
    position: relative;
    z-index: 1;
    flex: 1;
    min-height: 520px;
    margin: var(--space-lg) auto;
    width: min(1100px, 96vw);
}

.atlas__paths {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.atlas__path {
    fill: none;
    stroke: rgba(var(--color-accent-rgb), 0.25);
    stroke-width: 0.25;
    stroke-dasharray: 1 1.6;
    animation: atlas-drift 30s linear infinite;
}

@keyframes atlas-drift {
    to { stroke-dashoffset: -26; }
}

/* Islands */
.atlas__island {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-align: center;
    animation: atlas-float 7s ease-in-out infinite;
    z-index: 2;
}

.atlas__island:hover,
.atlas__island:focus-visible {
    z-index: 10;
}

@keyframes atlas-float {
    0%, 100% { margin-top: 0; }
    50% { margin-top: -10px; }
}

.atlas__island-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -70%);
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(var(--color-accent-rgb), 0.35) 0%, transparent 65%);
    pointer-events: none;
    transition: opacity var(--transition);
}

.atlas__island-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    box-shadow: var(--shadow-glow), inset 0 -6px 12px rgba(0, 0, 0, 0.35);
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.atlas__island--sm .atlas__island-body { width: 56px; height: 56px; }
.atlas__island--md .atlas__island-body { width: 74px; height: 74px; }
.atlas__island--lg .atlas__island-body { width: 96px; height: 96px; }

.atlas__island:hover .atlas__island-body,
.atlas__island:focus-visible .atlas__island-body {
    transform: scale(1.12);
    border-color: var(--color-accent);
    box-shadow: var(--shadow-glow-strong), inset 0 -6px 12px rgba(0, 0, 0, 0.35);
}

.atlas__island-icon {
    width: 45%;
    height: 45%;
    color: var(--color-accent-hover);
}

.atlas__island-name {
    font-family: var(--font-display);
    font-size: var(--font-size-sm);
    color: var(--color-text);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

.atlas__island-stat {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

/* Hover card */
.atlas__card {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    width: 240px;
    padding: var(--space-md);
    background: var(--color-bg-alt);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
    text-align: left;
    pointer-events: none;
}

.atlas__island:hover .atlas__card,
.atlas__island:focus-visible .atlas__card {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.atlas__card-title {
    font-family: var(--font-display);
    color: var(--color-text);
}

.atlas__card-desc {
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
}

.atlas__card-label {
    margin-top: var(--space-xs);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-accent-hover);
}

.atlas__card-topic {
    font-size: var(--font-size-xs);
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.atlas__card-cta {
    margin-top: var(--space-xs);
    font-size: var(--font-size-xs);
    color: var(--color-accent-hover);
    font-weight: 600;
}

.atlas__footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding-bottom: var(--space-xl);
}

.atlas__hint {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

/* Small screens: the sky becomes a constellation list */
@media (max-width: 639px) {
    .atlas__map {
        min-height: 0;
        display: flex;
        flex-direction: column;
        gap: var(--space-xl);
        padding: var(--space-lg) 0;
    }

    .atlas__paths { display: none; }

    .atlas__island {
        position: static;
        transform: none;
        animation: none;
    }

    .atlas__card {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        width: min(320px, 88vw);
        margin-top: var(--space-sm);
        pointer-events: auto;
    }
}

/* Reduced motion: park everything */
@media (prefers-reduced-motion: reduce) {
    .atlas__island, .atlas__path, .atlas__sky .star { animation: none; }
}
