:root {
  --primary: #DF2A36;
  --primary-dark: #B52B27;
  --secondary: #FFF9ED;
  --light: #FFFFFF;
  --dark: #000000;
  --muted: #6B6258;
  --muted-soft: #B7AB99;
  --ok: #2E7D32;
  --warn: #E07A1F;
  --bad: #B52B27;
  --border: #EADBC4;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--secondary);
  color: var(--dark);
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#app {
  display: grid;
  grid-template-rows: 110px minmax(0, 1fr) 100px 40px;
  width: 100vw;
  height: 100vh;
}

.topbar    { grid-row: 1; }
.board,
.fallback  { grid-row: 2; }
.ticker    { grid-row: 3; }
.bottombar { grid-row: 4; }

/* ================== TOPBAR ================== */
.topbar {
  background: var(--primary);
  color: var(--light);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 56px;
  border-bottom: 4px solid var(--primary-dark);
}

.brand { display: flex; align-items: center; gap: 22px; }

.brand__logo {
  height: 64px;
  width: auto;
  filter: brightness(0) invert(1);
}

.brand__title { line-height: 1; }
.brand__line1 {
  font-weight: 700;
  font-size: 28px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.brand__line2 {
  font-weight: 400;
  font-size: 19px;
  margin-top: 4px;
  opacity: 0.92;
}

.board-title {
  font-weight: 800;
  font-size: 38px;
  text-transform: uppercase;
  letter-spacing: 4px;
  text-align: center;
}

.topbar__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.22);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 16px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 0 3px rgba(74,222,128,0.25);
}
.dot.is-stale { background: #FFB020; box-shadow: 0 0 0 3px rgba(255,176,32,0.3); }
.dot.is-error { background: #FFE600; box-shadow: 0 0 0 3px rgba(255,230,0,0.3); }

.clock {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.clock__time {
  font-weight: 700;
  font-size: 44px;
  line-height: 1;
  letter-spacing: 2px;
}
.clock__date {
  font-weight: 400;
  font-size: 16px;
  margin-top: 4px;
  text-transform: capitalize;
  opacity: 0.92;
}

/* ================== BOARD ================== */
.board {
  padding: 24px 48px 0;
  overflow: hidden;
  min-height: 0;
  display: flex;
}

.cols {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.col-event {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  background: var(--light);
  border-top: 5px solid var(--primary);
  box-shadow: 0 4px 14px rgba(0,0,0,0.05);
  overflow: hidden;
  min-height: 0;
  animation: colEnter 700ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.col-event__photo-wrap {
  grid-row: 1;
  width: 100%;
  height: 25vh;
  overflow: hidden;
  background: var(--secondary);
  position: relative;
  animation: photoFade .5s ease both;
}

.col-event__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.col-event__photo-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.18) 100%);
  pointer-events: none;
}

.col-event__head { grid-row: 2; }
.col-event__body { grid-row: 3; }

@keyframes photoFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.col-event:nth-child(1) { animation-delay: 0ms; }
.col-event:nth-child(2) { animation-delay: 180ms; }
.col-event:nth-child(3) { animation-delay: 360ms; }
.col-event:nth-child(4) { animation-delay: 540ms; }

@keyframes colEnter {
  from { transform: translateY(28px) scale(0.985); opacity: 0; }
  to   { transform: translateY(0)    scale(1);     opacity: 1; }
}

.col-event.is-empty { opacity: 0.55; }

.col-event__head {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.col-event__icon { font-size: 36px; line-height: 1; margin-bottom: 2px; }

.col-event__cat {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--primary);
}

.col-event__name {
  font-weight: 800;
  font-size: 21px;
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--dark);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.col-event__meta {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.col-event__price {
  display: inline-block;
  align-self: flex-start;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.5px;
  color: var(--light);
  background: var(--primary);
  padding: 3px 10px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}

.col-event__place {
  font-weight: 400;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.col-event__body {
  padding: 4px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  min-height: 0;
}

.session {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.session:last-child { border-bottom: 0; }

.session.is-imminent {
  background: linear-gradient(90deg, #FFEFE0 0%, transparent 80%);
  margin: 0 -20px;
  padding: 10px 20px;
  border-bottom: 0;
}

.session.is-cancelled { opacity: 0.45; }

.session__time {
  font-weight: 800;
  font-size: 58px;
  line-height: 1;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  color: var(--dark);
}

.session.is-cancelled .session__time { text-decoration: line-through; }

.session__meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.session__day {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--primary);
}
.session__day--today { color: var(--ok); }

.session__status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  background: var(--ok);
  color: var(--light);
  white-space: nowrap;
}
.badge--warn { background: var(--warn); }
.badge--bad  { background: var(--bad); }
.badge--mute { background: var(--muted); }

.badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
}

.places-line {
  font-weight: 600;
  font-size: 15px;
  color: var(--muted);
}

.session.is-imminent .badge--warn { animation: pulse 1.4s ease-in-out infinite; }

.col-event__empty {
  padding: 30px 24px;
  text-align: center;
  font-size: 22px;
  color: var(--muted-soft);
  font-style: italic;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}


/* ================== TICKER (À l'affiche, rotation 30s) ================== */
.ticker {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: stretch;
  background: var(--primary);
  color: var(--light);
  border-top: 4px solid var(--primary-dark);
  overflow: hidden;
  height: 100px;
}

.ticker__label {
  background: var(--primary-dark);
  color: var(--light);
  padding: 0 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 2px;
  border-right: 4px solid rgba(255,255,255,0.18);
  position: relative;
  z-index: 2;
  text-transform: uppercase;
  line-height: 1;
}

.ticker__label__line1 {
  font-weight: 800;
  font-size: 30px;
  letter-spacing: 3px;
}

.ticker__label__line2 {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 3px;
  opacity: 0.85;
}

.ticker__label::after {
  content: '';
  position: absolute;
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 14px solid var(--primary-dark);
  z-index: 3;
}

.ticker__poster-wrap {
  position: relative;
  width: 160px;
  height: 100%;
  background: var(--primary-dark);
  overflow: hidden;
  flex-shrink: 0;
}

.ticker__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 350ms ease;
}

.ticker__poster-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-dark);
  font-weight: 800;
  font-size: 38px;
  letter-spacing: 4px;
  color: rgba(255,255,255,0.55);
}

.ticker__content {
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
  min-width: 0;
  height: 100%;
  transition: opacity 350ms ease;
}

.ticker.is-changing .ticker__content,
.ticker.is-changing .ticker__poster,
.ticker.is-changing .ticker__poster-fallback {
  opacity: 0;
}

.ticker__poster,
.ticker__poster-fallback {
  transition: opacity 350ms ease;
}

.ticker__track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  animation: ticker-scroll var(--ticker-duration, 40s) linear infinite;
  will-change: transform;
  padding-left: 48px;
}

.ticker__item {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.ticker__item--placeholder {
  font-style: italic;
  font-weight: 500;
  opacity: 0.85;
}

.ticker__item__title {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.ticker__item__date {
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: rgba(0,0,0,0.22);
  padding: 4px 14px;
  border-radius: 4px;
}

.ticker__item__lieu { opacity: 0.88; font-weight: 500; }
.ticker__item__tarif { opacity: 0.75; font-weight: 500; }

.ticker__item__price {
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 4px;
  background: rgba(0,0,0,0.25);
  color: var(--light);
}

.ticker__item__price--free {
  background: var(--ok);
  color: var(--light);
}

.ticker__sep {
  display: inline-flex;
  font-size: 16px;
  color: rgba(255,255,255,0.5);
  margin: 0 36px;
}

@keyframes ticker-scroll {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

.ticker__index {
  align-self: center;
  padding: 0 32px;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 2px;
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

/* ================== FALLBACK (aucune séance) ================== */
.fallback {
  padding: 32px 56px 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.fallback__title {
  margin: 0 0 24px;
  font-size: 42px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 4px;
  color: var(--primary);
}

.fallback__list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.event-card {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  background: var(--light);
  border-left: 8px solid var(--primary);
  padding: 20px 24px;
  min-height: 220px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.event-card__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--secondary);
}

.event-card__body { display: flex; flex-direction: column; gap: 10px; }
.event-card__date { font-weight: 700; font-size: 22px; color: var(--primary); text-transform: uppercase; letter-spacing: 2px; }
.event-card__title { font-weight: 700; font-size: 30px; line-height: 1.1; }
.event-card__lieu { font-size: 22px; color: var(--muted); }
.event-card__desc {
  font-size: 20px;
  color: var(--dark);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ================== BOTTOMBAR (minimal) ================== */
.bottombar {
  background: var(--dark);
  color: rgba(255,255,255,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  letter-spacing: 4px;
  text-transform: uppercase;
}
