/* =========================================================================
   Rejection City (/playground/rejection-city/)
   City map, walk and zoom, scene dialog with a device to fix, and "See all fixes".
   Positions come from apps/playground/content/rejection-city.json (set by static/js/rejection-city.js).
   Device screens use DM Sans and are drawn on a Figma-sized canvas: --px is one Figma pixel, so each screen
   scales with its device (390 wide for phones).
   ========================================================================= */

@font-face {
  font-family: "DM Sans";
  src: url("../../fonts/DMSans-latin.3ccd9ab2050b.woff2") format("woff2");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

.rc,
.rc-scene {
  --rc-fade: 600ms;
  --rc-zoom: 900ms;
  --rc-colour: 800ms;
  --rc-ink: #1b1b1f;
  --rc-focus: #0154FC;
}
.rc { padding: 0 var(--layout-margin) var(--layout-section-gap); }

/* --- Top bar ----------------------------------------------------------- */
.rc-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--bg-raised);
  border: var(--stroke-hairline) solid var(--ink-700);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.rc-bar__title { margin: 0; font-family: var(--font-display); font-size: 22px; line-height: 28px; font-weight: 600; color: var(--text-primary); }
.rc-bar__tagline { margin: 0; color: var(--text-body); font-size: 16px; text-align: center; }
.rc-bar__actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.rc-bar__count { margin: 0; color: var(--text-supporting); font-size: 15px; white-space: nowrap; }
.rc-bar__count span { color: var(--text-primary); font-weight: 600; }
.rc-bar__all, .rc-all__back, .rc-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--ink-900);
  font: 600 15px/1 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  border: 0;
  cursor: pointer;
}
.rc-bar__all:hover, .rc-all__back:hover, .rc-back:hover { background: var(--blue-50); }
.rc-bar__all:focus-visible, .rc-all__back:focus-visible, .rc-back:focus-visible { outline: 3px solid var(--blue-300); outline-offset: 3px; }
.rc-intro { max-width: 720px; margin: 16px 0; color: var(--text-supporting); }

/* --- City map ---------------------------------------------------------- */
.rc-stage {
  width: min(100%, calc((100dvh - 230px) * 1699 / 926));
  min-width: min(100%, 720px);
  margin: 0 auto;
  overflow: hidden;
  border-radius: var(--radius-lg);
}
.rc-camera {
  position: relative;
  aspect-ratio: 1699 / 926;
  transform-origin: 50% 50%;
  transition: transform var(--rc-zoom) cubic-bezier(0.6, 0, 0.3, 1);
}
.rc-camera__base, .rc-colour { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.rc-colour { -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; opacity: 0; transition: opacity var(--rc-colour) ease; pointer-events: none; }
.rc-colour.is-on { opacity: 1; }

.rc-place {
  position: absolute;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
}
.rc-place:focus-visible { outline: 3px solid var(--white); outline-offset: 2px; box-shadow: 0 0 0 6px var(--rc-focus); }
.rc-tag {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -30%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--ink-900);
  box-shadow: 0 6px 18px rgba(14, 14, 16, 0.22);
  font: 600 14px/18px var(--font-body);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  z-index: 2;
}
.rc-place:hover .rc-tag, .rc-place:focus-visible .rc-tag { opacity: 1; }
/* The office tower reaches the top edge of the city, so its tag sits lower, on the tower, with space above it. */
.rc-place[data-rc-place="office"] .rc-tag { top: 30%; transform: translate(-50%, -50%); }
/* The cash machine sits near the right edge, so its tag opens to the left instead of centring. */
.rc-place[data-rc-place="atm"] .rc-tag { left: auto; right: 0; transform: translate(0, -30%); }
.rc-tag__status { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; color: #4A4A50; }
.rc-tag__status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #8A8A90; }
.is-fixed .rc-tag__status { color: #17663A; }
.is-fixed .rc-tag__status::before { background: var(--signal-green); }

.rc-hint {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  background: var(--white);
  border: 3px solid var(--rc-focus);
  box-shadow: 0 0 0 0 rgba(1, 84, 252, 0.6);
  pointer-events: none;
  z-index: 1;
}
.rc-hint[hidden] { display: none; }

.rc-walker {
  position: absolute;
  height: 7%;
  transform: translate(-50%, -100%);
  pointer-events: none;
  z-index: 1;
  transition: opacity 300ms ease;
}
.rc-walker__flip { position: relative; display: block; height: 100%; aspect-ratio: 231 / 480; }
.rc-walker.is-left .rc-walker__flip { transform: scaleX(-1); }
.rc-walker__img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; transform-origin: 50% 100%; }

.rc-walker.is-hidden { opacity: 0; }

/* Phone list of places (the map is too small to tap under 768px) */
.rc-cards { display: none; list-style: none; margin: 16px 0 0; padding: 0; gap: 12px; }
.rc-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  padding: 14px 16px;
  border: var(--stroke-hairline) solid var(--ink-700);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.rc-card:focus-visible { outline: 3px solid var(--blue-300); outline-offset: 2px; }
.rc-card__num { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--ink-700); font-weight: 600; }
.rc-card__text { display: flex; flex-direction: column; flex: 1; }
.rc-card__name { font-weight: 600; }
.rc-card__what { color: var(--text-supporting); font-size: 15px; }
.rc-card .rc-tag__status { color: var(--text-supporting); }
.rc-card.is-fixed .rc-tag__status { color: #6FD39A; }

.rc-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  background: var(--white);
  color: var(--ink-900);
}
.rc-end[hidden] { display: none; }
.rc-end__text { margin: 0; font-family: var(--font-display); font-size: 22px; line-height: 28px; max-width: 640px; }
.rc-end:focus { outline: none; }

/* --- Scene dialog ------------------------------------------------------ */
.rc-scene { position: fixed; inset: 0; z-index: 100; background: #0B0B0D; opacity: 0; transition: opacity var(--rc-fade) ease; }
.rc-scene.is-open { opacity: 1; }
.rc-scene[hidden] { display: none; }
.rc-scene__frames, .rc-frame { position: absolute; inset: 0; width: 100%; height: 100%; }
.rc-frame { object-fit: cover; opacity: 0; transition: opacity var(--rc-fade) ease; }
.rc-frame.is-shown { opacity: 1; }
.rc-back { position: absolute; top: 16px; left: 16px; z-index: 3; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); }

.rc-play {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: auto minmax(0, 360px);
  justify-content: center;
  align-items: center;
  gap: 32px;
  padding: 76px 24px 24px;
  background: rgba(11, 11, 13, 0.35);
  opacity: 0;
  transition: opacity var(--rc-fade) ease;
}
.rc-play[hidden] { display: none; }
.rc-play.is-up { opacity: 1; }
.rc-play__device { transform: translateY(60px); transition: transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.rc-play.is-up .rc-play__device { transform: none; }
.rc-play.is-leaving .rc-play__device { transform: translateY(110vh); transition-duration: 700ms; transition-timing-function: cubic-bezier(0.6, 0, 0.8, 0.4); }
.rc-play__side { display: flex; flex-direction: column; gap: 12px; align-self: center; max-height: 100%; overflow: auto; }
.rc-play__count, .rc-play__hint {
  margin: 0;
  justify-self: start;
  width: fit-content;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--ink-900);
  font: 600 15px/20px var(--font-body);
}
.rc-play__hint { font-weight: 400; background: rgba(255, 255, 255, 0.92); }
.rc-notes, .rc-fix__notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.rc-note { display: flex; flex-direction: column; gap: 8px; padding: 18px; border: 1px solid #e4ded3; border-radius: 14px; background: var(--white); color: #1b1b1f; font-family: "DM Sans", var(--font-body); line-height: 1.35; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); }
.rc-note[hidden] { display: none; }
.rc-notes .rc-note { animation: rc-note-in 400ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.rc-note__title { margin: 0; font-weight: 700; font-size: 15px; }
.rc-note__line { display: flex; gap: 10px; margin: 0; font-size: 14px; color: #3c3c43; }
.rc-note__line strong { flex: none; width: 28px; font-size: 13px; font-weight: 700; color: #1b1b1f; }

/* --- Devices and screens (shared) ------------------------------------ */
.rc-device { container-type: inline-size; width: min(390px, calc((100dvh - 110px) * 390 / 844)); }
.rc-screen {
  --px: calc(100cqw / 390);
  font-family: "DM Sans", var(--font-body);
  line-height: 1.35;
  color: var(--rc-ink);
  text-align: left;
}
.rc-flaw {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: inherit;
  border-radius: calc(14 * var(--px));
}
button.rc-flaw { cursor: pointer; }
/* Thin flaws (a single line of text) get an invisible 44px-tall tap area, without changing the Figma layout. */
button.rc-flaw::after { content: ""; position: absolute; left: 0; right: 0; top: min(0px, calc((100% - 44px) / 2)); bottom: min(0px, calc((100% - 44px) / 2)); }
button.rc-flaw:not(.is-fixed) { animation: rc-pulse 1.8s ease-out infinite; }
button.rc-flaw:hover:not(.is-fixed) { box-shadow: 0 0 0 calc(4 * var(--px)) rgba(1, 84, 252, 0.35); }
button.rc-flaw:focus-visible { outline: 3px solid var(--rc-focus); outline-offset: calc(4 * var(--px)); }
/* State rules win over any scene's own display rules, so a part only ever shows in its own state. */
.rc-flaw:not(.is-fixed) .rc-flaw__fixed, .rc-flaw.is-fixed .rc-flaw__bad { display: none !important; }
.rc-flaw.is-fixed .rc-flaw__fixed { display: flex; flex-direction: column; }
button.rc-flaw.is-fixed .rc-flaw__fixed { animation: rc-fix-in 450ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.rc-flaw__bad, .rc-flaw__fixed { width: 100%; }
.rc-stub { display: block; padding: 24px; color: #4A4A50; }

/* Phone shell (Figma 390 × 844) */
.rc-device--phone .rc-screen {
  display: flex;
  flex-direction: column;
  gap: calc(16 * var(--px));
  aspect-ratio: 390 / 844;
  padding: calc(24 * var(--px));
  border: calc(10 * var(--px)) solid var(--rc-ink);
  border-radius: calc(44 * var(--px));
  background: var(--white);
  overflow: hidden;
  font-size: calc(17 * var(--px));
}

/* Each place's screen styles live in rejection-city/<place>.css. */

@media (max-width: 767px) {
  .rc-device.rc-device--atm, .rc-device.rc-device--tablet, .rc-device.rc-device--kiosk { width: 100%; }
}

/* --- See all fixes ---------------------------------------------------- */
.rc-all { padding-top: 8px; }
.rc-all__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 24px; }
.rc-all__title { margin: 0; font-family: var(--font-display); font-size: var(--display-h2); line-height: var(--display-h2-lh); }
.rc-all:focus { outline: none; }
.rc-fix { padding: 32px 0; border-top: var(--stroke-hairline) solid var(--ink-700); }
.rc-fix__title { margin: 0 0 20px; font-family: var(--font-display); font-size: var(--display-section); line-height: var(--display-section-lh); font-weight: 600; }
.rc-fix__pair { display: flex; flex-wrap: wrap; gap: 32px; margin-bottom: 24px; }
.rc-fix__screen { margin: 0; display: flex; flex-direction: column; gap: 12px; flex: 1 1 280px; max-width: 420px; }
.rc-fix__screen figcaption { color: var(--text-body); font-size: 16px; line-height: 22px; }
.rc-fix__screen .rc-device--phone { width: min(320px, 100%); }
.rc-fix__screen .rc-device:not(.rc-device--phone) { width: 100%; }
.rc-fix__notes { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.rc-fix__notes .rc-note { box-shadow: none; }

.rc-footer { margin: 32px 0 0; color: var(--text-supporting); font-size: 14px; line-height: 20px; }

/* --- Motion ------------------------------------------------------------ */
@keyframes rc-pulse {
  0% { box-shadow: 0 0 0 0 rgba(1, 84, 252, 0.55); }
  70% { box-shadow: 0 0 0 calc(10 * var(--px, 1px)) rgba(1, 84, 252, 0); }
  100% { box-shadow: 0 0 0 0 rgba(1, 84, 252, 0); }
}
@keyframes rc-hint { 0% { box-shadow: 0 0 0 0 rgba(1, 84, 252, 0.6); } 80%, 100% { box-shadow: 0 0 0 22px rgba(1, 84, 252, 0); } }
@keyframes rc-fix-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes rc-note-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.rc-hint { animation: rc-hint 1.6s ease-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .rc-hint, button.rc-flaw:not(.is-fixed) { animation: none; }
  button.rc-flaw:not(.is-fixed) { box-shadow: 0 0 0 3px rgba(1, 84, 252, 0.55); }
  .rc-camera { transition: none; }
  .rc-play__device, .rc-play.is-leaving .rc-play__device { transform: none; transition: none; }
  .rc-play.is-leaving { opacity: 0; }
  button.rc-flaw.is-fixed .rc-flaw__fixed, .rc-notes .rc-note { animation: rc-fade 300ms ease; }
}
@keyframes rc-fade { from { opacity: 0; } to { opacity: 1; } }

/* --- Phones: list of places, device fills the screen ------------------- */
@media (max-width: 767px) {
  .rc-bar { grid-template-columns: 1fr; text-align: left; border-radius: var(--radius-lg); }
  .rc-bar__tagline { text-align: left; }
  .rc-bar__actions { justify-content: space-between; }
  .rc-cards { display: grid; }
  .rc-play { grid-template-columns: 1fr; align-content: start; justify-items: center; overflow-y: auto; padding: 72px 12px 24px; gap: 16px; }
  .rc-play__device { display: flex; justify-content: center; width: 100%; }
  /* The scene scrolls on phones, so the device takes the full width rather than shrinking to fit the height. */
  .rc-device { width: min(100%, 390px); }
  .rc-play__side { width: 100%; overflow: visible; max-height: none; }
  .rc-fix__screen { max-width: none; }
}

/* "All brands are fictional": a quiet caption right under the city, where the brands are. */
.rc-credit { margin: 16px 0 0; color: var(--text-supporting); font-size: 14px; line-height: 20px; }
.rc--toolbar .rc-credit { order: 9; }

/* Phones: the city picture stays (tap a building to open it), with the toolbar under it and the list of places below. */
@media (max-width: 767px) {
  .rc--toolbar .rc-cards { order: 3; }
}

/* Phones: the count and the newest note sit in a sheet fixed to the bottom of the screen, so a fix and its note are
   seen together without scrolling. The scene keeps room at the bottom, so the whole device can still be scrolled to. */
@media (max-width: 767px) {
  .rc-play { padding-bottom: 260px; }
  .rc-play__side {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 4;
    width: auto;
    gap: 8px;
    max-height: 48dvh;
    overflow: auto;
  }
  .rc-play__count, .rc-play__hint { padding: 6px 12px; font-size: 14px; line-height: 18px; }
  .rc-play.has-note .rc-play__hint { display: none; }
  .rc-notes .rc-note:not(.is-latest) { display: none; }
  .rc-notes .rc-note { gap: 6px; padding: 14px 16px; }
  .rc-notes .rc-note .rc-note__line { font-size: 13px; }
}

/* Phones: the city is zoomed in a little on the five places, and the parked cars along the bottom are cropped away. */
@media (max-width: 767px) {
  .rc-stage { aspect-ratio: 205 / 100; min-width: 0; }
  .rc-camera { width: 112%; margin-left: -6%; }
  .rc-place[data-rc-place="cafe"] .rc-tag { left: 12px; transform: translate(0, -30%); }
}
