/* Live captions · IBSA Foundation Forum, Lugano 2026.
   Colours and type follow the forum's own page: IBSA navy, the teal of the
   forum header, Montserrat. The audience page is dark on purpose: it was read
   in an auditorium, mostly on phones, for a whole day.
   Since the forum ended (6 November 2026) the page has no live connection: it
   thanks the audience, and ?demo=1 replays the preview. */

@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(../fonts/montserrat-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(../fonts/montserrat-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --navy: #002f6c;          /* IBSA */
  --navy-deep: #0b2c3d;
  --teal: #1f7c7d;          /* forum header */
  --teal-bright: #00b09b;   /* the bar in the IBSA mark */
  --teal-soft: #e7f2f2;
  --ink: #171b25;
  --muted: #5d6b72;
  --line: #d5e3e3;
  --paper: #f3f8f8;
  --font: 'Montserrat', Arial, system-ui, sans-serif;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { touch-action: manipulation; }
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.eyebrow { font-size: 10px; letter-spacing: 1.7px; font-weight: 700; line-height: 1.6; text-transform: uppercase; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 46px; padding: 11px 17px; border: 1px solid var(--line); border-radius: 9px;
  background: transparent; color: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
button:hover, .button:hover { background: var(--teal-soft); }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--teal-bright); outline-offset: 3px;
}

.status-pill {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 99px; font-size: 11px; font-weight: 600; padding: 7px 12px;
}
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #9aa8ad; flex: none; }
.status-pill[data-state=live]::before { background: #2fd1b4; box-shadow: 0 0 0 4px rgba(47, 209, 180, .18); }
.status-pill[data-state=connecting]::before, .status-pill[data-state=reconnecting]::before { background: #f0b443; }

/* ===================================================================
   Audience page
   =================================================================== */
.audience-page {
  color-scheme: dark;
  --line: rgba(255, 255, 255, .16);
  --muted: #a9cbcb;
  min-height: 100dvh;
  color: #f4fbfb;
  background:
    radial-gradient(90% 70% at 0% 0%, rgba(39, 155, 147, .55), transparent 70%),
    radial-gradient(70% 60% at 100% 100%, rgba(0, 47, 108, .65), transparent 70%),
    linear-gradient(160deg, #0f4a52 0%, #0b2c3d 48%, #081a2c 100%);
  background-attachment: fixed;
}
.audience-shell {
  min-height: 100dvh; max-width: 1600px; margin: auto;
  display: flex; flex-direction: column;
  padding: max(22px, env(safe-area-inset-top)) clamp(18px, 5vw, 80px) max(18px, env(safe-area-inset-bottom));
}
.audience-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.audience-logo img { display: block; height: auto; width: clamp(150px, 18vw, 220px); }
.audience-partners { grid-column: 1 / -1; display: block; width: 100%; max-width: 760px; height: auto; margin-top: 4px; }
@media (min-width: 1100px) {
  .audience-logo img { width: clamp(620px, 50vw, 900px); }
  .audience-partners { display: none; }
}
.audience-page .status-pill { color: #e6f6f4; background: rgba(8, 26, 44, .35); }

.live-stage { flex: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: clamp(28px, 6vh, 70px) 0; }
.live-stage > .eyebrow { color: #7fe0cf; }
.live-stage h1 {
  font-size: clamp(15px, 1.7vw, 24px); font-weight: 500; letter-spacing: -.2px; line-height: 1.4;
  color: #bfe3df; margin: 10px 0 clamp(18px, 4vh, 36px); max-width: 60em;
}

/* The caption window: exactly four lines tall. Short text sits on the last
   line (margin-top:auto); older lines scroll up into the fade at the top. */
.caption-window {
  --lh: 1.34;
  font-size: clamp(25px, min(4.2vw, 7.6vh), 66px);
  line-height: var(--lh);
  height: calc(4 * var(--lh) * 1em);
  display: flex; flex-direction: column; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 26%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 26%);
}
.audience-page[data-size=large] .caption-window { font-size: clamp(31px, min(5.4vw, 9.2vh), 84px); }
.caption {
  font-size: inherit; line-height: inherit; font-weight: 500; letter-spacing: -.01em;
  margin: auto 0 0; overflow-wrap: anywhere; color: #fff;
}
/* New words arrive softly. No fill-mode: whatever happens to the animation,
   the words' own opacity is 1. */
.caption .fresh { animation: fresh .6s ease-out; }
@keyframes fresh { from { opacity: .2; } to { opacity: 1; } }
.ended-note {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 22px;
  margin: clamp(18px, 3.5vh, 32px) 0 0; color: var(--muted); font-size: 14px; line-height: 1.6;
}
.ended-note a { color: #7fe0cf; font-weight: 600; }

.audience-footer {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 16px 28px;
  border-top: 1px solid var(--line); padding-top: 18px; color: var(--muted); font-size: 11px; line-height: 1.6;
}
.audience-note { margin: 0; }
.viewer-controls { display: flex; gap: 10px; }
.viewer-controls select {
  width: auto; min-height: 40px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
  background: transparent; color: inherit; font-size: 12px;
}
.viewer-controls select option { color: var(--ink); }
.viewer-controls button { min-height: 40px; padding: 8px 14px; font-size: 12px; }
.audience-page button:hover { background: rgba(255, 255, 255, .08); }
.audience-event { display: flex; align-items: center; gap: 14px; text-align: right; }
.audience-event img { width: 74px; height: auto; display: block; opacity: .9; }

.audience-page.screen-mode .audience-shell { max-width: none; }

@media (max-height: 760px) and (min-width: 760px) {
  .live-stage { padding: 22px 0; }
  .live-stage h1 { margin-bottom: 14px; }
}

/* Phones: what most of the room will hold. */
@media (max-width: 759px) {
  .audience-shell { padding-left: 18px; padding-right: 18px; }
  .audience-logo img { width: 150px; }
  .audience-page .status-pill { font-size: 10px; padding: 6px 10px; }
  .live-stage { padding: 24px 0 28px; }
  .live-stage h1 { font-size: 14px; }
  /* A phone held upright has room for far more than four lines: the window
     takes all the height the page leaves it, never less than four lines.
     contain:size keeps the (very long) paragraph from ever sizing the window
     itself; the fade is measured in lines, not in a share of the height. */
  .caption-window {
    font-size: 26px; --lh: 1.38;
    flex: 1 1 0; height: auto; min-height: calc(4 * var(--lh) * 1em); contain: size;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 calc(1.5 * var(--lh) * 1em));
    mask-image: linear-gradient(to bottom, transparent 0, #000 calc(1.5 * var(--lh) * 1em));
  }
  .audience-page[data-size=large] .caption-window { font-size: 31px; }
  .audience-footer { grid-template-columns: 1fr; gap: 12px; padding-top: 14px; }
  .viewer-controls > * { flex: 1; }
  .audience-event { justify-content: space-between; text-align: left; }
  .audience-event img { width: 64px; }
}
@media (max-width: 359px) {
  .caption-window { font-size: 22px; }
  .audience-page[data-size=large] .caption-window { font-size: 27px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .caption .fresh { animation: none; }
}
