.class-timetable {
  --hours-width: 12.5%;
  color: #252525;
}

.class-timetable__status,
.class-timetable__booking {
  margin: 1em 0;
  font-size: 1.4rem;
  line-height: 1.5;
  text-align: center;
}

.class-timetable__status:empty { margin: 0; }

.class-timetable__booking a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.class-timetable__retry {
  display: block;
  margin-inline: auto;
  padding: 0.4em 0.75em;
  border: 1px solid currentColor;
  background: #fff;
  color: inherit;
  cursor: pointer;
}

.class-timetable__retry[hidden] { display: none; }

.class-timetable__days {
  overflow: auto;
  max-height: 97.2rem;
}

.class-timetable__days table { table-layout: fixed; }
.class-timetable__hours { width: var(--hours-width); }

/* Other dimensions, margins and borders come from each shop's original
   .calendar .tt_timetable stylesheet. Only the old tab widget supplied the font. */
.class-timetable table.tt_timetable { font-family: "Barlow Condensed", sans-serif; }
.class-timetable .event_header { overflow-wrap: anywhere; }

.class-timetable [data-color="cf"] { --slot: #d9652b; }
.class-timetable [data-color="cc"] { --slot: #e0362d; }
.class-timetable [data-color="sw"] { --slot: #adb0b3; }
.class-timetable [data-color="og"] { --slot: #49e8fa; }
.class-timetable [data-color="fb"] { --slot: #ffa83f; }
.class-timetable [data-color="hc"] { --slot: #3f3fff; }
.class-timetable [data-color="kb"] { --slot: #ff3f3f; }
.class-timetable [data-color="hyrox"] { --slot: #27ae60; }
.class-timetable [data-color="circuit"] { --slot: #477435; }
.class-timetable [data-color="recovery"] { --slot: #47778d; }
.class-timetable [data-color="beginner"] { --slot: #796097; }
.class-timetable [data-color="kids"] { --slot: #a27c18; }
.class-timetable .tt_timetable td.event { background-color: var(--slot); }

.class-timetable__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Takatsuki has its own original timetable, with sticky Japanese headings,
   a half-hour clock, and inset pastel cards on a quarter-hour grid. */
.class-timetable--takatsuki { --hours-width: 75px; }
.class-timetable--takatsuki .class-timetable__status,
.class-timetable--takatsuki .class-timetable__booking { font-size: 0.9375rem; }

.class-timetable--takatsuki .class-timetable__days:not(:empty) {
  max-height: 700px;
  border: 1px solid #e2e8f0;
  border-radius: 1.5rem;
  background: #fff;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 25%);
}

.class-timetable__grid {
  width: 100%;
  min-width: 1000px;
  border-spacing: 1px;
  border-collapse: separate;
  background: #cbd5e1;
}

.class-timetable__grid th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 40px;
  padding: 0;
  background: #0f172a;
  color: white;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.class-timetable__grid td { height: 18px; padding: 0; background: #fff; }
.class-timetable__grid .tt_hours_column {
  position: sticky;
  left: 0;
  z-index: 1;
  padding-top: 4px;
  border-right: 2px solid #cbd5e1;
  color: #475569;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  vertical-align: top;
}
.class-timetable__grid th:first-child { left: 0; z-index: 3; }

.class-timetable__grid [data-color="cf"] { --paper: #fff7ed; --ink: #9a3412; --slot: var(--brand-orange); }
.class-timetable__grid [data-color="cc"] { --paper: #fff1f2; --ink: #be123c; --slot: var(--brand-red); }
.class-timetable__grid [data-color="sw"] { --paper: #f0f9ff; --ink: #1e3a8a; --slot: var(--brand-navy); }
.class-timetable__grid [data-color="hyrox"] { --paper: #ecfdf5; --ink: #065f46; --slot: var(--brand-green); }
.class-timetable__grid [data-color="kids"] { --paper: #fefce8; --ink: #854d0e; --slot: var(--brand-yellow); }

.class-timetable__grid .event { position: relative; }
.class-timetable__grid .event_container {
  position: absolute;
  inset: 1px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border-left: 4px solid var(--slot);
  padding: 2px;
  background: var(--paper, #f1f5f9);
  color: var(--ink, #334155);
  box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
  font-size: 9px;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
}

@media (min-width: 768px) {
  .class-timetable--takatsuki { --hours-width: 85px; }
  .class-timetable--takatsuki .class-timetable__days:not(:empty) { max-height: 900px; }
  .class-timetable__grid { min-width: 1072px; }
  .class-timetable__grid th { height: 50px; }
  .class-timetable__grid td { height: 25px; }
  .class-timetable__grid .event_container { border-left-width: 6px; padding: 4px; font-size: 10px; }
}

@media (max-width: 767px) {
  .class-timetable.calendar { --hours-width: 9.26%; }
  .calendar .class-timetable__days { max-height: none; margin-inline: -5rem; }
  .main--shop-single .page-content--schedule .calendar .class-timetable__days table.tt_timetable {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0;
  }
  .calendar .class-timetable__status,
  .calendar .class-timetable__booking { font-size: 2.2rem; }

  .class-timetable--takatsuki {
    --hours-width: 36px;
    --schedule-surroundings: 250px;
  }
  .class-timetable-section#schedule { padding-block: 1.5rem; }
  #schedule .class-timetable--takatsuki { margin-inline: -0.5rem; }
  .class-timetable-section .class-timetable-section__header { margin-bottom: 0.75rem; }
  .class-timetable-section .class-timetable-section__note { margin-top: 0.5rem; }
  .class-timetable--takatsuki .class-timetable__days:not(:empty) {
    max-height: none;
    border-radius: 0.5rem;
  }
  .class-timetable__grid { min-width: 0; border-spacing: 0; }

  /* One screen for the weekly grid, with space for the store header and booking link. */
  .class-timetable__days table {
    --time-row-height: min(8px, calc((100svh - var(--schedule-surroundings, 200px)) / var(--time-rows)));
  }
  .main--shop-single .page-content--schedule .calendar .class-timetable__days th,
  .class-timetable__grid th {
    height: 22px !important;
    line-height: 22px !important;
  }
  .main--shop-single .page-content--schedule .calendar .class-timetable__days td,
  .main--shop-single .page-content--schedule .calendar .class-timetable__days td.tt_hours_column,
  .class-timetable__grid td {
    height: var(--time-row-height) !important;
    padding: 0 !important;
    line-height: 0 !important;
  }
  .class-timetable__grid td { border-bottom: 1px solid #e2e8f0; }
  .class-timetable__days .tt_hours_column { position: relative; }

  .class-timetable__clock {
    position: absolute;
    inset: 0 0 auto;
    font-size: 9px;
    line-height: 1;
    transform: translateY(-35%);
  }
  .class-timetable__hour-mark:first-child .class-timetable__clock { transform: none; }
  tr:not(.class-timetable__hour-mark) .class-timetable__clock { opacity: 0; }

  .class-timetable__days td.event { position: relative; }
  .class-timetable__days .event_container {
    position: absolute;
    inset: 0;
    overflow: hidden;
  }
  .class-timetable__grid .event_container {
    border-left-width: 2px;
    padding: 0;
  }
  .class-timetable__grid .slot-time {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
