/* Book a Cage (book-cage.php) — only what is this page's own; the rest is site.css. */

/* ---------- hero ---------- */
.cage-hero {
  background:
    var(--noise),
    radial-gradient(120% 120% at 85% 0%, color-mix(in srgb, var(--red) 22%, transparent) 0%, transparent 55%),
    linear-gradient(180deg, var(--ink), var(--black));
  background-blend-mode: soft-light, normal, normal;
  padding-bottom: var(--s3);
}
.cage-title { margin-bottom: var(--s1); }
.cage-sub { margin-bottom: var(--s1); }
.cage-who { margin: 0; color: var(--grey-light); }
.cage-who a { color: var(--white); font-weight: 600; }

/* ---------- board ---------- */
.cage-board {
  padding-top: var(--s2);
  /* a faint infield dirt at the top that fades into black, never a brown gradient under --noise
     (PSA_23626); the shade is heavy so the timetable stays the thing you read */
  background:
    radial-gradient(140% 80% at 50% 0%, color-mix(in srgb, var(--black) 72%, transparent) 0%, var(--black) 70%),
    url("../img/dirt.jpg") 0 0 / 600px 180px repeat,
    var(--black);
}

/* "Your upcoming bookings": its own box under the timetable, each booking's day, hour and cage
   (👤 Alex, PSA_23607; moved under the timetable and its count line gone, PSA_23638) */
.cage-mine {
  max-width: 46rem; margin: var(--s3) auto 0; padding: var(--s2) var(--s2) var(--s2); text-align: center;
  background: var(--char); border: 1px solid var(--steel); border-top: var(--edge) solid var(--turf-light); border-radius: var(--radius);
}
.cage-mine-title { font-size: var(--fs-h3); margin: 0 0 var(--s1); }
.cage-mine-list { list-style: none; margin: 0 0 var(--s1); padding: 0; display: grid; gap: var(--s0); color: var(--white); }
.cage-mine-list a { color: var(--white); font-weight: 600; }
.cage-mine-none { margin: 0 0 var(--s1); }
/* each booking's Cancel, the small pill My account uses (PSA_23616), at the right of its day, hour and cage
   (👤 Alex, PSA_23745: "put the cancel button to the right of the dates"); the words wrap on a phone, the pill stays right */
.cage-mine-list:has(.cage-mine-cancel) { gap: var(--s1); }
.cage-mine-list li { display: flex; align-items: center; justify-content: center; gap: var(--s2); }
.cage-mine-list li:has(.cage-mine-cancel) { justify-content: space-between; text-align: left; }
.cage-mine-cancel { margin: 0; flex: none; }
.cage-mine-cancel .pill-btn {
  position: relative; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: var(--s0) var(--s1-5);
  background: none; border: 2px solid var(--grey-light); border-radius: var(--radius-pill);
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: .06em; font-size: var(--fs-xs); line-height: 1.2; color: var(--white);
}
.cage-mine-cancel .pill-btn:hover { border-color: var(--white); }
.cage-mine-cancel .pill-btn:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.cage-mine-cancel .pill-btn::after { content: ''; position: absolute; inset: -8px -4px; }   /* a 44px tap target */
.cage-mine-flash { margin: 0 0 var(--s1); }

/* day chips: one row, scrolls sideways on a phone */
.day-chips {
  position: relative;
  display: flex; gap: var(--s1);
  overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
  padding: var(--s0) .1rem var(--s1-5); margin: 0 -.1rem var(--s2);
  scrollbar-width: thin;
}
.day-chip {
  flex: 0 0 auto; scroll-snap-align: start;
  display: grid; justify-items: center; gap: .1rem;
  min-width: 92px; padding: var(--s1) var(--s2);
  border: 2px solid var(--steel); border-radius: var(--radius);
  background: var(--char); color: var(--grey-light);
  text-decoration: none; line-height: 1.1;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.day-chip:hover { border-color: var(--grey); color: var(--white); }
.day-chip-top { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-base); text-transform: uppercase; letter-spacing: .04em; }
.day-chip-date { font-size: var(--fs-xs); color: var(--grey); }
.day-chip.is-active { background: var(--red); border-color: var(--red); color: var(--white); box-shadow: var(--glow); }
.day-chip.is-active .day-chip-date { color: var(--white); }   /* .85 white was 4.0 : 1 on red; white is 5.2 */

.cage-notice { margin-bottom: var(--s2); color: var(--chalk); }

.cage-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s1) var(--s3); margin-bottom: var(--s2); }
.cage-day-title { font-size: var(--fs-xl); margin: 0; }

/* ---------- the timetable: one row per hour, one column per cage (👤 Alex, 2026-10-25) ---------- */
.cage-cols { transition: opacity .15s ease; }
.cage-cols.is-loading { opacity: .45; pointer-events: none; }
.cage-empty { margin: 0; text-align: center; }

.cage-table { width: 100%; max-width: 1000px; margin: 0 auto; table-layout: fixed; border-collapse: separate; border-spacing: .5rem; }
/* the three cage columns are centred on the page and the hours sit to their left, outside the
   centring (👤 Alex, 2026-10-25; PSA_23607 point 3): the left margin is half the free width less
   half the hour column's share (its 6.2rem width plus one .5rem gap). From 720px the table gives up
   that share of its width so the centring holds on a small laptop too; a phone keeps every pixel */
@media (min-width: 720px) {
  .cage-table { width: min(1000px, 100% - 6.7rem); margin-left: calc((100% - min(1000px, 100% - 6.7rem)) / 2 - 3.35rem); margin-right: 0; }
}
.cage-table th { font-family: var(--font-display); font-weight: 600; line-height: 1.1; }
.cage-table thead th { padding: 0 .15rem .15rem; text-align: center; vertical-align: bottom; color: var(--white); font-size: var(--fs-lg); text-transform: uppercase; letter-spacing: .04em; }
/* the cage names stay in view under the site header while the hours scroll (a phone; on a wide
   screen the header is the cage cards below, too tall to pin) */
.cage-table thead th { position: sticky; top: calc(var(--header-h) + 3px); z-index: 2; padding-top: var(--s1); background: var(--black); box-shadow: 0 0 0 .5rem var(--black); }   /* the shadow fills the border-spacing gaps */
.cage-th-name { display: block; }
.cage-th-about { display: none; }
.cage-th:target .cage-th-about { display: block; margin-top: var(--s0); font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 400; text-transform: none; letter-spacing: 0; line-height: 1.35; color: var(--grey-light); }
/* a wide screen: each cage's header is a card with its description; no ⓘ, nothing pinned (👤 Alex, 2026-10-25) */
@media (min-width: 720px) {
  .cage-table thead th { position: static; box-shadow: none; background: none; }
  .cage-table thead .cage-th {
    vertical-align: top; padding: var(--s2) var(--s2) var(--s2);
    background: var(--char); border: 1px solid var(--steel); border-top: var(--edge) solid var(--red); border-radius: var(--radius);
  }
  .cage-th .cage-th-about {
    display: block; margin-top: var(--s1); font-family: var(--font-body); font-size: var(--fs-md); font-weight: 400;
    text-transform: none; letter-spacing: 0; line-height: 1.45; color: var(--grey-light);
  }
  .cage-th .cage-info { display: none; }
  /* a line across the whole card between the name and the description (👤 Alex, 2026-10-25) */
  .cage-th .cage-th-name::after { content: ''; display: block; height: 1px; margin: var(--s1) -1rem 0; background: var(--steel); }   /* edge to edge: -1rem undoes the cell's side padding */
}
/* the ⓘ under a cage's name: a tap opens its description (.cage-pop; PSA_23409) */
.cage-info {
  display: grid; place-items: center; width: 26px; height: 26px; margin: var(--s0) auto 0;
  border: 2px solid var(--grey); border-radius: 50%; color: var(--grey-light); text-decoration: none;
  font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-weight: 700; font-size: var(--fs-md); line-height: 1; text-transform: none;
  position: relative;
}
.cage-info::after { content: ''; position: absolute; inset: -9px; }   /* a 44px tap target round the 26px circle */
.cage-info:hover, .cage-info:focus-visible, .cage-info[aria-expanded="true"] { border-color: var(--white); color: var(--black); background: var(--white); }
.cage-pop {
  position: fixed; z-index: 40; width: min(17rem, calc(100vw - 16px));
  padding: var(--s1-5) var(--s2); border-radius: var(--radius-sm); border-top: var(--edge) solid var(--red);
  background: var(--white); color: var(--ink); box-shadow: var(--shadow-lg);
  font-size: var(--fs-md); line-height: 1.4; text-align: left;
}
.cage-pop::before {
  content: ''; position: absolute; top: calc(-8px - var(--edge)); left: calc(var(--arrow-x, 50%) - 7px);
  border: 7px solid transparent; border-bottom-color: var(--red);
}
.cage-pop[hidden] { display: none; }

/* Tim's line true of every cage, under the timetable */
.cage-abouts-all { margin: var(--s2) 0 0; text-align: center; color: var(--white); font-weight: 600; }
.cage-table .cage-time-col { width: 6.2rem; }
.cage-table tbody th { padding-right: var(--s0); text-align: right; white-space: nowrap; color: var(--grey-light); font-size: var(--fs-lg); letter-spacing: .02em; }
.cage-table td { padding: 0; }
.cage-table .slot { justify-content: center; width: 100%; min-height: 52px; padding: var(--s1) var(--s0); }
@media (max-width: 519.98px) {
  .cage-table { border-spacing: .3rem; }
  .cage-table .cage-time-col { width: 4.4rem; }
  .cage-table tbody th { font-size: var(--fs-md); padding-right: .1rem; }
  .cage-table thead th { font-size: var(--fs-sm); }
  .cage-table .slot { min-height: 48px; }
}

.slot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s1);
  min-height: 58px; padding: var(--s1-5) var(--s2);
  border-radius: var(--radius-sm);
  text-decoration: none; line-height: 1.1;
  border: 2px solid transparent;
}
.slot-state { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }

.slot.is-open {
  background: var(--chalk); color: var(--black);
  box-shadow: inset 5px 0 0 var(--turf-light), 0 3px 0 color-mix(in srgb, var(--black) 35%, transparent);
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
}
.slot.is-open .slot-state { color: var(--turf); }
.slot.is-open:hover, .slot.is-open:focus-visible {
  background: var(--white); color: var(--black); transform: translateY(-2px);
  box-shadow: inset 5px 0 0 var(--red), 0 6px 16px color-mix(in srgb, var(--black) 45%, transparent);
}
.slot.is-open:hover .slot-state { color: var(--red); }
.slot.is-picked { background: var(--red); color: var(--white); box-shadow: var(--glow); }
.slot.is-picked .slot-state { color: var(--white); }

.slot.is-booked { background: var(--char); color: var(--grey-on-dark);   /* 4.8 : 1; #6b7079 was 3.1 */ border-color: var(--steel); cursor: not-allowed; }
.slot.is-held { background: color-mix(in srgb, var(--amber) 8%, transparent); color: var(--amber-light); border: 2px dashed color-mix(in srgb, var(--amber) 60%, transparent); cursor: not-allowed; }
.slot.is-yours { background: transparent; color: var(--white); border-color: var(--red); cursor: default; }
.slot.is-yours .slot-state { color: var(--red-text); }
/* a Speed & Agility class hour: every cage is closed (ticket #90) — infield-dirt stripes, not Open, not Booked */
.slot.is-class {
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--clay) 22%, transparent) 0 8px, color-mix(in srgb, var(--clay) 8%, transparent) 8px 16px), var(--char);
  color: var(--clay-light); border-color: var(--clay-dark); cursor: not-allowed;
}
.slot.is-class .slot-state { color: var(--clay-light); }

/* How booking works (👤 Alex, PSA_23638): the rules as short cards, then the Batting Cage Membership
   call to action — the classes page's .class-cta look: dark box, red top edge, centred */
.cage-rules {
  max-width: 62rem; margin: var(--s4) auto 0; text-align: center;
  background: var(--char); border: 1px solid var(--steel); border-top: var(--edge) solid var(--red);
  border-radius: var(--radius); padding: var(--s3) var(--s2);
}
.cage-rules-grid { display: grid; gap: var(--s1); grid-template-columns: 1fr; }
@media (min-width: 900px) { .cage-rules-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cage-rules { max-width: 62rem; }
.cage-rule { border-top: 3px solid var(--turf-light); }   /* all three alike (👤 Alex, PSA_23638) */
/* the heading at the top of the card, the line under it centred in the space left (👤 Alex, PSA_23638) */
.cage-rule > span { margin: auto 0; padding-top: var(--s0); }
/* See memberships sits in the free-hour card, under its text (👤 Alex, PSA_23638) */
.cage-rule-btn { margin-top: var(--s2); margin-bottom: auto; }
.cage-rule > span:has(+ .cage-rule-btn) { margin-bottom: 0; }
.cage-rule { display: flex; flex-direction: column; align-items: center; gap: var(--s0);
  background: color-mix(in srgb, var(--black) 28%, transparent); border-radius: var(--radius-sm); padding: var(--s2) var(--s1);
  color: var(--grey-light); font-size: var(--fs-sm); }
.cage-rule-big { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  font-size: var(--fs-lg); line-height: 1.1; color: var(--white); margin: 0; }

/* ---------- the booking sheet (bottom sheet on a phone, a centred card on a desktop) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--black) 60%, transparent); backdrop-filter: blur(2px); }
.sheet {
  position: fixed; z-index: 61; left: 0; right: 0; bottom: 0;
  max-height: 92vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--white); color: var(--ink);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.4rem 1.15rem calc(1.2rem + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px color-mix(in srgb, var(--black) 50%, transparent);   /* --shadow-lg, cast upward from a bottom sheet */
  border-top: var(--edge) solid var(--red);
  animation: sheet-up .2s ease-out;
}
.sheet[hidden], .sheet-backdrop[hidden] { display: none; }
.sheet, .cage-pop { --grey: var(--grey-on-light); --link-hover: var(--red-deep); }   /* white surfaces: the darker grey and link hover (site.css) */
@keyframes sheet-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 720px) {
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%;
    width: min(540px, 92vw); transform: translate(-50%, -50%);
    border-radius: var(--radius);
    padding: var(--s3) var(--s4) var(--s3);
    animation: sheet-in .18s ease-out;
  }
  @keyframes sheet-in { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }
}
.sheet-close {
  position: absolute; top: .6rem; right: .8rem;
  width: 40px; height: 40px; display: grid; place-items: center;
  font-size: var(--fs-2xl); line-height: 1; text-decoration: none; color: var(--steel); border-radius: 50%;
}
.sheet-close:hover { background: var(--fill); color: var(--black); }
.sheet-title { color: var(--black); font-size: var(--fs-2xl); margin: .1rem 0 var(--s0); padding-right: var(--s4); }
.sheet-meta { color: var(--steel); margin-bottom: var(--s2); }
.sheet-price { color: var(--red); font-family: var(--font-display); font-size: var(--fs-h3); letter-spacing: .02em; }
.sheet-price.is-free { color: var(--turf); }
.sheet-form { gap: var(--s1-5); }
.sheet .field > label { font-size: var(--fs-sm); }
body.sheet-open { overflow: hidden; }

/* ---------- centred layout (👤 Alex, 2026-10-24): the hero text, the day chips, the day title,
   the note under the hours, and the one column of hours are centred. ---------- */
.cage-hero .wrap { text-align: center; }
/* auto margins, not justify-content: centre, so a row wider than a phone still scrolls from its start */
.day-chip:first-child { margin-left: auto; }
.day-chip:last-child { margin-right: auto; }
.cage-head { flex-direction: column; align-items: center; text-align: center; padding-top: var(--s3); margin-bottom: var(--s3); }   /* room under the dark hero (👤 Alex, PSA_23638) */
.cage-hero .lead { margin-left: auto; margin-right: auto; }
/* Your own booking is all green, not red (red reads as a warning) — 👤 Alex, 2026-10-24 */
.slot.is-yours { background: var(--turf); color: var(--white); border-color: var(--turf-light); }
.slot.is-yours .slot-state { color: var(--white); }

/* the family's hours for the shown day, under the day title (PSA_23051) */
.cage-quota { margin: 0; color: var(--grey-light); font-weight: 600; }
.cage-quota.is-full { color: var(--red-text); }

/* the hero's free-hour line sits on its own line under "Pick a day…" (PSA_23072) */
.cage-sub-rent, .cage-sub-free { display: block; }

/* the booking sheet: title and "1 hour · $N" are centred (PSA_23072). Padding both sides keeps the title clear of the close button. */
.sheet-title { text-align: center; padding-left: var(--s4); }
.sheet-meta { text-align: center; }
/* the cage the family picked, under the day and time (👤 Alex, 2026-10-25) */
.sheet-cage { margin: 0 0 var(--s0); text-align: center; color: var(--black); font-family: var(--font-display); font-weight: 600; font-size: var(--fs-h3); text-transform: uppercase; letter-spacing: .04em; }

/* The little popup at the 2-upcoming limit (👤 Alex, PSA_23638): its title and one line, centred */
.sheet-limit { text-align: center; }
.sheet-limit .sheet-title { font-size: clamp(1rem, 4.6vw, var(--fs-h3)); }   /* one line, a phone too (👤 Alex, PSA_23745) */
.sheet-limit-text { margin: var(--s1) 0 var(--s2); }
