/* =========================================================
   TIMETABLE.CSS
   Standalone interactive class timetable (timetable.html)
   Week grid + hover cards (desktop) / day timeline (mobile)
   ========================================================= */

.tt-main,
.tt-controls__inner,
.tt-hero__inner,
.tt-legend__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* Programme accent colours (single source for blocks, pills, legend) */
[data-prog="preschool"]    { --pc: #e07b3a; }
[data-prog="recreational"] { --pc: var(--color-flat-blue, #2f6db5); }
[data-prog="tumbling"]     { --pc: var(--color-red, #d51f2e); }
[data-prog="aerobics"]     { --pc: var(--color-velvet, #6b3fa0); }
[data-prog="rebound"]      { --pc: #0e7c86; }  /* teal: kept off the blue axis so it reads apart from Recreational */
[data-prog="parkour"]      { --pc: #2d7a4f; }
[data-prog="disability"]   { --pc: #5a8a44; }
[data-prog="adults"]       { --pc: var(--color-navy, #04336c); }
[data-prog="open"]         { --pc: #5a6472; }
[data-prog="homeed"]       { --pc: #7b5e9e; }
[data-prog="family-fun"]   { --pc: #d81e5b; }

/* =========================================================
   HERO
   ========================================================= */
.tt-hero {
  background: var(--color-navy);
  color: var(--color-white);
  padding: calc(var(--header-height) + var(--space-3xl)) 0 var(--space-2xl);
  position: relative;
  overflow: hidden;
}
.tt-hero::after {
  content: '';
  position: absolute;
  right: -8%;
  bottom: -60%;
  width: 50vw;
  height: 50vw;
  max-width: 560px;
  max-height: 560px;
  background: var(--color-red);
  opacity: 0.10;
  border-radius: 50%;
  pointer-events: none;
}
.tt-hero__inner { position: relative; z-index: 1; }
.tt-hero__eyebrow {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: var(--space-sm);
}
.tt-hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 6vw, 4rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 0.95;
  margin-bottom: var(--space-md);
}
.tt-hero__lede {
  font-size: var(--fs-base);
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.85);
  max-width: 58ch;
}

/* =========================================================
   CONTROLS  (sticky filter bar)
   ========================================================= */
.tt-controls {
  position: sticky;
  top: var(--sticky-top);
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--color-border, #e6e8ec);
}
.tt-controls__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  padding-top: var(--space-md);
  padding-bottom: var(--space-md);
  flex-wrap: wrap;
}

/* Programme pills */
.tt-filters {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}
.tt-pill {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-navy);
  background: transparent;
  border: 1.5px solid var(--color-border, #dfe3e8);
  border-radius: 100px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}
.tt-pill:hover { transform: translateY(-1px); border-color: var(--pc, var(--color-navy)); }
.tt-pill__dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--pc, var(--color-navy));
}
.tt-pill[aria-pressed="true"] {
  color: #fff;
  background: var(--pc, var(--color-navy));
  border-color: var(--pc, var(--color-navy));
}
.tt-pill[aria-pressed="true"] .tt-pill__dot { background: rgba(255,255,255,0.9); }
.tt-pill--all[aria-pressed="true"] { background: var(--color-navy); border-color: var(--color-navy); }

/* Age slider */
.tt-age { min-width: 230px; }
.tt-age__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-md); margin-bottom: 4px;
}
.tt-age__label {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-navy);
}
.tt-age__output {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 800;
  color: var(--color-red);
}
.tt-age__slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 100px;
  background: var(--color-border, #dfe3e8);
  outline: none;
}
.tt-age__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--color-red);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(4,51,108,0.3);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.tt-age__slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.tt-age__slider::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--color-red); border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(4,51,108,0.3); cursor: pointer;
}
.tt-age__clear {
  margin-top: 6px;
  background: none; border: none; cursor: pointer;
  font-family: var(--font-display); font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--color-text-muted, #8a93a0);
}
.tt-age__clear:hover { color: var(--color-red); }

/* =========================================================
   WEEK GRID  (desktop / tablet)
   ========================================================= */
.tt-main { padding-top: var(--space-2xl); padding-bottom: var(--space-3xl); }

.tt-gridwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.tt-grid {
  --ppm: 1.0667;          /* px per minute (set in JS too) */
  --gutter-w: 56px;
  display: grid;
  grid-template-columns: var(--gutter-w) repeat(7, minmax(120px, 1fr));
  grid-template-rows: auto 1fr;
  min-width: 920px;
  border: 1px solid var(--color-border, #e6e8ec);
  border-radius: var(--radius-md, 10px);
  overflow: hidden;
  background: #fff;
}

/* header row */
.tt-grid__corner {
  grid-row: 1; grid-column: 1;
  background: var(--color-navy);
}
.tt-grid__dayhead {
  grid-row: 1;
  background: var(--color-navy);
  color: #fff;
  text-align: center;
  padding: var(--space-md) 0.5rem;
  font-family: var(--font-display);
  border-left: 1px solid rgba(255,255,255,0.1);
}
.tt-grid__dayhead-name { font-size: var(--fs-sm); font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.tt-grid__dayhead-count { display: block; font-size: 0.68rem; font-weight: 600; color: rgba(255,255,255,0.55); margin-top: 2px; }
.tt-grid__dayhead--today { background: #06408a; }
.tt-grid__dayhead--today .tt-grid__dayhead-name::after { content: ' • Today'; color: var(--color-red); }

/* time gutter */
.tt-grid__times {
  grid-row: 2; grid-column: 1;
  position: relative;
  height: var(--tt-h);
  background: #fafbfc;
  border-right: 1px solid var(--color-border, #e6e8ec);
}
.tt-grid__hour {
  position: absolute; right: 8px;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 0.68rem; font-weight: 700;
  color: var(--color-text-muted, #97a0ad);
  white-space: nowrap;
}

/* day columns */
.tt-grid__col {
  grid-row: 2;
  position: relative;
  height: var(--tt-h);
  border-left: 1px solid var(--color-border, #eef0f3);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--hour-px) - 1px),
    var(--color-border, #eef0f3) calc(var(--hour-px) - 1px),
    var(--color-border, #eef0f3) var(--hour-px)
  );
}
.tt-grid__col--today { background-color: rgba(213, 31, 46, 0.025); }
.tt-grid__col--weekend { background-color: #fbfcfd; }

/* a class block */
.tt-block {
  position: absolute;
  left: 0; right: 2px;
  height: var(--bh);
  border: none;
  text-align: left;
  cursor: pointer;
  border-radius: 7px;
  padding: 5px 8px;
  overflow: hidden;
  color: var(--color-navy);
  background: color-mix(in srgb, var(--pc) 13%, white);
  border-left: 3px solid var(--pc);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pc) 22%, transparent);
  transition: box-shadow 0.14s ease, opacity 0.2s ease;
  font-family: var(--font-body);
}
/* Large intake sessions sit a shade deeper than the small groups in the
   same programme, so the big classes are readable at a glance. */
.tt-block--large {
  background: color-mix(in srgb, var(--pc) 22%, white);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pc) 34%, transparent);
}

/* On hover/focus the block swells to fit all of its text */
.tt-block:hover,
.tt-block:focus-visible {
  height: auto;
  min-height: var(--bh);
  overflow: visible;
  z-index: 30;
  box-shadow: 0 12px 30px rgba(4,51,108,0.24), inset 0 0 0 1px var(--pc);
  outline: none;
}
.tt-block__name { display: block; font-family: var(--font-display); font-weight: 800; font-size: 0.78rem; line-height: 1.12; }
.tt-block__meta { display: block; font-size: 0.68rem; color: var(--color-text-soft, #5a6472); margin-top: 1px; }
.tt-block--xs { padding: 3px 8px; }
.tt-block--xs .tt-block__meta { display: none; }
.tt-block:hover .tt-block__meta,
.tt-block:focus-visible .tt-block__meta { display: block; }

/* dimmed (softened by age slider or legend spotlight) */
.tt-block.is-dim { opacity: 0.18; filter: saturate(0.4); }

/* now marker */
.tt-now {
  position: absolute; left: 0; right: 0; height: 0;
  border-top: 2px solid var(--color-red);
  z-index: 4; pointer-events: none;
}
.tt-now::before {
  content: ''; position: absolute; left: -4px; top: -4px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--color-red);
}

/* =========================================================
   POPOVER  (hover / focus detail card)
   ========================================================= */
.tt-pop {
  position: fixed;
  z-index: 60;
  width: 260px;
  background: #fff;
  border-radius: var(--radius-md, 10px);
  box-shadow: 0 18px 50px rgba(4,51,108,0.28);
  border-top: 4px solid var(--pc, var(--color-navy));
  padding: var(--space-lg);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.14s ease, transform 0.14s ease;
  pointer-events: none;
}
.tt-pop.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.tt-pop__prog {
  font-family: var(--font-display); font-size: 0.66rem; font-weight: 800;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--pc, var(--color-navy));
  margin-bottom: 2px;
}
.tt-pop__name { font-family: var(--font-display); font-size: 1.05rem; font-weight: 900; color: var(--color-navy); line-height: 1.1; margin-bottom: var(--space-sm); }
.tt-pop__rows { display: grid; gap: 5px; margin-bottom: var(--space-md); }
.tt-pop__row { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--color-text-soft, #4a5563); }
.tt-pop__row svg { flex-shrink: 0; color: var(--pc, var(--color-navy)); }
.tt-pop__price { font-family: var(--font-display); font-weight: 800; color: var(--color-navy); }
.tt-pop__tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: var(--space-md); }
.tt-pop__tag {
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--pc, var(--color-navy));
  background: color-mix(in srgb, var(--pc) 12%, white);
  padding: 2px 7px; border-radius: 100px;
}
.tt-pop__actions { display: flex; gap: 6px; }
.tt-pop__btn {
  flex: 1; text-align: center; text-decoration: none;
  font-family: var(--font-display); font-size: 0.72rem; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.55rem 0.5rem; border-radius: 7px; cursor: pointer; border: none;
}
.tt-pop__btn--book { background: var(--color-red); color: #fff; }
.tt-pop__btn--book:hover { background: #b81a27; }
.tt-pop__btn--ics { background: var(--color-off-white, #eef1f5); color: var(--color-navy); display:inline-flex; align-items:center; justify-content:center; gap:5px; }
.tt-pop__btn--ics:hover { background: #e2e7ee; }

/* =========================================================
   MOBILE  (day timeline)
   ========================================================= */
.tt-mobile { display: none; }

.tt-daychips {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding-bottom: var(--space-md);
}
.tt-daychips::-webkit-scrollbar { display: none; }
.tt-chip {
  flex: 0 0 auto;
  font-family: var(--font-display); font-size: 0.78rem; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--color-navy); background: var(--color-off-white, #eef1f5);
  border: none; border-radius: 100px; padding: 0.5rem 0.95rem; cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.tt-chip[aria-selected="true"] { background: var(--color-navy); color: #fff; }
.tt-chip__count { opacity: 0.6; margin-left: 5px; font-weight: 600; }
.tt-chip[aria-selected="true"] .tt-chip__count { opacity: 0.8; }

.tt-daylist { display: flex; flex-direction: column; gap: var(--space-sm); }
.tt-tl {
  display: grid; grid-template-columns: 64px 1fr; gap: var(--space-md);
  background: #fff; border: 1px solid var(--color-border, #e6e8ec);
  border-left: 4px solid var(--pc, var(--color-navy));
  border-radius: var(--radius-md, 10px); padding: var(--space-md) var(--space-lg);
}
.tt-tl.is-hidden { display: none; }
.tt-tl__time { font-family: var(--font-display); font-weight: 800; font-size: 0.8rem; color: var(--color-navy); line-height: 1.25; }
.tt-tl__time small { display:block; font-weight: 600; color: var(--color-text-muted, #97a0ad); }
.tt-tl__name { font-family: var(--font-display); font-weight: 800; font-size: 1rem; color: var(--color-navy); }
.tt-tl__prog { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pc, var(--color-navy)); }
.tt-tl__meta { font-size: 0.82rem; color: var(--color-text-soft, #5a6472); margin-top: 3px; }
.tt-tl__tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tt-tl__tag { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pc, var(--color-navy)); background: color-mix(in srgb, var(--pc) 12%, white); padding: 2px 7px; border-radius: 100px; }
.tt-tl__actions { display: flex; gap: 6px; margin-top: var(--space-sm); }

/* =========================================================
   LEGEND + misc states
   ========================================================= */
.tt-legend { padding-bottom: var(--space-3xl); }
.tt-legend__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.tt-legend__hint { font-size: 0.74rem; font-style: italic; color: var(--color-text-muted, #97a0ad); margin-right: 2px; }
.tt-legend__item {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.78rem; color: var(--color-text-soft, #5a6472);
  background: none; border: 1.5px solid transparent; border-radius: 100px;
  padding: 0.32rem 0.72rem; cursor: pointer; font-family: var(--font-body);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.tt-legend__item:hover { background: var(--color-off-white, #eef1f5); }
.tt-legend__item[aria-pressed="true"] {
  border-color: var(--pc, var(--color-navy));
  background: color-mix(in srgb, var(--pc) 12%, white);
  color: var(--color-navy); font-weight: 700;
}
.tt-legend__dot { width: 11px; height: 11px; border-radius: 50%; background: var(--pc, var(--color-navy)); flex-shrink: 0; }

.tt-empty, .tt-loading { text-align: center; color: var(--color-text-muted, #8a93a0); padding: var(--space-3xl) 0; }
.tt-linkbtn { background: none; border: none; color: var(--color-red); font-weight: 700; cursor: pointer; font-family: var(--font-display); text-transform: uppercase; font-size: 0.78rem; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 880px) {
  .tt-gridwrap { display: none; }
  .tt-mobile { display: block; }
  .tt-controls { position: static; }
  .tt-controls__inner { gap: var(--space-md); }
  .tt-age { width: 100%; min-width: 0; }
  .tt-main, .tt-controls__inner, .tt-hero__inner, .tt-legend__inner {
    padding-left: var(--gutter-mobile); padding-right: var(--gutter-mobile);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tt-block, .tt-pop, .tt-pill, .tt-age__slider::-webkit-slider-thumb { transition: none; }
}

/* =========================================================
   STATIC TIMETABLE

   The whole timetable in plain HTML, written into the page by
   scripts/build-timetable.ps1 on every publish. It is what a
   search engine reads and what someone without JavaScript
   gets; js/timetable.js hides it once the interactive grid
   above has been built from the same rows.

   So on a normal visit this is never seen. It still has to
   look right, because it is what remains if the Sheet cannot
   be reached, and that is exactly when it matters.
   ========================================================= */
.tt-static {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-2xl) var(--gutter) var(--space-4xl);
}

.tt-static__title {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--color-navy);
  margin-bottom: var(--space-xs);
}

.tt-static__note {
  color: var(--color-text-muted);
  margin-bottom: var(--space-2xl);
}

.tt-static__day {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--color-navy);
  margin: var(--space-2xl) 0 var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--color-red);
}

/* A week of classes is wider than a phone. The table scrolls inside this
   rather than pushing the whole page sideways. */
.tt-static__scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tt-static__table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

/* The caption names the day for a screen reader reading the table on its
   own, but the visible <h3> above already says it, so it is not shown. */
.tt-static__caption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.tt-static__table th,
.tt-static__table td {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.tt-static__table thead th {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  background: var(--color-bg-light);
  white-space: nowrap;
}

.tt-static__table tbody th {
  font-weight: 600;
  color: var(--color-text);
}

.tt-static__table tbody tr:last-child th,
.tt-static__table tbody tr:last-child td {
  border-bottom: none;
}

.tt-static__table a {
  color: var(--color-navy);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tt-static__table a:hover,
.tt-static__table a:focus-visible {
  color: var(--color-red);
}
