/* Spotlight position must be registered so the dim mask glides between seats. */
@property --sx {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 50%;
}

@property --sy {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 50%;
}

:root {
  color-scheme: light;
  --ink: #182026;
  --muted: #65706e;
  --paper: #fbfaf4;
  --panel: rgba(251, 250, 244, 0.92);
  --line: rgba(24, 32, 38, 0.12);
  --accent: #d49a38;
  --accent-strong: #b85639;
  --blue: #315f72;
  --green: #4c7b5d;
  --shadow: 0 24px 64px rgba(24, 32, 38, 0.18);
  --radius: 8px;
  /* committee_room.png is 2820 x 1504 */
  --room-ratio: 2820 / 1504;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    linear-gradient(120deg, rgba(44, 76, 78, 0.1) 0 1px, transparent 1px 48px),
    linear-gradient(30deg, rgba(105, 81, 52, 0.12) 0 1px, transparent 1px 52px),
    #dde3d7;
}

button {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 390px);
  gap: clamp(14px, 2vw, 24px);
  min-height: 100vh;
  padding: clamp(12px, 2vw, 26px);
}

.stage-panel,
.control-panel {
  min-width: 0;
}

.stage-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- header ---------- */

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 4px 0;
}

.eyebrow,
.panel-heading {
  margin: 0 0 7px;
  color: #5d6a64;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow-date {
  margin-left: 6px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(1.45rem, 2.3vw, 2.5rem);
  line-height: 1.02;
}

.provenance {
  max-width: 640px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.provenance a {
  color: var(--blue);
  font-weight: 800;
  text-decoration-color: rgba(49, 95, 114, 0.4);
}

.header-side {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 8px;
}

.session-picker[hidden] {
  display: none;
}

.session-picker {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.session-picker select,
.speed-label select {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.turn-meter {
  display: grid;
  min-width: 82px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(251, 250, 244, 0.78);
  text-align: right;
  box-shadow: 0 12px 30px rgba(24, 32, 38, 0.08);
}

.turn-meter span:first-child {
  font-size: 1.2rem;
  font-weight: 850;
  white-space: nowrap;
}

.turn-meter span:last-child {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* ---------- stage ---------- */

.stage-frame {
  position: relative;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--room-ratio);
  overflow: hidden;
  border: 1px solid rgba(24, 32, 38, 0.16);
  border-radius: var(--radius);
  background: #20313a;
  isolation: isolate;
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 80px rgba(16, 24, 28, 0.28);
}

.room-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Dims the whole room except a soft ellipse around the active speaker. */
.room-dim {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: rgba(14, 22, 26, 0.34);
  -webkit-mask-image: radial-gradient(
    ellipse 15% 24% at var(--sx) var(--sy),
    transparent 30%,
    rgba(0, 0, 0, 0.95) 80%
  );
  mask-image: radial-gradient(
    ellipse 15% 24% at var(--sx) var(--sy),
    transparent 30%,
    rgba(0, 0, 0, 0.95) 80%
  );
  transition:
    --sx 520ms cubic-bezier(0.2, 0.78, 0.22, 1),
    --sy 520ms cubic-bezier(0.2, 0.78, 0.22, 1);
}

.spotlight {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  transform: translate(-50%, -54%);
  border-radius: 50%;
  background: radial-gradient(
    closest-side,
    rgba(255, 228, 148, 0.42),
    rgba(255, 228, 148, 0.14) 58%,
    transparent 74%
  );
  mix-blend-mode: screen;
  transition:
    left 520ms cubic-bezier(0.2, 0.78, 0.22, 1),
    top 520ms cubic-bezier(0.2, 0.78, 0.22, 1),
    width 520ms ease,
    height 520ms ease;
}

.spotlight::after {
  content: "";
  position: absolute;
  inset: 20%;
  border: 2.5px solid var(--spot-color, #f2c14e);
  border-radius: 50%;
  opacity: 0.8;
  animation: spotlightPulse 2.4s ease-in-out infinite;
}

.seat-nameplate {
  position: absolute;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 240px;
  padding: 4px 11px;
  transform: translate(-50%, 0);
  border: 1px solid rgba(24, 32, 38, 0.28);
  border-radius: 999px;
  background: var(--speaker-soft, #f7dfa2);
  box-shadow: 0 10px 22px rgba(24, 32, 38, 0.32);
  font-size: 0.74rem;
  white-space: nowrap;
  transition:
    left 520ms cubic-bezier(0.2, 0.78, 0.22, 1),
    top 520ms cubic-bezier(0.2, 0.78, 0.22, 1);
}

.seat-nameplate strong {
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
}

.seat-nameplate span {
  color: rgba(24, 32, 38, 0.66);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* ---------- speech bubble ---------- */

.speech-bubble {
  --arrow-x: 50%;
  position: absolute;
  z-index: 9;
  width: min(460px, calc(100% - 28px));
  max-height: min(44vh, 350px);
  padding: clamp(14px, 1.6vw, 20px);
  border: 1px solid rgba(24, 32, 38, 0.16);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(252, 248, 232, 0.98));
  box-shadow: 0 22px 52px rgba(24, 32, 38, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -100%) scale(0.98);
  transition:
    left 320ms ease,
    top 320ms ease,
    opacity 180ms ease,
    transform 320ms ease;
}

.speech-bubble.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -100%) scale(1);
}

.speech-bubble[data-placement="bottom"] {
  transform: translate(-50%, 0) scale(0.98);
}

.speech-bubble[data-placement="bottom"].is-visible {
  transform: translate(-50%, 0) scale(1);
}

.speech-bubble.pop {
  animation: bubblePop 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.speech-bubble[data-placement="bottom"].pop {
  animation-name: bubblePopBottom;
}

/* On small screens the bubble sits below the stage as a card. */
.speech-bubble[data-placement="static"] {
  position: static;
  width: auto;
  max-height: none;
  margin-top: 10px;
  transform: none;
  animation: none;
}

.speech-bubble[data-placement="static"] .bubble-arrow {
  display: none;
}

.bubble-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.bubble-speaker {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  padding: 5px 9px;
  border-radius: 999px;
  color: #14191d;
  background: var(--speaker-soft, #f7dfa2);
  font-size: 0.75rem;
  font-weight: 900;
}

.bubble-count {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.speech-bubble p {
  max-height: min(30vh, 230px);
  margin: 0;
  overflow: auto;
  color: #1d252a;
  font-size: clamp(0.92rem, 1.25vw, 1.13rem);
  line-height: 1.45;
}

.bubble-arrow {
  position: absolute;
  left: var(--arrow-x);
  bottom: -9px;
  width: 18px;
  height: 18px;
  transform: translateX(-50%) rotate(45deg);
  border-right: 1px solid rgba(24, 32, 38, 0.16);
  border-bottom: 1px solid rgba(24, 32, 38, 0.16);
  background: rgba(252, 248, 232, 0.98);
}

.speech-bubble[data-placement="bottom"] .bubble-arrow {
  top: -9px;
  bottom: auto;
  border: 0;
  border-top: 1px solid rgba(24, 32, 38, 0.16);
  border-left: 1px solid rgba(24, 32, 38, 0.16);
}

/* ---------- chapter banner ---------- */

.chapter-banner {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(24, 32, 38, 0.08);
}

.chapter-label {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5d6a64;
}

.chapter-takeaway {
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.35;
}

/* ---------- control panel ---------- */

.control-panel {
  position: sticky;
  top: clamp(12px, 2vw, 26px);
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100vh - clamp(24px, 4vw, 52px));
}

.control-dock {
  display: grid;
  grid-template-columns: 1fr 1.35fr 1fr;
  gap: 10px;
}

.control-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid rgba(24, 32, 38, 0.14);
  border-radius: var(--radius);
  box-shadow: 0 14px 28px rgba(24, 32, 38, 0.13);
  cursor: pointer;
  font-weight: 900;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

.control-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.control-button .icon-play path {
  fill: currentColor;
  stroke: none;
}

.control-button.primary {
  color: #fff9eb;
  background: linear-gradient(180deg, #bf6a42, #9b4630);
}

.control-button.secondary {
  color: #1e2a2f;
  background: rgba(251, 250, 244, 0.96);
}

.control-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(24, 32, 38, 0.17);
}

.control-button:active:not(:disabled) {
  transform: translateY(1px);
}

.control-button:disabled {
  cursor: default;
  opacity: 0.42;
  box-shadow: none;
}

.dock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.speed-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.keys-hint {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

/* ---------- progress ---------- */

.progress-track {
  position: relative;
  height: 12px;
  border: 1px solid rgba(24, 32, 38, 0.1);
  border-radius: 999px;
  background: rgba(251, 250, 244, 0.58);
  cursor: pointer;
}

.progress-track > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4c7b5d, #d49a38 58%, #b85639);
  transition: width 240ms ease;
}

.chapter-ticks {
  position: absolute;
  inset: 0;
}

.chapter-tick {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 14px;
  padding: 0;
  transform: translateX(-50%);
  border: 0;
  background: transparent;
  cursor: pointer;
}

.chapter-tick::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: rgba(24, 32, 38, 0.38);
}

.chapter-tick:hover::after {
  background: var(--accent-strong);
}

/* ---------- tabs ---------- */

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.tab-button {
  min-height: 36px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(251, 250, 244, 0.7);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  transition: background 160ms ease, color 160ms ease;
}

.tab-button[aria-selected="true"] {
  border-color: rgba(49, 95, 114, 0.45);
  background: #315f72;
  color: #f3f8f5;
}

.tab-button:hover:not([aria-selected="true"]) {
  background: rgba(251, 250, 244, 1);
  color: var(--ink);
}

.tab-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 16px 38px rgba(24, 32, 38, 0.11);
  overscroll-behavior: contain;
}

.panel-note {
  margin: 2px 2px 10px;
  color: var(--muted);
  font-size: 0.76rem;
}

/* ---------- dialogue rail ---------- */

.dialogue-rail {
  display: grid;
  gap: 7px;
}

.rail-chapter {
  margin: 10px 2px 2px;
  color: #5d6a64;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.rail-chapter:first-child {
  margin-top: 2px;
}

.rail-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.46);
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.rail-item:hover {
  border-color: rgba(24, 32, 38, 0.18);
  color: var(--ink);
}

.rail-item.is-current {
  border-color: rgba(49, 95, 114, 0.3);
  background: rgba(232, 243, 238, 0.95);
  color: var(--ink);
}

.rail-index {
  font-size: 0.74rem;
  font-weight: 900;
}

.rail-copy {
  min-width: 0;
}

.rail-speaker {
  display: block;
  overflow: hidden;
  color: var(--speaker-color, inherit);
  font-size: 0.76rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-item.is-current .rail-speaker {
  color: inherit;
}

.rail-line {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 0.78rem;
  line-height: 1.28;
}

/* ---------- chapter list ---------- */

.chapter-list {
  display: grid;
  gap: 8px;
}

.chapter-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.46);
  cursor: pointer;
  text-align: left;
}

.chapter-item:hover {
  border-color: rgba(24, 32, 38, 0.18);
}

.chapter-item.is-current {
  border-color: rgba(49, 95, 114, 0.32);
  background: rgba(232, 243, 238, 0.95);
}

.chapter-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #315f72;
  color: #f3f8f5;
  font-size: 0.74rem;
  font-weight: 900;
}

.chapter-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.chapter-name {
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--ink);
}

.chapter-note {
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.32;
}

.chapter-range {
  color: #5d6a64;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- cast list ---------- */

.cast-list {
  display: grid;
  gap: 8px;
}

.cast-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.46);
  cursor: pointer;
  text-align: left;
}

.cast-item:hover {
  border-color: rgba(24, 32, 38, 0.18);
}

.cast-item.is-active {
  border-color: rgba(49, 95, 114, 0.32);
  background: var(--speaker-soft, rgba(232, 243, 238, 0.95));
}

.cast-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--speaker-color, #52636a);
  color: #fdfcf6;
  font-size: 0.72rem;
  font-weight: 900;
}

.cast-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.cast-name {
  font-size: 0.86rem;
  font-weight: 900;
  color: var(--ink);
}

.cast-role {
  color: #4a5a56;
  font-size: 0.74rem;
  font-weight: 700;
}

.cast-description {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.32;
}

.cast-count {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(24, 32, 38, 0.08);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
}

/* ---------- about ---------- */

.about-copy h3 {
  margin: 14px 2px 6px;
  color: #5d6a64;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.about-copy h3:first-child {
  margin-top: 2px;
}

.about-copy p {
  margin: 0 2px 10px;
  color: var(--ink);
  font-size: 0.84rem;
  line-height: 1.5;
}

.about-copy a {
  color: var(--blue);
  font-weight: 800;
}

/* ---------- animation ---------- */

@keyframes spotlightPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.07);
    opacity: 0.55;
  }
}

@keyframes bubblePop {
  0% {
    opacity: 0;
    transform: translate(-50%, -94%) scale(0.92);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1);
  }
}

@keyframes bubblePopBottom {
  0% {
    opacity: 0;
    transform: translate(-50%, 6%) scale(0.92);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .app {
    grid-template-columns: 1fr;
    padding-bottom: 130px;
  }

  .control-panel {
    position: static;
    height: auto;
  }

  .tab-panel {
    max-height: 48vh;
  }

  .control-dock {
    position: fixed;
    left: 50%;
    bottom: 14px;
    z-index: 40;
    width: min(480px, calc(100vw - 24px));
    padding: 8px;
    transform: translateX(-50%);
    border: 1px solid rgba(24, 32, 38, 0.13);
    border-radius: var(--radius);
    background: rgba(251, 250, 244, 0.88);
    box-shadow: 0 18px 48px rgba(24, 32, 38, 0.22);
    backdrop-filter: blur(16px);
  }

  .progress-track {
    position: fixed;
    left: 50%;
    bottom: 80px;
    z-index: 41;
    width: min(480px, calc(100vw - 24px));
    transform: translateX(-50%);
    background: rgba(251, 250, 244, 0.94);
    box-shadow: 0 10px 24px rgba(24, 32, 38, 0.13);
  }

  .dock-row {
    justify-content: start;
  }

  .keys-hint {
    display: none;
  }
}

@media (max-width: 720px) {
  .app {
    padding: 10px 10px 130px;
  }

  .app-header {
    flex-direction: column;
    align-items: start;
    gap: 10px;
  }

  .header-side {
    flex-direction: row;
    align-items: center;
  }

  .seat-nameplate {
    font-size: 0.62rem;
    padding: 3px 8px;
  }

  .chapter-banner {
    flex-direction: column;
    gap: 4px;
  }

  .control-button {
    min-height: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

/* ---------- glossary tooltips ---------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* A term a layman may not know: hover or focus for a one-line definition. */
.gloss-term {
  position: relative;
  padding: 0 1px;
  border-radius: 3px;
  color: inherit;
  cursor: help;
  font-weight: 800;
  text-decoration: underline dotted rgba(49, 95, 114, 0.6);
  text-underline-offset: 3px;
  transition: background 160ms ease;
}

.gloss-term:hover,
.gloss-term:focus {
  background: rgba(212, 154, 56, 0.26);
  outline: none;
}

.gloss-term:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

/* The tooltip lives on <body>, not inside the term: the speech bubble is a
   scroll container, and an absolutely-positioned child would be clipped by it. */
.gloss-tip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  max-width: min(272px, 66vw);
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #182026;
  color: #f4f2e8;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.46;
  text-align: left;
  box-shadow: 0 18px 38px rgba(24, 32, 38, 0.34);
  opacity: 0;
  pointer-events: none;
  transform: translateY(5px);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.gloss-tip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.gloss-tip::after {
  content: "";
  position: absolute;
  left: var(--arrow-x, 50%);
  border: 6px solid transparent;
  transform: translateX(-50%);
}

.gloss-tip.is-above::after {
  top: 100%;
  border-top-color: #182026;
}

.gloss-tip.is-below::after {
  bottom: 100%;
  border-bottom-color: #182026;
}

/* ---------- home page ---------- */

.home-page {
  max-width: 820px;
  margin: 0 auto;
  /* Lets a tooltip rise out of its card without ever widening the page. */
  overflow-x: clip;
  padding: clamp(14px, 3vw, 40px) clamp(14px, 3vw, 32px) clamp(26px, 4vw, 52px);
}

.home-intro {
  /* An <h1> so the page keeps a heading; sized as body copy, not a title. */
  margin: 0 2px 14px;
  line-height: 1.45;
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 800;
}

/* ---------- the three committee types ---------- */

.committee-type {
  --type-accent: var(--blue);
  margin: 0 0 14px;
  padding: clamp(14px, 2vw, 19px) clamp(15px, 2.2vw, 22px);
  border: 1px solid var(--line);
  border-left: 4px solid var(--type-accent);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(24, 32, 38, 0.08);
}

.committee-type-select {
  --type-accent: var(--accent-strong);
  border-color: rgba(212, 154, 56, 0.42);
  border-left-color: var(--type-accent);
  background: linear-gradient(
      180deg,
      rgba(212, 154, 56, 0.17),
      rgba(212, 154, 56, 0.07)
    ),
    var(--panel);
}

.committee-type-lords {
  --type-accent: var(--green);
}

.type-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.type-number {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--type-accent);
  color: #f7f5ec;
  font-size: 0.74rem;
  font-weight: 900;
}

.type-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.04rem;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.type-lede {
  margin: 0;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.52;
}

.type-lead-in {
  margin: 15px 0 10px;
  padding-top: 13px;
  border-top: 1px dashed rgba(24, 32, 38, 0.15);
  color: #4a5a56;
  font-size: 0.82rem;
  font-weight: 800;
}

.type-note {
  margin: 12px 0 0;
  padding: 9px 12px;
  border-left: 2px solid var(--type-accent);
  border-radius: 0 6px 6px 0;
  background: rgba(255, 255, 255, 0.5);
  color: #4a5a56;
  font-size: 0.8rem;
  line-height: 1.46;
}

.type-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.type-list > li {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: start;
  color: var(--ink);
  font-size: 0.875rem;
  line-height: 1.5;
}

.type-list > li::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: 0.52em;
  border-radius: 2px;
  background: var(--type-accent);
  opacity: 0.55;
}

/* The one kind of meeting this site retells: a link into the session browser. */
/* Sits in the list like every other point — bullet and all — while its link
   stays a full-width button. */
.type-list > li.oral-evidence-highlight {
  margin: 3px 0;
}

.type-list > li.oral-evidence-highlight::before {
  /* Drop the dot to the button's first line of text, past its padding. */
  margin-top: calc(0.52em + 12px);
}

.oral-evidence-link {
  display: block;
  padding: 12px 14px;
  border: 1px solid rgba(184, 86, 57, 0.42);
  border-radius: var(--radius);
  background: linear-gradient(
    180deg,
    rgba(184, 86, 57, 0.22),
    rgba(212, 154, 56, 0.16)
  );
  box-shadow: 0 10px 24px rgba(155, 70, 48, 0.13);
  color: var(--ink);
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.oral-evidence-link:hover,
.oral-evidence-link:focus-visible {
  transform: translateY(-1px);
  background: linear-gradient(
    180deg,
    rgba(184, 86, 57, 0.3),
    rgba(212, 154, 56, 0.22)
  );
  box-shadow: 0 16px 32px rgba(155, 70, 48, 0.2);
}

.oral-evidence-text {
  /* Inherits the list's size, weight and leading so it reads as one of the
     bullets rather than a heading. */
  display: block;
}

.oral-evidence-cue {
  display: block;
  margin-top: 8px;
  color: var(--accent-strong);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.type-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  /* Dense so the wide Grand Committees group doesn't strand empty cells on the
     row above it. */
  grid-auto-flow: row dense;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.type-chip {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.42;
  transition:
    background 160ms ease,
    border-color 160ms ease;
}

/* In a chip the dotted underline alone marks the term, so the grid stays even. */
.type-chip .gloss-term {
  font-weight: inherit;
}

.type-chip:hover {
  border-color: rgba(24, 32, 38, 0.2);
  background: rgba(255, 255, 255, 0.85);
}

/* ---------- meeting menu ---------- */

.home-link {
  display: inline-block;
  margin-bottom: 14px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
}

.home-link:hover {
  background: rgba(212, 154, 56, 0.15);
}

.meeting-menu {
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 48px) clamp(16px, 3vw, 32px);
}

.menu-header h1 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 3.4vw, 2.2rem);
  color: var(--ink);
}

.menu-header p {
  margin: 0 0 18px;
  color: var(--muted);
  max-width: 56ch;
}

.menu-modes {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 26px;
  padding: 4px;
  background: rgba(24, 32, 38, 0.07);
  border-radius: 999px;
}

.mode-button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 7px 16px;
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.mode-button[aria-pressed="true"] {
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(24, 32, 38, 0.18);
}

.menu-crumb {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.crumb-back {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.crumb-back:hover {
  background: rgba(212, 154, 56, 0.15);
}

.crumb-title {
  font-weight: 700;
  color: var(--ink);
}

.block-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.block {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 154px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(24, 32, 38, 0.07);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.block:hover,
.block:focus-visible,
.block:focus-within,
.block.is-open {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(24, 32, 38, 0.15);
  /* Lift above neighbours so the reveal panel is never clipped by them. */
  z-index: 3;
}

.block-face {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.block-title {
  margin: 0 0 6px;
  font-size: 1rem;
  line-height: 1.32;
  color: var(--ink);
  font-weight: 700;
}

.block-meta {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
}

.block-count {
  margin: auto 0 0;
  padding-top: 12px;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent-strong);
}

.block-link .block-count {
  padding-right: 22px;
}

.block-go {
  position: absolute;
  right: 14px;
  bottom: 13px;
  font-size: 1.1rem;
  color: var(--accent-strong);
}

/* Hover panel listing the sessions inside an inquiry block. */
.block-reveal {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  background: var(--paper);
  border-radius: var(--radius);
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
}

.block:hover .block-reveal,
.block:focus-within .block-reveal,
.block.is-open .block-reveal {
  opacity: 1;
  pointer-events: auto;
}

.reveal-title {
  margin: 0 0 6px;
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
}

.reveal-session {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.reveal-session:hover,
.reveal-session:focus-visible {
  background: rgba(212, 154, 56, 0.18);
}

.reveal-session-name {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}

.reveal-session-date {
  font-size: 0.72rem;
  color: var(--muted);
}

.menu-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}

.menu-button:hover {
  background: rgba(212, 154, 56, 0.15);
}

/* ---------- home page: grouped chips and the blinking cue ---------- */

/* A dotted ring drawn around the three chips, with the label sitting on the
   border like a fieldset legend, so they still read as chips in the grid. */
.type-chip-group {
  position: relative;
  grid-column: 1 / -1;
  /* Pull the ring outwards by exactly its border + padding, so the chips inside
     sit on the same margin as the chips outside it. */
  margin-inline: -10px;
  padding: 9px;
  border: 1px dashed rgba(24, 32, 38, 0.34);
  border-radius: var(--radius);
  background: transparent;
}

.chip-group-label {
  position: absolute;
  top: -7px;
  left: 11px;
  padding: 0 6px;
  /* Masks the dashed line behind the text. */
  background: var(--panel);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.type-chips-nested {
  margin: 0;
  padding: 0;
}

@keyframes cue-blink {
  0%,
  45% {
    opacity: 1;
  }
  55%,
  100% {
    opacity: 0.15;
  }
}

.oral-evidence-cue {
  animation: cue-blink 1.05s steps(1, end) infinite;
}

/* A blinking label is a motion trigger for some readers. */
@media (prefers-reduced-motion: reduce) {
  .oral-evidence-cue {
    animation: none;
  }
}

/* ---------- who's who groups ---------- */

.cast-group {
  margin: 14px 0 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.cast-group:first-child {
  margin-top: 0;
}
