/* today.css — Today screen + History log.
   Reuses the design system from styles.css (.card, .badge, .badge--*, .dots,
   .eyebrow, .btn, .list, .row) and adds only the layout these two screens need.
   Every colour is a semantic token except the fixed intensity hues carried by the
   shared .badge--*/.dot--* classes (navy text), so it passes contrast in BOTH
   light and dark themes. Hover effects are gated to hover-capable pointers and
   motion honours prefers-reduced-motion (handled globally in styles.css). */

/* ---------------------------------------------------------- Today header --- */
.today-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.today-head__lead { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.today-head__sub { margin: 0; color: var(--text); font-weight: 600; }

/* "?" help toggle — a small 28px visual circle inside a full 48x48 tap target
   (the transparent button carries the hit area; the inner span is the visible
   mark), so it reads as "tiny" yet still meets the 48px minimum. */
.today-help-btn {
  flex: none;
  width: var(--tap-min);
  height: var(--tap-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}
.today-help-btn > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--field-border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 800;
  line-height: 1;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.today-help-btn[aria-expanded="true"] > span { background: var(--primary-tint); color: var(--text); border-color: var(--focus); }

/* The help note: a flat tinted callout (not a card), full-contrast text both themes. */
.today-help {
  margin: 0 0 var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  color: var(--text);
  font-size: var(--fs-sm);
}
.today-help[hidden] { display: none; }
.today-head__history {
  flex: none;
  min-height: var(--tap-min);
  padding: 0 var(--sp-4);
  font-size: var(--fs-sm);
  background: var(--surface);
  color: var(--text);
  border-color: var(--field-border);
  box-shadow: var(--shadow);
}
.today-head__history-icon { display: inline-flex; }

/* -------------------------------------------------------- Top controls ----- */
.today-controls { margin-bottom: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }

/* Prev / center / Next day navigator. */
.daynav {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.navbtn {
  flex: none;
  width: var(--tap-min);
  height: var(--tap-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--field-border);
  border-radius: var(--radius-input);
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.navbtn:disabled { opacity: 0.4; cursor: not-allowed; }

.daynav__center {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.daynav__main { font-size: var(--fs-h3); font-weight: 800; letter-spacing: -0.01em; }
.daynav__date { font-size: var(--fs-sm); color: var(--text-muted); }

/* Native date picker as the "jump anywhere" control under the season label. */
.navdate {
  width: auto;
  max-width: 100%;
  min-height: 36px;
  padding: 4px var(--sp-3);
  font-size: var(--fs-sm);
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--field-border);
  border-radius: var(--radius-pill);
  appearance: none;
}
.navdate:focus { outline: none; border-color: var(--primary); }
.navdate:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Session-slot toggle (camp two-a-day) — reuses .segmented/.seg from styles.css;
   only sizing tweaks here so it sits comfortably under the day navigator. */
.slots { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }

/* ---------------------------------------------------------------- Hero ----- */
.hero__top { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.hero__done { margin-left: auto; }

.hero__focus { margin-bottom: var(--sp-4); }
.hero__skill { margin: 2px 0 0; font-size: var(--fs-title); letter-spacing: -0.02em; }

.hero__dayline {
  margin: 0 0 var(--sp-4);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-muted);
}

.hero__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}
.hero__stat { display: flex; flex-direction: column; gap: var(--sp-2); }
.hero__intensity { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); }
.hero__intensity-num { font-weight: 800; color: var(--text); }
.hero__time { font-size: var(--fs-h2); font-weight: 800; color: var(--text); line-height: 1; }

/* ------------------------------------------------------ Coach-note callout -- */
/* Tinted highlight (not a card-in-card): a flat panel with full-contrast text in
   both themes. The icon carries the "tip" signal alongside the text. */
.coachnote {
  display: flex;
  gap: var(--sp-3);
  margin: var(--sp-4) 0;
  padding: var(--sp-4);
  background: var(--primary-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.coachnote__icon { flex: none; color: var(--focus); display: inline-flex; }
.coachnote__body { min-width: 0; }
.coachnote__main { margin: 0; color: var(--text); font-weight: 700; }
.coachnote__sub { margin: var(--sp-2) 0 0; color: var(--text); font-size: var(--fs-sm); }

/* ------------------------------------------------------------- Block card --
   A COLLAPSIBLE practice block: the whole card is one toggle button showing a
   compact summary (role · title · time · why); tapping it reveals the detail
   (setup, how it's organized, the court diagram, the steps, cues and gear).
   Folding the detail away turns Today from one long scroll into a short,
   scannable list — the coach opens only the block they're setting up. */
.blocks { display: flex; flex-direction: column; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.block { padding: 0; overflow: hidden; }
.block + .block { margin-top: 0; }   /* the flex gap owns the spacing */

/* The summary is the tap target for the entire block. */
.block__summary {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--sp-4);
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
}
.block__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.block__min {
  margin-left: auto;
  flex: none;
  font-size: var(--fs-sm);
  font-weight: 800;
  color: var(--text);
}
.block__chev {
  flex: none;
  display: inline-flex;
  color: var(--text-muted);
  transition: transform 0.18s var(--ease);
}
.block.is-open .block__chev { transform: rotate(180deg); }
.block__role {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.block__title { display: block; margin: 2px 0 var(--sp-1); font-size: var(--fs-h3); font-weight: 800; line-height: 1.2; }
.block__why { display: block; margin: 0; color: var(--text-muted); font-size: var(--fs-sm); }

/* The detail region, revealed on expand. */
.block__detail { padding: 0 var(--sp-4) var(--sp-4); }
.block__detail[hidden] { display: none; }
.block__section { margin-bottom: var(--sp-3); }
.block__section:first-child { padding-top: var(--sp-1); }
.block__section p { margin: var(--sp-1) 0 0; color: var(--text); }
.block__steps, .block__cues { margin: var(--sp-1) 0 0; padding-left: 1.25em; color: var(--text); }
.block__steps li, .block__cues li { margin-bottom: var(--sp-1); }
.block__steps li::marker { font-weight: 800; color: var(--text-muted); }

/* "Watch how" external link — a clear, tappable inline link. */
.watch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap-min);
  margin-bottom: var(--sp-1);
  color: var(--link);             /* deep coral text link: clears 4.5:1 on the card in both themes */
  font-size: var(--fs-sm);
  font-weight: 800;
  text-decoration: none;
}
.watch__icon { display: inline-flex; }

/* Tools row inside the detail: the optional Swap control. */
.block__tools { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.block__swap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap-min);
  padding: 0 var(--sp-4);
  border: 2px solid var(--field-border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.block__swap-icon { display: inline-flex; }

/* ---------------------------------------------------- Equipment / reference */
.gear__chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0 0 var(--sp-4); padding: 0; list-style: none; }
.gear__chip {
  display: inline-flex;
  align-items: center;
  padding: 6px var(--sp-3);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 700;
}
.gear__none { margin: 0 0 var(--sp-4); }
.gear__ref {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}
.gear__ref-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
}
.gear__ref-item strong { font-size: var(--fs-body); color: var(--text); }

/* --------------------------------------------------------------- Actions --- */
.today-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-4); }
.today-actions .btn { flex: 1 1 160px; }
.today-actions__note { flex-basis: 100%; margin: 0; font-size: var(--fs-sm); }
.btn__icon { display: inline-flex; }

/* --------------------------------------------------------------- History --- */
.history-list { margin-top: 0; }
.history-item {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid var(--border);
}
.history-item:last-child { border-bottom: none; }

/* The "open" affordance fills the row; the delete button sits beside it (kept as
   siblings so we never nest a button inside a button). */
.history-open {
  flex: 1 1 auto;
  min-width: 0;
  border-bottom: none;
  align-items: center;
  gap: var(--sp-3);
}
.history-open__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.history-open__date { font-weight: 700; color: var(--text); }
.history-open__sub {
  font-size: var(--fs-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-del {
  flex: none;
  width: var(--tap-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-left: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
}

/* ------------------------------------------------- Install (A2HS) banner --- */
/* Shown only when js/install.js has a real install prompt to offer; the empty
   wrapper collapses so it never leaves a gap. All colours are semantic tokens,
   so it reads in both themes. */
.install-host { margin-bottom: var(--sp-4); }
.install-host:empty { display: none; }

.install-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}
.install-card__icon { flex: none; display: inline-flex; color: var(--primary); }
.install-card__body { flex: 1 1 auto; min-width: 0; }
.install-card__title { margin: 0; font-size: var(--fs-body); font-weight: 700; color: var(--text); }
.install-card__sub { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--text-muted); }
.install-card__cta { flex: none; padding: 0 var(--sp-4); }

/* Dismiss "×": a small visible mark inside a full 48x48 tap target. */
.install-card__dismiss {
  flex: none;
  width: var(--tap-min);
  height: var(--tap-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

/* Gentle entrance, suppressed when the user prefers reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .install-card { animation: install-in 0.25s var(--ease) both; }
}
@keyframes install-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------- Rest day ---- */
/* Shown on a season date that isn't one of the team's chosen practice days, so
   the app stops inventing a practice for every day. Calm, centered, with a
   one-tap jump to the next real practice. */
.restday { text-align: center; }
.restday__icon { display: inline-flex; color: var(--text-muted); margin-bottom: var(--sp-2); }
.restday__title { margin: 0 0 var(--sp-2); }
.restday__sub { margin: 0 0 var(--sp-2); color: var(--text); }
.restday__days { margin: 0 0 var(--sp-4); font-size: var(--fs-sm); }

/* ----------------------------------------------------------------- Toast --- */
/* Bottom-centered confirmation, clear of the fixed tab bar. High-contrast bg/fg
   pair so it reads in both themes. */
.rr-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--sp-4));
  transform: translate(-50%, 8px);
  z-index: calc(var(--z-sticky) + 10);
  max-width: calc(var(--app-max) - 2 * var(--sp-4));
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-pill);
  background: var(--text);
  color: var(--bg);
  font-size: var(--fs-sm);
  font-weight: 700;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.rr-toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------- Hover (pointer devices) -- */
@media (hover: hover) {
  .navbtn:hover:not(:disabled) { background: var(--surface-2); }
  .block__summary:hover { background: var(--surface-2); }
  .block__swap:hover { background: var(--surface-2); }
  .today-head__history:hover { background: var(--surface-2); }
  .today-help-btn:hover > span { background: var(--surface-2); color: var(--text); }
  .history-del:hover { color: var(--focus); background: var(--surface-2); }
  .install-card__dismiss:hover { color: var(--text); background: var(--surface-2); }
  .watch:hover { text-decoration: underline; }   /* underline links on pointer hover only */
}

@media (prefers-reduced-motion: reduce) {
  .block__chev { transition: none; }
}
