/* institution.tv — Culture Commons livestream hub
   One typeface (UN_11ST), neutrals only, one red reserved for the LIVE state. */

@font-face {
  font-family: 'UN_11ST';
  src: url('../fonts/UN_11ST_Regular.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'UN_11ST';
  src: url('../fonts/UN_11ST_Italic.ttf') format('truetype');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'UN_11ST';
  src: url('../fonts/UN_11ST_Bold.ttf') format('truetype');
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --ground: #ffffff;
  --ink: #111827;
  --body: #333333;
  --muted: #6b7280;
  --rule: #e5e7eb;
  --live: #c8102e;

  --wash: #f7f7f6;
  --ink-wash: #f0f0ef;

  --sans: 'UN_11ST', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --pad: clamp(1rem, 4vw, 2.5rem);
  --max: 1180px;
  --measure: 66ch;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--body);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--ink); text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--muted); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 1px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 50;
  background: var(--ink); color: #fff; padding: .6rem 1rem; text-decoration: none;
}
.skip:focus { left: 0; }

/* ---------- layout primitives ---------- */

.wrap { max-width: var(--max); margin: 0 auto; padding-inline: var(--pad); }
.band { border-top: 1px solid var(--rule); }
.band > .wrap { padding-block: clamp(2rem, 5vw, 3.5rem); }
.prose { max-width: var(--measure); }
.prose p + p { margin-top: 1em; }

/* ---------- type roles ---------- */

.display {
  font-size: clamp(1.75rem, 4.6vw, 3rem);
  font-weight: 700; line-height: .98; letter-spacing: -.015em;
  color: var(--ink); margin: 0; text-wrap: balance;
}
.section-head {
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 700; line-height: 1.05; letter-spacing: -.01em;
  color: var(--ink); margin: 0 0 1.25rem; text-wrap: balance;
}
.label {
  font-size: .6875rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .14em; color: var(--muted); line-height: 1.4;
}
.hero-sub { font-style: italic; color: var(--body); margin: .5rem 0 0; max-width: 54ch; }
.time { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.muted { color: var(--muted); }
.small { font-size: .8125rem; line-height: 1.55; }

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

.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap {
  display: grid; grid-template-columns: auto 1fr;
  align-items: center; gap: .5rem 1rem; padding-block: .9rem;
}
/* The logo is sized from the title's own line box: two title lines tall at most,
   so it reads as part of the same composition however the title wraps. */
.brand {
  grid-column: 1; grid-row: 1; display: flex; align-items: center;
  line-height: 0; text-decoration: none;
}
.brand img {
  display: block; width: auto;
  /* Sized off the title's own line box so the wordmark keeps its relationship
     to the title at every breakpoint: ~24px beside the 22px desktop title,
     ~18px beside the 17px mobile one. The mark is 5.66:1, so the two-line
     ceiling below is a guard, never the working value. */
  height: calc(var(--title-size) * var(--title-lh) * 0.87);
  max-height: calc(var(--title-size) * var(--title-lh) * 2);
}
.header-titles { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
.header-title {
  margin: 0; font-size: var(--title-size); font-weight: 700;
  line-height: var(--title-lh); color: var(--ink);
  letter-spacing: -.01em; text-wrap: balance;
}
.header-dates { margin: .15rem 0 0; letter-spacing: .1em; }

/* Narrow screens: three rows, and every element is pinned to one of the two
   header edges — nothing is left floating between them.
     row 1  logo (left edge)          language toggle (right edge)
     row 2  state pill (right edge, stacked under the toggle)
     row 3  title + dates (left edge, under the logo)                        */
:root { --title-size: 1.0625rem; --title-lh: 1.25; }
@media (max-width: 51.99rem) {
  .site-header .header-tools { display: contents; }
  .site-header .uilang { grid-column: 2; grid-row: 1; justify-self: end; align-self: center; }
  .site-header .pill { grid-column: 1 / -1; grid-row: 2; justify-self: end; }
  .site-header .header-titles { grid-column: 1 / -1; grid-row: 3; }
}
@media (min-width: 52rem) {
  :root { --title-size: 1.375rem; }
  .site-header .wrap {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0 clamp(1rem, 3vw, 2.25rem); padding-block: 1.05rem;
  }
  .brand { align-self: center; }
  .header-titles { grid-column: 2; grid-row: 1; }
  .header-tools { grid-column: 3; grid-row: 1; align-self: center; }
}

/* visually hidden, still announced */
.vh {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- state pill ---------- */

.pill {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 1px solid var(--rule); padding: .3rem .7rem;
  font-size: .6875rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; color: var(--muted); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pill .dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.pill[data-phase="live"] { color: var(--live); border-color: var(--live); }
.pill[data-phase="live"] .dot { background: var(--live); }
@media (prefers-reduced-motion: no-preference) {
  .pill[data-phase="live"] .dot { animation: blip 2s ease-in-out infinite; }
}
@keyframes blip { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------- player band ---------- */

.player-band { background: var(--wash); border-bottom: 1px solid var(--rule); }
.player-band > .wrap { padding-block: clamp(1.25rem, 3vw, 2rem); }

.controls { display: grid; gap: 1rem; margin-bottom: 1rem; }
@media (min-width: 60rem) { .controls { grid-template-columns: auto 1fr; align-items: end; gap: 2rem; } }

.control-group > .label { display: block; margin-bottom: .45rem; }

.tabs { display: flex; gap: .5rem; flex-wrap: wrap; }
.langs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
@media (min-width: 30rem) { .langs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.btn {
  font: inherit; font-weight: 700; color: var(--ink);
  background: var(--ground); border: 1px solid var(--rule);
  padding: .55rem .9rem; cursor: pointer; text-align: left;
  line-height: 1.25; min-height: 2.75rem; display: block; width: 100%;
}
.tabs .btn { width: auto; min-width: 8rem; }
.btn .btn-sub { display: block; font-weight: 400; font-size: .75rem; color: var(--muted); margin-top: .1rem; }
.btn:hover { border-color: var(--muted); }
.btn[aria-pressed="true"] {
  background: var(--ink); border-color: var(--ink); color: var(--ground);
}
.btn[aria-pressed="true"] .btn-sub { color: rgba(255,255,255,.72); }
@media (prefers-reduced-motion: no-preference) {
  .btn { transition: background-color .12s linear, border-color .12s linear, color .12s linear; }
}

.stage { position: relative; background: #000; aspect-ratio: 16 / 9; width: 100%; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.placeholder {
  aspect-ratio: 16 / 9; width: 100%;
  border: 1px solid var(--rule); background: var(--ground);
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  gap: .6rem; padding: clamp(1rem, 4vw, 2.5rem);
}
.placeholder p { margin: 0; max-width: 44ch; }

.readout {
  display: grid; gap: .1rem .9rem; margin-top: 1rem;
  border-top: 1px solid var(--rule); padding-top: 1rem;
}
@media (min-width: 45rem) { .readout { grid-template-columns: 6rem 1fr; } }
.readout dt { grid-column: 1; }
.readout dd { grid-column: 1; margin: 0 0 .6rem; color: var(--ink); font-weight: 700; }
@media (min-width: 45rem) {
  .readout dt { align-self: baseline; }
  .readout dd { grid-column: 2; margin-bottom: .35rem; }
}
.readout dd .rd-meta { display: block; font-weight: 400; color: var(--muted); font-size: .8125rem; }

.player-links { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin-top: .75rem; }
.player-links a { font-weight: 700; font-size: .875rem; }

/* ---------- programme timeline ---------- */

.theme-head {
  border-top: 1px solid var(--ink); padding-top: .75rem; margin-top: 2rem;
}
.theme-head:first-child { margin-top: 0; }
.theme-head h3 { margin: 0; font-size: 1rem; font-weight: 700; color: var(--ink); line-height: 1.35; }

.row {
  border-top: 1px solid var(--rule);
  border-left: 3px solid transparent;
  padding: .9rem 0 .9rem .75rem;
  margin-left: -.75rem;
}
.row:last-of-type { border-bottom: 1px solid var(--rule); }
.row[data-current="true"] { border-left-color: var(--live); background: var(--wash); }
.row[data-streamed="false"] { color: var(--muted); }
.row[data-streamed="false"] .r-title { color: var(--muted); font-weight: 400; }

.row > summary {
  display: grid; gap: .15rem .75rem; cursor: pointer; list-style: none;
  grid-template-columns: 1fr;
}
.row > summary::-webkit-details-marker { display: none; }
@media (min-width: 45rem) {
  .row > summary { grid-template-columns: 10.5rem 1fr auto; align-items: baseline; }
}
.r-time { display: block; line-height: 1.35; }
.r-time .time { display: block; font-size: .9375rem; }
.r-time .r-local { display: block; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.r-main { display: block; min-width: 0; }
.r-title { display: block; margin: 0; font-size: 1.0625rem; font-weight: 700; line-height: 1.25; color: var(--ink); text-wrap: balance; }
.r-meta { display: block; margin: .15rem 0 0; font-size: .8125rem; color: var(--muted); }
.r-flag { justify-self: start; }
@media (min-width: 45rem) { .r-flag { justify-self: end; text-align: right; } }
.flag-live { color: var(--live); }
.row-blurb { margin: .7rem 0 .2rem; max-width: var(--measure); font-size: .9375rem; }
.row > summary:hover .r-title { text-decoration: underline; text-underline-offset: .18em; }
.row > summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.day-note { margin: 1.25rem 0 0; font-size: .8125rem; color: var(--muted); max-width: var(--measure); }

/* ---------- generic grids ---------- */

.grid-3 { display: grid; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
@media (min-width: 48rem) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.grid-3 > * { background: var(--ground); padding: clamp(1rem, 2.5vw, 1.5rem);
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.grid-3 h3 { margin: .5rem 0 .4rem; font-size: 1.0625rem; color: var(--ink); line-height: 1.3; }
.grid-3 p { margin: 0; font-size: .9375rem; }

.hubs { display: grid; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
@media (min-width: 34rem) { .hubs { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 62rem) { .hubs { grid-template-columns: repeat(4, 1fr); } }
.hub { background: var(--ground); padding: 1rem;
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.hub h3 { margin: .35rem 0 .2rem; font-size: 1rem; color: var(--ink); line-height: 1.25; }
.hub p { margin: 0; font-size: .8125rem; color: var(--muted); }

/* ---------- speakers / sessions (program.html) ---------- */

.sessions { display: grid; margin-top: 1.5rem;
  border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
@media (min-width: 52rem) { .sessions { grid-template-columns: repeat(2, 1fr); } }
.session { background: var(--ground); padding: clamp(1rem, 2.5vw, 1.5rem);
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.session img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; margin-bottom: .9rem; background: var(--wash); }
.session h3 { margin: .35rem 0 .35rem; font-size: 1.125rem; color: var(--ink); line-height: 1.25; text-wrap: balance; }
.session p { margin: 0; font-size: .9375rem; }
.session .session-meta { color: var(--muted); font-size: .8125rem; margin-bottom: .6rem; }
.session .watch-link { display: inline-block; margin-top: .9rem; font-size: .8125rem; font-weight: 700; }

.people { display: grid; margin-top: 1.5rem;
  border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
@media (min-width: 40rem) { .people { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 66rem) { .people { grid-template-columns: repeat(3, 1fr); } }
.person { background: var(--ground); padding: clamp(1rem, 2.5vw, 1.35rem);
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.person img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; margin-bottom: .8rem; background: var(--wash); filter: grayscale(1); }
.person h3 { margin: 0 0 .1rem; font-size: 1.0625rem; color: var(--ink); line-height: 1.25; }
.person .role { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; line-height: 1.4; }
.person p { margin: .6rem 0 0; font-size: .875rem; }

.venues { display: grid; margin-top: 1.5rem;
  border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
@media (min-width: 44rem) { .venues { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 68rem) { .venues { grid-template-columns: repeat(4, 1fr); } }
.venue { background: var(--ground); padding: 1rem;
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.venue img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; margin-bottom: .75rem; background: var(--wash); }
.venue h3 { margin: 0 0 .15rem; font-size: 1rem; color: var(--ink); line-height: 1.25; }
.venue p { margin: 0; font-size: .8125rem; }

/* ---------- partners ---------- */

.partners { display: grid; grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
@media (min-width: 40rem) { .partners { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 62rem) { .partners { grid-template-columns: repeat(5, 1fr); } }
.partner {
  background: var(--ground); padding: 1.15rem 1rem;
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  gap: .7rem; text-align: center; min-height: 8.5rem;
}
.partner img { max-height: 3.25rem; width: auto; object-fit: contain; filter: grayscale(1); opacity: .82; }
.partner .p-name { font-size: .8125rem; color: var(--ink); font-weight: 700; line-height: 1.3; }
.partner .p-role { font-size: .6875rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }

/* ---------- nav / footer ---------- */

.pagenav { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; padding-block: .8rem; border-bottom: 1px solid var(--rule); }
.pagenav a { font-size: .8125rem; font-weight: 700; text-decoration: none; color: var(--muted); }
.pagenav a[aria-current="page"], .pagenav a:hover { color: var(--ink); }

.site-footer { border-top: 1px solid var(--ink); margin-top: clamp(2rem, 5vw, 4rem); }
.site-footer > .wrap { padding-block: clamp(2rem, 5vw, 3rem); }
.footer-cols { display: grid; gap: 1.75rem; margin-top: 2rem; }
@media (min-width: 48rem) { .footer-cols { grid-template-columns: 1.2fr 1fr 1fr; gap: 2.5rem; } }
.footer-cols h3 { margin: 0 0 .6rem; font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols li { margin-bottom: .35rem; font-size: .875rem; }
.footer-logo { height: 24px; width: auto; }
.colophon { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); font-size: .75rem; color: var(--muted); }
.colophon p { margin: 0 0 .3rem; }

/* ---------- error page ---------- */

.error-wrap { min-height: 60vh; display: flex; flex-direction: column; justify-content: center; }

/* ---------- site-language toggle (separate from the audio selector) ---------- */

.uilang { display: inline-flex; border: 1px solid var(--rule); }
.uilang-btn {
  font: inherit; font-size: .75rem; font-weight: 700; line-height: 1;
  color: var(--muted); background: var(--ground);
  border: 0; border-left: 1px solid var(--rule);
  padding: .5rem .55rem; cursor: pointer; min-height: 2rem;
}
.uilang-btn:first-child { border-left: 0; }
.uilang-btn:hover { color: var(--ink); }
.uilang-btn[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
@media (prefers-reduced-motion: no-preference) {
  .uilang-btn { transition: background-color .12s linear, color .12s linear; }
}
.header-tools { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Chinese and Italian run longer / need different line breaking ---------- */

:root:lang(zh) { --measure: 40em; }
html[lang="zh"] body { line-height: 1.75; }
html[lang="zh"] .label, html[lang="zh"] .pill, html[lang="zh"] .p-role,
html[lang="zh"] .person .role { letter-spacing: .06em; }
html[lang="zh"] .display, html[lang="zh"] .section-head, html[lang="zh"] .header-title { letter-spacing: 0; }
html[lang="zh"] .r-title, html[lang="zh"] .header-title, html[lang="zh"] .display { word-break: normal; overflow-wrap: anywhere; }
html[lang="it"] .r-title, html[lang="it"] .header-title { hyphens: auto; }

/* ---------- speaker cards: photo fallback + session links ---------- */

.person-initials {
  width: 100%; aspect-ratio: 1 / 1; margin-bottom: .8rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--wash); color: var(--muted);
  font-size: 2rem; font-weight: 700; letter-spacing: .04em;
  border: 1px solid var(--rule);
}
.person-links { margin: .8rem 0 0; display: flex; flex-wrap: wrap; gap: .35rem 1rem; }
.person-links .watch-link { display: inline-block; margin: 0; font-size: .8125rem; font-weight: 700; }
