/* The recorded week, opened from the walk-in. The replay's own stylesheet
   still draws the town and every control; this file places things and dresses
   them in soscitea's pixel system (walk.css holds the tokens). The town is full
   bleed, the player floats at its foot on a raised bar, the residents and the
   feed sit on a raised sheet on the right, and the guide keeps talking from
   its dark panel at the bottom left. */

.rp { --side-w: 23rem; margin: 0; height: 100vh; height: 100dvh; overflow: hidden; background: var(--ground); font-family: var(--font-sans); }
.rp-main { position: fixed; inset: 0; max-width: none; margin: 0; padding: 0; } /* the replay's stylesheet sets every main to reading width */
.rp .townmap { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; z-index: 0; } /* its own layer: the names and bubbles over the 3D town stack inside it, under every panel */
.rp .townmap > svg { width: 100%; height: 100%; }
.rp .townmap.is3d .stage3d { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; }
.rp .viewpick { top: calc(74px + var(--safe-t)); left: 16px; }
.rp .mapui { top: calc(124px + var(--safe-t)); left: 16px; right: auto; }
.rp .mapcard {
  top: calc(74px + var(--safe-t)); left: 76px; bottom: auto; z-index: 3; font-family: var(--font-sans);
  background: var(--ground-raised); border: 2px solid var(--line); border-radius: 0; box-shadow: var(--shadow-panel);
}
.rp .mapcard h3 { font-family: var(--font-pixel); font-weight: 400; font-size: calc(var(--text-title) * .85); }
.rp .mapcard .dot { border-radius: 0; box-shadow: none; outline: 2px solid var(--line); }
.rp .mapcard q { font-family: var(--font-sans); font-style: normal; }

/* the bar */
.rp-title { margin: 0 auto 0 0; font: 400 .83rem/1 var(--font-pixel); color: var(--ink); background: var(--ground-raised); padding: 10px 14px 8px; border: 2px solid var(--line); border-radius: 0; box-shadow: var(--shadow-press); white-space: nowrap; }
.rp #join { margin-left: 0; }
/* the title chip needed 974px of bar beside the name and the four buttons it had then, in the pixel face; narrower, it steps aside, and the buttons keep to the right */
@media (max-width: 61rem) { .rp-title { display: none; } .rp .rp-back { margin-left: auto; } }
.rp .btn-quiet { color: var(--ink); background: var(--ground-raised); border-color: var(--line); box-shadow: var(--shadow-press); }
.rp .btn-quiet:hover { background: var(--ground); }
.rp .btn-quiet:active { transform: translateY(4px); box-shadow: none; }

/* residents and the feed: introductions, bids and talk, on a raised sheet */
.rp-side {
  position: fixed; top: calc(70px + var(--safe-t)); right: 14px; bottom: calc(14px + var(--safe-b)); width: var(--side-w); z-index: 4;
  overflow: auto; overscroll-behavior: contain; box-sizing: border-box; padding: 14px 18px 18px;
  background: var(--ground-raised); border: 2px solid var(--line); box-shadow: var(--shadow-panel);
}
.rp-side, .rp-side * { border-radius: 0; }
.rp-side-close {
  position: sticky; top: 0; float: right; z-index: 1; width: 36px; height: 36px; margin: -4px -8px 0 8px; padding: 0; box-sizing: border-box; cursor: pointer;
  border: 2px solid var(--line); background: var(--ground); color: var(--ink); font-size: 0; display: grid; place-items: center;
}
.rp-side-close::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--i-close) center / 16px no-repeat; mask: var(--i-close) center / 16px no-repeat; }
.rp-side-close:hover { background: var(--ground-sunken); }
.rp-side-close:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.rp-side h2 { margin: 6px 0 10px; font: 400 1.1875rem/1.25 var(--font-pixel); color: var(--ink); letter-spacing: 0; text-transform: none; }
.rp-side section + section { margin-top: 20px; }
.rp .feed { max-height: none; }
/* who's who: the resident's colour as a square outlined in line, the name in the pixel face, the place in small sans */
.rp .townres { column-gap: 12px; padding: 12px 0; border-bottom: 2px solid var(--line-soft); }
.rp .townres:last-child, .rp .feedline:last-child { border-bottom: 0; }
.rp .townres .dot { width: 10px; height: 10px; margin-top: 7px; border-radius: 0; box-shadow: none; outline: 2px solid var(--line); }
.rp .townres-name { font: 400 .85rem/1.75 var(--font-pixel); color: var(--ink); }
.rp .townres .where { font: 400 .875rem/1.43 var(--font-sans); color: var(--ink-muted); }
.rp .townres.chosen { background: var(--ground-sunken); box-shadow: none; }
.rp .feedline { border-bottom: 2px solid var(--line-soft); }
.rp .feedline .when { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* the player: a raised bar; play is a lamp square, the scrubber a segmented well */
.rp .controls {
  position: fixed; left: 16px; right: calc(var(--side-w) + 30px); bottom: calc(14px + var(--safe-b)); top: auto; z-index: 5;
  margin: 0; padding: 8px 12px; flex-wrap: nowrap;
  background: var(--ground-raised); border: 2px solid var(--line); border-radius: 0; box-shadow: var(--shadow-panel);
}
.rp:has(.rp-side[hidden]) .controls { right: 16px; }
.rp #play, .rp-cloud-play {
  flex: none; box-sizing: border-box; width: 40px; min-width: 40px; height: 40px; padding: 0; cursor: pointer; font-size: 0; display: grid; place-items: center;
  color: var(--on-lamp); background: var(--lamp); border: 2px solid var(--line); border-radius: 0; box-shadow: var(--shadow-press);
  transition: transform .08s steps(2), box-shadow .08s steps(2);
}
/* the pixel play and pause glyphs; the text glyph stays in the button at no size, beside its aria-label */
.rp #play::before, .rp-cloud-play::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--i-play) center / 16px no-repeat; mask: var(--i-play) center / 16px no-repeat; }
.rp #play[aria-label="pause"]::before, .rp-cloud-play[aria-label="pause"]::before { -webkit-mask-image: var(--i-pause); mask-image: var(--i-pause); }
.rp #play:hover, .rp-cloud-play:hover { background: var(--lamp-hover); }
.rp #play:active, .rp-cloud-play:active { transform: translateY(4px); box-shadow: none; }
.rp #play:disabled { background: var(--ground-sunken); color: var(--ink-muted); box-shadow: none; }
/* 32 segments in a sunken well: played in ink, the playhead a lamp block. --p
   is the played fraction, written by the replay on every move; the well's own
   colour is laid over in hard stops to cut the fill into segments, and an
   inset frame of it keeps them off the 2px line. */
.rp .controls input[type=range] { flex: 1; min-width: 5rem; height: 24px; }
.rp .controls input[type=range]::-webkit-slider-runnable-track {
  box-sizing: border-box; height: 18px; border: 2px solid var(--line); border-radius: 0; box-shadow: inset 0 0 0 3px var(--ground-sunken);
  background: repeating-linear-gradient(90deg, transparent 0 calc(100% / 32 - 2px), var(--ground-sunken) calc(100% / 32 - 2px) calc(100% / 32)),
    linear-gradient(90deg, var(--ink) var(--p, 0%), var(--ground-sunken) var(--p, 0%));
}
.rp .controls input[type=range]::-moz-range-track {
  box-sizing: border-box; height: 18px; border: 2px solid var(--line); border-radius: 0; box-shadow: inset 0 0 0 3px var(--ground-sunken);
  background: repeating-linear-gradient(90deg, transparent 0 calc(100% / 32 - 2px), var(--ground-sunken) calc(100% / 32 - 2px) calc(100% / 32)),
    linear-gradient(90deg, var(--ink) var(--p, 0%), var(--ground-sunken) var(--p, 0%));
}
.rp .controls input[type=range]::-moz-range-progress { background: transparent; }
.rp .controls input[type=range]::-webkit-slider-thumb {
  box-sizing: border-box; width: 12px; height: 18px; margin-top: -2px; border: 2px solid var(--line); border-radius: 0; background: var(--lamp); box-shadow: none;
}
.rp .controls input[type=range]::-moz-range-thumb {
  box-sizing: border-box; width: 12px; height: 18px; border: 2px solid var(--line); border-radius: 0; background: var(--lamp); box-shadow: none;
}
.rp .controls input[type=range]:hover::-webkit-slider-thumb, .rp .controls input[type=range]:active::-webkit-slider-thumb { background: var(--lamp-hover); }
.rp .controls input[type=range]:hover::-moz-range-thumb, .rp .controls input[type=range]:active::-moz-range-thumb { background: var(--lamp-hover); }
.rp .controls input[type=range]:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.rp .controls #pos { font: 400 .75rem/1 var(--font-mono); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.rp .controls select {
  box-sizing: border-box; min-height: 36px; padding: 0 8px; font: 400 .75rem/1 var(--font-pixel); color: var(--ink);
  background-color: var(--ground); border: 2px solid var(--line); border-radius: 0; box-shadow: none;
}
.rp .controls select:hover { background-color: var(--ground-sunken); }
.rp .clockface { font: 500 .9375rem/1 var(--font-mono); color: var(--ink); font-variant-numeric: tabular-nums; }

/* the guide */
.rp-guide { position: fixed; left: 16px; bottom: calc(84px + var(--safe-b)); width: min(31rem, calc(100vw - var(--side-w) - 64px)); z-index: 5; }
.rp:has(.rp-side[hidden]) .rp-guide { width: min(31rem, calc(100vw - 32px)); }
.rp-guide .talk-card { padding: 28px 20px 16px; }
.rp-guide .talk-line { min-height: 0; font-size: clamp(1rem, .92rem + .3vw, 1.15rem); }
/* the days of the week as 32px squares, and the key moments of the day the replay is in; the current one is lamp */
.rp-days { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font: 400 .6875rem/1 var(--font-pixel); letter-spacing: .04em; text-transform: uppercase; color: var(--panel-muted); }
.rp-daylist { display: flex; gap: 6px; }
.rp-day {
  box-sizing: border-box; width: 32px; height: 32px; padding: 0; cursor: pointer; border: 2px solid var(--panel-muted); border-radius: 0;
  font: 400 .75rem/1 var(--font-pixel); color: var(--panel-ink); background: transparent;
  font-variant-numeric: tabular-nums;
}
.rp-day:hover { background: var(--panel-rule); }
.rp-day[aria-current="true"] { background: var(--lamp); color: var(--on-lamp); border-color: var(--panel-ink); }
.rp-day:focus-visible { outline: 2px solid var(--panel-ink); outline-offset: 3px; }
.rp-guide .talk-line { min-height: 2.9em; }
.rp-moments {
  position: relative; display: flex; flex-wrap: nowrap; gap: 8px; margin: 12px -20px 0; padding: 0 20px 6px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-padding-inline: 20px; scrollbar-width: thin; scrollbar-color: var(--panel-muted) transparent;
}
.rp-moment { flex: none; transition: opacity .2s; }
.rp-moment.passed { opacity: .62; }
.rp-moment {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 46px; box-sizing: border-box;
  padding: 8px 12px 6px; border: 2px solid var(--panel-muted); border-radius: 0; cursor: pointer; text-align: left;
  font: 400 .75rem/1.25 var(--font-pixel); color: var(--panel-ink); background: transparent;
}
.rp-moment:hover { background: var(--panel-rule); }
.rp-moment[aria-current="true"] { background: var(--lamp); color: var(--on-lamp); border-color: var(--panel-ink); opacity: 1; }
.rp-moment:focus-visible { outline: 2px solid var(--panel-ink); outline-offset: 3px; }
.rp-when { font: 500 .75rem/1 var(--font-mono); opacity: .8; font-variant-numeric: tabular-nums; }

@media (max-width: 56rem) {
  .rp { --side-w: 0px; }
  /* on a phone who's who is a sheet over the lower screen, and the guide steps aside while it is open */
  .rp-side { left: 8px; right: 8px; width: auto; top: auto; bottom: calc(74px + var(--safe-b)); height: min(66vh, calc(100dvh - 150px)); z-index: 6; padding: 12px 16px 16px; }
  .rp:has(.rp-side:not([hidden])) .rp-guide { visibility: hidden; }
  .rp .controls { left: 8px; right: 8px; bottom: calc(8px + var(--safe-b)); gap: 8px; padding: 7px 10px; }
  .rp .controls select { width: 4.9rem; flex: none; }
  .rp .clockface { white-space: nowrap; font-size: .82rem; flex: none; }
  .rp-guide { left: 8px; right: 8px; width: auto; bottom: calc(72px + var(--safe-b)); }
  .rp-title, .rp #pos { display: none; }
  .rp-guide .talk-card { padding: 22px 15px 10px; }
  .rp-moments { margin: 10px -15px 0; padding: 0 15px 4px; scrollbar-width: none; }
  .rp-day { width: 32px; height: 32px; }
  .rp-guide .talk-line { min-height: 0; }
  .rp .mapcard { left: 10px; top: auto; bottom: calc(250px + var(--safe-b)); }
}

/* ---- folding the guide and the player into a cloud ---- */
.rp-min {
  position: absolute; top: 10px; right: 10px; width: 42px; height: 34px; padding: 0; box-sizing: border-box; cursor: pointer;
  display: grid; place-items: center; background: transparent; border: 2px solid var(--panel-muted); border-radius: 0;
}
.rp-min svg { width: 16px; height: 10px; fill: var(--panel-ink); shape-rendering: crispEdges; }
.rp-min:hover { background: var(--panel-rule); }
.rp-min:focus-visible { outline: 2px solid var(--panel-ink); outline-offset: 2px; }
/* folded, it is a pixel cloud: a raised sheet with two stepped puffs on its top edge */
.rp-cloud {
  position: fixed; left: 50%; bottom: calc(16px + var(--safe-b)); translate: -50% 0; z-index: 5;
  /* as wide as its line (the pixel face runs wider), not just the half-screen right of its left edge */
  display: flex; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 32px); box-sizing: border-box; padding: 6px 18px 6px 6px;
  background: var(--ground-raised); border: 2px solid var(--line); box-shadow: var(--shadow-panel);
}
.rp-cloud::before, .rp-cloud::after {
  content: ""; position: absolute; z-index: -1; box-sizing: border-box; background: inherit; pointer-events: none;
  border: 2px solid var(--line); border-bottom: 0;
}
.rp-cloud::before { width: 44px; height: 16px; left: 26%; top: -16px; }
.rp-cloud::after { width: 32px; height: 10px; left: calc(26% + 42px); top: -10px; }
.rp-cloud.puff { animation: puff .3s steps(2); }
@keyframes puff { 50% { transform: translateY(4px); } }
.rp-cloud-play { box-shadow: none; }
.rp-cloud-play:focus-visible, .rp-cloud-open:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.rp-cloud-open {
  display: grid; justify-items: start; gap: 2px; min-width: 0; min-height: 40px; align-content: center; padding: 0 22px 0 2px; border: 0; border-radius: 0;
  background: none; cursor: pointer; text-align: left; position: relative;
}
.rp-cloud-open::after { /* opens upward: a stepped caret */
  content: ""; position: absolute; right: 2px; top: 50%; width: 10px; height: 6px; margin-top: -3px; background: var(--ink-muted);
  clip-path: polygon(4px 0, 6px 0, 6px 2px, 8px 2px, 8px 4px, 10px 4px, 10px 6px, 0 6px, 0 4px, 2px 4px, 2px 2px, 4px 2px);
}
.rp-cloud-when { font: 500 .75rem/1 var(--font-mono); color: var(--ink-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rp-cloud-what { font: 400 .83rem/1.2 var(--font-pixel); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: min(58vw, 22rem); }
.rp.min .rp-guide, .rp.min .controls { display: none; }
.rp.min .mapcard { bottom: calc(96px + var(--safe-b)); }
@media (max-width: 56rem) {
  .rp.min .rp-side { bottom: calc(96px + var(--safe-b)); }
}

/* Four buttons on a phone, and the name never gives way: below 576px the bar
   takes two rows, the name and the way back to town above, the other three
   buttons below sharing the width (measured at 320, 360, 390 and 500 wide).
   The map's own buttons move down under it. */
@media (max-width: 36rem) {
  .rp .topbar { flex-wrap: wrap; }
  .rp .topbar::after { content: ""; order: 1; flex-basis: 100%; }
  .rp .topbar .btn { font-size: .68rem; padding-inline: 9px; }
  .rp .topbar .rp-back { margin-left: auto; }
  .rp .topbar #sidetoggle, .rp .topbar #join { order: 2; flex: 1 1 auto; margin-left: 0; }
  .rp .viewpick { top: calc(118px + var(--safe-t)); }
  .rp .mapui { top: calc(168px + var(--safe-t)); }
}
@media (max-width: 21rem) { .rp .topbar .btn { font-size: .64rem; padding-inline: 7px; } }

/* A bidder's stated reason, while the replay passes the ask it came with: a
   raised sheet under the guide's line, trailing two stepped squares up to it. */
.rp-thought { position: relative; margin: 14px 0 2px; padding: 9px 12px 10px; background: var(--ground-raised); color: var(--ink); border: 2px solid var(--line); }
.rp-thought::before, .rp-thought::after { content: ""; position: absolute; box-sizing: border-box; background: var(--ground-raised); border: 2px solid var(--line); }
.rp-thought::before { width: 10px; height: 10px; left: 18px; top: -14px; }
.rp-thought::after { width: 6px; height: 6px; left: 10px; top: -22px; }
.rp-thought figcaption { font: 600 .8125rem/1.3 var(--font-sans); color: var(--ink-muted); }
.rp-thought blockquote { margin: 4px 0 0; font: 400 .95rem/1.42 var(--font-sans); color: var(--ink); }
@media (max-width: 40rem) { .rp-thought blockquote { font-size: .88rem; } }

@media (forced-colors: active) {
  .rp-side-close::before, .rp #play::before, .rp-cloud-play::before { forced-color-adjust: none; background: ButtonText; }
}
