/* Today (home) — scoped under .today-page. Shared components come from components.css; this file only adds the
 * hero, goal checklist rows, quick-log tiles, water glasses, module summary cards, reflection and resurface bits. */

.today-page { gap: var(--s-5); }

/* ── Header ───────────────────────────────────────────────────────────────────────────── */
.today-header { align-items: flex-end; row-gap: var(--s-3); }
.today-eyebrow {
  margin: 0 0 4px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.01em;
}
.today-page.is-past .today-eyebrow { color: var(--primary); }
.today-header .page-title { text-wrap: balance; }
.today-datebar { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; min-width: 0; }
.today-page .date-nav-today { display: none; } /* replaced by the clearer "Back to today" pill */
.today-back {
  --btn-bg: var(--primary-soft);
  --btn-fg: var(--primary);
  min-height: 44px;
}
.today-back:hover { background: color-mix(in srgb, var(--primary) 18%, transparent); }
.today-back[hidden] { display: none; }

/* ── Layout ───────────────────────────────────────────────────────────────────────────── */
.today-grid { min-width: 0; }
.today-col { display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; }
.today-grid.is-wide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--s-5);
  align-items: start;
}
.today-grid.is-wide .today-col { gap: var(--s-5); }
.today-col > div:empty { display: none; }
.today-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); min-width: 0; }
.today-pair > div { display: flex; min-width: 0; }
.today-pair > div > .card { flex: 1 1 auto; }
@media (min-width: 720px) {
  .today-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.today-muted { margin: 0; color: var(--text-3); font-size: var(--fs-sm); line-height: 1.45; }

/* ── Backup banner ────────────────────────────────────────────────────────────────────── */
.today-banner { align-items: center; flex-wrap: wrap; row-gap: var(--s-2); }
.today-banner > .icon { margin-top: 0; }
.today-banner-text { flex: 1 1 240px; min-width: 0; font-size: var(--fs-sm); color: var(--text-2); }
.today-banner-text strong { color: var(--text); font-weight: 650; }
.today-banner-actions { display: flex; align-items: center; gap: var(--s-1); margin-left: auto; }

/* ── Hero ─────────────────────────────────────────────────────────────────────────────── */
.today-hero {
  --hero-c: var(--primary);
  overflow: hidden;
  background:
    radial-gradient(130% 120% at 0% 0%, color-mix(in srgb, var(--hero-c) 11%, transparent), transparent 58%),
    radial-gradient(90% 90% at 100% 100%, color-mix(in srgb, var(--goals) 7%, transparent), transparent 60%),
    var(--surface);
  border-color: color-mix(in srgb, var(--hero-c) 16%, var(--border));
}
.today-hero.is-perfect { --hero-c: var(--success); }
.today-hero-top { display: flex; align-items: center; gap: var(--s-5); min-width: 0; }
.today-hero-ring { position: relative; flex: none; }
.today-hero-ring .ring { width: 120px; height: 120px; }
.today-hero-ring .ring-value { font-size: 30px; font-weight: 780; }
.today-hero-ring .ring-sub { font-size: 12px; margin-top: 4px; max-width: 76%; line-height: 1.2; }
.today-hero-skel-ring { flex: none; width: 120px !important; height: 120px !important; }
.today-hero-badge {
  position: absolute;
  right: 0;
  bottom: 2px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--goals);
  color: #fff;
  box-shadow: 0 0 0 3px var(--surface), var(--shadow-sm);
}
.today-hero-text { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px; }
.today-hero-kicker {
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.today-motto {
  margin: 0 0 var(--s-2);
  font-size: var(--fs-lg);
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.012em;
  color: var(--text);
  text-wrap: pretty;
}
.today-hero-pills { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.today-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.25;
}
.today-pill strong { font-weight: 760; }
.today-pill-sub { font-weight: 500; opacity: 0.85; }
.today-streak {
  background: color-mix(in srgb, var(--food) 13%, transparent);
  color: color-mix(in srgb, var(--food) 62%, var(--text));
}
.today-streak .icon { color: var(--food); fill: color-mix(in srgb, var(--food) 30%, transparent); flex: none; }
.today-streak.is-cold { background: var(--surface-2); color: var(--text-3); }
.today-streak.is-cold .icon { color: var(--text-3); fill: none; }
.today-avg .icon { color: var(--primary); flex: none; }
.today-pill-link {
  min-height: 44px;
  background: var(--primary-soft);
  color: var(--primary);
  text-decoration: none;
}
.today-pill-link:hover { background: color-mix(in srgb, var(--primary) 18%, transparent); }

.today-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  margin-top: var(--s-4);
  padding-top: var(--s-3);
  border-top: 1px solid color-mix(in srgb, var(--hero-c) 10%, var(--border));
}
.today-week > .skeleton { justify-self: center; margin: 6px 0; }
.today-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 44px;
  padding: 6px 0 8px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--text-3);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-fast) var(--ease);
}
.today-day:hover { background: var(--hover); }
.today-day:active { background: var(--press); }
.today-day-name { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.today-day .ring-value { font-size: 11px; font-weight: 650; color: var(--text-2); letter-spacing: 0; }
.today-day.is-today .today-day-name { color: var(--primary); }
.today-day.is-selected { background: color-mix(in srgb, var(--hero-c) 12%, transparent); }
.today-day.is-selected .today-day-name,
.today-day.is-selected .ring-value { color: var(--text); }
.today-day.is-perfect .ring-value { color: var(--success); }

@media (min-width: 720px) {
  .today-hero-ring .ring { width: 148px; height: 148px; }
  .today-hero-skel-ring { width: 148px !important; height: 148px !important; }
  .today-hero-ring .ring-value { font-size: 38px; }
  .today-hero-ring .ring-sub { font-size: 13px; }
  .today-motto { font-size: var(--fs-xl); }
  .today-hero-top { gap: var(--s-6); }
}
@media (max-width: 379.98px) {
  .today-hero-top { gap: var(--s-4); }
  .today-hero-ring .ring { width: 104px; height: 104px; }
  .today-hero-ring .ring-value { font-size: 26px; }
  .today-motto { font-size: var(--fs-md); }
}

/* ── Goals checklist ──────────────────────────────────────────────────────────────────── */
.today-goals .card-header { padding-bottom: var(--s-2); }
.today-goals .empty-state { margin: 0 var(--s-4) var(--s-4); }
.today-manage { min-height: 36px; padding: 0 6px 0 10px; color: var(--primary); }
.today-goal-list { display: flex; flex-direction: column; padding: 0 var(--s-2) var(--s-2); }
.today-goal {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  min-height: 60px;
  padding: 10px var(--s-2);
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-fast) var(--ease);
}
button.today-goal { cursor: pointer; }
button.today-goal:hover { background: var(--hover); }
button.today-goal:active { background: var(--press); }
.today-goal + .today-goal::before {
  content: "";
  position: absolute;
  top: 0;
  left: calc(var(--s-2) + 36px + var(--s-3));
  right: var(--s-2);
  height: 1px;
  background: var(--border);
}
@media (min-width: 720px) {
  .today-goal-list { padding: 0 var(--s-3) var(--s-3); }
}
.today-goal-main { display: flex; flex-direction: column; gap: 7px; flex: 1 1 auto; min-width: 0; }
.today-goal-line { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 2px var(--s-3); min-width: 0; }
.today-goal-title { min-width: 0; font-size: var(--fs-md); font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.today-goal-value { flex: none; font-size: var(--fs-sm); color: var(--text-3); font-weight: 550; }
.today-goal.is-done .today-goal-value { color: var(--success); }
.today-goal.is-over .today-goal-value { color: var(--warning); font-weight: 650; }
.today-goal.is-nodata .today-goal-value { font-style: italic; }
.today-goal .progress { --progress-h: 6px; }
.today-goal-status {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  color: var(--surface);
}
.today-goal-status.is-done { background: var(--success); border-color: var(--success); }
.today-goal-status.is-over { border: 0; color: var(--warning); }

.today-goal.is-check .today-goal-main { gap: 2px; }
.today-goal.is-check .today-goal-value { font-size: var(--fs-xs); }
.today-check {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  color: transparent;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
button.today-goal.is-check:hover .today-check { border-color: var(--accent); }
.today-goal.is-check.is-done .today-check { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.today-goal.is-check.is-done .today-goal-title {
  color: var(--text-2);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--text-3) 70%, transparent);
  text-decoration-thickness: 1.5px;
}
.today-goal.is-skeleton { pointer-events: none; }

/* ── Quick log ────────────────────────────────────────────────────────────────────────── */
.today-qa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: var(--s-2); }
.today-qa {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 86px;
  padding: 12px 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.today-qa:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}
.today-qa:active { transform: scale(0.96); }
.today-qa-chip {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  transition: transform var(--dur) var(--ease-spring);
}
.today-qa:hover .today-qa-chip { transform: scale(1.06); }
.today-qa-label { max-width: 100%; font-size: var(--fs-xs); font-weight: 650; text-align: center; line-height: 1.2; overflow-wrap: anywhere; }

/* ── Water ────────────────────────────────────────────────────────────────────────────── */
.today-water .card-body { gap: var(--s-4); }
.today-glasses { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; }
.today-glass {
  position: relative;
  min-width: 0;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.today-glass:hover { background: var(--hover); }
.today-glass-fill {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 34px;
  transform: translate(-50%, -50%);
  clip-path: polygon(0 0, 100% 0, 84% 100%, 16% 100%);
  border-radius: 2px;
  background: color-mix(in srgb, var(--water) 13%, var(--surface-2));
  overflow: hidden;
  transition: transform var(--dur) var(--ease-spring);
}
.today-glass-fill::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--water) 70%, #fff), var(--water));
  transition: height 260ms var(--ease);
}
.today-glass.is-full .today-glass-fill::after { height: 84%; }
.today-glass:active .today-glass-fill { transform: translate(-50%, -50%) scale(0.9); }
.today-glass.is-bonus:not(.is-full) .today-glass-fill { opacity: 0.55; }
.today-water-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.today-water-bar .btn { border-radius: var(--r-full); }
.today-water-count { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 0 4px; text-align: center; }
.today-water-num { font-size: 30px; font-weight: 760; letter-spacing: -0.02em; line-height: 1.1; color: var(--text); }
.today-water-of { font-size: var(--fs-sm); color: var(--text-3); font-weight: 550; }
.today-water-done {
  flex-basis: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: var(--fs-xs);
  font-weight: 650;
  color: var(--success);
}

/* ── Module summary cards ─────────────────────────────────────────────────────────────── */
.today-modules { gap: var(--s-3); }
.today-mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: var(--s-4); }
.today-mod-slot { display: flex; min-width: 0; }
.today-mod-slot > .card { flex: 1 1 auto; }
.today-mod .card-header { margin-bottom: var(--s-3); }
.today-mod .card-subtitle { color: var(--text-2); font-weight: 600; }
.today-mod .card-actions .btn { min-height: 36px; }
.today-mod .card-actions .btn-icon { width: 36px; min-width: 36px; }
.today-mod-skel { padding-top: 2px; }
.today-items { display: flex; flex-direction: column; margin: 0 calc(-1 * var(--s-2)); }
.today-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 6px var(--s-2);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
}
button.today-item { cursor: pointer; }
button.today-item:hover { background: var(--hover); }
button.today-item:active { background: var(--press); }
.today-item-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent, var(--primary)); }
.today-item-main { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.today-item-title { font-size: var(--fs-md); font-weight: 550; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-item-meta { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.today-item-chev { flex: none; color: var(--text-3); opacity: 0.7; }
.today-more {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 var(--s-2);
  margin-left: calc(-1 * var(--s-2));
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}
.today-more:hover { background: var(--primary-soft); }
.today-mod-empty { margin: 0; color: var(--text-3); font-size: var(--fs-sm); }
.today-mod-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 44px;
  border: 1.5px dashed color-mix(in srgb, var(--accent, var(--primary)) 38%, var(--border-strong));
  border-radius: var(--r);
  background: color-mix(in srgb, var(--accent, var(--primary)) 4%, transparent);
  color: color-mix(in srgb, var(--accent, var(--primary)) 78%, var(--text));
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 650;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.today-mod-add:hover {
  background: color-mix(in srgb, var(--accent, var(--primary)) 10%, transparent);
  border-color: var(--accent, var(--primary));
}
.today-mod.is-error .card-header { margin-bottom: var(--s-3); }

/* ── Reflection ───────────────────────────────────────────────────────────────────────── */
.today-reflect { container-type: inline-size; }
.today-reflect .card-body { gap: var(--s-4); }
.today-reflect .mood-picker { max-width: none; }
.today-reflect-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
@container (min-width: 500px) {
  .today-reflect-row { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
}
.today-energy .rating { flex-wrap: nowrap; }
.today-reflect .textarea.today-ta-sm { min-height: 66px; }
.today-save {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 4px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-3);
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease);
}
.today-save[data-state="saving"],
.today-save[data-state="saved"],
.today-save[data-state="error"] { opacity: 1; }
.today-save[data-state="saved"] { color: var(--success); }
.today-save[data-state="error"] { color: var(--danger); }
.today-save-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Resurface ────────────────────────────────────────────────────────────────────────── */
.today-resurface .card-body { gap: var(--s-3); }
.today-resurface-body {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  width: 100%;
  padding: var(--s-3);
  border: 1px solid color-mix(in srgb, var(--learning) 18%, var(--border));
  border-radius: var(--r);
  background: color-mix(in srgb, var(--learning) 5%, var(--surface));
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.today-resurface-body:hover { border-color: color-mix(in srgb, var(--learning) 45%, var(--border)); }
.today-resurface-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.today-resurface-title { font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.today-resurface-quote {
  padding-left: 10px;
  border-left: 2px solid var(--learning);
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.today-resurface-meta { font-size: var(--fs-xs); color: var(--text-3); }
.today-resurface-meta:empty { display: none; }
.today-resurface-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s-2); }
.today-resurface-foot > .btn:only-child { margin-left: auto; }

/* ── Motion ───────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .today-goal.is-check.is-done .today-check { animation: today-pop 320ms var(--ease-spring); }
  .today-hero-badge { animation: today-pop 420ms var(--ease-spring) 500ms both; }
  .today-save[data-state="saving"] .today-save-dot { animation: today-pulse 900ms ease-in-out infinite; }
}
@keyframes today-pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes today-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}
