/* Tipografías (autoalojadas, licencia OFL): Bricolage Grotesque para títulos y cifras, Source Sans 3 para el texto. */
@font-face {
  font-family: 'Bricolage';
  src: url('/fonts/bricolage-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: 'Source Sans';
  src: url('/fonts/sourcesans-latin.woff2') format('woff2');
  font-weight: 200 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}

:root {
  color-scheme: light dark;

  /* Esmalte de consola: gris azulado frío, con el color reservado para las personas que hablan. */
  --paper: #edf0f3;
  --sheet: #fafbfc;
  --tint: #e2e7ed;
  --ink: #15202b;
  --ink-2: #55626f;
  --rule: #d0d7df;
  --accent: #1f55d6;
  --accent-ink: #ffffff;
  --rec: #d3263a;
  --danger: #b4232f;

  /* Un color por participante dentro de cada grabación. */
  --s1: #2f6fed;
  --s2: #e8590c;
  --s3: #0f9b78;
  --s4: #b83280;
  --s5: #7c5cf0;
  --s6: #c28a00;
  --s7: #0891b2;
  --s8: #64748b;

  --font-display: 'Bricolage', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-text: 'Source Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10151b;
    --sheet: #171d25;
    --tint: #1f2731;
    --ink: #e7ecf1;
    --ink-2: #9aa6b3;
    --rule: #29323d;
    --accent: #86a7ff;
    --accent-ink: #0c1220;
    --rec: #ff6470;
    --danger: #ff7b84;
    --s1: #5b8cff;
    --s2: #ff8a45;
    --s3: #2fc79f;
    --s4: #e060a8;
    --s5: #a18bff;
    --s6: #e0ac1f;
    --s7: #38bcd8;
    --s8: #94a3b8;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font-text);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p {
  margin: 0;
}

a {
  color: inherit;
}

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

.c1 { --c: var(--s1); }
.c2 { --c: var(--s2); }
.c3 { --c: var(--s3); }
.c4 { --c: var(--s4); }
.c5 { --c: var(--s5); }
.c6 { --c: var(--s6); }
.c7 { --c: var(--s7); }
.c8 { --c: var(--s8); }

.wrap {
  width: 100%;
  max-width: 1040px;
  margin-inline: auto;
  padding-inline: 20px;
}

/* --- Botones y campos ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--sheet);
  color: var(--ink);
  font: 600 0.9375rem/1 var(--font-text);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover {
  border-color: var(--ink-2);
}
.btn[aria-disabled='true'],
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--rule);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  border-color: var(--accent);
  filter: brightness(1.08);
}
.btn-danger {
  color: var(--danger);
}
.btn-danger.is-solid {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--paper);
}
.btn-quiet {
  min-height: 32px;
  padding: 0 10px;
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
  font-weight: 500;
}
.btn-quiet:hover {
  color: var(--ink);
  background: var(--tint);
  border-color: transparent;
}

.field {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--sheet);
  color: var(--ink);
  font: inherit;
}
.field::placeholder {
  color: var(--ink-2);
}

/* --- Cabecera ------------------------------------------------------------------------- */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 18px;
}

.wordmark {
  font: 800 1.625rem/1 var(--font-display);
  letter-spacing: -0.04em;
  text-decoration: none;
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: 0.9375rem;
}
.user img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--tint);
}
.user-name {
  max-width: 14ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Listado -------------------------------------------------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.toolbar .field[type='search'] {
  flex: 1 1 260px;
}

.summary {
  margin: 18px 0 14px;
  color: var(--ink-2);
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--rec);
  font-weight: 700;
}
.live::before {
  content: '';
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

.sessions {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.session {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px 7.5rem;
  gap: 2px 28px;
  align-items: center;
  padding: 16px 12px;
  border-bottom: 1px solid var(--rule);
  color: inherit;
  text-decoration: none;
}
.session:hover {
  background: var(--tint);
}

.session-title {
  overflow: hidden;
  font: 600 1.1875rem/1.3 var(--font-display);
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-sub {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 0.9375rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-main {
  min-width: 0;
}
.shape {
  height: 28px;
  color: var(--ink-2);
}
.shape svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}
.session.is-live .shape {
  color: var(--rec);
}
.session-length {
  text-align: right;
}
.session-length strong {
  display: block;
  font: 600 1.1875rem/1.3 var(--font-display);
}
.session-length span {
  color: var(--ink-2);
  font-size: 0.875rem;
}

.empty {
  max-width: 52ch;
  padding: 48px 12px;
  color: var(--ink-2);
}
.empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font: 600 1.25rem/1.3 var(--font-display);
}
.more {
  margin-top: 20px;
}

/* --- Detalle -------------------------------------------------------------------------- */

.back {
  display: inline-block;
  margin: 4px 0 10px -10px;
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--ink-2);
  font-size: 0.9375rem;
  text-decoration: none;
}
.back:hover {
  background: var(--tint);
  color: var(--ink);
}

.title-input {
  width: calc(100% + 20px);
  margin: 0 0 0 -10px;
  padding: 2px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: 700 clamp(1.75rem, 4.2vw, 2.625rem) / 1.15 var(--font-display);
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
}
.title-input::placeholder {
  color: var(--ink-2);
  opacity: 1;
}
.title-input:hover {
  background: var(--tint);
}
.title-input:focus-visible {
  background: var(--sheet);
  outline-offset: 0;
}

.rec-meta {
  max-width: 66ch;
  margin: 6px 0 20px;
  color: var(--ink-2);
}
.rec-meta .live {
  margin-right: 0.4rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.actions .spacer {
  flex: 1;
}

.console {
  margin-top: 28px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--sheet);
  overflow: hidden;
}

.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 14px 16px;
}
.play {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
}
.play:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.play svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.clock {
  font: 600 1.375rem/1 var(--font-display);
}
.clock small {
  color: var(--ink-2);
  font: 400 1rem/1 var(--font-text);
}
.source {
  display: flex;
  flex: 1 1 260px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px 10px;
  color: var(--ink-2);
  font-size: 0.9375rem;
  text-align: right;
}

.timeline {
  --gutter: 184px;
  position: relative;
  border-top: 1px solid var(--rule);
}
.ruler,
.lane {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
}
.axis {
  position: relative;
  height: 30px;
  cursor: pointer;
}
.tick {
  position: absolute;
  top: 0;
  bottom: 0;
  padding: 7px 0 0 6px;
  border-left: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 0.75rem;
  line-height: 1;
  white-space: nowrap;
}
.lane {
  min-height: 60px;
  border-top: 1px solid var(--rule);
}
.who {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  padding: 8px 12px 8px 16px;
}
.lane.is-solo .who {
  box-shadow: inset 3px 0 0 var(--c);
}
.who-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 600;
}
.who-name span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.swatch {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
}
.who-meta {
  color: var(--ink-2);
  font-size: 0.8125rem;
}
.who-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2px;
  margin: 2px 0 0 -10px;
}
.who-actions .btn-quiet {
  min-height: 26px;
  padding: 0 8px;
  font-size: 0.8125rem;
}

.strip {
  position: relative;
  cursor: pointer;
  background: linear-gradient(var(--rule), var(--rule)) 0 50% / 100% 1px no-repeat;
}
.seg {
  position: absolute;
  top: 50%;
  min-width: 3px;
  height: 22px;
  border-radius: 3px;
  background: var(--c);
  transform: translateY(-50%);
}

.overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: var(--gutter);
  pointer-events: none;
}
.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--ink);
}
.playhead::before {
  content: '';
  position: absolute;
  top: 0;
  left: -4px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--ink);
}
.hover-time {
  position: absolute;
  top: 34px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.75rem;
  line-height: 1.3;
  transform: translateX(-50%);
  white-space: nowrap;
}
.hover-time[hidden] {
  display: none;
}

.note {
  padding: 14px 16px;
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 0.9375rem;
}

/* --- Diálogo, avisos, acceso ------------------------------------------------------------ */

dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--sheet);
  color: var(--ink);
}
dialog::backdrop {
  background: rgb(8 12 17 / 0.55);
}
dialog h2 {
  font: 700 1.375rem/1.25 var(--font-display);
  letter-spacing: -0.01em;
}
dialog p {
  margin: 10px 0 22px;
  color: var(--ink-2);
}
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

#toasts {
  position: fixed;
  right: 0;
  bottom: 20px;
  left: 0;
  display: grid;
  justify-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  max-width: min(480px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.9375rem;
}

.login {
  display: grid;
  align-content: center;
  gap: 22px;
  min-height: 100vh;
  max-width: 560px;
  margin-inline: auto;
  padding: 32px 20px;
}
.login .wordmark {
  font-size: clamp(3.5rem, 12vw, 5rem);
  letter-spacing: -0.05em;
}
.login p {
  max-width: 42ch;
  font-size: 1.125rem;
}
.login .small {
  color: var(--ink-2);
  font-size: 0.9375rem;
}
.login .btn {
  justify-self: start;
  min-height: 46px;
  padding-inline: 22px;
}
.demo {
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--sheet);
}
.demo .lane {
  grid-template-columns: minmax(0, 1fr);
  min-height: 44px;
}
.demo .lane:first-child {
  border-top: 0;
}

.auth-error {
  display: grid;
  gap: 14px;
  justify-items: start;
  max-width: 460px;
  margin: 18vh auto 0;
  padding: 0 20px;
}
.auth-error h1 {
  font: 800 2rem/1 var(--font-display);
  letter-spacing: -0.04em;
}
.noscript {
  padding: 24px;
}

/* --- Pantallas estrechas ---------------------------------------------------------------- */

@media (max-width: 720px) {
  .session {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 8px;
  }
  .session .shape {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .session-length {
    grid-column: 2;
    grid-row: 1;
  }
  .session-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
  }
  .session-sub {
    white-space: normal;
  }
  .timeline {
    --gutter: 124px;
  }
  .who {
    padding-left: 12px;
  }
  .source {
    justify-content: flex-start;
    text-align: left;
  }
  .user-name {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .live::before {
    animation: none;
  }
}
