/* Eni Land — scrollable globe concept. Cream/plum brand, big illustrated planet hero.
   Tokens shared in spirit with ../2026-09-05-interactive-concepts-v1/concepts.css. */

:root {
  --cream: #FFFCF6;
  --cream-2: #F8F0DD;
  --plum: #2E2440;
  --plum-soft: #55496b;
  --plum-line: rgba(46, 36, 64, 0.16);
  --teal-mist: rgba(163, 214, 209, 0.38);
  --orange: #EF7D22;
  --orange-dark: #773C0A;
  --emotion: var(--orange);
  --radius-lg: 2rem;
  --radius-md: 1.25rem;
  --radius-sm: 0.75rem;
  --shadow-soft: 0 18px 40px -24px rgba(46, 36, 64, 0.35);
  --font: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --header-h: 4.25rem;
}

* { box-sizing: border-box; }

html { background: var(--cream); }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--cream);
  color: var(--plum);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
button { font-family: var(--font); }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 70;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(0.9rem, 3vw, 1.75rem);
  pointer-events: none;
}
.site-header > * { pointer-events: auto; }

.header-left { display: flex; align-items: center; }

#menuToggle {
  display: inline-flex; align-items: center; gap: 0.55rem;
  min-height: 44px; padding: 0.5rem 1rem 0.5rem 0.8rem;
  background: rgba(255, 252, 246, 0.92);
  border: 1px solid var(--plum-line);
  border-radius: 999px;
  color: var(--plum);
  font-weight: 800; font-size: 0.92rem;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(6px);
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
#menuToggle:hover, #menuToggle:focus-visible { color: var(--orange-dark); border-color: var(--orange); }
#menuToggle:active { transform: translateY(1px); }

.menu-icon { display: inline-flex; flex-direction: column; gap: 3px; width: 18px; }
.menu-icon span { display: block; height: 2px; border-radius: 2px; background: currentColor; }
.menu-icon span:nth-child(2) { width: 70%; }

.header-center {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
}
.wordmark {
  font-weight: 900; font-size: 1.05rem; letter-spacing: 0.02em;
  color: var(--plum);
}

.header-right {
  display: flex; align-items: center; gap: 0.85rem;
}
.concept-tag {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--plum-soft);
}
.concept-link {
  min-height: 44px; display: inline-flex; align-items: center;
  font-size: 0.82rem; font-weight: 800; text-decoration: none;
  color: var(--plum-soft); border-bottom: 1px solid var(--plum-line);
  padding: 0.2rem 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.concept-link:hover, .concept-link:focus-visible { color: var(--orange-dark); border-color: var(--orange); }

/* ---------- world menu ---------- */
#worldMenu {
  position: fixed; z-index: 65;
  top: calc(var(--header-h) - 0.25rem); left: 1.1rem;
  width: min(360px, calc(100vw - 2.2rem));
  max-height: calc(100svh - var(--header-h) - 1.5rem);
  overflow-y: auto;
  background: var(--cream);
  border: 1px solid var(--plum-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 1.25rem 1.1rem 1.4rem;
}
#worldMenu h2 {
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
}
#menuWorlds {
  display: flex; flex-direction: column; gap: 0.4rem;
}
#menuWorlds button {
  min-height: 44px;
  display: flex; align-items: center; gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--plum);
  font-weight: 700; font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
#menuWorlds button:hover, #menuWorlds button:focus-visible {
  background: var(--cream-2);
  border-color: var(--plum-line);
  color: var(--orange-dark);
  outline: none;
}
.menu-earlier-link {
  display: inline-block; margin-top: 1rem;
  font-size: 0.8rem; font-weight: 800; color: var(--plum-soft);
  text-decoration: none; border-bottom: 1px solid var(--plum-line);
}
.menu-earlier-link:hover, .menu-earlier-link:focus-visible { color: var(--orange-dark); border-color: var(--orange); }

/* ---------- globe scene ---------- */
#globeScene {
  position: relative;
  height: 400vh;
}

#globeStage {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: clip;
  display: grid;
  grid-template-columns: 30% 60%;
  align-items: center;
  gap: 4%;
  padding: calc(var(--header-h) + 1rem) clamp(1.25rem, 4vw, 3rem) 2rem;
  background:
    radial-gradient(120% 90% at 82% 45%, var(--teal-mist) 0%, rgba(163, 214, 209, 0) 62%),
    var(--cream);
}

.intro {
  position: relative;
  z-index: 2;
  max-width: 34ch;
}
.intro .eyebrow {
  text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.78rem;
  font-weight: 800; color: var(--orange-dark); margin: 0 0 0.5rem;
}
.intro h1 {
  font-size: clamp(1.9rem, 3vw, 2.9rem);
  line-height: 1.06;
  margin: 0 0 0.75rem;
  color: var(--plum);
}
.intro-copy {
  font-size: 1rem;
  color: var(--plum-soft);
  margin: 0 0 1.1rem;
  max-width: 32ch;
}

.globe-hint {
  font-size: 0.82rem; font-weight: 700; color: var(--plum-soft);
  margin-bottom: 1.1rem;
  opacity: 0.85;
}

.turn-controls {
  display: flex; gap: 0.6rem;
  margin-bottom: 1.4rem;
}
.turn-controls button {
  width: 44px; height: 44px;
  border-radius: 999px;
  border: 1px solid var(--plum-line);
  background: var(--cream-2);
  color: var(--plum);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.turn-controls button svg { width: 18px; height: 18px; }
.turn-controls button:hover, .turn-controls button:focus-visible { color: var(--orange-dark); border-color: var(--orange); outline: none; }
.turn-controls button:active { transform: translateY(1px); }

/* ---------- active world preview ---------- */
.active-world {
  display: grid;
  grid-template-columns: 3.4rem 1fr auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem;
  background: var(--cream);
  border: 1px solid var(--plum-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  max-width: 30rem;
}
#activeImage {
  width: 3.4rem; height: 3.4rem;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid var(--emotion);
}
.active-world-copy { min-width: 0; }
.active-emotion {
  display: block;
  font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--plum);
}
#activeName {
  margin: 0.1rem 0 0;
  font-size: 1.05rem;
  color: var(--plum);
  white-space: normal; overflow-wrap: anywhere; line-height:1.16;
}
#visitWorld {
  min-height: 44px;
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0 1.05rem;
  border-radius: 999px;
  border: 1px solid var(--plum);
  background: var(--plum);
  color: var(--cream);
  font-weight: 800; font-size: 0.88rem;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
#visitWorld:hover, #visitWorld:focus-visible { color: var(--orange); border-color: var(--orange); outline: none; }

/* ---------- planet frame ---------- */
#planetFrame {
  position: relative;
  z-index: 1;
  width: min(64vw, 80svh);
  max-width: 850px;
  aspect-ratio: 1;
  margin-inline: auto;
  justify-self: center;
}
#planetFrame::before {
  content: '';
  position: absolute;
  inset: -14%;
  z-index: 0;
  background: radial-gradient(circle at 50% 46%, rgba(163, 214, 209, 0.55) 0%, rgba(163, 214, 209, 0.16) 46%, rgba(163, 214, 209, 0) 72%);
  pointer-events: none;
}
#planetFrame::after {
  content: '';
  position: absolute;
  left: 50%; bottom: 2%;
  width: 62%; height: 9%;
  transform: translateX(-50%);
  z-index: 0;
  background: radial-gradient(ellipse at center, rgba(46, 36, 64, 0.22) 0%, rgba(46, 36, 64, 0) 72%);
  border-radius: 50%;
  pointer-events: none;
}

#globeCanvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
  cursor: grab;
  touch-action: pan-y;
}
#globeCanvas.dragging { cursor: grabbing; }

#continentPins {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 2;
  pointer-events: none;
}

#globeFallback {
  position: absolute; inset: 0;
  z-index: 2;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  padding: 1.5rem;
  font-weight: 700;
  color: var(--plum-soft);
  background: var(--cream-2);
  border-radius: 50%;
}

.continent-pin {
  position: absolute; left: 0; top: 0;
  transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 0.45rem;
  min-height: 32px;
  padding: 5px 8px;
  white-space: nowrap;
  font-size: clamp(0.6rem, 0.85vw, 0.8rem);
  font-weight: 800;
  color: var(--plum);
  background: rgba(255, 252, 246, 0.93);
  border: 1px solid var(--plum-line);
  border-radius: 99px;
  box-shadow: 0 6px 14px -8px rgba(46, 36, 64, 0.4);
  pointer-events: auto;
  cursor: pointer;
  max-width: 140px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.continent-pin .pin-name {
  white-space: normal; line-height:1.15;
}
.continent-pin .pin-dot {
  flex: 0 0 auto;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--emotion);
  background: transparent;
  transition: background 0.15s ease;
}
.continent-pin:hover .pin-dot,
.continent-pin:focus-visible .pin-dot {
  background: var(--emotion);
}
.continent-pin:hover,
.continent-pin:focus-visible {
  transform: translate(-50%, -50%) scale(1.05);
  border-color: var(--emotion);
  outline: none;
}
.continent-pin:focus-visible {
  outline: 2px solid var(--orange-dark);
  outline-offset: 2px;
}

/* ---------- side rail ---------- */
.rail {
  position: absolute;
  right: clamp(0.5rem, 1.6vw, 1.5rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
#rotationRange {
  writing-mode: vertical-lr;
  direction: ltr;
  width: 6px;
  height: min(38svh, 320px);
  accent-color: var(--plum);
  cursor: pointer;
}
#globeCount {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--plum-soft);
  letter-spacing: 0.03em;
}

/* ---------- footer ---------- */
.globe-footer {
  padding: clamp(2.5rem, 6vw, 4rem) clamp(1.25rem, 5vw, 3rem);
  text-align: center;
  background: var(--cream-2);
}
.globe-footer h2 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  color: var(--plum);
}
.globe-footer p {
  margin: 0 0 1.4rem;
  color: var(--plum-soft);
}
#backToStart {
  min-height: 44px;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  border: 1px solid var(--plum);
  background: var(--plum);
  color: var(--cream);
  font-weight: 800; font-size: 0.92rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
#backToStart:hover, #backToStart:focus-visible { color: var(--orange); border-color: var(--orange); outline: none; }

/* ---------- destination dialog ---------- */
#destination {
  position: fixed;
  inset: 0;
  width: 100vw; max-width: none;
  height: 100svh; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: var(--cream);
  color: var(--plum);
  overflow: auto;
  z-index: 90;
}
#destination::backdrop {
  background: transparent;
}
#destinationImage {transform-origin:50% 55%}
html {scrollbar-gutter:stable}
html:has(#destination[open]) {scrollbar-gutter:auto}

#returnGlobe {
  position: sticky;
  top: 1rem;
  left: 1rem;
  z-index: 5;
  margin: 1rem 0 0 1rem;
  min-height: 44px;
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--plum-line);
  background: rgba(255, 252, 246, 0.94);
  color: var(--plum);
  font-weight: 800; font-size: 0.9rem;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(6px);
  transition: color 0.15s ease, border-color 0.15s ease;
}
#returnGlobe:hover, #returnGlobe:focus-visible { color: var(--orange-dark); border-color: var(--orange); outline: none; }

.destination-scene {
  position: relative;
  height: 60svh;
  overflow: hidden;
  margin-top: -3.6rem;
}
#destinationImage {
  width: 100%; height: 100%;
  object-fit: cover;
}

.destination-content {
  position: relative;
  z-index: 2;
  max-width: 46rem;
  margin: 0 auto;
  padding: 2rem clamp(1.25rem, 5vw, 2.5rem) 3rem;
  background: var(--cream);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  margin-top: -2rem;
}
.destination-emotion {
  display: inline-block;
  font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--plum);
  margin-bottom: 0.35rem;
}
#destinationName {
  margin: 0 0 0.75rem;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}
#destinationDescription {
  margin: 0 0 1.75rem;
  color: var(--plum-soft);
  max-width: 56ch;
}

#destinationResidents {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.resident-item {
  text-align: center;
}
.resident-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 999px;
  border: 2px solid var(--plum-line);
  margin-bottom: 0.5rem;
}
.resident-item h3 {
  margin: 0;
  font-size: 0.88rem;
  color: var(--plum);
  overflow-wrap: break-word;
}

/* ---------- flight veil ---------- */
#flightVeil {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(60% 50% at 30% 30%, rgba(255, 252, 246, 0.9) 0%, rgba(255, 252, 246, 0) 70%),
    radial-gradient(60% 50% at 70% 70%, rgba(255, 252, 246, 0.9) 0%, rgba(255, 252, 246, 0) 70%),
    var(--cream);
}

/* ================= responsive ================= */

@media (max-width: 900px) {
  #globeStage {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    padding: calc(var(--header-h) + 0.5rem) 1rem 1rem;
    gap: 0.5rem;
    justify-items: center;
    text-align: center;
  }
  .intro { max-width: 90vw; order: 1; }
  .intro h1 { font-size: clamp(1.4rem, 6vw, 1.8rem); }
  .intro-copy { max-width: 40ch; margin-inline: auto; }
  .turn-controls { justify-content: center; margin-bottom: 0.85rem; }
  .globe-hint { margin-bottom: 0.75rem; }

  #planetFrame {
    order: 2;
    width: calc(100vw - 20px);
    max-width: none;
    min-height: 310px;
  }

  .active-world { order: 3; max-width: 26rem; margin-top: 0.75rem; }

  .rail { display: none; }
}

@media (max-width: 480px) {
  .header-right .concept-tag { display: none; }
  .concept-link { font-size: 0.72rem; }
  .active-world {
    grid-template-columns: 2.8rem 1fr auto;
    gap: 0.6rem;
  }
  #activeImage { width: 2.8rem; height: 2.8rem; }
}

@media (max-height: 700px) and (max-width: 900px) {
  #globeScene { height: auto; }
  #globeStage {
    position: static;
    height: auto;
    min-height: 100svh;
    overflow: visible;
  }
  .intro h1 { font-size: 1.35rem; }
  .intro-copy { margin-bottom: 0.6rem; }
  .globe-hint { margin-bottom: 0.6rem; font-size: 0.76rem; }
  #planetFrame { min-height: 310px; width: calc(100vw - 20px); }
}

@media (max-width: 900px) {
  #destination .destination-scene { height: 55svh; margin-top: -3.6rem; }
  #destinationResidents { gap: 0.7rem; }
  .resident-item h3 { font-size: 0.78rem; overflow-wrap: break-word; }
}

html[data-motion='reduced'] {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* Keep the complete globe and its selected-place control within the sticky view. */
#globeStage {grid-template-rows:1fr auto auto 1fr;row-gap:0}
.intro {grid-column:1;grid-row:2;max-width:none}
#activeWorld {grid-column:1;grid-row:3;margin-top:1rem;grid-template-columns:45px minmax(0,1fr) auto;gap:.55rem}
#activeImage {width:45px;height:45px}
#visitWorld {padding:0 .75rem;font-size:.78rem}
#planetFrame {grid-column:2;grid-row:1 / 5}
.continent-pin {min-height:36px}
.continent-pin::before {content:'';position:absolute;inset:-5px 0}
.continent-pin.active .pin-dot {background:var(--emotion)}
.resident-item {text-align:center}
.resident-item img {width:90px;height:90px;margin:0 auto 8px}
.resident-item h3 {line-height:1.2}
@media(max-width:900px) {
 #globeScene {height:400vh}
 #globeStage {position:sticky;height:100svh;min-height:0;overflow:clip;grid-template-rows:auto minmax(0,1fr) auto;gap:6px;padding:calc(var(--header-h) + 5px) 12px 18px}
 .intro {grid-column:1;grid-row:1;order:0;max-width:100%}
 .intro .eyebrow {font-size:.65rem;letter-spacing:.08em;margin-bottom:4px}
 .intro h1 {font-size:1.65rem;line-height:1.03;margin-bottom:9px}
 .intro-copy {display:none}
 .globe-hint {font-size:.74rem;margin-bottom:8px}
 .turn-controls {margin-bottom:0}
 #planetFrame {grid-column:1;grid-row:2;order:0;min-height:0;width:min(calc(100vw - 26px),calc(100svh - 320px));max-width:520px;align-self:center}
 #activeWorld {grid-column:1;grid-row:3;order:0;margin:0;width:min(100%,430px);max-width:none;text-align:left;padding:.6rem;align-self:end}
 #activeName {font-size:1rem}
 .continent-pin {max-width:105px;padding:4px 6px;font-size:.63rem;min-height:34px;gap:4px}
 .header-right .concept-tag {display:none}
 .resident-item img {width:65px;height:65px}
}
@media(max-width:900px) and (max-height:700px) {
 .intro h1 {font-size:1.4rem}
 .globe-hint {margin-bottom:5px}
 #planetFrame {width:min(calc(100vw - 24px),calc(100svh - 290px))}
}

/* Both the resident portrait and name open the full character profile. */
a.resident-item {display:block;color:inherit;text-decoration:none;border-radius:12px;padding:4px}
a.resident-item:hover img {border-color:var(--emotion)}
a.resident-item:focus-visible {outline:2px solid var(--plum);outline-offset:4px}

/* Scale the desktop composition together, including wide and shallow screens.
   Track widths use the available content area; the sphere stays square and fits
   below the header. Phone layouts retain their existing stacked composition. */
@media (min-width: 901px) {
  #globeStage {
    --hero-title-size: clamp(2.75rem, min(4.2vw, 7svh), 8rem);
    --hero-copy-width: clamp(20rem, calc(var(--hero-title-size) * 7), 56rem);
    --hero-gap: clamp(1rem, 2vw, 4.5rem);
    --hero-globe-size: min(58vw, calc(100svh - var(--header-h) - 4rem));
    grid-template-columns: var(--hero-copy-width) min(var(--hero-globe-size), calc(100% - var(--hero-copy-width) - var(--hero-gap)));
    column-gap: var(--hero-gap);
    justify-content: center;
    padding-inline: clamp(1.5rem, 3vw, 6rem);
  }
  #planetFrame {
    width: 100%;
    max-width: none;
    min-height: 0;
    margin-inline: 0;
    align-self: center;
  }
  #globeStage .intro h1 {font-size:var(--hero-title-size)}
  #globeStage .intro-copy {font-size:clamp(1rem, min(1.35vw, 2svh), 1.6rem)}
  #globeStage .intro .eyebrow {font-size:clamp(.75rem, min(.8vw, 1.35svh), 1.15rem)}
  #globeStage .globe-hint {font-size:clamp(.82rem, min(.95vw, 1.6svh), 1.15rem)}
  #globeStage #activeWorld {
    width:100%;
    max-width:min(100%, 36rem);
    margin-top:clamp(1rem, 2svh, 2rem);
  }
  #globeStage #activeName {font-size:clamp(1rem, min(1.35vw, 2svh), 1.6rem)}
  #globeStage #visitWorld {font-size:clamp(.78rem, min(.95vw, 1.5svh), 1.1rem)}
  #globeStage .continent-pin {font-size:clamp(.7rem, min(.8vw, 1.4svh), 1.1rem)}
}
@media (min-width: 901px) and (max-height: 550px) {
  #globeStage {--hero-title-size:clamp(1.65rem, 6.5svh, 2.4rem);padding-top:calc(var(--header-h) + .5rem);padding-bottom:1rem}
  #globeStage .intro h1 {margin-bottom:.5rem}
  #globeStage .intro-copy {margin-bottom:.6rem}
  #globeStage .globe-hint {margin-bottom:.5rem}
  #globeStage .turn-controls {margin-bottom:0}
  #globeStage #activeWorld {margin-top:.65rem}
}
