/*
 * The Cabina shell (ADR 0015): a marquee overhead, a ringside bar underfoot,
 * and the drawer that replaced every page's column of ghost links.
 *
 * It frames a player who has a pet. The landing, the sign-in funnel, creation
 * and the guest challenge are the walk in off the street — they are one page
 * each, not a venue, and `shell?` keeps this sheet off them.
 *
 * Every primitive here comes from ui.css and every value from tokens.css.
 */

/* ── Marquee ───────────────────────────────────────────────────────────── */

/*
 * The bar above the card. Amarillo with an ink rule under it: the one surface
 * in the app that inverts the ground, which is what makes it read as a fixture
 * of the building rather than a header of the page.
 *
 * `overflow` stays visible so the drawer can hang off it; the ticker does its
 * own clipping below.
 */
.marquee {
  position: fixed;
  z-index: 90;
  inset-block-start: 0;
  inset-inline: 0;
  height: var(--marquee);
  background: var(--amarillo);
  border-block-end: var(--border-poster) solid var(--ink);
}

.marquee__in {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: var(--shell);
  height: 100%;
  margin-inline: auto;
  padding-inline: var(--space-3);
}

/* The mark takes the ink here. Its own amarillo would vanish, and the rosa the
   tld wears elsewhere sits at 2.2:1 on this ground. */
.marquee__mark {
  flex: none;
  text-decoration: none;
}

.marquee__mark .wordmark,
.marquee__mark .wordmark__tld {
  color: var(--ink);
}

/*
 * What is on tonight, running past. It is the one piece of motion in the app
 * that never stops, so it is small, quiet, and the first thing
 * prefers-reduced-motion pins down.
 */
.marquee__ticker {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  mask-image: linear-gradient(
    90deg,
    transparent,
    var(--ink) var(--space-4),
    var(--ink) calc(100% - var(--space-4)),
    transparent
  );
}

.marquee__run {
  display: inline-flex;
  gap: var(--space-5);
  font: 700 var(--text-micro) / var(--marquee) var(--font-data);
  letter-spacing: var(--track-micro);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink);
  animation: marquee-run 32s linear infinite;
}

/* The run is printed twice in the markup, so translating exactly half of it
   lands the copy where the original started and the loop has no seam. */
@keyframes marquee-run {
  to {
    transform: translateX(-50%);
  }
}

/* A ticker that cannot be stopped is a reason to leave. Under reduced motion it
   holds still on the first item, which is why the ticker is never the only
   place something is said. */
@media (prefers-reduced-motion: reduce) {
  .marquee__run {
    animation: none;
  }
}

/* ── Drawer ────────────────────────────────────────────────────────────── */

/*
 * A native <details>, for the reason the shop's shelf is one: the toggle, its
 * keyboard handling and what a screen reader announces all come with the
 * element. The controller on top only adds Esc and a tap on the scrim — if the
 * module never arrives, the summary still opens and closes it, and navigation
 * is never behind JavaScript on a network-only PWA (ADR 0009).
 */
.drawer {
  flex: none;
}

.drawer__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  border: var(--border) solid var(--ink);
  color: var(--ink);
  list-style: none;
  cursor: pointer;
}

.drawer__toggle::-webkit-details-marker {
  display: none;
}

/*
 * Stops short of the marquee on purpose: the summary that opens the drawer has
 * to stay reachable to close it again, which is the whole of the no-script
 * close path.
 */
.drawer__scrim {
  position: fixed;
  inset: var(--marquee) 0 0;
  background: color-mix(in srgb, var(--ink) 82%, transparent);
}

.drawer__panel {
  position: fixed;
  z-index: 1;
  inset-block: var(--marquee) 0;
  inset-inline-end: 0;
  width: var(--drawer);
  overflow-y: auto;
  padding: var(--space-4) var(--space-4) var(--space-6);
  background-color: var(--card);
  background-image: var(--halftone);
  background-size: var(--halftone-grid);
  border-inline-start: var(--border-poster) solid var(--amarillo);
  animation: drawer-in var(--motion) var(--ease);
}

@keyframes drawer-in {
  from {
    transform: translateX(100%);
  }
}

.drawer__group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-block-end: var(--space-4);
}

.drawer__title {
  margin-block-end: var(--space-1);
  font: var(--text-micro) / var(--leading-tight) var(--font-display);
  letter-spacing: var(--track-display);
  text-transform: uppercase;
  color: var(--amarillo);
}

.drawer__link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding-inline: var(--space-2);
  border-block-end: var(--border-hair) solid var(--line);
  color: var(--texto);
  font-size: var(--text-body);
  text-decoration: none;
}

.drawer__link[aria-current] {
  color: var(--amarillo);
  font-weight: 700;
}

@media (hover: hover) {
  .drawer__link:hover {
    color: var(--amarillo);
  }
}

/* Leaving is not a destination, so it does not sit in the list of them. */
.drawer__out {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-block-start: var(--space-2);
}

/* ── Ringside ──────────────────────────────────────────────────────────── */

/*
 * The bar underfoot: what the day has left, and the one thing the page wants
 * next. It fades into the ink rather than sitting on a hard edge, so a log or a
 * table scrolling under it is never cut off by a line that looks like the end.
 */
.ringside {
  position: fixed;
  z-index: 80;
  inset-block-end: 0;
  inset-inline: 0;
  display: flex;
  align-items: center;
  height: var(--ringside);
  padding-inline: var(--space-3);
  background-image: linear-gradient(180deg, transparent, var(--ink) 38%);
  pointer-events: none;
}

.ringside__in {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  pointer-events: auto;
}

/*
 * A readout, not a chip: it is the size of a tap target because both of these
 * go somewhere — the fichas to the tienda, the day's peleas to the Arena.
 */
.ringside__box {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: var(--space-1) var(--space-3);
  background: var(--ink);
  border: var(--border-poster) solid var(--amarillo);
  color: var(--amarillo);
  text-decoration: none;
  white-space: nowrap;
}

/* Nothing left to spend today is the one state this bar has to say out loud,
   and it says it in the colour a loss already wears. */
.ringside__box--spent {
  border-color: var(--rosa);
  color: var(--rosa);
}

.ringside__value {
  font: var(--text-body) / 1 var(--font-display);
  font-variant-numeric: tabular-nums;
}

.ringside__label {
  font: 700 var(--text-micro) / 1 var(--font-data);
  letter-spacing: var(--track-micro);
  text-transform: uppercase;
  color: var(--dim);
}

.ringside__call {
  flex: 1;
  min-width: 0;
}

/* ── What the shell costs the page ─────────────────────────────────────── */

/*
 * One class on <body>, so no surface has to know it is being framed. The two
 * bars are fixed, and the page under them has to clear both or the marquee eats
 * a heading and the ringside buries the last line of a fight.
 */
.is-framed main {
  padding-block: var(--marquee) var(--ringside);
}

/* The locale switch moved into the drawer, so its footer only exists on the
   pages the shell does not frame. */
.is-framed .site-footer {
  display: none;
}

/*
 * The marquee carries the mark on every framed page, so the page's own copy of
 * it goes: printing a wordmark twice on one screen is how a venue starts
 * looking like a website again. The eyebrow beside it stays — it says which
 * room you are in, which the marquee does not.
 *
 * Done here rather than in thirty templates because that is exactly what it
 * is: a consequence of being framed, and no surface should have to know.
 */
.is-framed .masthead .wordmark {
  display: none;
}

/* The install prompt is offered over the ringside bar and has to clear it. */
.is-framed .install-prompt {
  inset-block-end: calc(var(--ringside) + var(--space-2));
}

/* ui.css grows the page so the prompt never buries the log it is congratulating;
   framed, it has the ringside to clear as well. */
.is-framed:has(.install-prompt:not([hidden])) {
  padding-block-end: calc(15rem + var(--ringside));
}
