/*
 * Whale Fall V102 — Earth + Time workspace composition.
 * Fix source: the page heading and the World engine HUD were both absolutely
 * overlaid at top-left of the SAME live Cesium stage. Guided tutorial was
 * sticky over the stage; inspector remained independently overlaid at right.
 * Separate content lanes, do not mutate geography, data or renderer layers.
 */
:root{--wf-v102-surface:#0d1218;--wf-v102-line:rgba(201,220,235,.20)}

/* The guided walkthrough is content ABOVE the globe, never a sticky curtain
   over the interactive map during page scrolling. */
#map.active #wfStory:not([hidden]){
  position:relative!important;
  top:auto!important;
  z-index:auto!important;
  margin:0 0 16px;
  padding:0;
  border:1px solid rgba(216,255,69,.24);
  border-radius:14px;
  background:linear-gradient(120deg,rgba(17,24,31,.97),rgba(9,14,21,.96));
  box-shadow:0 12px 36px rgba(0,0,0,.19);
  scroll-margin-top:82px;
}
#map.active #wfStory .wf-story-inner{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:18px;
  padding:17px 20px;
}
#map.active #wfStory .wf-story-inner>div{min-width:0}
#map.active #wfStory .wf-story-title{
  font-size:clamp(1.4rem,2.4vw,2.35rem);
  line-height:1.12;
  overflow-wrap:break-word;
}
#map.active #wfStory .wf-story-body{
  font-size:clamp(.84rem,1.15vw,1rem);
  line-height:1.5;
  max-width:68ch;
}
#map.active #wfStory .wf-story-action{
  min-height:28px;
  display:inline-flex;
  align-items:center;
  margin-top:8px;
  font-size:.77rem;
  max-width:100%;
  overflow-wrap:anywhere;
}
#map.active #wfStory .wf-story-controls{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:flex-end;
  max-width:390px;
  gap:8px;
  min-width:0;
}
#map.active #wfStory [data-story]{
  min-height:40px;
  padding:9px 13px;
  font-weight:630;
  font-size:.79rem;
  white-space:nowrap;
}
#map.active #wfStory .wf-story-count{
  min-width:51px;
  text-align:center;
  color:#f3f6ea;
}

/* The introductory heading belongs to the document flow, ABOVE the globe,
   not the same coordinate plane as the World scope/scale HUD. */
#map.active .earth-time-stage{
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
  gap:0;
  min-width:0;
}
#map.active .earth-time-heading{
  position:relative!important;
  inset:auto!important;
  top:auto!important;left:auto!important;bottom:auto!important;right:auto!important;
  z-index:auto!important;
  box-sizing:border-box;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  justify-items:start;
  width:100%!important;
  max-width:none!important;
  min-height:0;
  padding:12px 18px 13px!important;
  margin:0!important;
  border:1px solid rgba(216,255,69,.18);
  border-left:3px solid var(--accent,#d8ff45);
  border-radius:14px 14px 0 0;
  background:linear-gradient(90deg,rgba(16,27,26,.97),rgba(7,13,21,.97))!important;
  box-shadow:none!important;
  pointer-events:none;
}
#map.active .earth-time-heading .eyebrow{
  font-size:.67rem;
  letter-spacing:.12em;
  font-weight:750;
  color:var(--accent,#d8ff45);
}
#map.active .earth-time-heading h1{
  margin:4px 0 6px;
  max-width:100%;
  line-height:1.17;
  font-size:clamp(1.22rem,2vw,1.8rem);
  letter-spacing:-.025em;
  color:#fff;
}
#map.active .earth-time-heading p{
  font-size:clamp(.76rem,1vw,.89rem);
  max-width:75ch;
  line-height:1.48;
  color:#cbd5da;
  margin:0;
}
#map.active #earthTimeWorldSlot{
  position:relative;
  min-width:0;
  width:100%;
  overflow:hidden;
}
#map.active #earthTimeWorldSlot #wfWorldEngine{
  border-radius:0 0 14px 14px!important;
  min-width:0;
  isolation:isolate;
}
/* Globe HUD now displays only globe/scope material, not orbital provenance
   from a previous Solar System mode: the actual underlying data is untouched. */
#map.active #wfWorldEngine[data-workspace="earth-time"] #wfEngineEphemeris{
  display:none!important
}
#map.active #wfWorldEngine[data-workspace="earth-time"] .wf-engine-hud{
  top:14px!important;
  left:14px!important;
  right:auto!important;
  width:max-content;
  max-width:min(475px,calc(100% - 355px))!important;
  padding:11px 13px;
  gap:5px;
  border-radius:0 8px 8px 0;
  border-left:3px solid var(--accent,#d8ff45);
  background:linear-gradient(110deg,rgba(3,9,14,.95),rgba(5,13,22,.85))!important;
  box-shadow:0 8px 22px rgba(0,0,0,.35);
}
#map.active #wfWorldEngine .wf-engine-hud .wf-engine-loc strong{
  font-size:clamp(.95rem,1.8vw,1.32rem);
  line-height:1.2
}
#map.active #wfWorldEngine .wf-engine-breadcrumb,
#map.active #wfWorldEngine .wf-engine-interpretation,
#map.active #wfWorldEngine .wf-engine-status,
#map.active #wfWorldEngine .wf-engine-temporal{
  font-size:clamp(.66rem,.8vw,.8rem);
  line-height:1.4;
  overflow-wrap:anywhere
}

/* Stand the evidence inspector apart as its own opaque, readable panel.
   It remains scrollable and closable. The V101 lane manager still measures
   the safe top offset. */
body[data-wf-hud-layout] #map.active #wfWorldEngine .wf-engine-inspector:not([hidden]){
  min-width:0;
  width:min(327px,calc(100% - 20px))!important;
  padding:15px 16px 16px!important;
  border:1px solid rgba(201,220,235,.30)!important;
  border-top:2px solid rgba(216,255,69,.45)!important;
  border-radius:12px!important;
  background:rgba(5,13,22,.96)!important;
  box-shadow:0 15px 40px rgba(0,0,0,.6)!important;
  opacity:1;
  color:#edf2f5;
  overflow:auto;
  scrollbar-width:thin;
}
body[data-wf-hud-layout] #map.active #wfWorldEngine .wf-engine-inspector-eyebrow{
  font-size:.67rem;
  letter-spacing:.09em;
  line-height:1.35
}
body[data-wf-hud-layout] #map.active #wfWorldEngine .wf-engine-inspector h2{
  font-size:1.19rem;
  line-height:1.25;
}
body[data-wf-hud-layout] #map.active #wfWorldEngine .wf-engine-inspector dt,
body[data-wf-hud-layout] #map.active #wfWorldEngine .wf-engine-inspector dd{
  font-size:.73rem;
  line-height:1.45;
}
body[data-wf-hud-layout] #map.active #wfWorldEngine .wf-engine-inspector dt{
  color:#b5c5d1;
}
body[data-wf-hud-layout] #map.active #wfWorldEngine .wf-engine-inspector dd{
  color:#f1f6fb;
}
body[data-wf-hud-layout] #map.active #wfWorldEngine .wf-engine-inspector-note,
body[data-wf-hud-layout] #map.active #wfWorldEngine .wf-engine-inspector-source{
  font-size:.7rem;
  line-height:1.55;
  color:#c0ced6;
}
body[data-wf-hud-layout] #map.active #wfWorldEngine .wf-engine-inspector-close{
  min-width:30px;min-height:30px;
  color:#f6fbff;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.05)
}

/* Evidence analytics must remain readable across half-width windows and
   small screens. Prefer wrapping to overflow or a 15-column crushed grid. */
#map.active .atlas-experience{min-width:0;overflow:hidden}
#map.active .atlas-experience-head{min-width:0;flex-wrap:wrap}
#map.active .atlas-time{
  grid-template-columns:auto minmax(110px,1fr) auto auto minmax(160px,auto);
  align-items:center
}
#map.active .atlas-time>:is(input,button,span,label){min-width:0}
#map.active .atlas-observed-years{
  overflow-x:auto!important;
  overscroll-behavior-x:contain;
  scrollbar-width:thin;
  grid-template-columns:repeat(15,minmax(48px,1fr))!important;
  padding-bottom:9px
}
#map.active .atlas-observation-strip{min-width:0}
#map.active .atlas-observation-card strong,
#map.active .atlas-condition strong{font-variant-numeric:tabular-nums}
#map.active .atlas-condition{min-width:0;overflow-wrap:anywhere}
#map.active .atlas-condition small{font-size:.74rem;line-height:1.4}
#map.active .atlas-comparison-frame{min-width:0}

/* The detailed SVG uses thin county boundaries; text should identify places
   rather than flood the map in zoomed states. */
#map.active #realMap .wf-geo-place-label{
  font-size:9px!important;
  font-weight:650!important;
  stroke-width:2px!important
}
#map.active #realMap .wf-geo-place-label.selected{
  font-size:10px!important;
  stroke-width:2.5px!important;
}
#map.active #realMap .wf-geo-label.context-sibling{opacity:.24!important}

/* Preserve record provenance but display it as a real dialog side-sheet
   with enough contrast and proper maximum dimensions. */
body:has(#map.active) .drawer{
  right:0!important;
  width:min(580px,100vw)!important;
  max-width:100vw;
  max-height:100dvh;
  padding:clamp(15px,2.4vw,28px)!important;
  overflow:auto;
  overflow-wrap:anywhere;
  background:#0c1118;
  transform:translateX(102%);
  transition:transform .24s cubic-bezier(.2,.8,.2,1)!important;
  border-left:1px solid rgba(201,220,235,.3);
  box-shadow:-25px 0 60px rgba(0,0,0,.7)
}
body:has(#map.active) .drawer.open{right:0!important;transform:translateX(0)}
body:has(#map.active) .drawer:not(.open){visibility:hidden;pointer-events:none}
body:has(#map.active) .drawer.open{
  visibility:visible;
  pointer-events:auto;
}
body:has(#map.active) .drawer-close{
  position:sticky;
  float:right;
  top:0;
  z-index:2;
  min-width:44px;
  min-height:44px;
  border:1px solid rgba(201,220,235,.32);
  background:#17222b;
  color:#fff;
}
body:has(#map.active) .drawer .detail-table,
body:has(#map.active) .drawer .source-provenance{
  min-width:0;
  overflow-wrap:anywhere
}

/* The existing provenance panel is authoritative; display background
   becomes subordinate while it is open, without hiding original content. */
body:has(#map.active):has(.drawer.open)::before{
  content:"";
  position:fixed;
  inset:0;
  z-index:99;
  background:rgba(2,5,10,.47);
  pointer-events:none;
}

/* Middle/split-screen: guide controls wrap and globe HUD takes the full
   top section without horizontally competing with right inspector. */
@media(max-width:1050px){
  #map.active #wfStory .wf-story-inner{grid-template-columns:1fr}
  #map.active #wfStory .wf-story-controls{
    justify-content:flex-start;
    max-width:none;
    width:100%
  }
  #map.active #wfWorldEngine[data-workspace="earth-time"] .wf-engine-hud{
    max-width:min(470px,calc(100% - 30px))!important
  }
  #map.active .atlas-time{grid-template-columns:auto minmax(120px,1fr) auto;gap:9px}
  #map.active .atlas-time .atlas-speed{grid-column:1/3}
  #map.active .atlas-time .atlas-temporal-status{grid-column:3}
}
@media(max-width:760px){
  main:has(#map.active){padding:12px 10px 50px!important;min-width:0}
  #map.active #wfStory:not([hidden]){scroll-margin-top:74px}
  #map.active #wfStory .wf-story-inner{padding:13px 14px;gap:10px}
  #map.active #wfStory .wf-story-title{font-size:1.4rem}
  #map.active #wfStory .wf-story-body{font-size:.83rem}
  #map.active #wfStory .wf-story-controls{gap:7px}
  #map.active #wfStory [data-story]{flex:1 1 auto;min-height:44px;padding:9px 10px}
  #map.active .earth-time-heading{padding:11px 13px 12px!important}
  #map.active .earth-time-heading h1{font-size:1.18rem}
  #map.active .earth-time-heading p{font-size:.79rem}
  #map.active #wfWorldEngine[data-workspace="earth-time"] .wf-engine-hud{
    top:10px!important;left:10px!important;
    max-width:calc(100% - 20px)!important;
    width:min(100%,460px);
    padding:8px 10px;
    gap:3px
  }
  #map.active #wfWorldEngine[data-workspace="earth-time"] .wf-engine-hud .wf-engine-interpretation,
  #map.active #wfWorldEngine[data-workspace="earth-time"] .wf-engine-hud .wf-engine-status{
    display:none
  }
  #map.active #wfWorldEngine .wf-engine-controls{
    left:8px!important;right:8px!important;
    max-width:calc(100% - 16px)!important;
    justify-content:flex-end!important;
    flex-wrap:wrap
  }
  body[data-wf-hud-layout] #map.active #wfWorldEngine .wf-engine-inspector:not([hidden]){
    top:auto!important;bottom:68px!important;left:8px!important;right:8px!important;
    width:calc(100% - 16px)!important;
    max-height:min(33dvh,calc(100% - 145px))!important;
    padding:11px 13px 13px!important;
    border-radius:12px!important
  }
  #map.active .atlas-time{grid-template-columns:1fr 1fr;gap:10px}
  #map.active .atlas-time>input{grid-column:1/-1;grid-row:2}
  #map.active .atlas-time .atlas-speed{grid-column:1}
  #map.active .atlas-time .atlas-temporal-status{grid-column:2}
  #map.active .atlas-comparison-frame{grid-template-columns:1fr}
  #map.active .atlas-conditions{grid-template-columns:1fr 1fr}
  #map.active .atlas-observation-strip{display:block}
  #map.active .atlas-observation-label{display:block;margin-bottom:5px}
  body:has(#map.active) .drawer{width:100vw!important;max-width:100vw;padding:14px!important}
}
@media(max-width:420px){
  #map.active #wfStory .wf-story-controls{display:grid;grid-template-columns:1fr 1fr;gap:7px}
  #map.active #wfStory .wf-story-count{order:-1}
  #map.active .atlas-conditions{grid-template-columns:1fr 1fr}
  #map.active .atlas-time .atlas-temporal-status{grid-column:1/-1}
  #map.active #wfWorldEngine .wf-engine-controls button{min-height:38px;font-size:.7rem}
}
@media(prefers-reduced-motion:reduce){
  body:has(#map.active) .drawer{transition:none!important}
}
/* V102 source-panel clickaway is a real accessible button, not a decorative
   page overlay that blocks the map with no dismissal action. */
.wf-v102-drawer-backdrop{
  position:fixed;inset:0;z-index:98;
  width:100vw;height:100dvh;
  display:block;margin:0;padding:0;
  border:0;border-radius:0;
  background:rgba(2,5,10,.50);
  cursor:default;
}
.wf-v102-drawer-backdrop[hidden]{display:none!important}
body[data-wf-v102-drawer="open"]:has(#map.active) .drawer{
  z-index:101;
}
/* Pseudo-backdrop from the static CSS is superseded by its real close control. */
body:has(#map.active):has(.drawer.open)::before{display:none!important}
