/* ═════════════════════════════════════════════════════════════════════════════
   UTU TOTEM SIGNATURE OS — MAARA TownMesh integration build
   Kenya pride + Lo Shu gate 5 + unity-in-diversity first-contact overlay.
   Safe sensory rule: visual rhythm only; no infrasonic audio emitted.

   Integration note: body.utu-sig-active dark background is intentionally
   SCOPED to .utu-page-root so it only applies on the UTU landing page.
   The corner sigils (#utu-totem-layer) and route pill are always-on globally.
   ═════════════════════════════════════════════════════════════════════════════ */

:root {
  --utu-void: #05060a;
  --utu-night: #090d16;
  --utu-panel: rgba(255, 255, 255, 0.07);
  --utu-panel-strong: rgba(255, 255, 255, 0.115);
  --utu-border: rgba(255, 255, 255, 0.16);
  --utu-white: #f8fbff;
  --utu-water: #69d7ff;
  --utu-blood: #ff334f;
  --utu-green: #2dd46f;
  --utu-gold: #ffd36a;
  --utu-purple: #8d5cff;
  --utu-black: #050505;
  --utu-muted: rgba(248,251,255,0.72);
  --utu-left: rgba(105, 215, 255, 0.26);
  --utu-right: rgba(255, 211, 106, 0.24);
  --utu-center: rgba(248, 251, 255, 0.26);
  --utu-breath-seconds: 9s;
  --utu-tilt: 0deg;
  --utu-twist: 0deg;
  --utu-coherence: 0.5;
  --utu-vector: 0;
}

html.utu-root-first {
  scroll-behavior: smooth;
}

/* Dark background ONLY when the UTU page root is present */
.utu-page-root {
  background:
    radial-gradient(circle at 15% 42%, rgba(105,215,255,0.14), transparent 28%),
    radial-gradient(circle at 85% 46%, rgba(255,211,106,0.14), transparent 28%),
    radial-gradient(circle at 50% 20%, rgba(141,92,255,0.10), transparent 32%),
    linear-gradient(135deg, var(--utu-void), var(--utu-night));
  color: var(--utu-white);
  min-height: 100svh;
}

/* First-contact hero shell */
.utu-first-contact {
  min-height: 100svh;
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, .85fr) minmax(320px, 1.3fr) minmax(220px, .85fr);
  gap: clamp(14px, 2vw, 24px);
  align-items: stretch;
  padding: clamp(72px, 8vw, 112px) clamp(16px, 4vw, 54px) clamp(34px, 4vw, 56px);
  overflow: clip;
  isolation: isolate;
}

.utu-first-contact::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 50% 50%, rgba(248,251,255,0.11), transparent 23%),
    conic-gradient(from calc(180deg + var(--utu-twist)), rgba(105,215,255,0.14), rgba(255,255,255,0.12), rgba(255,51,79,0.12), rgba(45,212,111,0.12), rgba(105,215,255,0.14));
  filter: blur(24px);
  opacity: .82;
  animation: utuFieldBreath var(--utu-breath-seconds) ease-in-out infinite;
  z-index: -2;
}

@keyframes utuFieldBreath {
  0%, 100% { transform: scale(.985) rotate(calc(var(--utu-tilt) - 1deg)); opacity: .64; }
  50% { transform: scale(1.02) rotate(calc(var(--utu-tilt) + 1deg)); opacity: .96; }
}

.utu-hemisphere,
.utu-heart-panel {
  border: 1px solid var(--utu-border);
  background: linear-gradient(180deg, var(--utu-panel-strong), rgba(255,255,255,0.035));
  border-radius: 30px;
  box-shadow: 0 24px 90px rgba(0,0,0,0.34), inset 0 0 32px rgba(255,255,255,0.035);
  backdrop-filter: blur(18px);
}

.utu-hemisphere {
  padding: clamp(18px, 2vw, 26px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 520px;
}

.utu-hemisphere.left {
  border-color: rgba(105,215,255,0.28);
  box-shadow: 0 24px 90px rgba(0,0,0,0.34), 0 0 44px rgba(105,215,255,0.08);
}

.utu-hemisphere.right {
  border-color: rgba(255,211,106,0.30);
  box-shadow: 0 24px 90px rgba(0,0,0,0.34), 0 0 44px rgba(255,211,106,0.08);
}

.utu-kicker {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--utu-muted);
  margin-bottom: 10px;
}

.utu-hemisphere h2,
.utu-heart-panel h1 {
  margin: 0;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.utu-hemisphere h2 {
  font-size: clamp(1.45rem, 2.3vw, 2.35rem);
}

.utu-hemisphere p,
.utu-heart-panel p {
  color: var(--utu-muted);
  line-height: 1.62;
}

.utu-heart-panel {
  min-height: 600px;
  padding: clamp(22px, 3vw, 36px);
  display: grid;
  place-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.utu-heart-panel::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 26px;
  border: 1px solid rgba(255,255,255,0.06);
  pointer-events: none;
}

.utu-title-gradient {
  font-size: clamp(2.3rem, 5vw, 5.4rem);
  background: linear-gradient(90deg, var(--utu-white), var(--utu-water), var(--utu-gold), var(--utu-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 16px rgba(105,215,255,0.13));
}

.utu-subtitle {
  max-width: 760px;
  margin: 18px auto 0;
  font-size: clamp(1rem, 1.5vw, 1.18rem);
}

.utu-lucy-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  color: var(--utu-white);
  background: rgba(0,0,0,0.24);
  margin-bottom: 16px;
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.utu-loshu-orb {
  width: min(65vw, 340px);
  aspect-ratio: 1;
  margin: 22px auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  position: relative;
  background:
    radial-gradient(circle, rgba(248,251,255,0.20), transparent 42%),
    conic-gradient(from calc(120deg + var(--utu-twist)), var(--utu-water), var(--utu-white), var(--utu-blood), var(--utu-green), var(--utu-gold), var(--utu-water));
  box-shadow: 0 0 60px rgba(248,251,255, calc(.14 + var(--utu-coherence) * .18));
  transform: rotate(var(--utu-tilt));
  transition: transform 260ms ease, box-shadow 260ms ease;
}

.utu-loshu-grid {
  width: 74%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 7px;
  padding: 12px;
  border-radius: 28px;
  background: rgba(5,6,10,0.78);
  border: 1px solid rgba(255,255,255,0.18);
}

.utu-loshu-cell {
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.11);
  font-weight: 900;
  color: rgba(248,251,255,.84);
}

.utu-loshu-cell.gate5 {
  background: linear-gradient(135deg, var(--utu-white), var(--utu-gold));
  color: #06070b;
  box-shadow: 0 0 32px rgba(255,211,106,0.45);
}

.utu-card-skin,
.utu-totem-card {
  margin-top: 14px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.12);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.utu-card-skin:hover,
.utu-card-skin:focus-visible,
.utu-totem-card:hover {
  transform: translateY(-3px);
  background: rgba(255,255,255,0.075);
  border-color: rgba(255,255,255,0.26);
}

.utu-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.utu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  font-weight: 900;
  color: var(--utu-white);
  text-decoration: none;
  background: rgba(255,255,255,0.08);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.utu-btn:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.34); }
.utu-btn.primary { background: linear-gradient(135deg, var(--utu-green), var(--utu-gold)); color: #07100c; }
.utu-btn.water { background: linear-gradient(135deg, var(--utu-water), var(--utu-purple)); }
.utu-btn.gold { background: linear-gradient(135deg, var(--utu-gold), var(--utu-purple)); color: #110719; }

.utu-meter {
  width: min(420px, 88vw);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin: 18px auto 0;
  color: var(--utu-muted);
  font-size: .78rem;
}

.utu-meter-track {
  height: 12px;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, var(--utu-water), var(--utu-white), var(--utu-gold));
}

.utu-meter-core {
  position: absolute;
  top: -5px;
  left: 50%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 20px rgba(255,255,255,0.9);
  transform: translateX(-50%);
  transition: left 240ms ease;
}

/* ── Persistent Kenya Pride Totem Corners ─────────────────────────────────── */

#utu-totem-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99999;
  contain: layout style paint;
}

.utu-corner-sigil {
  position: absolute;
  width: clamp(62px, 7vw, 104px);
  height: clamp(62px, 7vw, 104px);
  opacity: .78;
  transform: translateZ(0);
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.45));
}

.utu-corner-sigil.tl { top: 10px; left: 10px; }
.utu-corner-sigil.tr { top: 10px; right: 10px; transform: scaleX(-1); }
.utu-corner-sigil.bl { bottom: 10px; left: 10px; transform: scaleY(-1); }
.utu-corner-sigil.br { bottom: 10px; right: 10px; transform: scale(-1); }

.utu-corner-sigil svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.utu-corner-sigil .breath {
  animation: utuSigilBreath 8s ease-in-out infinite;
  transform-origin: center;
}

@keyframes utuSigilBreath {
  0%, 100% { transform: scale(.985) rotate(-1deg); opacity: .76; }
  50% { transform: scale(1.03) rotate(1deg); opacity: .96; }
}

/* Route state pill — bottom-centre, always visible on desktop */
.utu-route-pill {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 99998;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(5,6,10,0.56);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(248,251,255,0.78);
  backdrop-filter: blur(12px);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: opacity 360ms ease;
}

.utu-route-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--utu-green), var(--utu-gold));
  box-shadow: 0 0 14px rgba(45,212,111,.55);
}

/* Coherence glow on corner sigils driven by JS --utu-coherence var */
#utu-totem-layer {
  --sig-glow: calc(var(--utu-coherence, 0.5) * 0.6);
}
.utu-corner-sigil {
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.45))
          drop-shadow(0 0 calc(var(--sig-glow, 0.3) * 40px) rgba(105,215,255, calc(var(--sig-glow, 0.3))));
}

@media (max-width: 960px) {
  .utu-first-contact {
    grid-template-columns: 1fr;
    padding-top: 88px;
  }
  .utu-heart-panel { order: -1; min-height: 560px; }
  .utu-hemisphere { min-height: auto; }
  .utu-corner-sigil { width: 60px; height: 60px; opacity: .64; }
  .utu-route-pill { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
