/* Server HTML and React share this renderer-free Spatial Atlas cover.
   Palette/type match PR1109, scoped away from Editor and Bridge. */
@font-face { font-family: 'Libre Caslon Display'; font-weight: 400; font-style: normal; font-display: optional; src: url('/fonts/libre-caslon-display-normal-latin.woff2') format('woff2'); }
@font-face { font-family: 'Open Sans'; font-weight: 300 800; font-style: normal; font-display: optional; src: url('/fonts/open-sans-normal-latin.woff2') format('woff2'); }
body { margin: 0; }
.view-atlas {
  --view-paper: #f2f3ee; --view-panel: #e6ebe6; --view-ink: #202929;
  --view-muted: #5e6c69; --view-accent: #245b63; --view-rule: #bbc5bd; --view-button-ink: #f2f3ee;
  --view-font: 'Open Sans', system-ui, sans-serif;
  --view-display: 'Libre Caslon Display', Georgia, serif;
  --view-paint-mask: url('/images/atlas/viewer-paint-desktop.svg');
}
:root[data-theme='dark'] .view-atlas {
  --view-paper: #171e20; --view-panel: #222d2e; --view-ink: #eef1eb;
  --view-muted: #bac7c1; --view-accent: #9bc9c7; --view-rule: #5e706d; --view-button-ink: #171e20;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .view-atlas {
    --view-paper: #171e20; --view-panel: #222d2e; --view-ink: #eef1eb;
    --view-muted: #bac7c1; --view-accent: #9bc9c7; --view-rule: #5e706d; --view-button-ink: #171e20;
  }
}
.view-cover { position: fixed; inset: 0; z-index: 1100; overflow: hidden; background: var(--view-paper); color: var(--view-ink); font-family: var(--view-font); font-synthesis: none; }
.view-cover a { color: inherit; }
.view-cover-activate { position: absolute; inset: 0; width: 100%; height: 100%; appearance: none; padding: 0; border: 0; background: transparent; cursor: pointer; }
.view-cover-activate:disabled { cursor: wait; }
.view-cover-image {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  pointer-events: none; user-select: none; -webkit-user-drag: none;
  /* Actual screenshot stays sharp; only its boundary is painted. */
  -webkit-mask: var(--view-paint-mask) center / 100% 100% no-repeat;
  mask: var(--view-paint-mask) center / 100% 100% no-repeat;
  transition: -webkit-mask-size 0.7s ease, mask-size 0.7s ease;
}
/* Clicking in opens the frame: the torn edge travels off the viewport. */
.view-cover[data-loading] .view-cover-image {
  -webkit-mask-size: 155% 155%;
  mask-size: 155% 155%;
}
.view-cover-centre {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: max-content; max-width: min(80%, 360px); text-align: center; pointer-events: none;
  transition: opacity 0.5s ease, transform 0.18s ease;
}
/* Fit the painted paper to the unchanged title, rather than the viewport. */
.view-cover-centre::before {
  content: ''; position: absolute; inset: -14px -22px; z-index: -1; background: var(--view-paper);
  -webkit-mask: url('/images/atlas/viewer-paint-opening.svg') center / 100% 100% no-repeat;
  mask: url('/images/atlas/viewer-paint-opening.svg') center / 100% 100% no-repeat;
  transition: background-color 0.18s ease, filter 0.18s ease;
}
/* The enter island is the button: padding is the paper around the label, and the
   blob fills that box so the whole shape takes the click, not only the words. */
.view-cover-centre:has(.view-cover-enter) { max-width: min(88%, 440px); }
.view-cover-centre:has(.view-cover-enter)::before {
  inset: 0;
  filter: drop-shadow(0 10px 22px rgba(32, 41, 41, 0.22));
}
.view-cover-centre:has(.view-cover-enter:hover:not(:disabled)) {
  transform: translate(-50%, -50%) scale(1.04);
}
.view-cover-centre:has(.view-cover-enter:hover:not(:disabled))::before {
  background: color-mix(in srgb, var(--view-accent) 14%, var(--view-paper));
  filter: drop-shadow(0 12px 26px rgba(32, 41, 41, 0.24));
}
.view-cover-centre:has(.view-cover-enter:active:not(:disabled)) {
  transform: translate(-50%, -50%) scale(0.98);
}
.view-cover[data-loading] .view-cover-centre { opacity: 0; }
.view-cover-centre button,.view-cover-centre a { pointer-events: auto; }
.view-cover-heading { display: block; margin: 0; font: 400 clamp(32px, 4vw, 56px)/1 var(--view-display); letter-spacing: -.035em; }
.view-cover-enter {
  appearance: none; position: relative; z-index: 1; width: 100%; margin: 0;
  padding: 28px 44px; border: 0; border-radius: 4px; background: none; color: inherit;
  cursor: pointer; font-size: clamp(18px, 2.2vw, 26px); line-height: 1.25; text-wrap: balance;
}
.view-cover-enter:hover:not(:disabled) { color: var(--view-accent); }
.view-cover-heading .view-cover-touch { display: none; }
.view-cover-enter:disabled { cursor: wait; }
.view-cover-load { appearance: none; border: 1px solid var(--view-accent); border-radius: 8px; padding: 15px 27px; background: var(--view-accent); color: var(--view-button-ink); font: 600 15px/1.3 var(--view-font); cursor: pointer; }
.view-cover-load:hover:not(:disabled) { filter: brightness(1.1); }
.view-cover-load:disabled { cursor: wait; opacity: .8; }
.view-cover-enter:focus-visible,.view-cover-load:focus-visible,.view-cover-more:focus-visible,.view-cover-brand:focus-visible { outline: 2px solid var(--view-accent); outline-offset: 5px; }
.view-cover-centre p { margin: 12px auto 0; color: var(--view-muted); font-size: 12px; line-height: 1.6; }
.view-cover-centre p:empty { margin: 0; }
.view-cover-brand { position: absolute; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 20px; text-decoration: none; background: none; border-radius: 50%; padding: 6px; pointer-events: auto; }
.view-cover-mark {
  display: block; width: 32px; height: 32px; background: var(--view-accent);
  -webkit-mask: url('/images/atlas/latom-eye.svg') center / contain no-repeat;
  mask: url('/images/atlas/latom-eye.svg') center / contain no-repeat;
}
/* The eye clips a viewport-aligned copy of the screenshot's white paint mask.
   It stays white on the photo and accent on paper, even across a paint edge or
   when the details card moves it. Reuses the cached SVG, without pixel reads,
   layout observers or a second screenshot. Keep its ancestors untransformed
   so the fixed paint layer shares the screenshot's viewport coordinates. */
.view-atlas[data-cover-poster] .view-cover-mark::before {
  content: ''; position: fixed; inset: 0; pointer-events: none;
  background: var(--view-paint-mask) center / 100% 100% no-repeat;
}
.view-cover-navigation { display: contents; }
.view-cover-back { position: absolute; top: 18px; left: 18px; background: var(--view-paper); border: 1px solid var(--view-rule); border-radius: 8px; padding: 10px 14px; text-decoration: none; font-size: 13px; }
.view-cover-info { position: absolute; top: 66px; left: 18px; box-sizing: border-box; width: min(418px, 32vw); max-height: calc(100% - 150px); overflow: auto; border: 1px solid var(--view-rule); border-radius: 4px; padding: 16px 18px; background: var(--view-paper); }
.view-cover-info h1 { font: 400 26px/1.2 var(--view-display); margin: 0 0 12px; }
.view-cover-info p { font-size: 13px; line-height: 1.6; }
.view-cover-description { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; white-space: pre-wrap; }
.view-cover-description[data-expanded] { -webkit-line-clamp: unset; }
.view-cover-more { color: var(--view-accent); background: none; border: 0; padding: 0; cursor: pointer; }
.view-cover-info ul { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; font-size: 12px; }
.view-cover-info li { border: 1px solid var(--view-rule); border-radius: 8px; padding: 4px 8px; }
.view-cover-noscript { position: absolute; bottom: 0; left: 18px; padding: 4px; background: var(--view-paper); font-size: 12px; }
.view-cover-controls {
  position: absolute; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  padding: 14px 18px; border: 1px solid var(--view-muted); border-radius: 4px;
  background: var(--view-paper); color: var(--view-ink); pointer-events: none;
}
.view-cover-controls p { margin: 0 0 10px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--view-muted); }
.view-cover-controls ul { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; align-items: center; margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--view-ink); }
.view-cover-controls li { display: contents; }
.view-cover-controls .view-cover-touch { display: none; }
.view-cover-controls kbd {
  justify-self: center; padding: 3px 8px; border: 1px solid var(--view-muted); border-radius: 4px;
  background: var(--view-panel); color: var(--view-ink); font-family: inherit; font-weight: 600; font-size: 11px; line-height: 1.3;
}
.view-cover-wasd { display: inline-grid; grid-template-columns: repeat(3, 20px); gap: 3px; justify-self: center; }
.view-cover-wasd kbd { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; }
.view-cover-wasd kbd:first-child { grid-column: 2; }
.view-cover-wasd kbd:nth-child(2) { grid-column: 1; }
/* Live controls keep their dark grade. Before loading, existing panels follow
   the same paper/ink palette as the server-rendered document. */
.view-atlas .view-cover-overlay.glass-surface.glass-dark {
  --bg: var(--view-paper); --bg-elevated: var(--view-panel); --ink: var(--view-ink);
  --muted: var(--view-muted); --accent: var(--view-accent); --glass-border: var(--view-rule);
  --glass-border-strong: var(--view-muted); --glass-fill-strong: linear-gradient(var(--view-paper), var(--view-paper));
  --glass-fill: linear-gradient(var(--view-paper), var(--view-paper)); --glass-blur: none; --glass-drop: 0 0 transparent;
  --glass-inset: 0 0 transparent; --font-site: var(--view-font); --font-display: var(--view-display);
}
@media (min-width: 861px) {
  .view-cover-centre::before {
    inset: -60px -62px;
    -webkit-mask-image: url('/images/atlas/viewer-paint-opening-desktop.svg');
    mask-image: url('/images/atlas/viewer-paint-opening-desktop.svg');
  }
  .view-cover-centre:has(.view-cover-enter)::before {
    inset: 0;
    -webkit-mask-image: url('/images/atlas/viewer-paint-opening-desktop.svg');
    mask-image: url('/images/atlas/viewer-paint-opening-desktop.svg');
  }
  .view-cover-heading { font-size: clamp(40px, 4.5vw, 68px); }
  .view-cover-enter { padding: 40px 56px; font-size: clamp(20px, 1.8vw, 28px); }
  .view-cover-centre p { margin-top: 8px; }
}
@media (min-width: 861px) and (max-height: 700px) {
  .view-cover-centre p { margin-top: 4px; }
}
@media (max-width: 860px) {
  .view-atlas { --view-paint-mask: url('/images/atlas/viewer-paint-mobile.svg'); }
  .view-cover-footer { position: absolute; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); left: 12px; right: 12px; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
  .view-cover-footer .view-cover-info { position: static; width: 100%; max-height: 27vh; pointer-events: auto; }
  .view-cover-navigation { display: flex; width: 100%; align-items: flex-end; justify-content: space-between; gap: 10px; }
  .view-cover-navigation .view-cover-brand,.view-cover-navigation .view-cover-controls { position: static; }
  .view-cover-back { top: 12px; left: 12px; }
  .view-cover-centre { top: 36%; }
  .view-cover-heading { font-size: clamp(32px, 6.5vw, 44px); }
  .view-cover-enter { padding: 22px 28px; font-size: clamp(17px, 4.6vw, 22px); }
  .view-cover-controls { display: none; }
}
@media (pointer: coarse) {
  .view-cover-controls .view-cover-desktop { display: none; }
  .view-cover-controls .view-cover-touch { display: contents; }
}
/* A finger gets "tap", including the phone layout. A mouse keeps "click". */
@media (max-width: 860px), (pointer: coarse) {
  .view-cover-heading .view-cover-desktop { display: none; }
  .view-cover-heading .view-cover-touch { display: inline; }
}
@media (max-width: 860px) and (max-height: 650px) {
  .view-cover-load { padding: 12px 24px; }
  .view-cover-centre p { margin-top: 8px; font-size: 11px; line-height: 1.5; }
}
@media (max-height: 480px) {
  .view-cover-heading { font-size: 32px; }
  .view-cover-enter { padding: 16px 22px; font-size: 17px; }
  .view-cover-centre p { margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .view-cover-image,.view-cover-centre,.view-cover-centre::before { transition: none; }
  .view-cover-centre:has(.view-cover-enter:hover:not(:disabled)),
  .view-cover-centre:has(.view-cover-enter:active:not(:disabled)) {
    transform: translate(-50%, -50%);
  }
}

/* A plain embed is the unmasked screenshot and one activation button. Keep
   loading/retry text readable over the image without adding a paper opening. */
.view-plain .view-cover-image { -webkit-mask: none; mask: none; }
.view-plain .view-cover-centre,
.view-direct .view-cover-centre { top: 50%; max-width: calc(100% - 48px); }
.view-plain .view-cover-centre::before,
.view-direct .view-cover-centre::before { content: none; -webkit-mask: none; mask: none; }
.view-plain .view-cover-centre p:not(:empty) {
  padding: 8px 12px; border-radius: 8px; background: #171e20e6; color: #eef1eb;
}
