/* The five second prototype in the home page hero: the console, the phone that turns
   over, and everything drawn inside it. Values come from tokens.css; the phone frame
   itself is in styles.css. The script is js/prototype.js. */

/* ---------- The console and the stage ----------
   A console and the phone. What is typed in the console shows up on the phone as it is
   typed. On a phone the name field sits right above the drawn phone, so both are on
   screen with the keyboard up, and the other choices follow it. From 720px the two
   halves of the console join into one panel on the left. */

.proto {
  display: grid;
  gap: var(--space-5);
  justify-items: center;
}

.proto-console,
.proto-options {
  position: relative;
  z-index: 1;
  display: grid;
  gap: var(--space-4);
  inline-size: 100%;
  padding: var(--space-5);
  border: var(--hair) solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.proto-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--heading-weight);
  font-stretch: var(--heading-stretch);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-heading);
}

.proto-field,
.proto-seg,
.proto-swatches,
.proto-logo {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
  padding: 0;
  border: 0;
}

.proto-field label,
.proto-options legend,
.proto-logo > span {
  padding: 0;
  color: var(--fg-soft);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-mono);
}

.proto-options legend {
  margin-block-end: var(--space-2);
}

.proto-field input,
.proto-field select {
  inline-size: 100%;
  border: var(--hair) solid var(--rule);
  border-radius: var(--radius-sm);
  background-color: var(--navy-950);
  color: var(--white);
  transition: border-color var(--fast) var(--ease);
}

.proto-field input {
  min-height: calc(var(--control-h) + var(--space-2));
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--heading-weight);
  letter-spacing: var(--tracking-heading);
  caret-color: var(--brass);
}

.proto-field input::placeholder {
  color: var(--on-navy-soft);
  font-weight: 600;
  opacity: 0.75;
}

/* A drawn caret, so the select matches the field above it on every platform. */
.proto-field select {
  appearance: none;
  min-height: var(--control-h-sm);
  padding: var(--space-2) var(--space-7) var(--space-2) var(--space-3);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--on-navy) 50%),
    linear-gradient(135deg, var(--on-navy) 50%, transparent 50%);
  background-position:
    right calc(var(--space-4) + var(--space-1) + var(--hair)) center,
    right var(--space-4) center;
  background-size: calc(var(--space-1) + var(--hair)) calc(var(--space-1) + var(--hair));
  background-repeat: no-repeat;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
}

.proto-field input:hover,
.proto-field input:focus-visible,
.proto-field select:hover,
.proto-field select:focus-visible {
  border-color: var(--brass);
}

/* Names to try, for visitors who would rather press than type. */
.proto-try {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  color: var(--fg-soft);
  font-size: var(--text-xs);
}

.proto-eg {
  position: relative;
  min-height: calc(var(--space-6) - var(--space-1));
  padding: 0 var(--space-3);
  border: var(--hair) solid var(--rule);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--fg);
  font-size: var(--text-xs);
  cursor: pointer;
  transition:
    border-color var(--fast) var(--ease),
    background-color var(--fast) var(--ease);
}

/* Grow the tap target to 44px without growing the pill. */
.proto-eg::after {
  content: "";
  position: absolute;
  inset: calc(var(--space-2) * -1) 0;
}

.proto-eg:hover {
  border-color: var(--fg);
  background: color-mix(in srgb, var(--fg) 9%, transparent);
}

/* What the demo worked out for itself, said plainly. */
.proto-note {
  color: var(--fg-soft);
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
}

.proto-note:empty {
  display: none;
}

/* Two choices as one switch. */
.seg {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: var(--hair) solid var(--rule);
  border-radius: var(--radius-sm);
}

.seg label,
.swatch {
  position: relative;
  display: block;
}

.seg input,
.swatch input {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.seg span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-h-sm);
  padding: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: var(--leading-snug);
  text-align: center;
  transition:
    background-color var(--fast) var(--ease),
    color var(--fast) var(--ease);
}

.seg label + label span {
  border-inline-start: var(--hair) solid var(--rule);
}

.seg input:checked + span {
  background: var(--on-navy);
  color: var(--ink);
  font-weight: 600;
}

.seg input:focus-visible + span {
  outline: var(--focus-w) solid var(--focus);
  outline-offset: var(--hair-strong);
}

/* Colour on the left, the generated logo on the right. */
.proto-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
}

.swatches {
  display: flex;
  gap: var(--hair-strong);
}

/* Narrower than they are tall, so five fit beside the logo. Still 44px to press. */
.swatch {
  display: grid;
  place-items: center;
  inline-size: calc(var(--space-6) + var(--hair-strong));
  block-size: var(--control-h-sm);
  border-radius: var(--radius-pill);
}

.swatch::before {
  content: "";
  inline-size: calc(var(--space-5) + var(--hair-strong));
  block-size: calc(var(--space-5) + var(--hair-strong));
  border-radius: 50%;
  background: var(--sw);
  box-shadow: 0 0 0 var(--hair) var(--navy-line);
  transition: transform var(--fast) var(--ease);
}

.swatch:hover::before {
  transform: scale(1.1);
}

.swatch:has(input:checked) {
  box-shadow: inset 0 0 0 var(--hair-strong) var(--on-navy);
}

.swatch:has(input:focus-visible) {
  outline: var(--focus-w) solid var(--focus);
  outline-offset: var(--hair-strong);
}

.swatch--teal   { --sw: var(--swatch-teal); }
.swatch--amber  { --sw: var(--swatch-amber); }
.swatch--coral  { --sw: var(--swatch-coral); }
.swatch--indigo { --sw: var(--swatch-indigo); }

/* Any colour at all: a wheel until one is picked, then that colour. The browser's own
   colour picker is opened from the script; its input stays out of sight. */
.swatch--custom {
  --sw: conic-gradient(var(--swatch-coral), var(--swatch-amber), var(--swatch-teal), var(--swatch-indigo), var(--swatch-coral));
}

.proto-custom {
  position: absolute;
  inline-size: var(--hair);
  block-size: var(--hair);
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.proto-swatches {
  position: relative;
}

.proto-roll {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-h-sm);
  padding: var(--space-1) var(--space-3) var(--space-1) var(--space-1);
  border: var(--hair) solid var(--rule);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--fg);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color var(--fast) var(--ease),
    background-color var(--fast) var(--ease);
}

.proto-roll:hover {
  border-color: var(--fg);
  background: color-mix(in srgb, var(--fg) 9%, transparent);
}

.proto-roll .pp-mark {
  border-radius: 50%;
}

.proto-caption {
  padding-block-start: var(--space-4);
  border-top: var(--hair) solid var(--rule);
  color: var(--fg-soft);
  font-size: var(--text-sm);
}

.proto-caption a {
  font-weight: 600;
  white-space: nowrap;
}

.proto-options {
  order: 3;
}

/* The phone stands on the slash of the N from the mark. The colours the visitor picks
   are set on the stage by the script, as custom properties everything inside reads. */
.proto-stage {
  --app: var(--swatch-teal);
  --app-on: var(--white);
  --app-text: var(--swatch-teal);
  --app-bright: var(--aqua);

  position: relative;
  order: 2;
  display: grid;
  gap: var(--space-4);
  justify-items: center;
  inline-size: 100%;
  isolation: isolate;
}

.proto-stage::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset-block: var(--space-6) var(--space-10);
  inset-inline-start: 50%;
  inline-size: calc(var(--phone-w) + var(--space-10) + var(--space-7));
  background: linear-gradient(170deg, var(--teal) 10%, color-mix(in srgb, var(--teal) 35%, transparent) 90%);
  clip-path: polygon(0 0, 30% 0, 100% 100%, 70% 100%);
  transform: translateX(-50%);
}

/* The brass bar from the C, beside it. */
.proto-stage::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset-block-start: 40%;
  inset-inline-start: calc(50% + var(--phone-w) / 2 + var(--space-2));
  inline-size: var(--space-8);
  block-size: var(--space-4);
  background: var(--brass);
}

.proto-url {
  max-inline-size: 100%;
  padding: var(--space-1) var(--space-4);
  border: var(--hair) solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--navy);
  color: var(--fg-soft);
  font-size: var(--text-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.proto-url span {
  color: var(--aqua);
}

@media (min-width: 720px) {
  .proto {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 1fr auto auto 1fr;
    gap: 0 var(--space-7);
    justify-items: stretch;
  }

  .proto-console {
    grid-area: 2 / 1;
    padding-block-end: 0;
    border-block-end: 0;
    border-end-start-radius: 0;
    border-end-end-radius: 0;
  }

  .proto-options {
    grid-area: 3 / 1;
    border-block-start: 0;
    border-start-start-radius: 0;
    border-start-end-radius: 0;
  }

  .proto-stage {
    grid-area: 1 / 2 / -1 / 3;
    align-self: center;
    inline-size: calc(var(--phone-w) + var(--space-6));
  }
}

/* Without the console (no JavaScript) the phone sits alone, so it is centred. */
.proto:not(:has(.proto-console:not([hidden]))) {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: none;
  justify-items: center;
}

.proto:not(:has(.proto-console:not([hidden]))) .proto-stage {
  grid-area: auto;
}

/* ---------- The phone turns over ----------
   Front: what the customer or the user sees. Back: what the owner sees. Both are real
   and share one state, so something done on the front is on the back when it turns. */

.flip {
  inline-size: min(100%, var(--phone-w));
  perspective: calc(var(--phone-w) * 5);
}

.flip-inner {
  position: relative;
  transform-style: preserve-3d;
  transition: transform var(--flip) var(--ease-flip);
}

.flip[data-side="back"] .flip-inner {
  transform: rotateY(180deg);
}

.flip .phone {
  backface-visibility: hidden;
}

.flip .phone--back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
}

/* Two buttons on the edge of the phone, so it reads as an object. */
.flip .phone::before,
.flip .phone::after {
  content: "";
  position: absolute;
  inline-size: calc(var(--hair) * 3);
  border-radius: var(--hair-strong);
  background: var(--bezel);
}

.flip .phone::before {
  inset-block-start: 24%;
  inset-inline-end: calc(var(--hair-strong) * -1);
  block-size: 13%;
}

.flip .phone::after {
  inset-block-start: 19%;
  inset-inline-start: calc(var(--hair-strong) * -1);
  block-size: 8%;
}

/* Which side is showing. */
.proto-sides {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  inline-size: min(100%, var(--phone-w));
  padding: calc(var(--hair) * 3);
  border: var(--hair) solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--navy-950);
}

.proto-sides button {
  min-height: calc(var(--control-h-sm) - var(--space-2));
  padding-inline: var(--space-2);
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--fg-soft);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color var(--medium) var(--ease),
    color var(--medium) var(--ease);
}

.proto-sides button:hover {
  color: var(--white);
}

.proto-sides button[aria-pressed="true"] {
  background: var(--on-navy);
  color: var(--ink);
}

/* ---------- Inside the phone ----------
   The app has its own small set of surface variables, so the owner's side and the app's
   dark mode are the same parts in other colours. */

.pp-screen {
  --pp-bg: var(--white);
  --pp-fg: var(--ink);
  --pp-soft: var(--ink-soft);
  --pp-line: var(--line);
  --pp-card: var(--white);
  --pp-well: var(--panel);
  --pp-ink: var(--app-text);
  --focus: var(--navy);

  background: var(--pp-bg);
  color: var(--pp-fg);
  transition:
    background-color var(--medium) var(--ease),
    color var(--medium) var(--ease);
}

.pp-screen[data-theme="dark"] {
  --pp-bg: var(--navy-950);
  --pp-fg: var(--on-navy);
  --pp-soft: var(--on-navy-soft);
  --pp-line: var(--navy-line);
  --pp-card: var(--navy-800);
  --pp-well: var(--navy);
  --pp-ink: var(--app-bright);
  --focus: var(--brass-bright);
}

.pp-screen button {
  font-family: var(--font-body);
  color: inherit;
  cursor: pointer;
}

.pp {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

/* Icons: one stroked path each. Marks: filled. */
.pp-ico {
  flex: none;
  inline-size: var(--space-4);
  block-size: var(--space-4);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pp-mark {
  display: grid;
  flex: none;
  place-items: center;
  inline-size: calc(var(--space-6) + var(--space-1));
  block-size: calc(var(--space-6) + var(--space-1));
  border-radius: var(--radius-md);
  background: var(--app);
  color: var(--app-on);
  transition: background-color var(--medium) var(--ease);
}

.pp-mark svg {
  inline-size: 60%;
  block-size: 60%;
  fill: currentColor;
}

/* The mark lands with a small pop each time it changes. */
.pp-mark svg {
  animation: pop var(--medium) var(--ease-spring);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
}

/* The dynamic island says what just happened, then closes again. */
.flip .phone-island {
  display: grid;
  place-items: center;
  color: var(--white);
  font-size: var(--text-3xs);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  transition: inline-size var(--slow) var(--ease-spring);
}

.flip .phone-island[data-live] {
  inline-size: 50%;
}

.flip .phone-island span {
  opacity: 0;
  transition: opacity var(--fast) var(--ease);
}

.flip .phone-island[data-live] span {
  opacity: 1;
  transition-delay: var(--fast);
}

/* A text message arriving. */
.pp-banner {
  position: absolute;
  z-index: 3;
  inset-inline: var(--space-2);
  inset-block-start: var(--space-7);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--hair-strong) var(--space-3);
  align-items: center;
  padding: var(--space-3);
  border: var(--hair) solid var(--line);
  border-radius: var(--radius-sheet);
  background: var(--white);
  color: var(--ink);
  font-size: var(--text-3xs);
  line-height: var(--leading-snug);
  box-shadow: var(--shadow-banner);
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(-100% - var(--space-8)));
  transition:
    transform var(--slow) var(--ease-spring),
    opacity var(--medium) var(--ease);
}

.pp-banner.is-in {
  opacity: 1;
  transform: none;
}

.pp-banner .pp-mark {
  grid-row: 1 / span 2;
  inline-size: var(--space-6);
  block-size: var(--space-6);
}

.pp-banner b {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--text-2xs);
}

.pp-banner b span {
  color: var(--ink-soft);
  font-weight: 400;
}

/* The bar at the top of the app. */
.pp-bar {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-4) var(--space-3);
  border-bottom: var(--hair) solid var(--pp-line);
}

.pp-id {
  flex: 1 1 auto;
  min-width: 0;
}

.pp-name {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--heading-weight);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pp-sub {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--pp-soft);
  font-size: var(--text-3xs);
  line-height: var(--leading-snug);
  white-space: nowrap;
}

.pp-dot {
  flex: none;
  inline-size: calc(var(--space-2) - var(--hair-strong));
  block-size: calc(var(--space-2) - var(--hair-strong));
  border-radius: 50%;
  background: var(--good);
}

.pp-dot--closed {
  background: var(--brass);
}

.pp-dot--live {
  background: var(--pp-ink);
  animation: pulse 2.4s var(--ease-fade) infinite;
}

.pp-iconbtn {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  inline-size: var(--space-6);
  block-size: var(--space-6);
  border: var(--hair) solid var(--pp-line);
  border-radius: var(--radius-md);
  background: transparent;
}

/* Something new since the bell was last opened. */
.pp-iconbtn[data-new]::after {
  content: "";
  position: absolute;
  inset-block-start: var(--space-1);
  inset-inline-end: var(--space-1);
  inline-size: var(--space-2);
  block-size: var(--space-2);
  border: var(--hair-strong) solid var(--pp-bg);
  border-radius: 50%;
  background: var(--app);
}

.pp-homebar {
  flex: none;
  align-self: center;
  inline-size: 36%;
  block-size: var(--space-1);
  margin-block: var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--pp-fg);
  opacity: 0.8;
}

/* Section labels, the body, and the foot. */
.pp-body {
  display: grid;
  flex: 1 1 auto;
  gap: var(--space-3);
  align-content: start;
  min-height: 0;
  padding: var(--space-3) var(--space-4) 0;
  overflow: hidden;
}

.pp-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--text-2xs);
  font-weight: 600;
}

.pp-h small {
  color: var(--pp-soft);
  font-size: var(--text-3xs);
  font-weight: 400;
}

.pp-group {
  display: grid;
  gap: var(--space-2);
}

.pp-foot {
  display: grid;
  flex: none;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4) 0;
}

.pp-fine {
  color: var(--pp-soft);
  font-size: var(--text-3xs);
  text-align: center;
}

.pp-cta {
  min-height: var(--control-h-sm);
  border: 0;
  border-radius: var(--radius-app);
  background: var(--app);
  font-size: var(--text-xs);
  font-weight: 600;
  transition: background-color var(--fast) var(--ease);
}

/* The script sets the readable text colour for whatever colour was picked. */
.pp-screen .pp-cta,
.pp-screen .pp-day[aria-pressed="true"],
.pp-screen .pp-day.is-on,
.pp-screen .pp-mini {
  color: var(--app-on);
}

/* The still page in the HTML draws its button as a paragraph, so nothing dead can be pressed. */
.pp-cta--still {
  display: grid;
  place-items: center;
}

.pp-cta:hover {
  background: color-mix(in srgb, var(--app) 86%, var(--ink));
}

.pp-cta:disabled {
  background: var(--pp-well);
  color: var(--pp-soft);
  cursor: not-allowed;
}

/* ---------- A service business: a booking page that takes a booking ---------- */

.pp-svc {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2);
  border: var(--hair) solid var(--pp-line);
  border-radius: var(--radius-app);
  background: var(--pp-card);
  text-align: start;
  transition:
    border-color var(--fast) var(--ease),
    background-color var(--fast) var(--ease);
}

.pp-svc-ico {
  display: grid;
  place-items: center;
  inline-size: calc(var(--space-6) + var(--hair-strong));
  block-size: calc(var(--space-6) + var(--hair-strong));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--app) 14%, var(--pp-card));
  color: var(--pp-ink);
}

.pp-svc-ico .pp-ico {
  inline-size: calc(var(--space-4) + var(--space-1));
  block-size: calc(var(--space-4) + var(--space-1));
}

.pp-svc b {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: var(--leading-snug);
}

.pp-svc small {
  color: var(--pp-soft);
  font-size: var(--text-3xs);
}

.pp-radio {
  inline-size: var(--space-4);
  block-size: var(--space-4);
  border: var(--hair-strong) solid var(--pp-line);
  border-radius: 50%;
  transition: border var(--fast) var(--ease);
}

.pp-svc[aria-pressed="true"],
.pp-svc.is-on,
.pp-slot[aria-pressed="true"],
.pp-slot.is-on {
  border-color: var(--app);
  background: color-mix(in srgb, var(--app) 9%, var(--pp-card));
  box-shadow: inset 0 0 0 var(--hair) var(--app);
}

.pp-svc[aria-pressed="true"] .pp-radio,
.pp-svc.is-on .pp-radio {
  border: calc(var(--space-1) + var(--hair)) solid var(--app);
}

.pp-days {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: calc(var(--space-1) + var(--hair-strong));
}

.pp-day {
  display: grid;
  justify-items: center;
  padding: calc(var(--space-2) - var(--hair)) 0 var(--space-2);
  border: var(--hair) solid var(--pp-line);
  border-radius: var(--radius-app);
  background: var(--pp-card);
  transition:
    border-color var(--fast) var(--ease),
    background-color var(--fast) var(--ease),
    color var(--fast) var(--ease);
}

.pp-day span {
  color: var(--pp-soft);
  font-size: var(--text-3xs);
}

.pp-day b {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--heading-weight);
  line-height: var(--leading-snug);
  font-variant-numeric: tabular-nums;
}

.pp-day[aria-pressed="true"],
.pp-day.is-on {
  border-color: var(--app);
  background: var(--app);
}

.pp-day[aria-pressed="true"] span,
.pp-day.is-on span {
  color: inherit;
}

/* On the owner's side a day with a booking carries a count. */
.pp-day {
  position: relative;
}

.pp-day.is-busy {
  border-color: var(--pp-ink);
}

.pp-count {
  position: absolute;
  inset-block-start: calc(var(--space-2) * -1);
  inset-inline-end: calc(var(--space-1) * -1);
  display: grid;
  place-items: center;
  min-inline-size: var(--space-4);
  block-size: var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--pp-ink);
  color: var(--navy-950);
  font-size: var(--text-3xs);
  font-style: normal;
  font-weight: 600;
  line-height: 1;
  animation: pop var(--slow) var(--ease-spring);
}

.pp-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: calc(var(--space-1) + var(--hair-strong));
}

.pp-slot {
  min-height: calc(var(--space-6) + var(--hair-strong));
  border: var(--hair) solid var(--pp-line);
  border-radius: var(--radius-md);
  background: var(--pp-card);
  font-size: var(--text-2xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition:
    border-color var(--fast) var(--ease),
    background-color var(--fast) var(--ease);
}

/* In the still page the times are plain boxes, so they centre their own text. */
div.pp-slot {
  display: grid;
  place-items: center;
}

/* A time someone else already has. */
.pp-slot:disabled,
.pp-slot.is-gone {
  border-color: transparent;
  background: var(--pp-well);
  color: var(--pp-soft);
  font-weight: 400;
  text-decoration: line-through;
  cursor: not-allowed;
}

/* Booked: a tick that draws itself, and a ticket. */
.pp-done {
  display: grid;
  flex: 1 1 auto;
  gap: var(--space-3);
  align-content: center;
  justify-items: center;
  padding: var(--space-4);
  text-align: center;
}

.pp-tick {
  inline-size: var(--space-7);
  block-size: var(--space-7);
  border-radius: 50%;
  background: var(--app);
  color: var(--app-on);
  animation: pop var(--slow) var(--ease-spring);
}

.pp-tick path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: draw var(--slow) var(--ease) var(--medium) forwards;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* With animation switched off the tick must still be there. */
@media (prefers-reduced-motion: reduce) {
  .pp-tick path {
    stroke-dashoffset: 0;
  }
}

.pp-done-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--display-weight);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-display);
  outline: 0;
}

.pp-ticket {
  inline-size: 100%;
  border: var(--hair) solid var(--pp-line);
  border-radius: var(--radius-app);
  background: var(--pp-card);
  text-align: start;
}

.pp-ticket-top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
}

.pp-ticket-top b {
  display: block;
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
}

.pp-ticket-top small {
  color: var(--pp-soft);
  font-size: var(--text-3xs);
}

/* The tear line, with a notch bitten out of each edge. */
.pp-ticket-cut {
  position: relative;
  border-top: var(--hair) dashed var(--pp-line);
}

.pp-ticket-cut::before,
.pp-ticket-cut::after {
  content: "";
  position: absolute;
  inset-block-start: calc(var(--space-2) * -1);
  inline-size: var(--space-4);
  block-size: var(--space-4);
  border: var(--hair) solid var(--pp-line);
  border-radius: 50%;
  background: var(--pp-bg);
}

.pp-ticket-cut::before {
  inset-inline-start: calc(var(--space-2) * -1 - var(--hair));
  clip-path: inset(0 0 0 50%);
}

.pp-ticket-cut::after {
  inset-inline-end: calc(var(--space-2) * -1 - var(--hair));
  clip-path: inset(0 50% 0 0);
}

.pp-ticket dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-1) var(--space-3);
  margin: 0;
  padding: var(--space-3);
  font-size: var(--text-2xs);
}

.pp-ticket dt {
  color: var(--pp-soft);
}

.pp-ticket dd {
  font-weight: 600;
  text-align: end;
}

.pp-ghost {
  min-height: calc(var(--space-6) + var(--space-1));
  padding-inline: var(--space-4);
  border: var(--hair) solid var(--pp-fg);
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: var(--text-2xs);
  font-weight: 600;
}

.pp-ghost:hover {
  background: color-mix(in srgb, var(--pp-fg) 8%, transparent);
}

.pp-textbtn {
  min-height: var(--space-5);
  padding: 0;
  border: 0;
  background: none;
  font-size: var(--text-2xs);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: var(--hair-strong);
}

.pp-screen .pp-textbtn {
  color: var(--pp-ink);
}

/* ---------- The owner's side ---------- */

.pp-tiles {
  display: grid;
  flex: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4) 0;
}

.pp-tile {
  display: grid;
  gap: var(--hair-strong);
  padding: var(--space-3);
  border: var(--hair) solid var(--pp-line);
  border-radius: var(--radius-app);
  background: var(--pp-card);
}

.pp-tile b {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--display-weight);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.pp-tile span {
  color: var(--pp-soft);
  font-size: var(--text-3xs);
}

.pp-live {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--pp-soft);
  font-family: var(--font-mono);
  font-size: var(--text-3xs);
}

.pp-job {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2);
  border: var(--hair) solid var(--pp-ink);
  border-radius: var(--radius-app);
  background: var(--pp-card);
  animation: pop var(--slow) var(--ease-spring);
}

.pp-job b {
  display: block;
  font-size: var(--text-2xs);
  line-height: var(--leading-snug);
}

.pp-job small {
  color: var(--pp-soft);
  font-size: var(--text-3xs);
}

.pp-new {
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--pp-ink);
  color: var(--navy-950);
  font-size: var(--text-3xs);
  font-weight: 600;
}

.pp-events {
  display: grid;
}

.pp-events li {
  display: grid;
  grid-template-columns: calc(var(--space-7) + var(--space-2)) minmax(0, 1fr);
  gap: var(--space-2);
  padding-block: calc(var(--space-1) + var(--hair-strong));
  border-top: var(--hair) solid var(--pp-line);
  font-size: var(--text-3xs);
  line-height: var(--leading-snug);
}

.pp-events li:first-child {
  border-top: 0;
}

.pp-events time {
  color: var(--pp-soft);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.pp-empty {
  color: var(--pp-soft);
  font-size: var(--text-3xs);
  line-height: var(--leading-snug);
}

/* ---------- An app idea: four kinds of app, each with something that works ---------- */

.pp-view {
  display: grid;
  flex: 1 1 auto;
  gap: var(--space-3);
  align-content: start;
  min-height: 0;
  padding: var(--space-3) var(--space-4) 0;
  overflow: hidden;
}

.pp-tabs {
  display: grid;
  flex: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: var(--space-1) var(--space-2) 0;
  border-top: var(--hair) solid var(--pp-line);
}

.pp-tab {
  display: grid;
  justify-items: center;
  gap: var(--hair-strong);
  padding-block: var(--space-2) var(--space-1);
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  font-size: var(--text-3xs);
  font-weight: 500;
}

.pp-screen .pp-tab {
  color: var(--pp-soft);
}

.pp-screen .pp-tab[aria-pressed="true"] {
  color: var(--pp-ink);
  font-weight: 600;
}

.pp-tab .pp-ico {
  inline-size: calc(var(--space-4) + var(--space-1));
  block-size: calc(var(--space-4) + var(--space-1));
}

/* Small pill buttons used across the four apps. */
.pp-mini {
  min-height: calc(var(--space-6) - var(--space-1));
  padding-inline: var(--space-3);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--app);
  font-size: var(--text-3xs);
  font-weight: 600;
  white-space: nowrap;
  transition: background-color var(--fast) var(--ease);
}

.pp-screen .pp-mini[aria-pressed="true"] {
  background: color-mix(in srgb, var(--app) 16%, var(--pp-card));
  color: var(--pp-ink);
}

.pp-mini:disabled {
  background: var(--pp-well);
  cursor: not-allowed;
}

.pp-screen .pp-mini:disabled {
  color: var(--pp-soft);
}

/* Buy and sell */

.pp-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--pp-well);
  color: var(--pp-soft);
  font-size: var(--text-2xs);
  white-space: nowrap;
  overflow: hidden;
}

.pp-chips {
  display: flex;
  gap: var(--space-1);
}

.pp-chip {
  min-height: calc(var(--space-6) - var(--space-1));
  padding-inline: var(--space-3);
  border: var(--hair) solid var(--pp-line);
  border-radius: var(--radius-pill);
  background: var(--pp-card);
  font-size: var(--text-3xs);
  font-weight: 600;
}

.pp-screen .pp-chip[aria-pressed="true"] {
  border-color: var(--pp-fg);
  background: var(--pp-fg);
  color: var(--pp-bg);
}

.pp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.pp-item {
  position: relative;
  display: grid;
  border: var(--hair) solid var(--pp-line);
  border-radius: var(--radius-app);
  background: var(--pp-card);
}

.pp-item[hidden] {
  display: none;
}

.pp-item-open {
  display: grid;
  gap: var(--hair-strong);
  padding: var(--space-1) var(--space-1) var(--space-2);
  border: 0;
  border-radius: var(--radius-app);
  background: none;
  text-align: start;
}

.pp-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  margin-block-end: var(--space-1);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--app) 13%, var(--pp-card));
  color: var(--pp-ink);
}

.pp-thumb .pp-ico {
  inline-size: var(--space-6);
  block-size: var(--space-6);
  stroke-width: 1.4;
}

.pp-item-open b,
.pp-item-open span {
  padding-inline: var(--space-1);
}

.pp-item-open b {
  font-size: var(--text-2xs);
  line-height: var(--leading-snug);
}

.pp-item-open span {
  color: var(--pp-soft);
  font-size: var(--text-3xs);
}

.pp-like {
  position: absolute;
  inset-block-start: var(--space-2);
  inset-inline-end: var(--space-2);
  display: grid;
  place-items: center;
  inline-size: calc(var(--space-5) + var(--hair-strong));
  block-size: calc(var(--space-5) + var(--hair-strong));
  border: 0;
  border-radius: 50%;
  background: var(--pp-card);
}

.pp-screen .pp-like {
  color: var(--pp-soft);
}

.pp-like .pp-ico {
  inline-size: calc(var(--space-3) + var(--hair-strong));
  block-size: calc(var(--space-3) + var(--hair-strong));
}

.pp-screen .pp-like[aria-pressed="true"],
.pp-screen .pp-act[aria-pressed="true"] {
  color: var(--pp-ink);
}

.pp-like[aria-pressed="true"] .pp-ico,
.pp-act[aria-pressed="true"] .pp-ico {
  fill: currentColor;
  animation: pop var(--medium) var(--ease-spring);
}

/* The sheet that slides up over the app. */
.pp-sheet-wrap {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  align-items: end;
  background: var(--scrim);
  animation: fade var(--medium) var(--ease);
}

.pp-sheet-wrap[hidden] {
  display: none;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.pp-sheet {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4) var(--space-4);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  background: var(--pp-bg);
  box-shadow: var(--shadow-sheet);
  animation: rise var(--slow) var(--ease-spring);
}

@keyframes rise {
  from {
    transform: translateY(100%);
  }
}

.pp-grab {
  justify-self: center;
  inline-size: var(--space-7);
  block-size: var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--pp-line);
}

.pp-sheet .pp-thumb {
  aspect-ratio: 16 / 7;
}

.pp-sheet-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--heading-weight);
  outline: 0;
}

.pp-sheet p {
  color: var(--pp-soft);
  font-size: var(--text-2xs);
  line-height: var(--leading-snug);
}

.pp-sheet .pp-sheet-title {
  color: var(--pp-fg);
  font-size: var(--text-sm);
}

.pp-sheet-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
}

/* Book and schedule */

.pp-session {
  display: grid;
  grid-template-columns: calc(var(--space-7) + var(--space-1)) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: var(--hair) solid var(--pp-line);
  border-radius: var(--radius-app);
  background: var(--pp-card);
}

.pp-session time {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--heading-weight);
  line-height: var(--leading-snug);
  font-variant-numeric: tabular-nums;
}

.pp-session time small {
  display: block;
  color: var(--pp-soft);
  font-family: var(--font-body);
  font-size: var(--text-3xs);
  font-weight: 400;
}

.pp-session b {
  display: block;
  font-size: var(--text-2xs);
  line-height: var(--leading-snug);
}

.pp-session span {
  color: var(--pp-soft);
  font-size: var(--text-3xs);
}

/* Share and chat */

.pp-avatar {
  display: grid;
  flex: none;
  place-items: center;
  inline-size: calc(var(--space-6) - var(--space-1));
  block-size: calc(var(--space-6) - var(--space-1));
  border-radius: 50%;
  background: var(--av, var(--app));
  color: var(--white);
  font-size: var(--text-3xs);
  font-style: normal;
  font-weight: 600;
}

.pp-avatar--1 { --av: var(--swatch-indigo); }
.pp-avatar--2 { --av: var(--swatch-coral); }
.pp-avatar--3 { --av: var(--swatch-amber); }

.pp-avatar--you {
  background: var(--app);
  color: var(--app-on);
}

.pp-avatar--lg {
  inline-size: var(--space-7);
  block-size: var(--space-7);
  font-size: var(--text-xs);
}

.pp-composer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.pp-composer p {
  flex: 1 1 auto;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--pp-well);
  color: var(--pp-soft);
  font-size: var(--text-3xs);
}

.pp-posts {
  display: grid;
}

.pp-post {
  display: grid;
  gap: var(--space-1);
  padding-block: var(--space-2);
  border-top: var(--hair) solid var(--pp-line);
  animation: pop var(--medium) var(--ease);
}

.pp-post-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-2xs);
}

.pp-post-head span {
  color: var(--pp-soft);
  font-size: var(--text-3xs);
}

.pp-post p {
  font-size: var(--text-2xs);
  line-height: var(--leading-snug);
}

.pp-acts {
  display: flex;
  gap: var(--space-3);
}

.pp-act {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--space-5);
  padding: 0;
  border: 0;
  background: none;
  font-size: var(--text-3xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pp-screen .pp-act {
  color: var(--pp-soft);
}

.pp-act .pp-ico {
  inline-size: calc(var(--space-3) + var(--hair-strong));
  block-size: calc(var(--space-3) + var(--hair-strong));
}

/* Track and measure */

.pp-ring {
  position: relative;
  display: grid;
  place-items: center;
  justify-self: center;
  inline-size: calc(var(--space-9) + var(--space-5));
  aspect-ratio: 1;
}

.pp-ring svg {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  transform: rotate(-90deg);
}

.pp-ring circle {
  fill: none;
  stroke: var(--pp-well);
  stroke-width: 9;
}

/* The script sets --p from 0 to 1. The circle is 276 units round. */
.pp-ring circle + circle {
  stroke: var(--app);
  stroke-linecap: round;
  stroke-dasharray: calc(var(--p, 0) * 276) 276;
  transition: stroke-dasharray var(--slow) var(--ease);
}

.pp-ring b {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--display-weight);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.pp-ring span {
  display: block;
  color: var(--pp-soft);
  font-size: var(--text-3xs);
  text-align: center;
}

.pp-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--space-2);
  align-items: end;
  block-size: var(--space-8);
}

.pp-bars li {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: var(--space-1);
  block-size: 100%;
  color: var(--pp-soft);
  font-size: var(--text-3xs);
  text-align: center;
}

/* The script sets --v from 0 to 1 on each bar. */
.pp-bars i {
  align-self: end;
  block-size: calc(var(--v, 0) * 100%);
  min-block-size: var(--hair-strong);
  border-radius: var(--radius-sm);
  background: var(--pp-well);
  transition: block-size var(--slow) var(--ease-spring);
}

.pp-bars .is-today {
  color: var(--pp-fg);
  font-weight: 600;
}

.pp-bars .is-today i {
  background: var(--app);
}

/* The You tab */

.pp-me {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-block-end: var(--space-2);
}

.pp-me b {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-sm);
}

.pp-me span {
  color: var(--pp-soft);
  font-size: var(--text-3xs);
}

.pp-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: var(--space-2);
  border-top: var(--hair) solid var(--pp-line);
  font-size: var(--text-2xs);
}

.pp-switch {
  position: relative;
  flex: none;
  inline-size: calc(var(--space-7) - var(--space-2));
  block-size: var(--space-5);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--pp-well);
  transition: background-color var(--medium) var(--ease);
}

.pp-switch::after {
  content: "";
  position: absolute;
  inset-block-start: var(--hair-strong);
  inset-inline-start: var(--hair-strong);
  inline-size: calc(var(--space-5) - var(--space-1));
  block-size: calc(var(--space-5) - var(--space-1));
  border-radius: 50%;
  background: var(--white);
  transition: transform var(--medium) var(--ease-spring);
}

.pp-switch[aria-checked="true"] {
  background: var(--app);
}

.pp-switch[aria-checked="true"]::after {
  transform: translateX(var(--space-4));
}
