/* ============================================================
   Neocypherpunk Summit — Program display
   Pure-black, Archivo, real time-grid agenda for big TV screens.
   Scales with the viewport (720p / 1080p / 4K) with no changes.
   ============================================================ */

:root {
  /* palette — pure black background */
  --bg:        #000000;
  --ink:       #ffffff;
  --ink-soft:  #c7c4d2;
  --ink-dim:   #7d788f;
  --line:      rgba(255, 255, 255, 0.10);
  --line-soft: rgba(255, 255, 255, 0.06);
  --line-2:    rgba(255, 255, 255, 0.20);

  /* per-room accent hues (bright enough to carry black tab text) */
  --room-0: #ffffff;   /* Hauptbühne (Saal 1) — white main-stage column */
  --room-1: #00ff78;   /* brand green */
  --room-2: #ffc24b;
  --room-3: #ff86c2;

  /* fluid type scale */
  --fs-xs:  clamp(0.52rem, 0.62vw, 0.78rem);
  --fs-sm:  clamp(0.62rem, 0.78vw, 0.96rem);
  --fs-md:  clamp(0.74rem, 0.92vw, 1.12rem);
  --fs-lg:  clamp(0.88rem, 1.12vw, 1.36rem);
  --fs-xl:  clamp(1.05rem, 1.6vw, 2.0rem);
  --fs-2xl: clamp(1.45rem, 2.55vw, 3.1rem);

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: #000000;
  background: var(--bg);
  color: #ffffff;
  color: var(--ink);
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  cursor: none;
}

/* ---------- layout shell ---------- */
.screen {
  position: relative;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  max-width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto auto;
  padding: 18px 64px 22px;
  padding: clamp(0.75rem, 1.2vw, 1.1rem) 64px clamp(0.9rem, 1.4vw, 1.4rem);
}

/* ===================== HEADER (small) ===================== */
.topbar {
  display: flex;
  align-items: center;
  gap: clamp(0.55rem, 1vw, 1.25rem);
  padding-bottom: clamp(0.28rem, 0.55vw, 0.62rem);
  border-bottom: 1px solid var(--line);
}
.logo {
  height: 46px;
  height: clamp(2rem, 2.7vw, 3.15rem);
  width: auto;
  object-fit: contain;
  flex: none;
}
.window-info {
  margin-left: auto;
  text-align: right;
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  flex: none;
  white-space: nowrap;
}
.window-label {
  font-weight: 700;
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.window-range {
  font-size: var(--fs-xs);
  color: var(--ink-dim);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.dots { display: flex; gap: clamp(0.3rem, 0.5vw, 0.55rem); flex: none; }
.dots button {
  appearance: none; border: none; cursor: none; padding: 0;
  width: clamp(0.5rem, 0.7vw, 0.85rem);
  height: clamp(0.5rem, 0.7vw, 0.85rem);
  background: var(--line-2);
  transition: background 0.3s ease, width 0.3s ease;
}
.dots button.active { background: var(--ink); width: clamp(1.4rem, 2.1vw, 2.4rem); }

/* ===================== STAGE / SLIDES ===================== */
.stage { position: relative; overflow: hidden; min-height: 0; flex: 1 1 auto; }
.track { height: 100%; }

.slide {
  position: absolute;
  inset: 0;
  padding-top: clamp(0.24rem, 0.48vw, 0.58rem);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  overflow: hidden;
}
.slide.active { opacity: 1; transform: none; }

/* ---------- the real time grid ---------- */
.grid {
  display: grid;
  grid-template-columns: minmax(3rem, max-content) repeat(var(--cols, 4), minmax(0, 1fr));
  align-content: start;            /* rows take natural height, no fake stretch */
  height: 100%;
  overflow: hidden;
}

/* Legacy-TV runtime renders a real table so old browsers do not need CSS Grid. */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.schedule-table th,
.schedule-table td {
  vertical-align: middle;
}
.schedule-table .tab {
  display: table-cell;
  background: #ffffff;
}
.schedule-table .tab span {
  display: block;
}
.schedule-table .gt,
.schedule-table .cell {
  display: table-cell;
}
.schedule-table .gt {
  width: 4.8rem;
}

/* room tabs (header row): solid colour, square edges, no dot, larger text */
.tab {
  background: var(--rc, var(--room-0));
  color: #050409;
  font-weight: 800;
  font-size: var(--fs-md);
  line-height: 1.05;
  letter-spacing: -0.005em;
  padding: clamp(0.28rem, 0.52vw, 0.55rem) clamp(0.42rem, 0.72vw, 0.78rem);
  display: flex;
  align-items: center;
  min-width: 0;
}
.tab span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.tab-gutter { background: transparent; }   /* empty top-left corner */

/* time gutter cells */
.gt {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: clamp(0.28rem, 0.48vw, 0.52rem) clamp(0.38rem, 0.58vw, 0.65rem) clamp(0.28rem, 0.48vw, 0.52rem) 0.15rem;
  border-top: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-2);   /* the fine line that sets time apart */
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* body cells */
.cell {
  border-top: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  min-height: 42px;
  min-height: clamp(2.1rem, 4.55vh, 3.05rem);
  padding: clamp(0.28rem, 0.5vw, 0.56rem) clamp(0.38rem, 0.62vw, 0.68rem);
  min-width: 0;
  display: flex;
  align-items: center;
}
.cell:last-child { border-right: none; }
.cell.empty { background: transparent; }

/* a talk inside a cell */
.talk {
  width: 100%;
  min-width: 0;
  border-left: 3px solid var(--rc, var(--room-0));
  padding-left: clamp(0.28rem, 0.48vw, 0.52rem);
  display: flex;
  flex-direction: column;
  gap: 0.12em;
  justify-content: center;
}
.talk-title {
  font-weight: 700;
  font-size: 16px;
  font-size: clamp(0.68rem, 0.82vw, 1rem);
  line-height: 1.16;
  color: var(--ink);
  /* no clamp: long titles simply grow the row, as requested */
  overflow-wrap: anywhere;
}
.talk-spk {
  font-size: var(--fs-xs);
  color: var(--ink-dim);
  line-height: 1.12;
  font-weight: 500;
  margin-top: 0.1em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* live / past states */
.talk.is-live {
  background: color-mix(in srgb, var(--rc, var(--room-0)) 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rc, var(--room-0)) 55%, transparent);
  border-radius: 0 0.3rem 0.3rem 0;
}
.talk.is-live .talk-title { color: #fff; }
.cell:has(.talk.is-past) { opacity: 0.4; }

.live-tag {
  display: none;
  align-self: flex-start;
  margin-bottom: 0.15em;
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--rc, var(--room-0));
}
.talk.is-live .live-tag { display: inline-flex; align-items: center; gap: 0.4em; }
.live-dot {
  width: 0.55em; height: 0.55em; border-radius: 50%;
  background: currentColor;
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 currentColor; }
  70%  { box-shadow: 0 0 0 0.6em transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ===================== AUTO-ADVANCE PROGRESS ===================== */
.progress {
  height: 2px;
  background: var(--line-soft);
  overflow: hidden;
  margin-top: clamp(0.16rem, 0.32vw, 0.34rem);
}
.progress i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--room-0), var(--room-1));
}

/* ===================== FOOTER / TICKER ===================== */
.ticker {
  display: flex;
  align-items: center;
  gap: 22px;
  gap: clamp(0.75rem, 1.25vw, 1.6rem);
  padding: 8px 0 0;
  padding: clamp(0.38rem, 0.7vw, 0.7rem) 0 0;
  border-top: 1px solid var(--line);
  margin-top: clamp(0.18rem, 0.34vw, 0.36rem);
  min-height: 0;
}
.clock { display: flex; align-items: baseline; gap: 0.4em; flex: none; }
.clock-time {
  font-weight: 800;
  font-size: 44px;
  font-size: var(--fs-2xl);
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.clock-meta { display: flex; flex-direction: column; line-height: 1.05; }
.clock-secs {
  font-size: var(--fs-md);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.clock-zone { font-size: var(--fs-xs); color: var(--ink-dim); letter-spacing: 0.12em; }

/* QR code (replaces the old "now" label) */
.qr { display: flex; align-items: center; gap: clamp(0.4rem, 0.8vw, 0.9rem); flex: none; }
.qr-img {
  width: 78px;
  height: 78px;
  width: clamp(3.1rem, 4.25vw, 4.95rem);
  height: clamp(3.1rem, 4.25vw, 4.95rem);
  background: #fff;
  padding: clamp(0.2rem, 0.4vw, 0.45rem);
  border-radius: 0.35rem;
  display: flex;
}
.qr-img img, .qr-img svg, .qr-img canvas {
  width: 100%; height: 100%;
  image-rendering: pixelated;
  display: block;
}
.qr-cap {
  font-size: var(--fs-xs);
  color: var(--ink-dim);
  font-weight: 600;
  max-width: 6em;
  line-height: 1.15;
}

.nn-up { flex: 1 1 auto; display: flex; flex-direction: column; gap: 0.24em; min-width: 0; border-left: 1px solid var(--line); padding-left: clamp(0.75rem, 1.2vw, 1.45rem); }
.nn-head {
  font-weight: 700;
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
}
.nn-items { display: flex; gap: clamp(0.5rem, 0.9vw, 1.05rem); min-width: 0; max-width: 100%; overflow: hidden; }
.nn-item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 0.1em;
  min-width: 0;
  padding-left: clamp(0.28rem, 0.46vw, 0.52rem);
  border-left: 3px solid var(--rc, var(--room-1));
}
.nn-room {
  font-size: var(--fs-xs);
  color: var(--rc, var(--ink-dim));
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nn-time {
  font-size: var(--fs-sm);
  color: var(--rc, var(--room-1));
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.nn-title { font-size: var(--fs-md); font-weight: 700; line-height: 1.04; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nn-title.nn-done { color: var(--ink-dim); font-weight: 600; font-size: var(--fs-sm); }

/* ===================== LOADER / STATES ===================== */
.loader {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.2rem;
  color: var(--ink-soft);
  font-size: var(--fs-md);
}
.spinner {
  width: clamp(2rem, 3vw, 3.5rem); height: clamp(2rem, 3vw, 3.5rem);
  border: 3px solid var(--line-2);
  border-top-color: var(--room-0);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

body[data-state="ready"] .loader { display: none; }
body[data-state="loading"] .track,
body[data-state="error"] .track { display: none; }
body[data-state="error"] .spinner { display: none; }

@media (prefers-reduced-motion: reduce) {
  .slide { transition: opacity 0.3s ease; transform: none; }
  .live-dot { animation: none; }
  .spinner { animation-duration: 1.6s; }
}

@media (width: 1920px) and (height: 1080px), (max-height: 1100px) and (min-aspect-ratio: 16/10) {
  .screen {
    padding-left: 64px;
    padding-right: 64px;
    padding-top: 16px;
    padding-bottom: 26px;
  }
  .logo { height: 44px; }
  .window-label { font-size: 19px; }
  .window-range { font-size: 11px; }
  .tab { font-size: 16px; padding-top: 7px; padding-bottom: 7px; }
  .gt { font-size: 16px; padding-top: 7px; padding-bottom: 7px; }
  .cell { min-height: 41px; padding-top: 6px; padding-bottom: 6px; }
  .talk-title { font-size: 15px; line-height: 1.14; }
  .talk-spk { font-size: 11px; line-height: 1.08; }
  .ticker { padding-top: 7px; gap: 20px; }
  .clock-time { font-size: 42px; }
  .clock-secs { font-size: 16px; }
  .clock-zone, .qr-cap, .nn-head, .nn-room { font-size: 10px; }
  .qr-img { width: 74px; height: 74px; }
  .nn-time { font-size: 13px; }
  .nn-title { font-size: 15px; }
}

body.tv-compact .screen {
  padding-left: 64px;
  padding-right: 64px;
  padding-top: 10px;
  padding-bottom: 96px;
}
body.tv-compact .topbar {
  gap: 12px;
  padding-bottom: 5px;
}
body.tv-compact .logo {
  height: 30px;
}
body.tv-compact .window-label {
  font-size: 15px;
}
body.tv-compact .window-range {
  font-size: 9px;
}
body.tv-compact .dots {
  gap: 5px;
}
body.tv-compact .dots button {
  width: 8px;
  height: 8px;
}
body.tv-compact .dots button.active {
  width: 20px;
}
body.tv-compact .slide {
  padding-top: 4px;
  transform: none;
}
body.tv-compact .schedule-table .gt {
  width: 62px;
}
body.tv-compact .tab {
  font-size: 13px;
  line-height: 1;
  padding: 6px 8px;
}
body.tv-compact .gt {
  font-size: 13px;
  padding: 8px 8px 8px 0;
}
body.tv-compact .cell {
  min-height: 41px;
  padding: 6px 8px;
}
body.tv-compact .talk {
  border-left-width: 2px;
  padding-left: 6px;
  gap: 0.05em;
}
body.tv-compact .talk-title {
  font-size: 13px;
  line-height: 1.12;
}
body.tv-compact .talk-spk {
  font-size: 10px;
  line-height: 1.08;
  margin-top: 0;
  -webkit-line-clamp: 1;
}
body.tv-compact .live-tag {
  font-size: 8px;
}
body.tv-compact .progress {
  height: 2px;
  margin-top: 3px;
}
body.tv-compact .ticker {
  gap: 14px;
  padding-top: 5px;
  margin-top: 4px;
}
body.tv-compact .clock-time {
  font-size: 30px;
}
body.tv-compact .clock-secs {
  font-size: 11px;
}
body.tv-compact .clock-zone,
body.tv-compact .nn-head,
body.tv-compact .nn-room {
  font-size: 8px;
}
body.tv-compact .qr {
  position: fixed;
  right: 64px;
  bottom: 156px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid var(--line-2);
}
body.tv-compact .qr-img {
  width: 92px;
  height: 92px;
  padding: 5px;
}
body.tv-compact .qr-cap {
  max-width: 4.7em;
  font-size: 10px;
}
body.tv-compact .nn-up {
  gap: 2px;
  padding-left: 12px;
}
body.tv-compact .nn-items {
  gap: 10px;
}
body.tv-compact .nn-item {
  border-left-width: 2px;
  padding-left: 6px;
  gap: 0;
}
body.tv-compact .nn-time {
  font-size: 10px;
}
body.tv-compact .nn-title {
  font-size: 11px;
  line-height: 1;
}

@media (max-height: 760px), (max-width: 1366px) {
  .screen {
    padding-left: 64px;
    padding-right: 64px;
    padding-top: 10px;
    padding-bottom: 96px;
  }
}
