/* ==========================================================================================================
   Availability components (public/js/calendar.js) + the /availability page.
   Loaded by /availability and /book. Tokens come from /css/site.css ("The Cyc").

   .cal      month grid shaded by availability (compact on /book, large on /availability)
   .track    level meter of free cameras per 30-minute slot, with the picked window as an amber "clip" and the
             turnaround buffer hatched after it — read like an edit timeline
   .tl       day panel: track + start-time grid (the grid doubles as the meter's table view)
   ========================================================================================================== */

/* Month calendar -------------------------------------------------------------------------------------------- */
.cal { --cal-gap: 4px; display: grid; gap: 10px; }
.cal__head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; }
.cal__title { text-align: center; font: 700 1.0625rem/1.2 var(--font-display); font-stretch: 112%; letter-spacing: -.01em; }
.cal__nav {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r-1); border: 1px solid var(--line);
  background: transparent; color: var(--bone); transition: border-color .18s, background-color .18s;
}
.cal__nav:hover:not(:disabled) { border-color: var(--line-2); background: rgba(239, 234, 225, .04); }
.cal__nav:disabled { opacity: .3; cursor: not-allowed; }
.cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--cal-gap); }
.cal__dow { display: grid; place-items: center; height: 24px; font: 500 .6875rem/1 var(--font-mono); letter-spacing: .06em; color: var(--bone-2); }
.cal__pad { aspect-ratio: 1 / 1; min-height: 44px; }
.cal__day {
  position: relative; aspect-ratio: 1 / 1; min-height: 44px; min-width: 0; padding: 0; border-radius: var(--r-1);
  border: 1px solid transparent; background: var(--graphite-2); color: var(--bone);
  display: grid; place-items: center; align-content: center; gap: 2px;
  font: 500 .9375rem/1 var(--font-mono); font-variant-numeric: tabular-nums;
  transition: background-color .15s, border-color .15s, color .15s, transform .15s var(--ease);
}
.cal__num { position: relative; z-index: 1; }
.cal__meter { position: absolute; left: 22%; right: 22%; bottom: 7px; height: 3px; border-radius: 3px; background: rgba(239, 234, 225, .1); overflow: hidden; }
.cal__meter::after { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--v, 0) * 100%); border-radius: inherit; background: var(--go); }
.cal__day:hover:not(:disabled) { border-color: var(--line-2); background: #2e2c27; }
.cal__day.is-open { background: linear-gradient(180deg, rgba(134, 201, 138, .07), rgba(134, 201, 138, .02)), var(--graphite-2); }
.cal__day.is-partial .cal__meter::after { background: repeating-linear-gradient(90deg, var(--low) 0 4px, transparent 4px 6px); }
.cal__day.is-full {
  color: var(--bone-2);
  background: repeating-linear-gradient(135deg, rgba(239, 234, 225, .06) 0 2px, transparent 2px 7px), var(--graphite-0);
  border-color: var(--line);
}
.cal__day.is-full .cal__num { text-decoration: line-through; text-decoration-color: rgba(239, 234, 225, .45); }
.cal__day.is-full .cal__meter { display: none; }
.cal__day.is-out { background: transparent; color: var(--bone-3); opacity: .55; cursor: not-allowed; }
.cal__day.is-out .cal__meter { display: none; }
.cal__day.is-loading { background: var(--graphite-2); }
.cal__day.is-loading .cal__meter { background: rgba(239, 234, 225, .06); }
.cal__day.is-today::before { content: ""; position: absolute; top: 6px; left: 50%; translate: -50% 0; width: 4px; height: 4px; border-radius: 50%; background: var(--amber); }
.cal__day.is-selected { background: var(--amber); color: var(--amber-ink); border-color: var(--amber); box-shadow: 0 8px 22px -10px rgba(231, 180, 95, .8); }
.cal__day.is-selected .cal__num { text-decoration: none; font-weight: 600; }
.cal__day.is-selected .cal__meter { background: rgba(31, 30, 27, .18); }
.cal__day.is-selected .cal__meter::after { background: var(--amber-ink); }
.cal__day.is-selected.is-today::before { background: var(--amber-ink); }
.cal__free { position: relative; z-index: 1; font: 500 .625rem/1 var(--font-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--bone-2); white-space: nowrap; }
.cal--large .cal__day { container-type: inline-size; }
@container (max-width: 62px) { .cal__free { display: none; } }
.cal__day.is-selected .cal__free { color: rgba(31, 30, 27, .75); }
.cal__day.is-full .cal__free { text-decoration: none; }
.cal__status { min-height: 0; font-size: .875rem; color: var(--bone-2); }
.cal__status:empty { display: none; }
.cal__status.is-error { color: var(--error); }
.cal__retry, .tl .link { background: none; border: 0; padding: 10px 2px; font: inherit; color: var(--amber); text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
@media (prefers-reduced-motion: no-preference) {
  .cal__day.is-loading .cal__meter { background: linear-gradient(90deg, rgba(239, 234, 225, .05), rgba(239, 234, 225, .16), rgba(239, 234, 225, .05)); background-size: 200% 100%; animation: cal-shimmer 1.2s linear infinite; }
}
@keyframes cal-shimmer { to { background-position: -200% 0; } }

/* Large variant (/availability) */
.cal--large { --cal-gap: 6px; }
.cal--large .cal__day { aspect-ratio: auto; min-height: 58px; place-items: start; align-content: start; padding: 9px 8px 16px; text-align: left; }
.cal--large .cal__num { font-size: .9375rem; }
.cal--large .cal__meter { left: 8px; right: 8px; bottom: 8px; }
.cal--large .cal__day.is-today::before { top: 11px; left: auto; right: 9px; translate: none; }
.cal--large .cal__pad { aspect-ratio: auto; min-height: 58px; }
@media (min-width: 600px) {
  .cal--large .cal__day, .cal--large .cal__pad { min-height: 76px; }
  .cal--large .cal__num { font-size: 1.0625rem; }
  .cal--large .cal__free { font-size: .6875rem; }
}
@media (max-width: 420px) { .cal--large .cal__free { display: none; } .cal--large .cal__day { place-items: center; align-content: center; padding-bottom: 12px; } .cal--large .cal__day.is-today::before { top: 6px; right: auto; left: 50%; translate: -50% 0; } }

/* Calendar key */
.cal-legend { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; font: 500 .6875rem/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: .05em; color: var(--bone-2); }
.cal-legend li { display: inline-flex; align-items: center; gap: 8px; }
.cal-legend__key { width: 18px; height: 14px; border-radius: 4px; background: var(--graphite-2); position: relative; flex: none; }
.cal-legend__key::after { content: ""; position: absolute; left: 3px; right: 3px; bottom: 3px; height: 2px; border-radius: 2px; }
.cal-legend__key--open::after { background: var(--go); }
.cal-legend__key--partial::after { background: repeating-linear-gradient(90deg, var(--low) 0 3px, transparent 3px 5px); }
.cal-legend__key--full { background: repeating-linear-gradient(135deg, rgba(239, 234, 225, .16) 0 2px, transparent 2px 5px), var(--graphite-0); border: 1px solid var(--line); }
.cal-legend__key--full::after { display: none; }
.cal-legend__key--short { background: repeating-linear-gradient(135deg, rgba(239, 234, 225, .2) 0 2px, transparent 2px 5px); border: 1px solid var(--line-2); }
.cal-legend__key--short::after { display: none; }
.cal-legend__key--bar { width: 10px; height: 14px; background: rgba(239, 234, 225, .4); border-radius: 3px 3px 0 0; }
.cal-legend__key--bar::after { display: none; }
.cal-legend__key--clip { background: rgba(231, 180, 95, .22); border: 1.5px solid var(--amber); }
.cal-legend__key--clip::after { display: none; }
.cal-legend__key--buffer { background: repeating-linear-gradient(135deg, rgba(231, 180, 95, .55) 0 2px, transparent 2px 5px); border: 1px dashed rgba(231, 180, 95, .6); }
.cal-legend__key--buffer::after { display: none; }
.cal-legend__key--return { background: transparent; }
.cal-legend__key--return::after { left: 0; right: 0; bottom: 5px; height: 3px; background: repeating-linear-gradient(90deg, var(--low) 0 4px, transparent 4px 6px); }

/* Day timeline: the track ---------------------------------------------------------------------------------- */
.tl { display: grid; gap: 16px; }
.track { margin: 0; display: grid; gap: 8px; padding: 14px 14px 10px; border-radius: var(--r-2); background: var(--graphite-0); border: 1px solid var(--line); }
.track__cap { display: flex; justify-content: space-between; gap: 12px; font: 500 .6875rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--bone-2); }
.track__plot { position: relative; height: 64px; margin-top: 18px; }
.tl--browse .track__plot { height: 120px; }
@media (min-width: 768px) { .tl--browse .track__plot { height: 150px; } }
/* recessive grid: quarter lines */
.track__plot::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(239, 234, 225, .07) 1px, transparent 1px) 0 0 / 100% 25%;
}
.track__bars { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; align-items: end; }
.track__bar { display: block; height: max(2px, calc(var(--v) * 100%)); border-radius: 3px 3px 0 0; background: rgba(239, 234, 225, .42); transition: height .3s var(--ease), background-color .2s; }
.track__bar.is-short { background: repeating-linear-gradient(135deg, rgba(239, 234, 225, .22) 0 2px, rgba(239, 234, 225, .06) 2px 5px); }
.track__clip {
  position: absolute; top: -4px; bottom: 0; z-index: 2; pointer-events: none;
  left: calc(var(--from) / var(--n) * 100%); width: calc((var(--to) - var(--from)) / var(--n) * 100%);
  border: 1.5px solid var(--amber); border-radius: 6px; background: rgba(231, 180, 95, .16);
  box-shadow: 0 0 0 1px rgba(31, 30, 27, .6), 0 8px 24px -10px rgba(231, 180, 95, .55);
}
.track__clip.runs-on { border-right-style: dashed; border-top-right-radius: 0; border-bottom-right-radius: 0; background: linear-gradient(90deg, rgba(231, 180, 95, .16) 70%, rgba(231, 180, 95, .04)); }
.track__clip-label {
  position: absolute; top: -1px; left: -1px; translate: 0 -100%; padding: 3px 7px 2px; border-radius: 5px 5px 5px 0;
  background: var(--amber); color: var(--amber-ink); font: 600 .625rem/1.2 var(--font-mono); letter-spacing: .04em; white-space: nowrap;
}
.track__clip-label:empty { display: none; }
.track__buffer {
  position: absolute; top: 6px; bottom: 0; z-index: 1; pointer-events: none;
  left: calc(var(--from) / var(--n) * 100%); width: calc((var(--to) - var(--from)) / var(--n) * 100%);
  border: 1px dashed rgba(231, 180, 95, .55); border-left: 0; border-radius: 0 6px 6px 0;
  background: repeating-linear-gradient(135deg, rgba(231, 180, 95, .3) 0 2px, transparent 2px 6px);
}
.track__mark {
  position: absolute; bottom: -7px; height: 3px; z-index: 1;
  left: calc(var(--at) / var(--n) * 100%); width: max(6px, calc((var(--to) - var(--at)) / var(--n) * 100%));
  background: repeating-linear-gradient(90deg, var(--low) 0 4px, transparent 4px 6px); border-radius: 2px;
}
.track__mark::before { content: ""; position: absolute; left: -3px; top: 50%; translate: 0 -50%; width: 7px; height: 7px; border-radius: 50%; background: var(--low); box-shadow: 0 0 0 2px var(--graphite-0); }
.track__ruler { position: relative; height: 16px; margin-top: 8px; }
.track__ruler span { position: absolute; left: calc(var(--at) / var(--n) * 100%); top: 0; font: 500 .625rem/1 var(--font-mono); color: var(--bone-2); white-space: nowrap; }
.track__ruler span { translate: -50% 0; }
.track__tip {
  position: absolute; z-index: 5; top: -8px; left: var(--x, 50%); translate: -50% -100%; pointer-events: none;
  padding: 6px 9px; border-radius: 8px; background: var(--graphite-2); border: 1px solid var(--line-2); box-shadow: var(--shadow-sm);
  font: 500 .75rem/1.2 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--bone); white-space: nowrap;
}

/* Day timeline: start-time grid ------------------------------------------------------------------------------ */
.tl__pick { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 14px; }
.tl__legend { padding: 0; font: 500 .75rem/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--bone-2); margin-bottom: 2px; }
.tl__group { display: grid; gap: 8px; }
.tl__group-label { font: 500 .6875rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--bone-2); }
.tl__slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 6px; }
.slot { position: relative; min-width: 0; }
.slot input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.slot label {
  display: grid; gap: 3px; align-content: center; min-height: 52px; padding: 7px 9px; border-radius: var(--r-1);
  border: 1px solid var(--line-2); background: var(--graphite-2); cursor: pointer; text-align: left;
  transition: background-color .15s, border-color .15s, color .15s;
}
.slot__time { font: 600 .9063rem/1.1 var(--font-body); font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.01em; }
.slot__hint { font: 500 .6875rem/1.1 var(--font-mono); text-transform: uppercase; letter-spacing: .04em; color: var(--bone-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot.is-low .slot__hint { color: var(--low); }
.slot input:hover + label { border-color: rgba(239, 234, 225, .34); background: #2e2c27; }
.slot input:focus-visible + label { outline: 2px solid var(--amber); outline-offset: 2px; }
.slot input:checked + label { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); box-shadow: 0 8px 22px -12px rgba(231, 180, 95, .9); }
.slot input:checked + label .slot__hint { color: rgba(31, 30, 27, .72); }
.slot.is-off label { background: transparent; border-style: dashed; border-color: var(--line); cursor: not-allowed; }
.slot.is-off .slot__time { color: var(--bone-2); }
.slot.is-off .slot__hint { color: var(--bone-3); }
.slot.is-off input { cursor: not-allowed; }
.tl__none { font-size: .9375rem; color: var(--bone-2); }
.tl__events { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tl__event { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: baseline; font-size: .875rem; color: var(--bone-2); }
.tl__event b { color: var(--bone); font-weight: 600; font-variant-numeric: tabular-nums; }
.tl__event-icon { font: 600 .875rem/1 var(--font-mono); color: var(--low); text-align: center; }
.tl__event--pickup .tl__event-icon { color: var(--bone-2); }
.tl__loading { display: grid; gap: 10px; }
.tl__skel { display: block; height: 52px; border-radius: var(--r-1); background: var(--graphite-2); }
.tl__skel:first-child { height: 104px; border-radius: var(--r-2); }
.tl__skel--short { width: 60%; }
.tl__error { color: var(--error); font-size: .9375rem; }
@media (prefers-reduced-motion: no-preference) {
  .tl__skel { background: linear-gradient(90deg, var(--graphite-2), #302d29, var(--graphite-2)); background-size: 200% 100%; animation: cal-shimmer 1.3s linear infinite; }
}

/* ===========================================================================================================
   /availability page
   =========================================================================================================== */
.avail { padding-block: clamp(28px, 5vw, 56px) clamp(8px, 2vw, 24px); } /* the CTA band below brings its own space */
.avail__head { display: grid; gap: 14px; max-width: 760px; margin-bottom: clamp(24px, 4vw, 40px); }
.avail__title { font: 760 clamp(2.3rem, 6vw, 4.4rem)/.98 var(--font-display); font-stretch: var(--stretch); letter-spacing: -.025em; text-wrap: balance; }
.avail__lede { font-size: clamp(1.0625rem, 1.4vw, 1.1875rem); color: var(--bone-2); max-width: 58ch; text-wrap: pretty; }
.avail__live { display: inline-flex; align-items: center; gap: 10px; font: 500 .75rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--bone); }
.avail__live .tally { animation: tally 2.4s ease-in-out infinite; }
.avail__controls { display: grid; gap: 10px; margin-bottom: 20px; }
.avail__controls .seg__opts { max-width: 560px; }
.avail__controls legend { font: 500 .75rem/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--bone-2); }
.avail__grid { display: grid; gap: 20px; }
.avail__panel { background: var(--graphite-2); border: 1px solid var(--line); border-radius: var(--r-3); padding: clamp(14px, 2.6vw, 24px); box-shadow: var(--shadow); min-width: 0; }
.avail__day { display: grid; gap: 16px; align-content: start; }
.avail__day-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; }
.avail__day-title { font: 760 clamp(1.4rem, 2.6vw, 1.9rem)/1.05 var(--font-display); font-stretch: var(--stretch); letter-spacing: -.02em; }
.avail__day-sub { font: 500 .75rem/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--bone-2); }
.avail__empty { color: var(--bone-2); padding: 24px 0; }
/* "Book this time" floats at the bottom of the screen while the day panel is in view, so picking a start time in
   the long grid always shows its result right away (on phones the box would otherwise sit far below the tap). */
.avail__book {
  position: sticky; bottom: 12px; z-index: 5; display: grid; gap: 10px; padding: 14px 16px; margin-inline: -4px;
  border: 1px solid rgba(231, 180, 95, .42); border-radius: var(--r-2);
  background: rgba(40, 38, 34, .94); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .8), 0 0 0 1px rgba(0, 0, 0, .2);
}
.avail__book-text { font-size: .9063rem; line-height: 1.45; color: var(--bone-2); }
.avail__book-text b { color: var(--bone); font-weight: 600; }
.avail__book .btn { justify-self: start; }
@media (max-width: 479px) { .avail__book .btn { justify-self: stretch; } }
.avail .track { background: var(--graphite); }
.avail .cal__day { background: var(--graphite); }
.avail .cal__day.is-open { background: linear-gradient(180deg, rgba(134, 201, 138, .08), rgba(134, 201, 138, .02)), var(--graphite); }
.avail .cal__day.is-out { background: transparent; }
.avail .cal__day.is-full { background: repeating-linear-gradient(135deg, rgba(239, 234, 225, .06) 0 2px, transparent 2px 7px), var(--graphite-0); }
.avail .cal__day.is-selected { background: var(--amber); }
.avail .slot label { background: var(--graphite); }
.avail .slot.is-off label { background: transparent; }
.avail .slot input:checked + label { background: var(--amber); }
.avail__explain { display: grid; gap: 16px; margin-top: clamp(40px, 6vw, 72px); }
.explain { display: grid; gap: 10px; align-content: start; padding: 20px; border-radius: var(--r-2); border: 1px solid var(--line); }
.explain__title { font: 600 1.0625rem/1.3 var(--font-body); }
.explain__text { color: var(--bone-2); font-size: .9688rem; }
.explain__text strong { color: var(--bone); }
.explain__icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--amber-soft); color: var(--amber); }
/* Turnaround diagram: return → buffer → ready */
.turn { display: grid; grid-template-columns: 4fr 3fr 4fr; gap: 3px; margin-top: 6px; font: 500 .625rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .05em; }
.turn span { padding: 8px 8px 7px; border-radius: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turn__out { background: rgba(239, 234, 225, .1); color: var(--bone); }
.turn__buf { background: repeating-linear-gradient(135deg, rgba(231, 180, 95, .35) 0 2px, transparent 2px 6px); border: 1px dashed rgba(231, 180, 95, .55); color: var(--amber); }
.turn__ready { background: rgba(134, 201, 138, .12); color: var(--go); }
@media (min-width: 900px) { .avail__explain { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) {
  .avail__grid { grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: 24px; align-items: start; }
  .avail__day { position: sticky; top: calc(var(--header-h) + 20px); }
}

