/* Atlas — a dark microsite for the travel globe.
   Self-contained, like beliefs.css and palabras.css. Deeper black than
   Beliefs: the page is a night sky for the canvas to glow against, but the
   type scale and the gold keep it in the same family. */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    color-scheme: dark;

    --at-bg: #0a0a09;
    --at-fg: #c8c4bc;
    --at-fg-bright: #ede9e1;
    --at-fg-muted: #8a857c;
    --at-fg-dim: #5c584f;
    --at-ghost: #2a2825;
    /* Gold, shared with Beliefs and Palabras — the special pages are siblings.
       Warmed a touch so it glows against the deeper black. */
    --at-accent: #e0ba74;
    --at-border: #1d1c1a;

    --at-serif: 'Source Serif 4', Georgia, serif;
    --at-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --at-gutter: clamp(20px, 5vw, 80px);
    --at-measure: 1180px;

    --at-ease: cubic-bezier(0.23, 1, 0.32, 1);
    --at-dur: 200ms;
}

html {
    /* Fluid, but anchored to the reader's own text-size setting. */
    font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: var(--at-serif);
    font-optical-sizing: auto;
    background: var(--at-bg);
    color: var(--at-fg);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

p { text-wrap: pretty; }

:focus-visible {
    outline: 2px solid var(--at-accent);
    outline-offset: 3px;
    border-radius: 2px;
}

::selection {
    background: color-mix(in srgb, var(--at-accent) 30%, transparent);
    color: var(--at-fg-bright);
}

/* ---- Nav ---- */

.at-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    max-width: var(--at-measure);
    margin: 0 auto;
    padding: 2rem var(--at-gutter);
}

.at-nav-name {
    font-family: var(--at-sans);
    font-size: 1rem;
    font-weight: 600;
    color: var(--at-fg-bright);
    text-decoration: none;
}

.at-nav-links {
    display: flex;
    gap: clamp(1rem, 3vw, 2rem);
}

.at-nav-links a {
    font-family: var(--at-sans);
    font-size: 0.875rem;
    color: var(--at-fg-muted);
    text-decoration: none;
    transition: color var(--at-dur) var(--at-ease);
}

@media (hover: hover) and (pointer: fine) {
    .at-nav-name:hover,
    .at-nav-links a:hover { color: var(--at-accent); }
}

/* ---- Shell ---- */

.at-main {
    max-width: var(--at-measure);
    margin: 0 auto;
    padding: 0 var(--at-gutter);
}

/* ---- Hero ---- */

.at-hero {
    padding: clamp(3rem, 8vw, 6rem) 0 clamp(1.5rem, 3vw, 2.5rem);
}

.at-title {
    font-weight: 300;
    font-size: clamp(3.75rem, 15vw, 10rem);
    line-height: 0.92;
    letter-spacing: -0.045em;
    color: var(--at-fg-bright);
    margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.at-title-word { display: block; }

.at-title-word > span {
    display: inline-block;
    animation: at-rise 800ms var(--at-ease) backwards;
}

/* Letters arrive left to right, quickly enough to read as one gesture. */
.at-title-word > span:nth-child(1) { animation-delay:   0ms; }
.at-title-word > span:nth-child(2) { animation-delay:  45ms; }
.at-title-word > span:nth-child(3) { animation-delay:  90ms; }
.at-title-word > span:nth-child(4) { animation-delay: 135ms; }
.at-title-word > span:nth-child(5) { animation-delay: 180ms; }

@keyframes at-rise {
    from { opacity: 0; transform: translateY(0.18em); }
    to   { opacity: 1; transform: none; }
}

.at-lede {
    max-width: 34em;
    font-size: clamp(1.05rem, 1.6vw, 1.2rem);
    line-height: 1.65;
    color: var(--at-fg-muted);
}

/* ---- Globe stage ---- */

.at-stage {
    padding: clamp(0.5rem, 2vw, 1.5rem) 0 0;
}

.at-globe-wrap {
    width: min(100%, 920px);
    aspect-ratio: 1;
    margin: 0 auto;
}

.at-globe {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    /* Horizontal drags spin the globe; vertical ones still scroll the page. */
    touch-action: pan-y;
}

.at-globe:active { cursor: grabbing; }

.at-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 1rem 0 0;
}

.at-controls[hidden] { display: none; }

.at-chip {
    font-family: var(--at-sans);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--at-fg-muted);
    background: transparent;
    border: 1px solid var(--at-ghost);
    border-radius: 100px;
    padding: 0.35rem 0.85rem;
    cursor: pointer;
    transition:
        color var(--at-dur) var(--at-ease),
        border-color var(--at-dur) var(--at-ease),
        background var(--at-dur) var(--at-ease);
}

.at-chip.is-active {
    color: var(--at-accent);
    border-color: color-mix(in srgb, var(--at-accent) 45%, transparent);
    background: color-mix(in srgb, var(--at-accent) 8%, transparent);
}

@media (hover: hover) and (pointer: fine) {
    .at-chip:hover { color: var(--at-accent); border-color: var(--at-accent); }
}

.at-hint {
    font-family: var(--at-sans);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--at-fg-dim);
}

.at-noscript {
    font-family: var(--at-sans);
    font-size: 0.85rem;
    color: var(--at-fg-muted);
    text-align: center;
    padding: 1.5rem 0;
}

/* ---- Country list, grouped by region — this is also the color code ---- */

.at-list {
    margin-top: clamp(2.5rem, 6vw, 4.5rem);
    border-top: 1px solid var(--at-border);
    padding-top: clamp(1.5rem, 4vw, 2.5rem);
    display: flex;
    flex-direction: column;
    gap: clamp(1.75rem, 4vw, 2.5rem);
}

.at-region-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--at-sans);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--at-fg-muted);
    margin-bottom: 0.6rem;
}

/* The legend swatch: same hue as the region's dots and arcs on the globe. */
.at-region-label::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--dot, var(--at-accent));
    box-shadow: 0 0 10px color-mix(in srgb, var(--dot, var(--at-accent)) 60%, transparent);
}

.at-countries {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.1rem 1.5rem;
}

.at-country {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-family: var(--at-sans);
    font-size: 0.85rem;
    text-align: left;
    color: var(--at-fg-muted);
    background: none;
    border: 0;
    border-radius: 3px;
    padding: 0.45rem 0.25rem;
    cursor: pointer;
    transition: color var(--at-dur) var(--at-ease);
}

.at-country::before {
    content: '';
    flex: none;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    /* Each button's bullet takes its country's globe hue via --dot, set by JS. */
    background: var(--dot, var(--at-fg-dim));
    align-self: center;
    transition: background var(--at-dur) var(--at-ease), box-shadow var(--at-dur) var(--at-ease);
}

.at-country.is-selected {
    color: var(--at-fg-bright);
}

.at-country.is-selected::before {
    background: var(--dot, var(--at-accent));
    box-shadow: 0 0 8px color-mix(in srgb, var(--dot, var(--at-accent)) 70%, transparent);
}

@media (hover: hover) and (pointer: fine) {
    .at-country:hover { color: var(--at-fg-bright); }
    .at-country:hover::before {
        box-shadow: 0 0 8px color-mix(in srgb, var(--dot, var(--at-accent)) 70%, transparent);
    }
}

/* ---- Footer ---- */

.at-footer {
    margin-top: clamp(3rem, 7vw, 5rem);
    padding: 2.5rem 0 3.5rem;
    border-top: 1px solid var(--at-border);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.at-footer p {
    font-family: var(--at-sans);
    font-size: 0.8rem;
    color: var(--at-fg-dim);
}

.at-footer-links {
    display: flex;
    gap: 1.5rem;
}

.at-footer-links a {
    color: var(--at-fg-dim);
    text-decoration: none;
    transition: color var(--at-dur) var(--at-ease);
}

@media (hover: hover) and (pointer: fine) {
    .at-footer-links a:hover { color: var(--at-accent); }
}

/* ---- Narrow ---- */

@media (max-width: 640px) {
    .at-countries {
        grid-template-columns: repeat(2, 1fr);
        gap: 0 1rem;
    }
    .at-controls {
        flex-direction: column;
        gap: 0.75rem;
    }
}
