/* Poster viewer, in the same material as the home page: night ground, the sheet lifted off it. */

:root {
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s6: 24px; --s8: 32px; --s16: 64px;
  --round: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --night: #07131D;
  --night-2: #152B3B;
  --text: #F3F7FA;
  --text-2: #A9BBC8;   /* 9.6:1 on --night */
  --accent: #86D6E0;

  --top-h: 56px;
  --r-pill: 999px;
  --elev: 0 1px 2px rgba(0,0,0,.3), 0 16px 40px rgba(0,0,0,.45);
  --ease: cubic-bezier(.2,.8,.2,1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; overflow: hidden; background: var(--night); color: var(--text);
  font-family: var(--round); font-weight: 400; line-height: 1.5; -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, a { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.mark { display: inline-block; padding: var(--s1) var(--s3); border-radius: var(--r-pill); background: rgba(255,255,255,.12); color: #fff; font-size: 13px; font-weight: 700; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--text); text-decoration: none; }
.icon-btn:hover { background: rgba(255,255,255,.08); }

.top {
  position: fixed; inset: 0 0 auto 0; z-index: 20; display: flex; align-items: center; gap: var(--s3);
  height: calc(var(--top-h) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) var(--s2) 0 var(--s2);
  background: rgba(7,19,29,.82); -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%);
}
.brand { display: flex; align-items: center; gap: var(--s2); height: 44px; padding: 0 var(--s3) 0 var(--s2); border-radius: var(--r-pill); text-decoration: none; }
.brand:hover { background: rgba(255,255,255,.08); }
.where { flex: 1; margin: 0; text-align: center; font-size: 15px; font-weight: 600; color: var(--text-2); white-space: nowrap; }

/* The stage never scrolls: the sheet is moved with a transform, so pinch and drag stay ours. */
.stage {
  position: fixed; inset: calc(var(--top-h) + env(safe-area-inset-top, 0px)) 0 0 0;
  overflow: hidden; touch-action: none; cursor: grab; contain: strict;
}
.stage.dragging { cursor: grabbing; }
.sheet {
  position: absolute; top: 0; left: 0; transform-origin: 0 0; background: #fff;
  box-shadow: var(--elev); will-change: transform;
}
.sheet canvas { display: block; width: 100%; height: 100%; }

.hint {
  position: fixed; left: 50%; bottom: calc(var(--s16) + var(--s6) + env(safe-area-inset-bottom, 0px)); z-index: 15;
  margin: 0; padding: var(--s2) var(--s4); border-radius: var(--r-pill);
  background: rgba(21,43,59,.88); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  color: var(--text-2); font-size: 14px; white-space: nowrap; pointer-events: none;
  transform: translateX(-50%); transition: opacity .4s var(--ease);
}
.hint.gone { opacity: 0; }

.loading, .failed { position: fixed; inset: 0; z-index: 25; display: grid; place-content: center; justify-items: center; gap: var(--s3); padding: var(--s6); text-align: center; background: var(--night); }
.loading p, .failed p { margin: 0; color: var(--text-2); }
.loading p:first-of-type { margin-top: var(--s2); color: var(--text); font-size: 18px; font-weight: 600; }
.bar { width: 220px; height: 4px; overflow: hidden; border-radius: var(--r-pill); background: var(--night-2); }
.bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .2s var(--ease); }
.failed .failed-title { color: var(--text); font-size: 20px; font-weight: 700; }
.pill-link { margin-top: var(--s3); padding: var(--s3) var(--s6); border-radius: var(--r-pill); background: #fff; color: var(--night); font-weight: 700; text-decoration: none; }
.text-link { color: var(--accent); font-weight: 600; text-decoration: none; }

.dock {
  position: fixed; left: 50%; bottom: calc(var(--s4) + env(safe-area-inset-bottom, 0px)); z-index: 18;
  display: flex; align-items: center; gap: var(--s1); padding: var(--s1); border-radius: var(--r-pill);
  background: rgba(21,43,59,.88); -webkit-backdrop-filter: blur(20px) saturate(150%); backdrop-filter: blur(20px) saturate(150%);
  box-shadow: var(--elev); transform: translateX(-50%);
}
.dock-btn { display: flex; align-items: center; gap: var(--s2); height: 44px; min-width: 44px; padding: 0 var(--s3); border: 0; border-radius: var(--r-pill); background: transparent; font-size: 15px; font-weight: 600; text-decoration: none; justify-content: center; }
.dock-btn:hover, .dock-zoom:hover { background: rgba(255,255,255,.1); }
.dock-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.dock-zoom { height: 44px; min-width: 72px; padding: 0 var(--s3); border: 0; border-radius: var(--r-pill); background: transparent; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dock-sep { width: 1px; height: 24px; margin: 0 var(--s1); background: rgba(255,255,255,.14); }

@media (max-width: 479px) {
  .where { display: none; }
  .dock-wide span { display: none; }
}

@media (prefers-reduced-motion: reduce) { * { transition-duration: .01ms !important; } }
