/* The poster page chrome, shared.
 *
 * Every chart here is the same page around a different drawing: the sheet, a
 * hover tooltip, one hairline control bar, a loading cover and a help dialog.
 * Five charts were carrying byte-identical private copies of this file. Load
 * shared/theme.css first — it owns the colour tokens; this owns the layout.
 */

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, sans-serif;
}

.sheet {
  width: min(1520px, 100vw);
  margin: 0 auto;
  padding: 8px 12px 96px;
}
.sheet.compact-card {
  width: min(780px, calc((100svh - 120px) * 0.8), 100vw);
  padding: 8px 8px 96px;
}
#poster { display: block; width: 100%; height: auto; }

.tip {
  position: fixed; background: var(--surface); border: 1px solid var(--border);
  border-radius: 5px; padding: 10px 13px; max-width: 320px;
  pointer-events: none; opacity: 0; transition: opacity 0.1s;
  z-index: 1000; backdrop-filter: blur(10px); color: var(--ink);
  font-size: 12px; line-height: 1.5;
}
.tip.show { opacity: 1; }
.tip strong { display: block; color: var(--ink-bright); font-size: 14px; font-weight: 600; }
.tip .src { display: block; margin-top: 4px; color: var(--ink-muted); font-size: 10px; }

.ctrl {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: stretch; gap: 6px; z-index: 100;
  max-width: calc(100vw - 16px);
}
.ctrl button, .ctrl select {
  background: var(--btn-bg); border: 1px solid var(--btn-border);
  color: var(--ink); padding: 6px 12px; border-radius: 4px;
  font-size: 13px; cursor: pointer; backdrop-filter: blur(6px);
  transition: all 0.15s; letter-spacing: 0.3px; min-width: 0;
}
.ctrl button:hover, .ctrl select:hover {
  background: var(--surface); color: var(--ink-bright); border-color: var(--border);
}
.ctrl button[disabled] { opacity: 0.5; cursor: wait; }
.icon-btn {
  display: flex; align-items: center; justify-content: center;
  padding: 6px; flex-shrink: 0; color: var(--ink);
  background: none; border: none; cursor: pointer;
}
.icon-btn:hover { color: var(--ink-bright); background: none; border: none; }
.icon-btn svg { display: block; }
.sep { width: 1px; background: var(--btn-border); margin: 0 3px; align-self: stretch; }

#loading {
  position: fixed; inset: 0; display: flex; align-items: center;
  justify-content: center; flex-direction: column;
  background: var(--bg); z-index: 2000; transition: opacity 0.4s;
}
#loading.hide { opacity: 0; pointer-events: none; visibility: hidden; }
.spinner {
  width: 28px; height: 28px; border: 2px solid var(--btn-border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.7s linear infinite; margin-bottom: 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 300; font-size: 28px; letter-spacing: 4px; color: var(--ink-bright);
}
#loading p { font-size: 13px; color: var(--ink-muted); margin-top: 5px; }

dialog {
  max-width: 480px; width: calc(100vw - 32px); padding: 20px 22px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 8px;
  backdrop-filter: blur(18px);
  margin: auto;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-head h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500; font-size: 24px; color: var(--ink-bright);
}
dialog p { margin: 10px 0; font-size: 12px; line-height: 1.6; }
dialog .key { color: var(--ink-muted); }
dialog .fine { color: var(--ink-muted); font-size: 11px; }
dialog ul { margin: 8px 0 8px 18px; font-size: 12px; line-height: 1.6; }
dialog strong { color: var(--ink-bright); }
dialog em { font-style: italic; }

#poster .hit { cursor: pointer; }

@media (max-width: 700px) {
  .ctrl button, .ctrl select { padding: 10px 8px; font-size: 13px; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  #loading { transition: none; }
}

/* The cross-links live in the help dialog: on the page they competed with the
   poster for attention, which is the one thing the page is for. */
.sees { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 14px; }
.sees a { color: var(--accent); text-decoration: none; }
.sees a:hover { text-decoration: underline; }
