/* POVPAD's page around the stage: a desk at night. Atkinson Hyperlegible for every word (kits/brand/fonts.css), our
   night and lamplight (knowledge/notes/brand), spacing from theme/web/spacing.css; the stage (mat/) brings the worlds'
   own glow. Phones first: 360 × 640 up. */

:root {
  --night: #14111f;
  --ink: #1d1a2f;
  --ink2: #2a2547;
  --line: #463f6e;
  --paper: #fffaf0;
  --muted: #c4bde3;
  --lamp: #ffd966;
  --err: #ffa38f;
  /* the shop's bar over the page, where it is (its own --shop-bar, products/front/README.md) */
  --bar: var(--shop-bar, 0px);
  --shop-bubble: #1d1a2f;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
  background: var(--night);
  color: var(--paper);
  font:
    400 16px/1.4 A,
    system-ui,
    sans-serif;
  -webkit-text-size-adjust: 100%;
}
body:not(.page) {
  overflow: hidden;
  overscroll-behavior: none;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
a {
  color: var(--lamp);
}

/* ---- the frame: the stage above, the steps below (beside it on a wide screen), never a scroll */
/* the aiming step and the desk camera open under the shop's bar too, or the bar hides their close button */
#layer > .aim-layer {
  top: var(--bar);
}
.app {
  /* the sheet: one height for every step, a little more of it on a tall phone */
  --sheet: max(calc(312px + var(--soon-room)), 40%);
  --soon-room: 0px;
  position: fixed;
  inset: var(--bar) 0 0 0;
  display: flex;
  flex-direction: column;
}
/* a narrow phone wraps every line sooner: its sheet takes a little more, the stage draws the mat to its width anyway */
@media (max-width: 359px) {
  .app {
    --sheet: max(calc(336px + var(--soon-room)), 40%);
  }
}
/* while ordering is closed the first step has one line more, the opens-soon line: room for it on a short phone */
html:is([data-ordering='closed'], [data-ordering='soon']) .app {
  --soon-room: 20px;
}
.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--night);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
/* a choice changed: the stage's rim glows once in lamplight */
.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  box-shadow: inset 0 0 0 0 rgb(255 217 102 / 0);
  pointer-events: none;
}
.stage.pulse::after {
  animation: rim 0.7s ease-out;
}
@keyframes rim {
  30% {
    box-shadow: inset 0 0 0 3px rgb(255 217 102 / 0.55);
  }
}
.stage-top {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-xs);
  padding: 6px;
  pointer-events: none;
}
.stage-top > * {
  pointer-events: auto;
}
.round {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--paper);
  font:
    700 18px/1 A,
    sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.round > span,
.round > svg {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgb(29 26 47 / 0.72);
  box-shadow: 0 0 0 1px rgb(255 250 240 / 0.14);
}
.sound svg {
  padding: 6px;
  fill: none;
  stroke: var(--paper);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sound .spk {
  fill: var(--paper);
}
.sound[data-muted='true'] .on,
.sound[data-muted='false'] .off {
  display: none;
}
.round:focus-visible,
.btn:focus-visible,
.back:focus-visible,
.link:focus-visible,
.design input:focus-visible + span,
.field input:focus-visible {
  outline: 3px solid var(--lamp);
  outline-offset: 2px;
}
/* the one line about the seat, said once, where the stage first shows */
.seat {
  margin: 6px 0 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgb(29 26 47 / 0.72);
  font-size: 14px;
  line-height: 1.3;
  text-align: center;
  text-wrap: balance;
  pointer-events: none;
}
.seat b {
  font-weight: 700;
}
.drag {
  color: var(--muted);
  white-space: nowrap;
}
/* the seat step's own drag (aim/drag.js) takes the stage's pointers: getting up isn't what a drag does then */
.stage:has(.aim-drag) #dragHint {
  display: none;
}
.drag::before {
  content: '';
  display: inline-block;
  width: 1.1em;
  height: 0.8em;
  margin: 0 0.2em 0 0.1em;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 16'%3E%3Cpath d='M1 8h20M5 4L1 8l4 4M17 4l4 4-4 4' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

/* ---- what the preview shows: a chip per step on the stage's foot, its small word saying which, the current one lit.
   A chip is a button back to its step; between them the stage takes the drag as everywhere else. */
.shows {
  position: absolute;
  left: 50%;
  bottom: 8px;
  z-index: 3;
  display: flex;
  gap: 6px;
  width: max-content;
  max-width: calc(100% - 16px);
  margin: 0;
  padding: 0;
  list-style: none;
  transform: translateX(-50%);
  pointer-events: none;
}
.shows li {
  display: flex;
  min-width: 0;
  border-radius: 999px;
  transition:
    box-shadow 0.2s,
    opacity 0.2s;
}
.shows button {
  display: flex;
  align-items: baseline;
  gap: 0.35em;
  position: relative;
  min-width: 0;
  min-height: 26px;
  padding: 3px 10px;
  border: 0;
  border-radius: inherit;
  background: rgb(29 26 47 / 0.8);
  box-shadow: 0 0 0 1px rgb(255 250 240 / 0.14);
  color: var(--paper);
  font:
    400 13px/1.3 A,
    sans-serif;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}
/* a thumb's hit area: 42 px tall, meeting the next chip's halfway across the gap, the pill as it is */
.shows button::after {
  content: '';
  position: absolute;
  inset: -8px -3px;
}
.shows button:focus-visible {
  outline: 3px solid var(--lamp);
  outline-offset: 2px;
}
.shows small {
  flex: none;
  color: var(--muted);
  font-size: 0.8em;
}
.shows li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shows li.unset span {
  color: var(--muted);
}
.shows li.now {
  box-shadow: 0 0 0 1.5px var(--lamp);
}
.shows li.now small {
  color: var(--lamp);
}
.shows li.pulse {
  animation: chip 0.6s cubic-bezier(0.3, 1.6, 0.5, 1);
}
@keyframes chip {
  35% {
    transform: scale(1.1);
    box-shadow:
      0 0 0 2px var(--lamp),
      0 0 18px rgb(255 217 102 / 0.45);
  }
}

/* ---- the steps: a sheet of one height for every step, so the stage never jumps */
.panel {
  position: relative;
  z-index: 4;
  flex: none;
  height: var(--sheet);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--ink);
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 32px rgb(0 0 0 / 0.45);
}
.steps,
.panel > .foot {
  max-width: 520px;
  margin-inline: auto;
}
.steps {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  /* at least the sheet: a step that runs longer in some language scrolls the sheet, never runs over its own links */
  min-height: 100%;
  gap: 6px;
  padding: 4px var(--space-s) calc(10px + env(safe-area-inset-bottom));
}
.steps-head {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  min-height: 42px;
  padding-top: 3px;
}
.steps-head h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  outline: none;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 44px;
  min-height: 44px;
  margin-left: -8px;
  padding: 0 8px 0 2px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--paper);
  font:
    400 15px A,
    sans-serif;
  cursor: pointer;
}
.back svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.back[hidden] + h1 {
  grid-column: 1 / 3;
}
.count {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
/* the progress line along the sheet's top edge */
.progress {
  position: absolute;
  inset: -4px calc(-1 * var(--space-s)) auto;
  height: 3px;
  background: var(--ink2);
}
.progress i {
  display: block;
  width: calc(var(--done, 0.25) * 100%);
  height: 100%;
  background: var(--lamp);
  transition: width 0.35s cubic-bezier(0.3, 1.2, 0.5, 1);
}
.step {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-height: 0;
}
.step:not([hidden]) {
  animation: step-in 0.28s ease-out;
}
@keyframes step-in {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
}
.lead {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  text-wrap: pretty;
}
.steps-foot {
  display: grid;
  gap: var(--space-xs);
}
/* the remake promise under the basket button: the small print's quiet type, the whole line a link to the terms */
.remake {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  text-wrap: balance;
}
.remake a {
  color: inherit;
  text-underline-offset: 2px;
}

/* step 1: the designs, a card each with the design seen from a seat */
fieldset.designs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}
.design {
  position: relative;
  display: block;
  min-width: 0;
}
.design input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.design span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 2px 2px 3px;
  border: 2px solid var(--line);
  border-radius: 12px;
  /* the desk's dark wood under the card's mat, as on the stage */
  background: radial-gradient(ellipse at 50% 45%, #3a2d29, #1b1517 75%);
  cursor: pointer;
  transition:
    border-color 0.15s,
    transform 0.18s cubic-bezier(0.3, 1.6, 0.5, 1),
    box-shadow 0.2s;
}
.design canvas {
  display: block;
  width: 100%;
  height: 50px;
}
/* until its picture is drawn, a card shows a calm outline of the mat, as seen from the seat */
.design canvas:not(.drawn) {
  background: rgb(23 20 29 / 0.9);
  clip-path: polygon(20% 18%, 80% 18%, 95% 86%, 5% 86%);
}
.design canvas.drawn {
  animation: drawn 0.3s ease-out;
}
@keyframes drawn {
  from {
    opacity: 0;
  }
}
/* the designs' two kinds, named on a wide screen where each kind takes rows of its own */
.designs .kind {
  display: none;
  grid-column: 1 / -1;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.design b {
  max-width: 100%;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.design input:checked + span {
  border-color: var(--lamp);
  box-shadow:
    0 0 0 1px var(--lamp),
    0 0 18px rgb(255 217 102 / 0.18);
}
.design:active span {
  transform: scale(0.96);
}

/* step 2: the gamertag */
.field {
  display: flex;
  align-items: center;
  min-height: 48px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--night);
  overflow: hidden;
}
.field:focus-within {
  border-color: var(--paper);
}
.field input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--paper);
  font:
    700 18px A,
    sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.field input::placeholder {
  color: #9d96c2;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.field input:focus {
  outline: none;
}

/* step 3: the aiming step's box (aim/), and the honest way round it */
.seat-host {
  flex: 1 1 auto;
  min-height: 0;
}
.link {
  align-self: center;
  min-height: 28px;
  padding: 2px 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font:
    400 14px A,
    sans-serif;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* step 4: the camera on your desk, the mat and the price; what it's drawn for only when it's the standard angle */
.see {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.yours {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  text-wrap: pretty;
}
.what {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.what b {
  color: var(--paper);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 6px 14px;
  border: 2px solid var(--lamp);
  border-radius: 999px;
  background: var(--lamp);
  color: var(--ink);
  font:
    700 16px/1.15 A,
    sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s;
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.55;
}
.btn svg {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn.ghost {
  background: transparent;
  color: var(--paper);
  border-color: var(--line);
}
.btn.big {
  flex-direction: column;
  gap: 0;
  width: 100%;
  min-height: 50px;
  padding-block: 5px;
  font-size: 17px;
}
.btn.big.pay {
  min-height: 54px;
  box-shadow: 0 0 22px rgb(255 217 102 / 0.22);
}
.btn.big small {
  font-size: 12px;
  font-weight: 400;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}
.row.stack {
  flex-direction: column;
  margin-top: var(--space-m);
}
/* the camera's button, its privacy line one line under it */
.desk-row {
  display: grid;
  justify-items: start;
  gap: 4px;
}
.desk-row .btn {
  padding-inline: 14px;
  font-size: 15px;
}
.cam-line {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}
.err {
  margin: 0;
  color: var(--err);
  font-size: 14px;
  font-weight: 700;
}
.soon {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
}
/* the first step's opens-soon line: a lead, just brighter than the design's */
.soon-first {
  color: var(--paper);
  font-weight: 700;
}
/* the price, on its own line above the opens-soon words */
.soon b {
  display: block;
}
.added {
  display: grid;
  gap: 10px;
}
.big-note {
  margin: 4px 0 0;
  font-size: 22px;
  font-weight: 700;
}
.fine,
.small,
.kicker {
  color: var(--muted);
  font-size: 14px;
}
.fine {
  margin: var(--space-l) auto 0;
}
.see .fine {
  margin: 0;
  font-size: 13px;
}
.wide-only {
  display: none;
}
.foot {
  margin-top: var(--space-m);
  padding: var(--space-s) var(--space-s) var(--space-m);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.foot a {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  color: var(--paper);
}
.foot .ai {
  margin: var(--space-xs) 0 0;
  text-wrap: balance;
}

/* a short screen (a phone with its keyboard out): the sheet takes only what the step needs, the stage the rest */
@media (max-height: 500px) and (max-aspect-ratio: 1/1) {
  .app {
    --sheet: auto;
  }
  .panel {
    max-height: 70%;
  }
  .steps .lead {
    display: none;
  }
}

/* a wide screen: the stage on the left, the steps down the right, one night and one lamp across both */
@media (min-width: 860px) and (min-aspect-ratio: 1/1) {
  .app {
    flex-direction: row;
  }
  .panel {
    display: flex;
    flex-direction: column;
    width: 420px;
    height: auto;
    border-top: 0;
    background: linear-gradient(90deg, rgb(29 26 47 / 0.92), var(--ink) 40px);
    box-shadow: -18px 0 40px rgb(0 0 0 / 0.35);
  }
  .steps {
    flex: 1 0 auto;
    width: 100%;
    height: auto;
    gap: var(--space-s);
    min-height: 0;
    padding: var(--space-m) var(--space-l) var(--space-m);
  }
  .steps-head {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    row-gap: 2px;
  }
  .steps-head h1 {
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: 26px;
  }
  .back[hidden] + h1 {
    grid-column: 1 / -1;
  }
  .count {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }
  .back:not([hidden]) ~ .count {
    grid-column: 2;
  }
  .steps-head:has(.back[hidden]) .count {
    grid-column: 1 / -1;
    justify-self: start;
  }
  .progress {
    inset: calc(-1 * var(--space-m)) calc(-1 * var(--space-l)) auto;
  }
  /* the chips grow with the stage (the window less the steps' 420 px): 15 px at 1366, 22 px on a 2560 screen */
  .shows {
    bottom: 0.9em;
    gap: 0.5em;
    font-size: clamp(15px, (100vw - 420px) / 95, 22px);
  }
  .shows button {
    padding: 0.3em 0.9em;
    font-size: inherit;
  }
  fieldset.designs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-xs);
  }
  .designs .kind {
    display: block;
  }
  .design canvas {
    height: auto;
    aspect-ratio: 4 / 3;
  }
  .design b {
    font-size: 14px;
  }
  .wide-only {
    display: block;
  }
  .lead {
    font-size: 15px;
  }
  .panel > .foot {
    width: 100%;
    margin-top: 0;
    padding-inline: var(--space-l);
  }
}

@media (prefers-reduced-motion: reduce) {
  .design span,
  .btn,
  .shows li,
  .progress i {
    transition: none;
  }
  .step:not([hidden]),
  .shows li.pulse,
  .stage.pulse::after {
    animation: none;
  }
}

/* ---- the order's page */
.status {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--space-l) var(--gutter) var(--space-xl);
}
.status .mat-flat {
  display: block;
  width: min(100%, 420px);
  height: auto;
  margin: 0 auto;
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgb(255 250 240 / 0.08),
    0 14px 34px rgb(0 0 0 / 0.5);
}
#stPrint {
  margin: var(--space-xs) 0 var(--space-l);
  text-align: center;
}
.status h1 {
  font-size: 26px;
}
.kicker {
  margin: 0;
}
/* under the status: a cancel taken back, "Delete my details" confirmed once (kits/payments/order.js) */
.order-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin: var(--space-s) 0 0;
}
.order-actions:empty {
  display: none;
}
.order-actions-note,
.order-actions-ask p {
  margin: 0;
}
.order-actions-ask {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-s);
  border: 2px solid var(--line);
  border-radius: 14px;
}
.btn.quiet {
  align-self: flex-start;
  padding-inline: 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 400;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
