/* ============================================================================
   class-app shell: the chrome around the deck.

   Everything here is view and panel styling for the four surfaces. The DECK
   itself lives in slides.css, and the split follows the open-day app's line:
   anything inside `.slide` is deck, everything else is chrome.

   No bundler touches this file. A new .css file here is invisible until its
   <link> is added to index.html, after tokens.css.

   RTL is global (tokens.css sets direction: rtl on html/body), so logical
   properties are used throughout - padding-inline, inset-inline, margin-inline.
   The two exceptions are marked where they appear, and both are the scaled
   slide canvas, which is a physical coordinate system on purpose.
   ============================================================================ */

/* ── Shared shell ──────────────────────────────── */
.cl-view {
  min-block-size: 100dvh;
  padding: var(--space-lg) var(--space-md) var(--space-2xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.cl-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.cl-panel__title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* The 3-stop brand hairline. Used under the two sign-in titles and nowhere
   else: the gradient reads as a brand mark precisely because it is rare. */
.cl-gate__title {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-color);
}

.cl-gate__title::after {
  content: '';
  display: block;
  inline-size: 96px;
  block-size: 2px;
  margin-block-start: var(--space-md);
  border-radius: 2px;
  background: linear-gradient(90deg, #0894ff 0%, #bd32d6 50%, #ffa304 100%);
}

.cl-gate__body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* ── Controls ──────────────────────────────────── */
.cl-btn {
  appearance: none;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-color);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.cl-btn:hover:not(:disabled) {
  background: var(--fsp-hover-bg);
  border-color: var(--primary-border);
}

.cl-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.cl-btn--primary {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.cl-btn--primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.cl-btn--ghost {
  background: transparent;
  border-color: var(--border-default);
  color: var(--text-secondary);
  font-weight: 400;
}

.cl-btn--small {
  font-size: 13px;
  padding: 6px 14px;
}

/* Armed state of a two-press destructive control (lib/armed.ts). Warm rather
   than red: it is a prompt to confirm, not a warning about damage. */
.cl-btn.is-armed {
  background: var(--accent-warm);
  border-color: var(--accent-warm);
  color: #fff;
}

.cl-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.cl-input {
  inline-size: 100%;
  font-family: var(--font-body);
  font-size: 16px; /* 16px or iOS Safari zooms the page on focus */
  padding: 12px 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-color);
}

.cl-input:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 1px;
}

.cl-input--number {
  inline-size: 5rem;
  text-align: center;
}

.cl-error {
  font-size: 14px;
  color: var(--accent-warm);
}

.cl-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.cl-dot {
  inline-size: 8px;
  block-size: 8px;
  border-radius: var(--radius-full);
  background: var(--text-tertiary);
  flex: none;
}

.cl-dot.is-on {
  background: var(--primary-color);
}

.cl-dot.is-off {
  background: #c9ccd6;
}

/* ── The scaled slide stage ────────────────────── */
/* A fixed 1920x1080 canvas, transform-scaled to fit. The aspect-ratio box is
   what makes the fit exact: the canvas is anchored at the box's top-left and
   the measured width and height already carry the deck's ratio, so there is no
   letterbox offset to compute. */
.cl-stage {
  position: relative;
  inline-size: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
}

/* PHYSICAL top/left, not inset-inline-start. In an RTL container the logical
   start edge is the RIGHT one, and anchoring a transform-origin: top left
   canvas there scales it off the screen. The canvas is a coordinate system, not
   a text flow. */
.cl-stage__canvas {
  position: absolute;
  top: 0;
  left: 0;
  inline-size: 1920px;
  block-size: 1080px;
  transform-origin: top left;
  /* THE reason the presenter's preview matches the projector: every rule in
     slides.css sizes itself in cqw against this box, which is always 1920 wide
     whatever the screen is. */
  container-type: inline-size;
}

.cl-stage__label {
  position: absolute;
  inset-block-start: 8px;
  inset-inline-start: 10px;
  z-index: 2;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border-light);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.cl-stage--compact {
  border-radius: var(--radius-sm);
}

/* ── /enter ────────────────────────────────────── */
.cl-enter {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.cl-enter__brand {
  margin-block-end: var(--space-lg);
}

.cl-enter__logo {
  inline-size: min(220px, 60vw);
}

.cl-enter__card {
  max-inline-size: 30rem;
  text-align: start;
}

.cl-enter__status {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-secondary);
}

.cl-enter__title {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-color);
}

.cl-enter__body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.cl-enter__cta {
  align-self: flex-start;
  text-decoration: none;
}

/* ── /display ──────────────────────────────────── */
/* The projector window. No padding and no chrome: the deck is the screen. */
.cl-display {
  padding: 0;
  display: grid;
  place-items: center;
  gap: 0;
  block-size: 100dvh;
}

.cl-display .cl-stage {
  border: none;
  border-radius: 0;
  max-block-size: 100dvh;
  max-inline-size: 100vw;
}

.cl-display__gate {
  max-inline-size: 24rem;
}

.cl-display__badge {
  position: fixed;
  inset-block-end: var(--space-lg);
  inset-inline-end: var(--space-lg);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.6);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  backdrop-filter: blur(6px);
}

.cl-display__pin {
  color: var(--accent-warm);
}

/* ── / (student) ───────────────────────────────── */
.cl-student {
  max-inline-size: 44rem;
  inline-size: 100%;
  margin-inline: auto;
}

.cl-student__gate {
  max-inline-size: 30rem;
  margin-inline: auto;
  margin-block-start: var(--space-2xl);
}

.cl-student__gate .cl-btn {
  align-self: flex-start;
  text-decoration: none;
}

.cl-student__bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.cl-student__mark {
  inline-size: 34px;
  flex: none;
}

.cl-student__meeting {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-inline-size: 0;
}

.cl-student__meeting-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-color);
}

.cl-student__actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.cl-student__actions .cl-btn {
  font-size: 13px;
  padding: 6px 14px;
  text-decoration: none;
}

.cl-student__deck {
  scroll-margin-block-start: var(--space-md);
}

/* Browse bar. The chevron direction is not flipped in CSS: the labels are
   words, so there is nothing to mirror. */
.cl-browse {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.cl-browse__btn {
  appearance: none;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--primary-color);
  padding: 8px 4px;
  cursor: pointer;
}

.cl-browse__btn:disabled {
  color: var(--text-tertiary);
  cursor: default;
}

.cl-browse__count {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-tertiary);
}

/* The catch-up control. Sticky rather than fixed, so it rides the reading
   position instead of covering the answer panel on a short screen. */
.cl-backlive {
  position: sticky;
  inset-block-start: var(--space-md);
  z-index: 4;
  align-self: center;
  appearance: none;
  border: 1px solid var(--primary-border);
  background: var(--primary-color);
  color: #fff;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 22px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.cl-answer__note,
.cl-answer__prompt {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.cl-answer__prompt {
  color: var(--text-color);
  font-weight: 500;
}

.cl-answer__mine {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-md);
  background: var(--primary-light);
  border-radius: var(--radius-md);
}

.cl-answer__mine-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.cl-answer__mine-text {
  font-size: 15px;
  color: var(--text-color);
  overflow-wrap: anywhere;
}

/* The anonymity statement. Quiet, but always present on the surface where
   somebody is deciding whether to answer honestly. */
.cl-answer__privacy {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-tertiary);
  padding-block-start: var(--space-sm);
  border-block-start: 1px solid var(--border-light);
}

/* ── Free text ─────────────────────────────────── */
.cl-textform {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.cl-textform__label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.cl-textform__input {
  inline-size: 100%;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  padding: 12px 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-color);
  resize: vertical;
}

.cl-textform__input:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 1px;
}

.cl-textform__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.cl-textform__count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ── Q&A ───────────────────────────────────────── */
.cl-qa__title {
  font-size: 17px;
  font-weight: 500;
  color: var(--text-color);
}

.cl-qa__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.cl-qa__item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.cl-qa__item.is-answered {
  opacity: 0.6;
}

.cl-qa__vote {
  appearance: none;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  cursor: pointer;
  flex: none;
}

.cl-qa__vote:disabled {
  background: var(--primary-light);
  border-color: var(--primary-border);
  cursor: default;
}

.cl-qa__votes {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-color);
}

.cl-qa__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  min-inline-size: 0;
}

.cl-qa__body {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-color);
  flex: 1 1 auto;
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

.cl-qa__asker {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
}

.cl-qa__actions {
  display: flex;
  gap: var(--space-xs);
  flex: none;
}

.cl-qa__tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--primary-color);
  flex: none;
}

.cl-qa__empty {
  font-size: 14px;
  color: var(--text-tertiary);
}

/* ── /presenter ────────────────────────────────── */
.cl-presenter {
  max-inline-size: 46rem;
  inline-size: 100%;
  margin-inline: auto;
}

.cl-presenter__gate {
  max-inline-size: 24rem;
  margin-inline: auto;
  margin-block-start: var(--space-2xl);
}

.cl-console {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.cl-console__status {
  justify-content: flex-start;
  gap: var(--space-sm);
}

.cl-console__index {
  margin-inline-start: auto;
  color: var(--text-tertiary);
}

/* The deck controls. Sticky at the bottom of the viewport so Back and Next stay
   under a thumb however far the queue below has been scrolled - the one thing on
   this surface that must never require two hands or a scroll. */
.cl-deckbar {
  position: sticky;
  inset-block-end: 0;
  z-index: 6;
  display: flex;
  gap: var(--space-sm);
  padding-block: var(--space-sm);
  background: linear-gradient(to top, var(--bg-secondary) 65%, transparent);
}

.cl-deckbar__btn {
  appearance: none;
  flex: 1 1 0;
  min-block-size: 60px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-color);
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 500;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.cl-deckbar__btn--primary {
  flex: 2 1 0;
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.cl-notes__body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-color);
  white-space: pre-wrap;
  max-block-size: 9rem;
  overflow-y: auto;
}

.cl-notes__empty,
.cl-nextslide__empty,
.cl-groups__empty {
  font-size: 14px;
  color: var(--text-tertiary);
}

.cl-interaction__prompt {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-color);
}

.cl-interaction__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
}

.cl-interaction__count {
  color: var(--primary-color);
}

.cl-interaction__actions,
.cl-timer__actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.cl-groups__controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.cl-groups__lists {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.cl-groups__bucket-title {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-block-end: var(--space-xs);
}

.cl-groups__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.cl-groups__group {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  font-size: 15px;
  color: var(--text-color);
}

.cl-groups__badge,
.cl-group__badge {
  font-family: var(--font-mono);
  font-size: 13px;
  min-inline-size: 1.8rem;
  text-align: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary-color);
  flex: none;
}

.cl-groups__members {
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

.cl-timer__readout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* Solid colour, never the brand gradient: this is a large numeral at weight
   500, and the gradient is only ever applied to light letterforms. */
.cl-timer__elapsed {
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 500;
  color: var(--primary-color);
  letter-spacing: -0.01em;
}

.cl-timer__slide {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-secondary);
}

.cl-timer__note {
  font-size: 12px;
  color: var(--text-tertiary);
}

.cl-timer__break {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  font-size: 14px;
  color: var(--text-color);
  padding: var(--space-md);
  background: var(--accent-warm-light);
  border-radius: var(--radius-md);
}

.cl-timer__dismiss {
  appearance: none;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  flex: none;
}

/* ── Install ───────────────────────────────────── */
.cl-guide {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: end center;
}

.cl-guide__scrim {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 40, 0.45);
}

.cl-guide__sheet {
  position: relative;
  inline-size: min(30rem, 100%);
  background: var(--bg-surface);
  border-start-start-radius: var(--radius-xl);
  border-start-end-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-lg) var(--space-2xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  box-shadow: var(--shadow-lg);
}

.cl-guide__title {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-color);
}

.cl-guide__lede {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.cl-guide__steps {
  /* RTL list indentation is padding-RIGHT, per the repo convention. */
  padding-right: 1.2em;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-color);
}

.cl-guide__close {
  align-self: flex-start;
}

/* ── Breakpoints: 1024 tablet, 767 mobile ──────── */
@media (max-width: 1024px) {
  .cl-view {
    padding-inline: var(--space-md);
  }
}

@media (max-width: 767px) {
  .cl-view {
    padding-block-start: var(--space-md);
  }

  .cl-card {
    padding: var(--space-md);
  }

  .cl-deckbar__btn {
    min-block-size: 68px;
    font-size: 19px;
  }

  .cl-qa__item {
    flex-wrap: wrap;
  }

  .cl-qa__main {
    flex-basis: 100%;
    order: 3;
  }

  .cl-student__actions {
    flex-basis: 100%;
  }
}
