/* =========================================================
   02 · Earth — globe chapter (owned by Agent B)
   ========================================================= */
#globe { --accent: var(--cyan); --globe-amber: var(--amber); overflow: hidden; }
#globe::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 50% at 30% 55%, rgba(92, 242, 255, .07), transparent 70%),
    radial-gradient(40% 40% at 85% 20%, rgba(255, 181, 71, .05), transparent 70%);
}

#globe .globe-head .sec__lede { max-width: 52ch; }

#globe .globe-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: clamp(16px, 2vw, 28px); align-items: start;
}
#globe .globe-stage, #globe .globe-panel { min-width: 0; }

/* ---------- 3D view ---------- */
#globe .globe-view {
  position: relative; height: clamp(440px, 76vh, 800px); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(closest-side at 50% 50%, rgba(40, 110, 170, .22), rgba(4, 5, 10, 0) 75%),
    radial-gradient(1px 1px at 12% 18%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(1px 1px at 72% 12%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(1px 1px at 88% 64%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1px 1px at 22% 82%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1.5px 1.5px at 46% 90%, rgba(180,220,255,.6), transparent 60%),
    radial-gradient(1px 1px at 63% 38%, rgba(255,255,255,.35), transparent 60%),
    radial-gradient(1px 1px at 5% 50%, rgba(255,255,255,.45), transparent 60%),
    radial-gradient(1.5px 1.5px at 94% 30%, rgba(255,230,200,.55), transparent 60%),
    linear-gradient(180deg, #05070f, #03040a);
  box-shadow: 0 30px 80px -40px rgba(92, 242, 255, .25), inset 0 0 0 1px rgba(255,255,255,.02);
}
#globe .globe-canvas { position: absolute; inset: 0; cursor: grab; }
#globe .globe-canvas:active { cursor: grabbing; }
#globe .globe-canvas canvas { max-width: none; }

#globe .globe-loading {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px;
  color: var(--ink-2); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; text-align: center; padding: 24px;
  transition: opacity .8s var(--ease-out); pointer-events: none;
}
#globe .globe-loading.is-done { opacity: 0; }
#globe .globe-loading.is-error { text-transform: none; letter-spacing: 0; font-size: 13px; }
#globe .globe-loading__ring {
  width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--line-strong); border-top-color: var(--cyan);
  animation: globe-spin 1.1s linear infinite; box-shadow: 0 0 30px rgba(92,242,255,.25);
}
@keyframes globe-spin { to { transform: rotate(360deg); } }

/* overlays */
#globe .globe-clock {
  position: absolute; top: 14px; left: 14px; z-index: 2; display: grid; gap: 2px; pointer-events: none;
  padding: 8px 12px; border-radius: 12px; background: rgba(4, 6, 14, .55); border: 1px solid var(--line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: 12px; color: var(--ink-2);
}
#globe .globe-clock__time { color: var(--ink); font-weight: 600; font-size: 14px; letter-spacing: .04em; }
#globe .globe-clock__sun { color: var(--amber); }

#globe .globe-ctrls { position: absolute; right: 14px; top: 14px; z-index: 2; display: flex; flex-direction: column; gap: 8px; }
#globe .globe-btn {
  min-width: 40px; height: 40px; padding: 0 10px; border-radius: 12px; cursor: pointer;
  background: rgba(4, 6, 14, .6); border: 1px solid var(--line-strong); color: var(--ink);
  font-family: var(--f-mono); font-size: 13px; line-height: 1;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: border-color .2s, box-shadow .2s, color .2s;
}
#globe .globe-btn[data-act="iss"] { color: var(--cyan); letter-spacing: .08em; }
#globe .globe-btn:hover, #globe .globe-btn:focus-visible { border-color: var(--cyan); box-shadow: 0 0 16px rgba(92,242,255,.35); outline: none; }

#globe .globe-toast {
  position: absolute; left: 50%; top: 14px; z-index: 3; max-width: min(440px, calc(100% - 200px));
  transform: translate(-50%, -140%); opacity: 0; pointer-events: none;
  padding: 8px 14px; border-radius: 999px; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: rgba(40, 20, 6, .75); border: 1px solid rgba(255, 181, 71, .55); box-shadow: 0 0 24px rgba(255, 181, 71, .35);
  transition: transform .6s var(--ease-out), opacity .6s var(--ease-out);
}
#globe .globe-toast b { color: var(--amber); font-weight: 600; margin-right: 4px; }
#globe .globe-toast.is-on { transform: translate(-50%, 0); opacity: 1; }

#globe .globe-caption {
  position: absolute; left: 14px; bottom: 14px; right: 70px; z-index: 2; margin: 0; width: fit-content; max-width: calc(100% - 84px);
  padding: 8px 14px; border-radius: 12px; font-size: 13px; line-height: 1.4; color: var(--ink);
  background: rgba(4, 6, 14, .7); border: 1px solid var(--line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; transform: translateY(8px); transition: opacity .4s, transform .4s var(--ease-out); pointer-events: none;
}
#globe .globe-caption.is-on { opacity: 1; transform: none; }
#globe .globe-caption .mono { color: var(--ink-2); font-size: 12px; }

/* library tooltip */
#globe .float-tooltip-kap {
  background: rgba(6, 8, 18, .88) !important; border: 1px solid var(--line-strong); border-radius: 10px !important;
  padding: 7px 10px !important; font-family: var(--f-body) !important; font-size: 12.5px !important; color: var(--ink) !important;
  max-width: 260px; line-height: 1.4;
}
#globe .globe-tip .mono { color: var(--ink-2); font-size: 11px; }

/* markers on the globe (HTML layer) */
/* (CSS2DRenderer owns the inline transform, so each marker box is just its dot; labels hang off it) */
#globe .globe-iss { position: relative; width: 12px; height: 12px; pointer-events: auto; cursor: pointer; }
#globe .globe-iss i {
  position: absolute; inset: 0; border-radius: 50%; background: #e9feff;
  box-shadow: 0 0 6px 2px var(--cyan), 0 0 22px 6px rgba(92,242,255,.55);
}
#globe .globe-iss i::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 1px solid var(--cyan);
  animation: globe-ping 2s var(--ease-out) infinite;
}
#globe .globe-iss span, #globe .globe-sunmk span {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: .14em; color: var(--cyan);
  text-shadow: 0 0 6px rgba(0,0,0,.9), 0 0 2px #000; white-space: nowrap;
  position: absolute; left: calc(100% + 7px); top: 50%; transform: translateY(-50%);
}
#globe .globe-sunmk { position: relative; width: 10px; height: 10px; pointer-events: none; }
#globe .globe-sunmk i { position: absolute; inset: 0; border-radius: 50%; background: #fff3cf; box-shadow: 0 0 8px 3px var(--amber), 0 0 26px 8px rgba(255,181,71,.45); }
#globe .globe-sunmk span { color: var(--amber); }
@keyframes globe-ping { 0% { transform: scale(.5); opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }

#globe .globe-ev {
  width: 20px; height: 20px; padding: 3px; border: 0; border-radius: 50%; cursor: pointer; pointer-events: auto;
  background: rgba(4, 6, 14, .55); color: var(--c); display: grid; place-items: center;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 55%, transparent), 0 0 10px color-mix(in srgb, var(--c) 45%, transparent);
  transition: box-shadow .2s;
}
#globe .globe-ev svg { width: 13px; height: 13px; transition: transform .2s var(--ease-out); }
#globe .globe-ev:hover, #globe .globe-ev:focus-visible { outline: none; box-shadow: 0 0 0 1.5px var(--c), 0 0 16px var(--c); }
#globe .globe-ev:hover svg, #globe .globe-ev:focus-visible svg { transform: scale(1.2); }

/* ---------- legend + toggles ---------- */
#globe .globe-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin-top: 14px; }
#globe .globe-depth { display: grid; grid-template-columns: auto 150px; grid-template-rows: auto auto; column-gap: 10px; align-items: center; font-size: 11px; color: var(--ink-2); }
#globe .globe-depth > .mono:first-child { grid-row: 1 / span 2; letter-spacing: .1em; text-transform: uppercase; }
#globe .globe-depth__bar {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, #ff4a4a 0%, #ff7a3d 5%, #ffb547 10%, #ffe28a 21%, #7fd8ff 43%, #8b7bff 100%);
}
#globe .globe-depth__ticks { display: flex; justify-content: space-between; font-size: 10px; color: var(--ink-3); }
#globe .globe-toggles { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
#globe .globe-tg {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; cursor: pointer;
  background: rgba(255,255,255,.03); border: 1px solid var(--line); color: var(--ink); font-size: 12px; line-height: 1.3;
  transition: border-color .2s, opacity .2s, background .2s;
}
#globe .globe-tg i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
#globe .globe-tg .mono { color: var(--ink-2); font-size: 11px; }
#globe .globe-tg:hover, #globe .globe-tg:focus-visible { border-color: var(--line-strong); outline: none; }
#globe .globe-tg[aria-pressed="false"] { opacity: .45; }
#globe .globe-tg[aria-pressed="false"] i { background: transparent; box-shadow: inset 0 0 0 1px var(--c); }

/* ---------- facts ---------- */
#globe .globe-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
#globe .globe-facts p {
  margin: 0; padding: 14px 16px; border-left: 2px solid var(--accent); background: linear-gradient(90deg, rgba(92,242,255,.06), transparent);
  border-radius: 0 12px 12px 0; font-size: var(--step--1); color: var(--ink-2); line-height: 1.5;
}
#globe .globe-facts p:first-child { border-left-color: var(--amber); background: linear-gradient(90deg, rgba(255,181,71,.07), transparent); }
#globe .globe-facts p:last-child { border-left-color: #ffd27a; }
#globe .globe-facts b { color: var(--ink); font-weight: 600; }

/* ---------- side panel ---------- */
#globe .globe-panel { display: flex; flex-direction: column; gap: 16px; }
#globe .globe-card { position: relative; overflow: hidden; }
#globe .globe-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
#globe .globe-card__head h3 { margin: 0; }
#globe .globe-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
#globe .globe-stats .stat__value { font-size: var(--step-1); }
#globe .globe-v-max { color: var(--amber); }
#globe .globe-v-speed { color: var(--cyan); }
#globe .globe-energy { margin-bottom: 8px; }
#globe .globe-energy .stat__value { font-size: var(--step-1); color: #ffd27a; }
#globe .globe-energy b, #globe .globe-note b { color: var(--ink); font-weight: 600; }
#globe .globe-note { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin: 0 0 12px; }
#globe .globe-src { font-size: 10.5px; color: var(--ink-3); margin: 12px 0 0; letter-spacing: .03em; }
#globe .globe-iss-where { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 13px; }
#globe .globe-v-vis[data-day="1"] { color: var(--amber); border-color: rgba(255,181,71,.4); }
#globe .globe-v-vis[data-day="0"] { color: #9fb4ff; border-color: rgba(155,123,255,.4); }

/* quake list */
#globe .globe-qlist {
  list-style: none; margin: 0; padding: 0 4px 0 0; max-height: 252px; overflow-y: auto; overscroll-behavior: contain;
  border-top: 1px solid var(--line);
  -webkit-mask-image: linear-gradient(180deg, #000 85%, transparent); mask-image: linear-gradient(180deg, #000 85%, transparent);
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
#globe .globe-q {
  width: 100%; display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 10px; align-items: center; text-align: left;
  padding: 8px 6px; background: transparent; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 8px;
  transition: background .2s;
}
#globe .globe-q:hover, #globe .globe-q:focus-visible { background: rgba(255,255,255,.04); outline: none; }
#globe .globe-q.is-sel { background: rgba(92,242,255,.08); }
#globe .globe-q.is-new { animation: globe-new 2.4s var(--ease-out) 2; }
@keyframes globe-new { 0% { background: rgba(255,181,71,.35); } 100% { background: transparent; } }
#globe .globe-q__mag {
  grid-row: 1 / span 2; justify-self: start; min-width: 40px; text-align: center; padding: 4px 0; border-radius: 8px;
  font-weight: 600; font-size: 13px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
}
#globe .globe-q__place { font-size: 13px; color: var(--ink); line-height: 1.3; overflow-wrap: anywhere; }
#globe .globe-q__meta { font-size: 11px; color: var(--ink-3); }

/* events by category */
#globe .globe-evlist { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
#globe .globe-evlist li { display: grid; grid-template-columns: 22px 30px minmax(0, 1fr); align-items: start; gap: 8px; font-size: 13px; color: var(--ink); }
#globe .globe-evlist__ico { color: var(--c); width: 18px; height: 18px; margin-top: 1px; filter: drop-shadow(0 0 6px var(--c)); }
#globe .globe-evlist__ico svg { width: 18px; height: 18px; }
#globe .globe-evlist b { color: var(--c); font-size: 15px; }
#globe .globe-evlist small { display: block; color: var(--ink-3); font-size: 11.5px; overflow-wrap: anywhere; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  #globe .globe-grid { grid-template-columns: minmax(0, 1fr); }
  #globe .globe-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
}
@media (max-width: 760px) {
  #globe .globe-facts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  #globe .globe-view { height: auto; aspect-ratio: 1 / 1.08; max-height: 560px; min-height: 340px; margin: 0 calc(var(--gutter) * -1); border-radius: 0; border-left: 0; border-right: 0; }
  #globe .globe-clock { top: 10px; left: 10px; padding: 6px 9px; font-size: 10.5px; }
  #globe .globe-clock__time { font-size: 12px; }
  #globe .globe-ctrls { top: auto; bottom: 10px; right: 10px; flex-direction: row; gap: 6px; }
  #globe .globe-btn { min-width: 36px; height: 36px; }
  #globe .globe-caption { left: 10px; right: 10px; bottom: 54px; max-width: calc(100% - 20px); font-size: 12px; }
  #globe .globe-toast { top: auto; bottom: 54px; max-width: calc(100% - 20px); transform: translate(-50%, 40%); }
  #globe .globe-toast.is-on { transform: translate(-50%, 0); }
  #globe .globe-depth { grid-template-columns: auto minmax(0, 1fr); width: 100%; }
  #globe .globe-panel { grid-template-columns: minmax(0, 1fr); }
  #globe .globe-stats .stat__value { font-size: 1.3rem; }
  #globe .globe-ev { width: 16px; height: 16px; padding: 2px; }
  #globe .globe-ev svg { width: 11px; height: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  #globe .globe-iss i::after, #globe .globe-loading__ring { animation: none; }
}
