/* =======================================================
   Zulu Code: dotted Africa hero piece (js/africa.js)
   The fallback image shows until the script adds .is-live.
   ======================================================= */

.africa {
    position: relative;
    aspect-ratio: 1;
    width: 100%;
    isolation: isolate;
    container: africa / inline-size;   /* lets the city label size to the square, not the viewport */
}

/* Soft light behind the continent: teal body, a magenta warmth over the south */
.africa::before {
    content: "";
    position: absolute;
    inset: 4%;
    z-index: -1;
    border-radius: 50%;
    background:
        radial-gradient(circle at 63% 76%, rgba(229, 0, 109, 0.11), rgba(229, 0, 109, 0) 26%),
        radial-gradient(closest-side, rgba(0, 168, 150, 0.15), rgba(0, 168, 150, 0.05) 58%, rgba(0, 168, 150, 0) 100%);
    pointer-events: none;
    transition: opacity 0.6s ease;
}
/* The glow belongs to the continent view; below it the map has its own light */
.africa.is-za-target::before { opacity: 0; }

.africa > canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) and (pointer: fine) {
    .africa > canvas { cursor: grab; }
    .africa.is-dragging > canvas { cursor: grabbing; }
}

.africa-fallback {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.africa.is-live .africa-fallback { display: none; }

/* ---------- Pins (positioned every frame by the script) ---------- */

.africa-pin {
    position: absolute;
    top: 0;
    left: 0;
    display: none;
    pointer-events: none;
    will-change: transform;
    transition: opacity 0.35s ease;
}
.africa.is-live .africa-pin { display: block; }
/* Fade in once the intro wave has reached the south. Children only and
   fill-mode backwards, so it never overrides .is-behind or .is-lensed. */
.africa.is-live .africa-pin > i,
.africa.is-live .africa-pin > span {
    animation: africa-pin-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) 1.3s backwards;
}
.africa-pin > span { transition: opacity 0.3s ease; }
.africa-pin.is-lensed > span { opacity: 0.15; }   /* let the code under the lens show */
.africa.is-live .africa-pin.is-behind { opacity: 0; }

/* The dot sits exactly on the coordinate */
.africa-pin > i {
    position: absolute;
    left: -3.5px;
    top: -3.5px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #00A896;
    box-shadow: 0 0 0 2px rgba(10, 10, 10, 0.85);
}
.africa-pin > i::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 1px solid currentColor;
    color: #00A896;
    opacity: 0;
    animation: africa-pulse 2.8s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}
.africa-pin--home > i {
    left: -4.5px;
    top: -4.5px;
    width: 9px;
    height: 9px;
    background: #ff1a88;
}
.africa-pin--home > i::after { color: #ff1a88; }

/* Label: a small dark tag joined to the dot by a hairline */
.africa-pin > span {
    position: absolute;
    top: 0;
    left: 22px;
    transform: translateY(-50%);
    padding: 0.4rem 0.65rem 0.45rem;
    border: 1px solid rgba(244, 243, 239, 0.1);
    border-radius: 8px;
    background: rgba(10, 10, 10, 0.72);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #f4f3ef;
    font: 600 0.8125rem/1.15 'Outfit', sans-serif;
    letter-spacing: 0.005em;
    white-space: nowrap;
}
.africa-pin > span::before {
    content: "";
    position: absolute;
    top: 50%;
    right: 100%;
    width: 15px;
    height: 1px;
    background: rgba(244, 243, 239, 0.35);
}
.africa-pin > span small {
    display: block;
    margin-top: 0.15rem;
    color: rgba(244, 243, 239, 0.58);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.africa-pin--home > span small { color: #ff1a88; }

/* Secondary pins label to the left so they never collide with the studio tag.
   Either side can be forced with --left / --right. */
.africa-pin:not(.africa-pin--home):not(.africa-pin--right) > span,
.africa-pin--left > span {
    left: auto;
    right: 22px;
    text-align: right;
}
.africa-pin:not(.africa-pin--home):not(.africa-pin--right) > span::before,
.africa-pin--left > span::before {
    right: auto;
    left: 100%;
}

@media (max-width: 520px) {
    .africa-pin > span { font-size: 0.75rem; padding: 0.32rem 0.55rem 0.36rem; }
    .africa-pin > span small { font-size: 0.5625rem; }
}


/* =======================================================
   South Africa mode
   .is-za-target: heading there (Africa pins step back)
   .is-za:        arrived, relief loaded (cities and provinces show)
   ======================================================= */

.africa > canvas { transition: opacity 0.2s ease; }
.africa.is-fading > canvas { opacity: 0; }   /* reduced motion: crossfade instead of a flight */

.africa.is-za-target .africa-pin {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.za-city,
.za-prov {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    will-change: transform;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}
.africa.is-za .za-city,
.africa.is-za .za-prov {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.6s ease 0.15s;
}
.africa.is-fading .za-city,
.africa.is-fading .za-prov { opacity: 0; }
.za-city.is-off { display: none; }
.africa.is-za .za-city.is-hidden { opacity: 0; }

/* City dot on the coordinate; studio in magenta with the pulse */
.za-city > i {
    position: absolute;
    left: -2.5px;
    top: -2.5px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #f4f3ef;
    box-shadow: 0 0 0 1.5px rgba(10, 10, 10, 0.8);
}
.za-city--home > i {
    left: -4.5px;
    top: -4.5px;
    width: 9px;
    height: 9px;
    background: #ff1a88;
    box-shadow: 0 0 0 2px rgba(10, 10, 10, 0.85);
}
.za-city--home > i::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 1px solid #ff1a88;
    opacity: 0;
    animation: africa-pulse 2.8s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

/* City label: mono, lowercase like the site's instrument labels; the script
   picks the side (data-side r / l / t / b) so labels never overlap */
.za-city > span {
    position: absolute;
    top: 0;
    left: 9px;
    transform: translateY(-50%);
    color: #f4f3ef;
    font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, monospace);
    font-size: 0.6875rem;
    line-height: 1.2;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    white-space: nowrap;
    text-shadow: 0 0 3px #0a0a0a, 0 0 8px rgba(10, 10, 10, 0.9);
    transition: opacity 0.25s ease;
}
.za-city[data-side="l"] > span { left: auto; right: 9px; text-align: right; }
.za-city[data-side="t"] > span { top: auto; bottom: 9px; left: 0; transform: translateX(-50%); text-align: center; }
.za-city[data-side="b"] > span { top: 9px; left: 0; transform: translateX(-50%); text-align: center; }
.za-city--home > span { font-weight: 500; }
.za-city > span small {
    display: block;
    color: #ff1a88;
    font-size: 0.5625rem;
    letter-spacing: 0.1em;
}
.za-city.is-quiet > span,
.za-city.is-lensed > span { opacity: 0; }

/* Province names: mono uppercase in a pale warm white, quieter than the cities */
.za-prov > span {
    position: absolute;
    transform: translate(-50%, -50%);
    color: rgba(246, 238, 222, 0.8);   /* pale warm white on a full-strength ink halo */
    font-weight: 500;
    font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, monospace);
    font-size: 0.625rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    white-space: nowrap;
    text-shadow: 0 0 1px #0a0a0a, 0 0 2px #0a0a0a, 0 0 3px #0a0a0a, 0 0 6px #0a0a0a, 0 0 12px rgba(10, 10, 10, 0.9);
    transition: opacity 0.25s ease;
}
.za-prov.is-quiet > span { opacity: 0; }

/* Map views: Africa / South Africa / Cape Town / Johannesburg. A mono tab row
   right-aligned under the map, magenta underline on the active tab (like the
   browser tabs in styles.css); wraps on phones. Hidden until the canvas is live. */
.africa-modes {
    display: none;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0 0.25rem;
    margin-top: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.africa-modes.is-ready { display: flex; }
.africa-mode {
    position: relative;
    min-height: 44px;
    padding: 0.7rem 0.85rem 0.75rem;
    border: 0;
    background: none;
    color: rgba(255, 255, 255, 0.55);
    font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, monospace);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.3s ease;
}
.africa-mode::after {
    content: "";
    position: absolute;
    left: 0.85rem;
    right: 0.85rem;
    bottom: -1px;
    height: 2px;
    background: #E5006D;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.africa-mode:hover,
.africa-mode.is-active { color: #ffffff; }
.africa-mode.is-active::after { transform: scaleX(1); }
.africa-mode:focus-visible { outline-offset: -3px; }
@media (max-width: 520px) {
    .africa-modes { justify-content: center; }
    .africa-mode { padding: 0.65rem 0.6rem 0.7rem; }
    .africa-mode::after { left: 0.6rem; right: 0.6rem; }
}

/* In South Africa mode, the Cape Town and Johannesburg pins open their cities */
.za-city.is-link > i,
.za-city.is-link > span { pointer-events: auto; cursor: pointer; }
.za-city.is-link > i { box-shadow: 0 0 0 1.5px rgba(10, 10, 10, 0.8), 0 0 0 4px rgba(229, 0, 109, 0.35); }

/* City photos: one quiet lower-third label, nothing else over the picture */
.africa-place {
    position: absolute;
    left: 6%;
    bottom: 6%;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: #f4f3ef;
    font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, monospace);
    font-size: 0.74rem;
    letter-spacing: 0.05em;
    text-transform: lowercase;
    text-shadow: 0 0 6px rgba(10, 10, 10, 0.8);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}
.africa-place > i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ff1a88;
    box-shadow: 0 0 0 2px rgba(10, 10, 10, 0.6);
}
.africa.is-photo .africa-place { opacity: 1; transition-delay: 0.4s; }
/* squares narrower than 480 px (phones): a slightly smaller label */
@container africa (max-width: 479px) {
    .africa-place { font-size: 11px; }
}

@keyframes africa-pin-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes africa-pulse {
    0% { transform: scale(1); opacity: 0.8; }
    70%, 100% { transform: scale(3.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .africa.is-live .africa-pin > i,
    .africa.is-live .africa-pin > span { animation: none; }
    .africa-pin > i::after,
    .za-city--home > i::after { animation: none; }
    .africa-mode::after { transition: none; }
}
