/* The same viewport carries the planet, its anchored places, and its reading surface. */
.world {
  --edge: clamp(1rem, 3vw, 3.25rem);
  --frame-height: 100svh;
  --reading-scale: 1.65;
  --top-space: 2rem;
  --cutaway: min(calc(var(--orbit) * 1.46), max(min(76vw,72rem), min(108svh,80rem)));
  --orbit: min(96vw, 86svh);
  background: var(--space);
}
.world-frame { position: relative; isolation: isolate; min-height: var(--frame-height); }
.world-scene {
  position: absolute; left: 0; right: 0; top: 0;
  height: var(--frame-height);
}
.world-frame { overflow: clip; background: radial-gradient(ellipse at 48% 45%, var(--space-near) 0%, var(--space-mid) 47%, var(--space-far) 100%); }
.world-top .brand {
  background: var(--glass); color: var(--glass-ink); border-radius: 2rem; padding: .18rem .8rem .18rem .22rem;
}
.world-top .brand b { color: var(--glass-accent); }
.atlas-earth { width: 100%; height: 100%; --earth-diameter: min(96cqw, 86cqh); }
.world-scene { transition: transform 620ms var(--ease); }
.world-top {
  position: absolute; z-index: 9; left: var(--edge); right: var(--edge);
  top: max(1.2rem, env(safe-area-inset-top)); display: flex; align-items: center; justify-content: space-between;
  gap: .65rem; pointer-events: none;
}
.world-top > * { pointer-events: auto; }
html:not(.interactive) .world-tools :is(.locator.enhanced, .theme-switch) { display: block !important; visibility: hidden; }
.world-tools { display: flex; gap: .5rem; align-items: center; }
.world-top .locator summary, .atlas-info summary, .theme-switch { background: var(--glass); border: 1px solid var(--line); box-shadow: 0 2px 7px #31526909; }
.world-top .locator summary { min-width: 10.6rem; }
.atlas-info { position: relative; }
.atlas-info summary, .theme-switch { display: grid; place-items: center; width: var(--control); height: var(--control); border-radius: 100%; color: var(--blue); }
.atlas-info summary:hover, .theme-switch:hover { border-color: var(--blue); }
.info-page, .world-top .locator-popover { position: absolute; right: 0; top: calc(100% + .5rem); margin: 0; border: 1px solid var(--line); background: var(--paper); box-shadow: var(--shadow); border-radius: var(--radius); }
.info-page {
  width: min(20.5rem, calc(100vw - 2 * var(--edge))); padding: 1.15rem 1.15rem .95rem;
  max-height: 72svh; overflow: auto; border-radius: 1.15rem;
}
.info-page h2 { font-size: 1.35rem; letter-spacing: -.02em; }
.atlas-totals { display: grid; grid-template-columns: 1fr auto; gap: .4rem 1rem; margin: .8rem 0 1rem; font-size: .96rem; }
.atlas-totals dt { color: var(--muted); }
.atlas-totals dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.info-page nav { border-block: 1px solid var(--line); padding: .25rem 0; }
.info-page nav a {
  display: flex; align-items: center; gap: .65rem; min-height: 2.75rem;
  color: var(--ink); font-weight: 550; text-decoration: none; border-radius: .45rem;
}
.info-page nav a:hover { background: var(--sky); }
.info-page nav a .icon:first-child { color: var(--blue); }
.info-page nav a .icon:last-child { margin-left: auto; width: .9rem; color: var(--muted); }
.info-page .credit-line { display: grid; gap: .25rem; margin-top: .85rem; }
.atlas-credit, .imagery-credit { font-size: .84rem; line-height: 1.4; color: var(--muted); }
.atlas-credit a { font-weight: 600; }
.imagery-credit { width: fit-content; font-size: .76rem; }
.world-position, .camera-controls, .world-dock { position: absolute; z-index: 4; }
.world-position { left: var(--edge); top: calc(var(--frame-height) - 3.6rem); display: inline-flex; align-items: center; gap: .45rem; font-size: .79rem; padding: .25rem .65rem; border-radius: 2rem; background: var(--glass); color: var(--glass-ink); font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.world-position .icon { color: var(--glass-accent); }
.camera-controls { right: var(--edge); top: calc(var(--frame-height) - 4.65rem); box-shadow: 0 2px 7px #31526909; }
.world-dock {
  left: 50%; top: calc(var(--frame-height) - 5rem); transform: translateX(-50%);
  display: flex; align-items: center; padding: .32rem; gap: .15rem;
  border: 1px solid var(--line); border-radius: 2rem; background: var(--glass); box-shadow: 0 6px 22px #28485d17;
}
.world-dock a { display: flex; align-items: center; justify-content: center; gap: .43rem; padding: .66rem 1rem; border-radius: 2rem; font-size: 1rem; font-weight: 600; text-decoration: none; color: var(--glass-ink); }
.world-dock a:hover { background: var(--sky); }
.world-dock a[aria-current] { color: var(--on-active); background: var(--active); }
.world-dock .icon { width: 1.04rem; height: 1.04rem; }
.world-preview {
  position: absolute; z-index: 5; top: 50%; right: var(--edge); transform: translateY(-50%);
  width: clamp(16rem, 24vw, 21rem); max-height: calc(var(--frame-height) - 11rem);
  padding: 0; overflow: auto; overscroll-behavior: contain; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 1.15rem;
  box-shadow: 0 2px 7px #08142126, 0 14px 40px #08142138;
}
.world-preview > img { width: 100%; height: clamp(6rem, 15svh, 9rem); object-fit: cover; border-radius: 0; }
.world-preview > .community-logo { object-fit: contain; background: var(--ice); }
.world-preview .preview-copy { min-width: 0; padding: 1rem 1.1rem; }
.world-preview:not(:has(> img)) .preview-copy { padding-top: 1.6rem; }
.world-preview h3 { margin: .22rem 0 .4rem; font-size: clamp(1.25rem, 1.6vw, 1.5rem); line-height: 1.16; }
.world-preview .field-label { color: var(--muted); font-size: .84rem; }
.world-preview p { font-size: .94rem; line-height: 1.4; }
.world-preview .place-group { display: block; font-size: .94rem; margin: .3rem 0; }
.world-preview .preview-close {
  top: .45rem; right: .45rem; width: 2rem; height: 2rem; color: var(--glass-ink);
  background: var(--glass); border: 1px solid var(--line); line-height: 1; font-size: 1.35rem;
}
.world-preview .preview-close::after { content: ""; position: absolute; inset: -.35rem; }
.world-preview .preview-actions {
  display: flex; flex-wrap: wrap; gap: .25rem .65rem; margin-top: .8rem; align-items: center;
}
.world-preview .preview-actions .text-link { font-size: .9rem; min-height: 2rem; }
.world-preview .preview-actions .text-link:first-child {
  border-radius: 1rem; color: var(--on-active); background: var(--active); padding: .2rem .8rem;
}
.globe-pages { position: relative; margin-top: var(--frame-height); }
.world-frame[data-view] { height: var(--frame-height); min-height: 0; }
.world-frame[data-view] .world-touch { touch-action: none; }
.world-frame.inside .world-scene { transform: scale(var(--reading-scale)); }
.world-frame.inside :is(.world-cards, .world-preview, .camera-controls, .world-position) { visibility: hidden; }
.world-frame::after {
  content: ""; position: absolute; z-index: 1; pointer-events: none;
  width: var(--cutaway); aspect-ratio: 1; border-radius: 50%; left: 50%;
  top: calc(var(--frame-height) * .5);
  transform: translate(-50%, -50%) scale(.58); opacity: 0; visibility: hidden;
  background: radial-gradient(ellipse at 47% 40%, var(--paper) 42%, var(--sky) 78%, var(--reader-rim) 100%);
  box-shadow: inset 0 4px 14px #1d627e31, 0 0 0 2px var(--paper), 0 0 0 6px var(--reader-edge), 0 5px 20px 15px #1d546a33;
  transition: transform .56s var(--ease), opacity .3s, visibility .56s;
}
.world-frame.inside::after { visibility: visible; opacity: 1; transform: translate(-50%, -50%) scale(1); }
.world-frame[data-view] .globe-pages {
  position: absolute; z-index: 3; inset: 0; margin: auto;
  width: min(55rem, calc(var(--cutaway) * .76), calc(100% - 2 * var(--edge)));
  height: min(calc(var(--cutaway) * .61), calc(var(--frame-height) - 11rem));
  overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable;
  scrollbar-color: var(--rail-thumb) transparent; scrollbar-width: thin;
}
.globe-pages > .section, .globe-pages .detail-page { padding: 1.2rem clamp(.6rem, 2.2vw, 2rem); background: transparent; border: 0; }
.globe-pages .section-inner { width: 100%; }
.globe-pages .split-heading { margin-bottom: 1.5rem; }
.globe-pages .split-heading h2, .globe-pages .activity-layout h2 { font-size: clamp(2rem,3vw,2.65rem); }
.globe-pages .event-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.globe-pages .community-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.globe-pages .activity-layout { display: grid; grid-template-columns: 1fr; gap: 2rem; }
.globe-pages .timeline a { padding: .75rem 0 1.25rem; }
.globe-pages .detail-layout { gap: 2rem; }
#globe-story > h2, #globe-story > p { margin: 1.5rem; }
html.interactive .world-frame[data-view]:not(.permalink) .globe-pages:not([hidden]) { animation: enter-earth .45s var(--ease) both; }
@keyframes enter-earth { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
html[data-motion="off"] .world-frame *, html[data-motion="off"] .world-scene { animation-duration: .01ms; transition-duration: .01ms; }
@media (max-width: 900px) {
  .world-position { top: var(--top-space); left: 50%; transform: translateX(-50%); }
  .camera-controls { top: auto; bottom: 5.7rem; }
  .globe-pages .community-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 600px) {
  .world { --edge: .85rem; --top-space: 4rem; --orbit: min(123vw, 86svh); }
  .atlas-earth { --earth-diameter: min(123cqw,86cqh); }
  .world-top { top: max(.9rem,env(safe-area-inset-top)); }
  .world-top .locator summary { min-width: auto; padding: .55rem .8rem; }
  .world-position { top: calc(var(--frame-height) - max(5.8rem, env(safe-area-inset-bottom) + 5.3rem)); left: var(--edge); transform: translateY(-100%); font-size: .8125rem; }
  .locator-shortcut { display: none; }
  .world-top .locator-popover { right: -3.15rem; max-height: 55svh; }
  .world-dock { top: calc(var(--frame-height) - max(.85rem, env(safe-area-inset-bottom))); transform: translate(-50%, -100%); max-width: calc(100% - 1rem); gap: .1rem; }
  .world-dock a { flex-direction: column; gap: .1rem; border-radius: 1.4rem; font-size: .875rem; padding: .36rem .68rem; min-width: 3.35rem; }
  .world-dock .icon { width: 1.06rem; height: 1.06rem; }
  .camera-controls { top: auto; bottom: max(5.25rem,calc(env(safe-area-inset-bottom) + 4.8rem)); }
  .camera-controls button { height: 2.28rem; width: 2.28rem; }
  .world { --cutaway: min(calc(var(--orbit) * 1.55), max(132vw, 92svh)); }
  .world-frame[data-view] .globe-pages { width: calc(100% - 1.15rem); height: min(calc(var(--frame-height) - 11rem),calc(var(--cutaway) * .77)); }
  .globe-pages > .section, .globe-pages .detail-page { padding: 1.15rem; }
  .globe-pages .section-inner { min-width: 0; }
  .globe-pages .event-grid, .globe-pages .community-grid, .globe-pages .detail-layout { grid-template-columns: 1fr; }
}
@media (max-width: 800px) and (orientation: portrait), (max-width: 600px) {
  .world-preview {
    left: var(--edge); right: var(--edge); top: auto; bottom: calc(5.45rem + env(safe-area-inset-bottom));
    width: auto; max-width: 28rem; margin-inline: auto; transform: none; max-height: min(30svh, 14rem); padding: .8rem 2.4rem .8rem .85rem;
    display: flex; align-items: flex-start; gap: .7rem;
  }
  .world-preview > img { flex: none; width: 3.65rem; height: 4.4rem; border-radius: .65rem; }
  .world-preview .preview-copy, .world-preview:not(:has(> img)) .preview-copy { padding: 0; }
  .world-preview h3 { font-size: 1.12rem; margin: .05rem 0 .2rem; }
  .world-preview .preview-actions { margin-top: .35rem; }
  .world-preview .preview-actions .text-link { min-height: 1.85rem; }
  .world-preview .preview-close { top: .25rem; right: .25rem; }
  .world-frame:has(.world-preview:not([hidden])) .camera-controls {
    top: calc(4.2rem + env(safe-area-inset-top)); bottom: auto;
  }
  .world-frame:has(.world-preview:not([hidden])) .world-position {
    top: calc(4.45rem + env(safe-area-inset-top)); left: var(--edge); transform: none;
  }
}
@media (max-height: 530px) and (orientation:landscape) {
  .world { --top-space: .3rem; }
  .world-top { top: .5rem; }
  .world-dock { top: calc(var(--frame-height) - .35rem); transform: translate(-50%, -100%); }
  .world-dock a { padding: .47rem .7rem; }
  .world-frame[data-view] .globe-pages { height: calc(var(--frame-height) - 8rem); }
  .world-position { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .world-scene, .world-frame::after, html.interactive .world-frame[data-view]:not(.permalink) .globe-pages:not([hidden]) { transition: none; animation: none; }
}
html:not(.interactive) .world-frame:not(.permalink) { overflow: hidden; }
html:not(.interactive) .world-frame:not(.permalink) .globe-pages { margin-top: 0; padding-top: var(--frame-height); pointer-events: none; }
html:not(.interactive) .world-frame:not(.permalink) .globe-pages > * { pointer-events: auto; background: var(--paper); }
#place { padding: 0; }
.place-mast { position: relative; isolation: isolate; padding: clamp(1.5rem,4vw,3.8rem); background: var(--ice); }
.place-mast:has(img) { min-height: clamp(11rem,28svh,18rem); display: flex; align-items: end; color: white; background: #123951; }
.place-mast img, .place-mast:has(img)::after { position: absolute; inset: 0; width: 100%; height: 100%; }
.place-mast img { object-fit: cover; z-index: -2; }
.place-mast:has(img)::after { content: ""; z-index: -1; background: linear-gradient(0deg,#08263ce6,transparent 95%); }
.place-name h2 { font-size: clamp(2.25rem,4.25vw,3.6rem); }
.place-chip { display: inline-flex; align-items: center; min-height: 2.5rem; margin: 0 .35rem .25rem 0; padding: .3rem .85rem; border-radius: 2rem; background: var(--paper); border: 1px solid var(--line); font-size: .88rem; font-weight: 650; text-decoration: none; }
.local-cities { margin-top: .65rem; }
.local-credit { position: absolute; right: .6rem; bottom: .45rem; max-width: 90%; font-size: .75rem; padding: .1rem .4rem; color: white; background: #102a3de8; border-radius: .3rem; }
.place-records { padding: clamp(1.2rem,3.5vw,3rem); display: grid; gap: 1.9rem; }
.local-list h3 { font-size: 1.3rem; margin-bottom: .55rem; }
.local-list p, .local-entry small { color: var(--muted); }
.local-entry { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; padding: .8rem 0; border-top: 1px solid var(--line); text-decoration: none; }
.local-entry small { flex: none; }
@media(max-width:600px) { .local-entry { display: grid; gap: .15rem; } .place-mast { padding-bottom: 2.2rem; } }

html[data-motion="off"] .world-frame::after { transition: none; }
.globe-pages .place-mast { border-radius: .9rem; overflow: hidden; }
.globe-pages :is(#submit, #notifications) { padding: .9rem; }
.globe-pages #entry-studio, .globe-pages .wrap { padding-block: .3rem 1.5rem; width: 100%; }
.globe-pages .entry-layout { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 1.75rem; }
@media (max-width: 800px) { .globe-pages .entry-layout { grid-template-columns: 1fr; } }

.permalink main { padding: .9rem; }
.permalink .section { background: transparent; border: 0; padding: 1rem; }

.theme-switch { flex: none; }
.theme-switch .icon:first-child, .theme-switch[aria-pressed="true"] .icon:last-child { display: none; }
.theme-switch[aria-pressed="true"] .icon:first-child { display: block; }
@media (max-width: 450px) {
  .world-top .locator summary, .world-tools > a.pill { min-width: var(--control); width: var(--control); height: var(--control); padding: 0; justify-content: center; }
  .world-top .locator summary span { display: none; }
  .world-tools > a.pill { font-size: 0; gap: 0; }
  .world-tools > a.pill .icon { width: 1.1rem; height: 1.1rem; }
}

.theme-iris {
  position: fixed; inset: 0; z-index: 20; pointer-events: none;
  background: #dfebed55;
}
.theme-iris[data-pass="screen"] { z-index: 21; background: #d7e2e5; }
:root[data-iris="screen"]::view-transition { pointer-events: none; }
:root[data-iris="screen"]::view-transition-group(root),
:root[data-iris="screen"]::view-transition-old(root) { animation: none; }
:root[data-iris="screen"]::view-transition-old(root),
:root[data-iris="screen"]::view-transition-new(root) { mix-blend-mode: normal; }
:root[data-iris="screen"]::view-transition-new(root) {
  animation: theme-open 510ms cubic-bezier(.23,.66,.35,1) both;
}
:root[data-iris="screen"][data-theme="dark"]::view-transition-new(root) { z-index: 0; animation: none; }
:root[data-iris="screen"][data-theme="dark"]::view-transition-old(root) {
  z-index: 1; animation: theme-open 510ms cubic-bezier(.23,.66,.35,1) reverse both;
}
@keyframes theme-open {
  from { clip-path: circle(0px at var(--iris-origin)); }
  to { clip-path: circle(var(--iris-edge) at var(--iris-origin)); }
}

.world-frame[data-view] .globe-pages.awaiting-scrollbar { scrollbar-color: transparent transparent; }
.world-frame[data-view] .globe-pages.has-curved-scroll {
  scrollbar-width: none; scrollbar-gutter: auto; padding-inline-end: var(--reader-gutter);
}
.globe-pages.has-curved-scroll::-webkit-scrollbar { display: none; width: 0; height: 0; }
.reader-scrollbar {
  position: absolute; z-index: 4; overflow: visible; fill: none;
  stroke-linecap: round; touch-action: none; pointer-events: none;
}
.reader-scrollbar .scroll-track { stroke: var(--rail-track); stroke-width: 2; }
.reader-scrollbar .scroll-thumb { stroke: var(--rail-thumb); stroke-width: 5; }
.reader-scrollbar .scroll-hit { stroke: transparent; stroke-width: 24; pointer-events: stroke; cursor: pointer; }
.reader-scrollbar:active .scroll-hit { cursor: grabbing; }
.reader-scrollbar:focus-visible { outline: none; }
.reader-scrollbar:focus-visible .scroll-thumb { stroke: var(--blue); stroke-width: 8; }
@media (forced-colors: active) {
  .reader-scrollbar .scroll-track { stroke: GrayText; }
  .reader-scrollbar .scroll-thumb, .reader-scrollbar:focus-visible .scroll-thumb { stroke: Highlight; }
}
