:root {
  --ink: #17312f;
  --muted: #61706e;
  --paper: #f7f3ea;
  --paper-deep: #eee8db;
  --cream: #fffdf8;
  --line: rgba(23, 49, 47, 0.14);
  --coral: #e95f45;
  --coral-dark: #a12e24;
  --teal: #276d68;
  --hour-height: 82px;
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 88% 1%, rgba(233, 95, 69, 0.12), transparent 24rem),
    linear-gradient(180deg, #fbf8f1 0, var(--paper) 32rem);
}

button,
a {
  font: inherit;
}

.schedule-header,
main {
  width: min(1680px, calc(100% - 48px));
  margin-inline: auto;
}

.schedule-header {
  padding: 48px 0 34px;
  border-bottom: 1px solid var(--line);
}

.schedule-header__eyebrow,
.calendar-intro__kicker {
  margin: 0 0 10px;
  color: var(--coral-dark);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.schedule-header__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}

.schedule-header__actions {
  display: flex;
  align-items: flex-end;
  flex: 0 0 auto;
  gap: 14px;
}

.cache-refresh {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 7px;
}

.cache-refresh__button {
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--teal);
  border-radius: 14px;
  background: var(--teal);
  color: #fffdf8;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(39, 109, 104, 0.15);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.schedule-download__button {
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--teal);
  border-radius: 14px;
  background: #fffdf8;
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(39, 109, 104, 0.1);
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.schedule-download__button:hover:not(:disabled) {
  background: var(--teal);
  color: #fffdf8;
  transform: translateY(-1px);
}

.schedule-download__button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.schedule-download__button:disabled {
  border-color: #c5cbc9;
  background: #eef0ef;
  color: #8a9491;
  cursor: not-allowed;
  box-shadow: none;
}

.cache-refresh__button:hover:not(:disabled) {
  background: #1e5b57;
  transform: translateY(-1px);
}

.cache-refresh__button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.cache-refresh__button:disabled {
  border-color: #9ca4a2;
  background: #9ca4a2;
  color: #eef0ef;
  cursor: not-allowed;
  box-shadow: none;
}

.cache-refresh__status {
  max-width: 260px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
  text-align: right;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: "Fraunces", Georgia, serif;
}

h1 {
  max-width: 900px;
  margin-bottom: 8px;
  font-size: clamp(3rem, 7vw, 6.6rem);
  line-height: 0.9;
  letter-spacing: -0.055em;
}

.schedule-header__dates {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.draft-warning {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 12px;
  min-width: 235px;
  padding: 15px 18px;
  border: 1px solid rgba(161, 46, 36, 0.3);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.78);
  color: var(--coral-dark);
  box-shadow: 0 10px 30px rgba(65, 44, 28, 0.06);
}

.draft-warning__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 6px rgba(233, 95, 69, 0.14);
}

.draft-warning span:last-child {
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
  line-height: 1.3;
}

.draft-warning strong {
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

main {
  padding: 34px 0 72px;
}

.calendar-intro {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto;
  align-items: end;
  gap: 36px;
  margin-bottom: 26px;
}

.calendar-intro h2,
.issue-summary h2 {
  margin-bottom: 7px;
  font-size: clamp(1.8rem, 3.6vw, 3.25rem);
  line-height: 1;
  letter-spacing: -0.035em;
}

.calendar-intro p:last-child {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 18px;
  max-width: 600px;
  color: var(--muted);
  font-size: 0.78rem;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.legend-swatch {
  display: inline-block;
  width: 20px;
  height: 12px;
  border-radius: 4px;
}

.legend-swatch--event {
  border: 2px solid #276d68;
  background: rgba(39, 109, 104, 0.12);
}

.legend-swatch--slot {
  background: #276d68;
}

.legend-swatch--soundcheck {
  border: 2px solid #76aaa6;
  background: #c7dedc;
}

.legend-swatch--issue {
  border: 2px dotted #d33b32;
  background: #fff4f1;
}

.schedule-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.8);
  color: var(--muted);
}

.schedule-status[hidden] {
  display: none;
}

.schedule-status--error {
  color: var(--coral-dark);
}

.schedule-status__pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--coral);
  animation: pulse 1.3s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.25; transform: scale(0.7); }
}

.schedule-shell {
  overflow: hidden;
  border: 1px solid rgba(23, 49, 47, 0.18);
  border-radius: 24px;
  background: var(--cream);
  box-shadow: 0 28px 80px rgba(65, 44, 28, 0.1);
}

.schedule-scroll {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.calendar {
  position: relative;
  width: var(--calendar-width);
  min-width: var(--calendar-width);
}

.calendar-head {
  display: grid;
  grid-template-columns: var(--calendar-columns);
  min-height: 92px;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.96);
  backdrop-filter: blur(18px);
}

.calendar-head__corner {
  border-right: 1px solid var(--line);
}

.day-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px;
  border-right: 1px solid var(--line);
}

.day-heading:last-child {
  border-right: 0;
}

.day-heading__weekday {
  display: block;
  margin-bottom: 4px;
  color: var(--coral-dark);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.day-heading__date {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.day-heading__count {
  padding-bottom: 3px;
  color: var(--muted);
  font-size: 0.68rem;
}

.calendar-body {
  position: relative;
  display: grid;
  grid-template-columns: var(--calendar-columns);
  height: var(--plot-height);
  background: var(--cream);
}

.time-rail {
  position: relative;
  z-index: 8;
  border-right: 1px solid var(--line);
  background: var(--cream);
}

.time-label {
  position: absolute;
  right: 13px;
  transform: translateY(-50%);
  color: #7b8583;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.day-column {
  position: relative;
  min-width: 0;
  border-right: 1px solid var(--line);
  background-image:
    linear-gradient(to bottom, rgba(23, 49, 47, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(23, 49, 47, 0.035) 1px, transparent 1px);
  background-position: 0 0, 0 0;
  background-size: 100% var(--hour-height), 100% calc(var(--hour-height) / 2);
}

.day-column:last-of-type {
  border-right: 0;
}

.day-column--weekend {
  background-color: rgba(238, 232, 219, 0.24);
}

.overall-event,
.slot-card {
  position: absolute;
  overflow: hidden;
  appearance: none;
  width: auto;
  margin: 0;
  text-align: left;
}

.overall-event {
  z-index: 10;
  left: calc(var(--lane-left) + 4px);
  width: calc(var(--lane-width) - 8px);
  min-height: 34px;
  padding: 4px;
  border: 2px solid var(--event-color);
  border-radius: 13px;
  background: var(--event-wash);
  box-shadow: 0 8px 20px rgba(41, 45, 40, 0.08);
}

.overall-event:focus-visible,
.slot-card:focus-visible {
  outline: 3px solid #111;
  outline-offset: 3px;
}

.overall-event__heading {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 20px;
  width: 100%;
  padding: 0 4px;
  border: 0;
  background: transparent;
  overflow: hidden;
  color: var(--event-ink);
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}

.overall-event__heading span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.overall-event--half-lane .overall-event__heading {
  align-items: flex-start;
  flex-wrap: wrap;
  height: auto;
  line-height: 1.18;
  white-space: normal;
}

.overall-event--half-lane .overall-event__heading span:first-child {
  flex: 1 1 100%;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.overall-event__venue {
  opacity: 0.72;
  font-weight: 500;
}

.draft-pill {
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.nested-slots {
  position: absolute;
  inset: 0 4px 4px;
  pointer-events: none;
}

.stage-keys {
  position: absolute;
  z-index: 24;
  top: 25px;
  right: 8px;
  left: 8px;
  height: 18px;
  pointer-events: none;
}

.stage-key {
  position: absolute;
  top: 0;
  display: flex;
  align-items: center;
  width: 66.667%;
  height: 18px;
  padding: 0 7px;
  border: 1px solid #fff;
  border-radius: 6px;
  color: var(--event-ink);
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.stage-key--one {
  left: 0;
  justify-content: flex-start;
  background: linear-gradient(90deg, var(--event-color) 0 5px, rgba(255, 255, 255, 0.78) 5px 100%);
}

.stage-key--two {
  right: 0;
  justify-content: flex-end;
  background: linear-gradient(270deg, var(--event-color) 0 5px, rgba(255, 255, 255, 0.78) 5px 100%);
}

.slot-card {
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 4px 7px;
  border: 1px solid #fff;
  border-radius: 7px;
  background: var(--slot-color);
  color: var(--slot-ink);
  box-shadow: 0 3px 8px rgba(33, 37, 33, 0.13);
  cursor: pointer;
  pointer-events: auto;
}

.slot-card__time {
  font-size: 0.55rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  opacity: 0.82;
  text-transform: uppercase;
}

.slot-card__name {
  overflow: hidden;
  font-size: 0.67rem;
  font-weight: 700;
  line-height: 1.12;
  text-overflow: ellipsis;
}

.slot-card__meta {
  overflow: hidden;
  font-size: 0.52rem;
  line-height: 1.1;
  opacity: 0.78;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-card--soundcheck,
.slot-card--diagnostic,
.slot-card--unconnected {
  left: calc(var(--lane-left) + 13px);
  width: calc(var(--lane-width) - 26px);
}

.slot-card--soundcheck {
  z-index: 30;
  border: 2px solid var(--parent-color);
  background: var(--slot-color);
  color: var(--parent-ink);
  box-shadow: 0 5px 14px rgba(33, 37, 33, 0.11);
}

.slot-card--diagnostic,
.slot-card--unconnected {
  z-index: 36;
  border: 3px dotted #d33b32;
  background: #fff5f1;
  color: #7d241d;
  box-shadow: 0 5px 16px rgba(132, 40, 32, 0.12);
}

.slot-card--diagnostic::after,
.slot-card--unconnected::after {
  content: "check";
  position: absolute;
  top: 4px;
  right: 5px;
  padding: 2px 4px;
  border-radius: 999px;
  background: #d33b32;
  color: white;
  font-size: 0.46rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.connector-layer {
  position: absolute;
  inset: 0;
  z-index: 15;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.connector-layer path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.edge-note {
  position: absolute;
  z-index: 38;
  right: 8px;
  width: min(220px, calc(100% - 16px));
  padding: 8px 10px;
  border: 2px dotted #d33b32;
  border-radius: 9px;
  background: #fff5f1;
  color: #7d241d;
  font-size: 0.58rem;
  line-height: 1.3;
  box-shadow: 0 6px 16px rgba(132, 40, 32, 0.12);
}

.issue-summary {
  display: grid;
  grid-template-columns: minmax(260px, 0.6fr) 1.4fr;
  gap: 32px;
  margin-top: 32px;
  padding: 28px;
  border: 1px solid rgba(211, 59, 50, 0.24);
  border-radius: 20px;
  background: rgba(255, 245, 241, 0.66);
}

.issue-summary[hidden] {
  display: none;
}

.issue-list {
  display: grid;
  gap: 8px;
}

.issue-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.86);
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.issue-item__mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--coral);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
}

.issue-item strong {
  color: var(--ink);
}

.event-dialog {
  width: min(560px, calc(100% - 32px));
  max-height: min(760px, calc(100vh - 48px));
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 22px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 30px 100px rgba(27, 33, 29, 0.35);
}

.event-dialog::backdrop {
  background: rgba(19, 35, 33, 0.52);
  backdrop-filter: blur(5px);
}

.event-dialog__close {
  position: sticky;
  top: 14px;
  z-index: 2;
  float: right;
  width: 36px;
  height: 36px;
  margin: 14px 14px 0 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.94);
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.event-dialog__hero {
  min-height: 132px;
  padding: 32px 64px 26px 28px;
  background: var(--dialog-wash, var(--paper-deep));
  border-bottom: 1px solid var(--line);
}

.event-dialog__hero h3 {
  margin: 4px 0 8px;
  font-size: 2rem;
  line-height: 1.04;
}

.event-dialog__body {
  padding: 24px 28px 32px;
  color: var(--muted);
  line-height: 1.58;
}

.event-dialog__body strong {
  color: var(--ink);
}

.event-dialog__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.event-dialog__meta span {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--paper);
  font-size: 0.7rem;
}

.event-dialog__link {
  display: inline-flex;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 9px;
  background: var(--ink);
  color: white;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 900px) {
  .schedule-header,
  main {
    width: min(100% - 26px, 1680px);
  }

  .schedule-header {
    padding-top: 30px;
  }

  .schedule-header__row,
  .calendar-intro,
  .issue-summary {
    grid-template-columns: 1fr;
  }

  .schedule-header__row {
    align-items: flex-start;
    flex-direction: column;
  }

  .schedule-header__actions {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .cache-refresh {
    align-items: flex-start;
  }

  .cache-refresh__status {
    text-align: left;
  }

  .draft-warning {
    min-width: 0;
  }

  .calendar-legend {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 3.15rem;
  }

  .calendar-intro h2,
  .issue-summary h2 {
    font-size: 2rem;
  }

  .schedule-shell {
    border-radius: 16px;
  }

  .issue-summary {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
