/* ===========================================================================
 * Regio Clarity — Application Styles
 * ---------------------------------------------------------------------------
 * Layout, glassmorphism, view transitions, components.
 * Tokens come from tokens.css.
 * =========================================================================*/

/* ============================ App shell ================================ */
#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ============================ View Transitions ========================== */
/* Native View Transitions API (Safari 18+, Chrome 111+) */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 280ms;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  }
  ::view-transition-old(root) {
    animation-name: vt-fade-out;
  }
  ::view-transition-new(root) {
    animation-name: vt-fade-slide-in;
  }
}

@keyframes vt-fade-out {
  to { opacity: 0; }
}
@keyframes vt-fade-slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* CSS fallback for browsers without View Transitions */
.view.entering {
  animation: vt-fade-slide-in 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================ Top app bar ============================== */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(1rem + var(--safe-top)) 1.5rem 1rem;
  background: var(--background);
  /* No 1px border — tonal shift only */
}
.app-bar.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.app-bar__title {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-bar__group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Icon button (round, subtle) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  color: var(--primary);
  transition: background 180ms ease, transform 120ms ease;
}
.icon-btn:hover { background: var(--surface-container-low); }
.icon-btn:active { transform: scale(0.92); }

.dark .icon-btn { color: var(--primary-fixed-dim); }

/* ============================ Live indicator ============================ */
.live-card {
  margin: 0 1.5rem 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--surface-container-low);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.live-card__main { display: flex; align-items: center; gap: 1rem; }
.live-card__title { font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.01em; }
.live-card__sub { font-size: 0.8125rem; color: var(--on-surface-variant); margin-top: 2px; }
.live-card__brand {
  font-style: italic;
  font-weight: 700;
  color: var(--primary);
  font-size: 0.875rem;
}
.dark .live-card__brand { color: var(--primary-fixed-dim); }

.live-dot {
  position: relative;
  display: inline-flex;
  width: 0.75rem;
  height: 0.75rem;
  flex-shrink: 0;
}
.live-dot::before,
.live-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  background: var(--primary);
}
.live-dot::before {
  animation: pulse-ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
  opacity: 0.75;
}
.live-card.idle .live-dot::before,
.live-card.idle .live-dot::after { background: var(--on-surface-variant); }
.live-card.idle .live-dot::before { animation: none; opacity: 0; }

@keyframes pulse-ping {
  0%   { transform: scale(1);   opacity: 0.75; }
  75%, 100% { transform: scale(2.2); opacity: 0; }
}

/* ============================ Language card ============================= */
.lang-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0 1.5rem;
}

.lang-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--surface-container-low);
  border-radius: var(--radius-xl);
  transition: background 200ms ease, transform 120ms ease;
}
.lang-card:hover { background: var(--surface-container); }
.lang-card.active {
  background: var(--surface-container-lowest);
  box-shadow:
    var(--shadow-ambient),
    inset 0 0 0 2px var(--primary-container);
}
.dark .lang-card { background: var(--surface-container); }
.dark .lang-card:hover { background: var(--surface-container-high); }
.dark .lang-card.active { background: var(--surface-container-lowest); }

.lang-card__label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.lang-card__name {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--on-surface);
  letter-spacing: -0.005em;
}
.lang-card.active .lang-card__name { color: var(--primary); }
.dark .lang-card.active .lang-card__name { color: var(--primary-fixed-dim); }
.lang-card__sub {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--on-surface-variant);
}
.lang-card__flag {
  font-size: 1.75rem;
  line-height: 1;
  margin-right: 0.25rem;
}

.lang-card__actions { display: flex; align-items: center; gap: 0.75rem; }

.lang-card__read {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-full);
  color: var(--on-surface-variant);
  transition: background 180ms ease, color 180ms ease, transform 120ms ease;
}
.lang-card__read:hover {
  background: var(--surface-container-high);
  color: var(--primary);
}
.lang-card__read:active { transform: scale(0.92); }

.lang-card__play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-full);
  background: var(--surface-container-lowest);
  color: var(--primary);
  box-shadow: var(--shadow-ambient);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.lang-card__play:hover { transform: scale(1.05); }
.lang-card__play:active { transform: scale(0.94); }

.lang-card.active .lang-card__play {
  background: var(--gradient-primary);
  color: #ffffff;
  box-shadow: var(--shadow-fab);
  transform: scale(1.05);
}

/* ============================ Bento info ================================ */
.bento {
  margin: 3rem 1.5rem 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.bento__card {
  background: var(--surface-container-low);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
}
.bento__card.full { grid-column: 1 / -1; }
.bento__icon {
  color: var(--primary);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  display: block;
}
.dark .bento__icon { color: var(--primary-fixed-dim); }
.bento__title {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--on-surface);
  margin-bottom: 0.25rem;
}
.bento__body {
  font-size: 0.8125rem;
  color: var(--on-surface-variant);
  line-height: 1.55;
}

/* ============================ Bottom nav ================================ */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0.5rem 2rem calc(1.5rem + var(--safe-bottom));
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-top-left-radius: var(--radius-2xl);
  border-top-right-radius: var(--radius-2xl);
  box-shadow: 0 -8px 30px rgba(28, 27, 27, 0.06);
}
.dark .bottom-nav {
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem;
  color: var(--on-surface-variant);
  border-radius: var(--radius-full);
  transition: color 180ms ease, transform 180ms ease, background 180ms ease;
}
.nav-btn:hover { color: var(--primary); }
.nav-btn.active { color: var(--primary); }
.dark .nav-btn.active { color: var(--primary-fixed-dim); }

.nav-btn--fab {
  background: var(--gradient-primary);
  color: #ffffff;
  width: 3.75rem;
  height: 3.75rem;
  border-radius: var(--radius-full);
  transform: translateY(-0.5rem) scale(1.05);
  box-shadow: var(--shadow-fab);
}
.nav-btn--fab:hover { color: #ffffff; transform: translateY(-0.5rem) scale(1.10); }

/* Spacer below content so the bottom nav doesn't cover the last item */
.has-bottom-nav {
  padding-bottom: calc(7rem + var(--safe-bottom));
}

/* ============================ Footer brand ============================== */
.brand-footer {
  margin-top: 3rem;
  padding: 3rem 1.5rem;
  background: var(--surface-container-low);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}
.brand-footer__mark {
  font-style: italic;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--surface-container-highest);
  filter: grayscale(1);
  transition: filter 280ms ease, color 280ms ease;
}
.brand-footer__mark:hover { filter: grayscale(0); color: var(--primary); }
.brand-footer__copy {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--on-surface-variant);
}
.brand-footer__link {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--on-surface-variant);
  transition: color 200ms ease;
}
.brand-footer__link:hover { color: var(--primary); }

/* ============================ Transcript view =========================== */
.transcript-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.transcript-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 2rem 0.5rem;
}
.transcript-status__dot {
  position: relative;
  display: inline-flex;
  width: 0.5rem;
  height: 0.5rem;
}
.transcript-status__dot::before,
.transcript-status__dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  background: var(--primary);
}
.transcript-status__dot::before {
  animation: pulse-ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
  opacity: 0.75;
}
.transcript-status.idle .transcript-status__dot::before,
.transcript-status.idle .transcript-status__dot::after {
  background: var(--on-surface-variant);
}
.transcript-status.idle .transcript-status__dot::before { animation: none; opacity: 0; }

.transcript-status__label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
}
.transcript-status.idle .transcript-status__label { color: var(--on-surface-variant); }

/* Connection banner (WS disconnect / reconnect feedback) */
.conn-banner {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin: 0 1.25rem 0.5rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-md, 10px);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  border: 1px solid transparent;
  animation: conn-banner-slide 0.25s ease-out;
}
.conn-banner__icon { flex: 0 0 auto; font-size: 1rem; line-height: 1; }
.conn-banner__text { flex: 1 1 auto; min-width: 0; }
.conn-banner__action {
  flex: 0 0 auto;
  padding: 0.375rem 0.75rem;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  border-radius: var(--radius-sm, 6px);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.conn-banner__action:hover { background: rgba(255, 255, 255, 0.1); }
.conn-banner--warn {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #d97706;
}
.conn-banner--error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
  color: #dc2626;
}
.conn-banner--ok {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
  color: #059669;
}
@keyframes conn-banner-slide {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Transcript feed: column-reverse so newest at the bottom */
.transcript-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 2rem 18rem;
  display: flex;
  flex-direction: column-reverse;
  gap: 2rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.transcript-item {
  animation: slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.transcript-item__text {
  font-size: clamp(1.25rem, 1rem + 1.5vw, 2rem);
  line-height: 1.55;
  letter-spacing: -0.01em;
  font-weight: 500;
  color: var(--on-surface);
}
.transcript-item:nth-child(1) .transcript-item__text { font-weight: 600; }
.transcript-item:nth-child(2) .transcript-item__text { opacity: 0.65; }
.transcript-item:nth-child(3) .transcript-item__text { opacity: 0.40; }
.transcript-item:nth-child(n+4) .transcript-item__text { opacity: 0.25; }

.transcript-item__time {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--on-surface-variant);
  margin-bottom: 0.5rem;
  display: block;
}

.transcript-item__original {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface-container-low);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-style: italic;
  color: var(--on-surface-variant);
  line-height: 1.5;
  display: none;
}
.transcript-item__original.visible { display: block; }
.dark .transcript-item__original { background: var(--surface-container); }

.llm-note {
  font-style: italic;
  color: var(--on-surface-variant);
  font-weight: 400;
}

/* Wide-screen 2-column: original on the right */
@media (min-width: 900px) {
  .transcript-screen.split .transcript-feed {
    padding: 1rem 2.5rem 18rem;
  }
  .transcript-screen.split .transcript-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
  .transcript-screen.split .transcript-item__original {
    display: block;
    margin-top: 0;
    background: transparent;
    padding: 0;
    font-size: 1rem;
    color: var(--on-surface-variant);
    font-style: normal;
  }
}

/* Empty / waiting state */
.waiting {
  padding: 4rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  color: var(--on-surface-variant);
  text-align: center;
}
.pulse-dots {
  display: flex;
  gap: 0.625rem;
}
.pulse-dots span {
  width: 0.875rem;
  height: 0.875rem;
  border-radius: var(--radius-full);
  background: var(--primary-container);
  opacity: 0.25;
  animation: pulse-bounce 1.4s ease-in-out infinite;
}
.pulse-dots span:nth-child(2) { animation-delay: 0.2s; }
.pulse-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse-bounce {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.75); }
  40% { opacity: 1; transform: scale(1.05); }
}

/* ============================ Floating player =========================== */
.player {
  position: fixed;
  left: 1rem;
  right: 1rem;
  /* Sits close to the safe-area bottom; the language view has no app bottom-nav
     so the older 6.5rem offset left a large empty band. 1.5rem keeps a small
     breathing space above the OS gesture/nav area. */
  bottom: calc(1.5rem + var(--safe-bottom));
  z-index: 35;
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--radius-2xl);
  padding: 1.25rem 1.25rem 1rem;
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 32rem;
  margin: 0 auto;
}
.player__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.player__info { display: flex; align-items: center; gap: 0.875rem; min-width: 0; }
.player__icon {
  width: 3rem;
  height: 3rem;
  flex-shrink: 0;
  border-radius: var(--radius-lg);
  background: var(--gradient-primary);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-fab);
}
.player__meta { min-width: 0; }
.player__title {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player__sub {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--on-surface-variant);
  margin-top: 2px;
}

.player__controls { display: flex; align-items: center; gap: 0.5rem; }
.player__btn {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 120ms ease, background 200ms ease;
}
.player__btn--ghost {
  background: var(--surface-container-lowest);
  color: var(--primary);
  box-shadow: var(--shadow-ambient);
}
.player__btn--primary {
  background: var(--gradient-primary);
  color: #ffffff;
  box-shadow: var(--shadow-fab);
}
.player__btn:active { transform: scale(0.92); }
.player__btn:hover { transform: scale(1.04); }

.player__progress {
  height: 4px;
  background: var(--surface-container-high);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.player__progress-fill {
  height: 100%;
  background: var(--primary-container);
  border-radius: var(--radius-full);
  width: 100%;
  animation: progress-flow 6s linear infinite;
}
@keyframes progress-flow {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(0); }
}

.player__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.player__live {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--primary);
}
.player__live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--radius-full);
  background: var(--primary);
  position: relative;
}
.player__live-dot::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--primary);
  opacity: 0.6;
  animation: pulse-ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.player__counter {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--on-surface-variant);
}

/* When player is visible the transcript feed needs space below.
   Reduced in line with the player's new lower bottom-offset (1.5rem). */
.transcript-screen.has-player .transcript-feed {
  padding-bottom: 17rem;
}

/* ============================ Share modal =============================== */
.share-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  /* No flex — we center the modal via absolute + transform instead. */
  overflow-y: auto;
  animation: fade-in 280ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.share-modal {
  /* Absolute center within the fixed .share-overlay. No flex on the
   * parent — position: absolute + top/left 50% + translate(-50%, -50%)
   * is the classic pattern that centers reliably across all browsers. */
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28rem;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 2rem);
  text-align: center;
  /* Top padding reserves room for the absolutely-positioned close button
   * so it never overlaps the title, even with long translations. */
  padding-top: 3rem;
  /* Explicit 1-column grid — without this, the implicit grid auto-sizes
   * the column to content, making the modal shrink-wrap. */
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
}
.share-modal__close {
  position: absolute;
  top: 0.375rem;
  right: 0.375rem;
}
.share-modal__title {
  font-weight: 800;
  font-size: 1.375rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.375rem;
  color: var(--on-surface);
}
.share-modal__sub {
  font-size: 0.875rem;
  color: var(--on-surface-variant);
  margin-bottom: 1.25rem;
  line-height: 1.45;
  max-width: 20rem;
}
/* Full-width wrapper (the grid item). NOT display: contents — that
 * would make .share-modal__qr itself the grid item, and grid's default
 * `min-width: auto` would then force the card to expand to the canvas's
 * intrinsic 320px buffer width, blowing out past the 13rem card box. */
.share-modal__qr-wrap {
  width: 100%;
  text-align: center;
  min-width: 0;
}

/* The QR card is now responsive again — possible because share.js strips
 * the inline width/height styles that the qrcode library injects on the
 * canvas after rendering. Without that strip, inline styles would win
 * over any class-based CSS and force the canvas to its 320px buffer size. */
.share-modal__qr {
  display: block;
  width: 17rem;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  padding: 0.875rem;
  background: var(--surface-container-lowest);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-ambient);
  box-sizing: border-box;
}
.share-modal__qr canvas,
.share-modal__qr svg,
.share-modal__qr img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  max-width: none;
  min-width: 0;
}

.share-modal__link {
  margin: 1.25rem auto 0;
  width: 100%;
  max-width: 22rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-container);
  padding: 0.25rem 0.25rem 0.25rem 1.25rem;
  border-radius: var(--radius-full);
}
.share-modal__link span {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.share-modal__copy {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--gradient-primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.875rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-fab);
  transition: transform 120ms ease;
}
.share-modal__copy:active { transform: scale(0.94); }

.share-modal__quick {
  margin: 1rem auto 0;
  width: 100%;
  max-width: 22rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.share-modal__quick button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.75rem;
  background: var(--surface-container-low);
  border-radius: var(--radius-xl);
  transition: background 200ms ease, transform 120ms ease;
}
.share-modal__quick button:hover { background: var(--surface-container-high); }
.share-modal__quick button:active { transform: scale(0.97); }
.share-modal__quick button .icon-bubble {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-full);
  background: var(--surface-container-lowest);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-ambient);
}
/* Material Symbol icons inside the bubble need an explicit size — the
 * default inherits 1em from body, which looks too small in a 44px circle. */
.share-modal__quick button .icon-bubble .material-symbols-outlined {
  font-size: 1.5rem;
  line-height: 1;
}
/* Brand SVG icons (WhatsApp) — render at the same visual weight. */
.share-modal__quick button .icon-bubble .brand-icon {
  width: 1.5rem;
  height: 1.5rem;
  display: block;
}
/* WhatsApp brand color inside its bubble */
.share-modal__quick button .icon-bubble--whatsapp {
  color: #25D366;
}
.share-modal__quick button span {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--on-surface-variant);
}

/* === Wi-Fi modal specifics (label + row spacing) ======================= */
.wifi-modal__row {
  margin: 1rem auto 0;
  width: 100%;
  max-width: 22rem;
  text-align: left;
}
.wifi-modal__label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--on-surface-variant);
  padding-left: 1.25rem;
  margin-bottom: 0.375rem;
}
.wifi-modal__link {
  margin: 0 auto;
}
.wifi-modal__link > span {
  /* Slightly smaller monospace-ish feel for credentials */
  font-size: 0.8125rem;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--on-surface);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Read-only display (for the SSID — no copy button) */
.wifi-modal__readonly {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-container);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-full);
  margin: 0 auto;
}
.wifi-modal__readonly > span {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--on-surface);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================ Info view ================================= */
.info-view {
  padding: 6rem 1.5rem 8rem;
  max-width: 36rem;
  margin: 0 auto;
}
.info-view h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.info-view h2 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--on-surface-variant);
  margin: 2rem 0 0.75rem;
}
.info-view p {
  line-height: 1.65;
  color: var(--on-surface);
  margin-bottom: 0.875rem;
}
.info-view .info-section {
  background: var(--surface-container-low);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.info-view .schedule-card {
  background: var(--gradient-primary);
  color: #ffffff;
  padding: 1.5rem;
  border-radius: var(--radius-xl);
  margin: 1.5rem 0;
}
.info-view .schedule-card h3 {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 0.25rem;
}
.info-view .schedule-card p {
  color: #ffffff;
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}
.info-view .info-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.info-view .info-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-container-low);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  transition: background 200ms ease;
  width: 100%;
  text-align: left;
}
.info-view .info-action:hover { background: var(--surface-container); }
.info-view .info-action__label { font-weight: 600; }
.info-view .info-action__sub {
  font-size: 0.75rem;
  color: var(--on-surface-variant);
  margin-top: 2px;
}

/* ============================ Material symbols ========================= */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.material-symbols-outlined.fill {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ============================ Utility =================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden { display: none !important; }

/* ===========================================================================
 * Phase 2 additions
 * ===========================================================================
 *  - Landing (radical minimal)
 *  - Player state-machine variants
 *  - Side drawer
 *  - Centered app-bar title
 * =========================================================================*/

/* ============================ Landing =================================== */
.view--landing {
  padding: 0;
  background: var(--background);
}

/* Hero fills exactly one viewport — header + language list, no more.
 * The footer sits below this and is only reached by scrolling, so the
 * initial view has a single uniform dark background all the way down. */
.landing__hero {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--background);
}

.landing__header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(1.25rem + var(--safe-top)) 1.5rem 1.25rem;
  background: var(--background);
}
.landing__header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
  flex-shrink: 0;
}

.landing__title {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  font-family: var(--font-headline);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--on-surface);
}
.landing__title-sub {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-top: 0.2rem;
}
.dark .landing__title-sub { color: var(--primary-fixed-dim); }

.landing__list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  /* Vertically centre the cards in the space between header and footer */
  justify-content: center;
  gap: 0.875rem;
  padding: 0.5rem 1.5rem 2rem;
  max-width: 40rem;
  margin: 0 auto;
  width: 100%;
  min-height: 0;
}

.landing__empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--on-surface-variant);
  font-size: 0.9375rem;
}

.landing-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 1.5rem 1.5rem;
  background: var(--surface-container-low);
  border-radius: var(--radius-xl);
  color: var(--on-surface);
  text-align: left;
  transition: background 200ms ease, transform 120ms ease,
              box-shadow 200ms ease;
  box-shadow: var(--shadow-ambient);
}
.landing-card:hover {
  background: var(--surface-container);
  transform: translateY(-1px);
}
.landing-card:active {
  transform: translateY(0) scale(0.995);
}
.dark .landing-card { background: var(--surface-container); }
.dark .landing-card:hover { background: var(--surface-container-high); }

.landing-card__main {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  flex: 1;
}
.landing-card__flag {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}
.landing-card__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.landing-card__name {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--on-surface);
}
.landing-card__sub {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--on-surface-variant);
}
.landing-card__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  background: var(--surface-container-lowest);
  color: var(--primary);
  flex-shrink: 0;
  transition: transform 200ms ease;
}
.landing-card:hover .landing-card__chevron {
  transform: translateX(2px);
}
.dark .landing-card__chevron {
  background: var(--surface-container-highest);
  color: var(--primary-fixed-dim);
}

.landing__footer {
  margin-top: 2rem;
  padding: 3rem 1.5rem calc(3rem + var(--safe-bottom));
  background: var(--surface-container-low);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}
.landing__logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  text-decoration: none;
  transition: opacity 200ms ease, transform 200ms ease;
}
.landing__logo-wrap:hover {
  opacity: 0.85;
  transform: scale(1.02);
}
.landing__logo-wrap:active {
  transform: scale(0.98);
}
.landing__logo-img {
  display: block;
  height: auto;
  width: auto;
  max-width: min(18rem, 70%);
  max-height: 3rem;
  object-fit: contain;
}
/* Light-mode logo is shown by default; dark-mode variant is hidden.
 * The `.dark` class on <html> flips this. */
.landing__logo-img--light { display: block; }
.landing__logo-img--dark  { display: none; }
.dark .landing__logo-img--light { display: none; }
.dark .landing__logo-img--dark  { display: block; }
.landing__byline {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--on-surface-variant);
  letter-spacing: 0.04em;
}
.landing__byline--muted { opacity: 0.6; }

/* ============================ App bar title (centered) ================== */
/* Absolutely positioned at the viewport's horizontal center — NOT between
 * the two flex icon groups. When the left group has 1 icon and the right
 * group has 2, the flex space between them is asymmetric, which would
 * pull a `flex: 1; text-align: center` title off the true viewport center.
 * position:absolute + left:50% + translate(-50%) escapes the flex layout
 * entirely. */
.app-bar__title--centered {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: calc(100% - 10rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  padding: 0 0.5rem;
}

.icon-btn--active {
  background: var(--surface-container-high);
  color: var(--primary-container);
}

/* ============================ Player state machine ===================== */
.player[data-state="idle"],
.player[data-state="stopped"],
.player[data-state="loading"] {
  padding: 1.25rem 1.5rem;
}

.player__slab {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 4.5rem;
}
.player__slab--idle .player__copy-title,
.player__slab--stopped .player__copy-title,
.player__slab--loading .player__copy-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--on-surface);
  letter-spacing: -0.005em;
}
.player__copy-sub {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--on-surface-variant);
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.player__copy {
  min-width: 0;
  flex: 1;
}

/* Big circular button for stopped/idle states */
.player__big-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--surface-container-lowest);
  color: var(--on-surface-variant);
  box-shadow: var(--shadow-ambient);
  transition: transform 180ms ease, background 200ms ease;
}
.player__big-btn .material-symbols-outlined { font-size: 2.25rem; }
.player__big-btn:hover:not(:disabled) { transform: scale(1.04); }
.player__big-btn:active:not(:disabled) { transform: scale(0.94); }

.player__big-btn--primary {
  background: var(--gradient-primary);
  color: #ffffff;
  box-shadow: var(--shadow-fab);
}

.player__big-btn:disabled {
  cursor: default;
  opacity: 0.55;
  color: var(--on-surface-variant);
  background: var(--surface-container-low);
  box-shadow: none;
}

/* Loading spinner */
.player__spinner {
  width: 4rem;
  height: 4rem;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--surface-container-lowest);
  box-shadow: var(--shadow-ambient);
  position: relative;
}
.player__spinner::before {
  content: "";
  position: absolute;
  inset: 0.5rem;
  border-radius: inherit;
  border: 3px solid var(--surface-container-high);
  border-top-color: var(--primary-container);
  animation: spin 900ms linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.player[data-state="idle"] {
  opacity: 0.85;
}

/* ============================ Side drawer =============================== */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
}

.drawer.open {
  pointer-events: auto;
}

.drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 16, 16, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: background 320ms cubic-bezier(0.16, 1, 0.3, 1),
              backdrop-filter 320ms cubic-bezier(0.16, 1, 0.3, 1);
}
.drawer.open .drawer__backdrop {
  background: rgba(17, 16, 16, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.drawer__panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(85vw, 22rem);
  background: var(--background);
  /* Prevent horizontal scrollbar when floating children (e.g. buttons with
   * glow shadows) would otherwise cause 1–2px of overflow. */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  transform: translateX(-100%);
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
  padding-bottom: calc(2rem + var(--safe-bottom));
}
.drawer.open .drawer__panel {
  transform: translateX(0);
}

/* Directional shadow — lives OUTSIDE the scrolling panel so it can't
 * trigger horizontal overflow, and can't move with page scroll.
 * It's a separate sibling element that shares the panel's transform,
 * so it slides in/out in sync. The ::after is the actual gradient strip
 * rendered at the element's right edge (= the panel's right edge).
 */
.drawer__shadow {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(85vw, 22rem);
  pointer-events: none;
  transform: translateX(-100%);
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
}
.drawer__shadow::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 100%;
  width: 40px;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.28),
    rgba(0, 0, 0, 0)
  );
  opacity: 0;
  transition: opacity 280ms cubic-bezier(0.16, 1, 0.3, 1);
}
.drawer.open .drawer__shadow {
  transform: translateX(0);
}
.drawer.open .drawer__shadow::after {
  opacity: 1;
}

.drawer__header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: flex-end;
  padding: calc(0.75rem + var(--safe-top)) 1rem 0;
  background: var(--background);
  z-index: 1;
}

/* padding-top gives the CTA button's 30px-blur glow room to breathe so
 * it doesn't get clipped by the sticky header's opaque background. */
.drawer__content {
  padding: 1.5rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Primary "Change Language" CTA */
.drawer__cta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.125rem 1.25rem;
  background: var(--gradient-primary);
  color: #ffffff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-fab);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.005em;
  transition: transform 160ms ease, box-shadow 200ms ease;
}
.drawer__cta:hover { transform: translateY(-1px); }
.drawer__cta:active { transform: translateY(0) scale(0.985); }
.drawer__cta .material-symbols-outlined { font-size: 1.5rem; }

/* Live card in drawer */
.drawer__live {
  background: var(--surface-container-low);
  border-radius: var(--radius-xl);
  padding: 1.125rem 1.25rem;
}
.drawer__live-main {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}
.drawer__live-title {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--on-surface);
}
.drawer__live-sub {
  font-size: 0.75rem;
  color: var(--on-surface-variant);
  margin-top: 2px;
}
.drawer__live.idle .live-dot::before { animation: none; opacity: 0; }
.drawer__live.idle .live-dot::before,
.drawer__live.idle .live-dot::after { background: var(--on-surface-variant); }

/* Drawer sections */
.drawer__section {
  padding: 0 0.25rem;
}
.drawer__section h2 {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--on-surface-variant);
  margin-bottom: 0.75rem;
}
.drawer__p {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--on-surface);
  margin-bottom: 0.625rem;
}
.drawer__p--muted { color: var(--on-surface-variant); font-size: 0.8125rem; }

.drawer__actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.drawer__action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-container-low);
  border-radius: var(--radius-lg);
  padding: 1rem 1.125rem;
  transition: background 200ms ease;
  width: 100%;
  text-align: left;
  color: var(--on-surface);
}
.drawer__action:hover { background: var(--surface-container); }
.drawer__action .material-symbols-outlined { color: var(--primary); }
.dark .drawer__action .material-symbols-outlined { color: var(--primary-fixed-dim); }

.drawer__action-label {
  font-weight: 600;
  font-size: 0.9375rem;
}
.drawer__action-sub {
  font-size: 0.6875rem;
  color: var(--on-surface-variant);
  margin-top: 2px;
}

/* Drawer footer logo (link to the main church site) */
.drawer__logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4rem;
  margin-top: 2rem;
  padding: 1rem 0 0.5rem;
  text-decoration: none;
  transition: opacity 200ms ease, transform 200ms ease;
}
.drawer__logo-wrap:hover {
  opacity: 0.85;
  transform: scale(1.02);
}
.drawer__logo-wrap:active {
  transform: scale(0.98);
}
/* Drawer logo is ~20% smaller than the landing footer logo. */
.drawer__logo-wrap .landing__logo-img {
  max-height: 2.4rem;
  max-width: min(14rem, 56%);
}
