:root { --bg: #fbfaf7; --ink: #222; --muted: #777; --line: #e5e1d8; --accent: #2f6fb0; --live: #d0342c; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; display: flex; flex-direction: column; font: 14px/1.4 -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
button, input, select { font: inherit; }
[hidden] { display: none !important; }

#bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 8px 12px 4px; border-bottom: 1px solid var(--line); }
.clock, .pick, .viewas { display: flex; align-items: center; gap: 6px; }
#readout { min-width: 13.5em; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
#readout.scrubbing { color: var(--accent); }
.badge { padding: 1px 7px; border-radius: 3px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: #fff; background: var(--live); }
#golive { color: var(--live); background: #fff; border: 1px solid var(--live); border-radius: 3px; cursor: pointer; }
/* Auto drives the site frame from what happened at each moment; fixed leaves it where the viewer put it. */
#view { font-size: 12px; }
#page-id { width: 6em; }
.combo { position: relative; }
#viewas { width: 13em; }
#viewas-list { position: absolute; z-index: 10; top: calc(100% + 2px); left: 0; min-width: 100%; width: max-content; max-width: min(26em, calc(100vw - 32px)); max-height: 20em; overflow-y: auto; margin: 0; padding: 4px 0; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15); }
#viewas-list li { display: flex; justify-content: space-between; gap: 16px; padding: 3px 10px; white-space: nowrap; cursor: pointer; }
#viewas-list li:hover { background: #eef3f9; }
#viewas-list li[aria-selected="true"] { color: #fff; background: var(--accent); }
#viewas-list li span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#viewas-list .member-id { color: var(--muted); font-variant-numeric: tabular-nums; }
#viewas-list li[aria-selected="true"] .member-id { color: rgba(255, 255, 255, 0.8); }
#viewas-list li.note { color: var(--muted); cursor: default; background: none; }
#welcome {
  padding: 2px 10px; font-size: 13px; font-weight: 600; color: var(--accent);
  background: #fff; border: 1px solid var(--line); border-radius: 3px; cursor: pointer; white-space: nowrap;
}
#welcome:hover { border-color: var(--accent); }

/* The welcome, over the whole shell. The panel frames facade.html?embed=1 rather than repeating its words. */
#welcome-modal { position: fixed; inset: 0; z-index: 50; }
#welcome-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }
#welcome-panel {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(46rem, calc(100vw - 32px)); height: min(80vh, calc(100vh - 48px));
  display: flex; background: #f4f2ee; border-radius: 3px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
#welcome-frame { flex: 1 1 auto; width: 100%; height: 100%; border: 0; border-radius: 3px; }
#welcome-close {
  position: absolute; top: 6px; right: 8px; z-index: 1; width: 28px; height: 28px; line-height: 1;
  font-size: 20px; color: var(--muted); background: #fff; border: 1px solid var(--line);
  border-radius: 3px; cursor: pointer;
}
#welcome-close:hover { color: var(--ink); border-color: var(--accent); }
.scrub { order: 10; flex: 1 1 100%; min-width: 0; }  /* its own row under the controls */

/* The whole loop is always the track -- the months underneath keep their places, so Aug 2004 is Aug 2004 whatever
   is playing. Inside it, --life-start and --life-end mark the span of the life on show, and the filled part runs
   from the start marker to the thumb rather than from the beginning of the loop: in the life view "how far in" means
   how far into this show's own story, not how far into 2004-2006.
   The defaults (0% and 100%) make this an ordinary slider, which is what auto and fixed want. Custom-styled because
   a native range paints its fill from position zero and cannot be told otherwise. */
#scrub {
  --life-start: 0%; --life-end: 100%; --now: 0%;
  display: block; width: 100%; margin: 0; height: 18px;
  -webkit-appearance: none; appearance: none; background: transparent;
}
#scrub::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background:
    linear-gradient(to right,
      var(--line) 0 var(--life-start),
      #1f6fd0 var(--life-start) var(--now),
      #bcd7f2 var(--now) var(--life-end),
      var(--line) var(--life-end) 100%),
    var(--line);
}
/* The two markers, drawn over the boundaries so they read as points rather than as a change of colour. */
#scrub::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -4px;
  border-radius: 50%; background: #1f6fd0; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
}
#scrub::-moz-range-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--line) 0 var(--life-start), #1f6fd0 var(--life-start) var(--now),
                              #bcd7f2 var(--now) var(--life-end), var(--line) var(--life-end) 100%);
}
#scrub::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: #1f6fd0; border: 2px solid #fff;
}
/* The life's span, called out on the row of months below the track. */
.months .life-edge { border-left-color: #1f6fd0; color: #1f6fd0; font-weight: 600; }
.months { position: relative; height: 13px; margin: 0 8px; overflow: hidden; font-size: 10px; line-height: 13px; color: var(--muted); }
.months span { position: absolute; top: 0; padding-left: 2px; white-space: nowrap; border-left: 1px solid var(--line); }
.months .year { color: var(--ink); }
/* A blanked label keeps its place in the row (fitMonths measures offsetLeft), so it is hidden rather than removed --
   including its tick. Hiding only the text left ten ticks stacked in the first few pixels of the bar, which read as a
   smudge over the opening months: the early loop is sparse, so Aug 2004 to Feb 2005 all land inside 9px. */
.months .crowded { color: transparent; border-left-color: transparent; }

#panes { flex: 1 1 auto; display: flex; min-height: 0; }
#site-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
#site, #site-buffer { position: absolute; top: 0; left: 0; display: block; width: 100%; height: 100%; border: 0; background: #fff; }
#site { z-index: 1; }
/* The next page loads here, under #site and out of sight but laid out (so it loads and scrolls) until live.js swaps the two. */
#site-buffer { z-index: 0; visibility: hidden; pointer-events: none; }
#feed { flex: 0 0 380px; width: 380px; height: 100%; border: 0; border-left: 1px solid var(--line); background: var(--bg); }
#notyet { position: absolute; z-index: 2; top: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; width: max-content; max-width: calc(100% - 32px); padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 4px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15); }
#notyet p { margin: 0; font-weight: 600; }
/* While a page the viewer asked for loads in the buffer; fades in after a moment so quick pages don't flash it. */
#site-loading { position: absolute; z-index: 3; top: 10px; right: 16px; display: flex; align-items: center; gap: 7px; padding: 3px 11px 3px 9px; font-size: 12px; color: var(--muted); background: rgba(255, 255, 255, 0.96); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12); pointer-events: none; opacity: 0; animation: site-loading-in 0.15s ease 0.15s forwards; }
#site-loading::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: site-loading-pulse 0.8s ease-in-out infinite alternate; }
@keyframes site-loading-in { to { opacity: 1; } }
@keyframes site-loading-pulse { from { opacity: 0.25; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #site-loading::before { animation: none; } }

@media (max-width: 899.98px) {  /* the feed column stacks under the site */
  html, body { height: auto; }
  body { display: block; }
  #panes { display: block; }
  #site-wrap { height: 70vh; min-height: 360px; }
  #feed { display: block; width: 100%; height: 80vh; border-left: 0; border-top: 1px solid var(--line); }
  #readout { min-width: 0; }
}
