/* ==========================================================================
   Apps 4 That — DailyNudge  (app.css)
   App-specific layer on top of a4t-ui.css. Accent = #2EAD7A (set in index).
   Mobile-first. Tap targets >= 44px. prefers-reduced-motion respected.
   ========================================================================== */

/* Nav button styled like the nav links in a4t-ui.css */
.a4t-nav__btn {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: transparent;
  border: 0;
  font-weight: var(--fw-medium);
  min-height: var(--tap-min);
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.a4t-nav__btn:hover { background: var(--bg-sunken); color: var(--text); }

/* --------------------------------------------------------------------------
   STREAK STRIP
   -------------------------------------------------------------------------- */
.streak-strip {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-4) var(--space-5);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--surface-line));
  border-radius: var(--radius-card);
}
.streak-pill {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}
.streak-pill__num {
  font-size: 2.25rem;
  font-weight: var(--fw-black);
  line-height: 1;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}
.streak-pill__label {
  font-weight: var(--fw-semibold);
  color: var(--accent-strong);
}
.streak-strip__note {
  color: var(--text-muted);
  font-size: var(--fs-caption);
  margin: 0;
}

/* --------------------------------------------------------------------------
   HABIT CARDS
   -------------------------------------------------------------------------- */
.habit-card__head { align-items: flex-start; }
.habit-card__icon {
  font-size: 1.6rem;
  line-height: 1;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  background: var(--bg-sunken);
  border-radius: var(--radius-md);
  flex: none;
}
.habit-card__streak {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.habit-card__hint {
  font-size: var(--fs-caption);
  color: var(--text-faint);
  margin: 0;
  min-height: 1.2em;
  transition: color var(--t-fast);
}
.habit-card.is-logged .habit-card__hint { color: var(--accent-strong); font-weight: var(--fw-medium); }

/* --------------------------------------------------------------------------
   STEPPER (sleep / water / movement)
   -------------------------------------------------------------------------- */
.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) 0;
}
.stepper__btn {
  width: 3rem;
  height: 3rem;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  flex: none;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: var(--fw-bold);
  line-height: 1;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1.5px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast), box-shadow var(--t-base);
  user-select: none;
}
.stepper__btn:hover { background: color-mix(in srgb, var(--accent) 24%, var(--c-white)); transform: translateY(-1px); }
.stepper__btn:active { transform: translateY(0); }
.stepper__btn:focus-visible { outline: none; box-shadow: var(--ring-focus); }
.stepper__btn[disabled] { opacity: 0.4; cursor: not-allowed; transform: none; }
.stepper__value {
  flex: 1;
  text-align: center;
  font-size: 2rem;
  font-weight: var(--fw-black);
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.35rem;
}
.stepper__unit {
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
}

/* Water dots — quick visual of glasses */
.water-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-1);
  min-height: 0.9rem;
}
.water-dots__dot {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--bg-sunken);
  border: 1.5px solid var(--surface-line-strong);
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.water-dots__dot.is-full {
  background: var(--accent);
  border-color: var(--accent);
}

/* --------------------------------------------------------------------------
   MOOD
   -------------------------------------------------------------------------- */
.mood-row {
  display: flex;
  gap: var(--space-2);
  justify-content: space-between;
}
.mood-btn {
  flex: 1;
  min-width: var(--tap-min);
  min-height: 3.25rem;
  font-size: 1.7rem;
  line-height: 1;
  background: var(--bg-sunken);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast);
  filter: grayscale(0.55) opacity(0.7);
}
.mood-btn:hover { transform: translateY(-2px); filter: none; }
.mood-btn:focus-visible { outline: none; box-shadow: var(--ring-focus); }
.mood-btn[aria-checked="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  filter: none;
  transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   STICKY NOTE WRAP
   -------------------------------------------------------------------------- */
.note-wrap {
  display: flex;
  justify-content: center;
  margin: var(--space-7) 0 var(--space-2);
}

/* --------------------------------------------------------------------------
   7-DAY CHART  (pure CSS bars)
   -------------------------------------------------------------------------- */
.chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-size: var(--fs-caption);
  color: var(--text-faint);
}
.chart-legend__dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: var(--radius-xs);
  background: var(--accent);
  display: inline-block;
}
.chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-2);
  align-items: end;
  height: 9.5rem;
  padding: var(--space-4) var(--space-3) 0;
  background: var(--bg-elevated);
  border: 1px solid var(--surface-line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}
.chart__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  height: 100%;
}
.chart__track {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.chart__bar {
  width: 70%;
  max-width: 2rem;
  min-height: 4px;
  background: var(--accent);
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  height: var(--_h, 0%);
  transition: height var(--t-slow);
  position: relative;
}
.chart__bar--empty {
  background: var(--bg-sunken);
  border: 1px dashed var(--surface-line-strong);
}
.chart__bar[data-count]::after {
  content: attr(data-count);
  position: absolute;
  top: -1.25rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.chart__bar--today {
  background: var(--accent-strong);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
}
.chart__label {
  font-size: var(--fs-caption);
  color: var(--text-faint);
  font-weight: var(--fw-medium);
}
.chart__label--today { color: var(--accent-strong); font-weight: var(--fw-bold); }

/* --------------------------------------------------------------------------
   DATA CONTROLS
   -------------------------------------------------------------------------- */
.data-controls {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--surface-line);
}

/* --------------------------------------------------------------------------
   TOAST visibility (a4t-ui ships .a4t-toast styling; we just toggle hidden)
   -------------------------------------------------------------------------- */
.a4t-toast[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .stepper__btn:hover, .mood-btn:hover, .mood-btn[aria-checked="true"] { transform: none; }
  .chart__bar { transition: none; }
}

/* ==========================================================================
   v2 (2026-07-10) — goals, day switch, welcome, support, history view
   ========================================================================== */

/* Handwritten personality on the sticky note (Caveat, loaded in index) */
.a4t-note {
  font-family: var(--font-hand);
  font-size: 1.35rem;
  line-height: 1.25;
}

/* --------------------------------------------------------------------------
   DAY SWITCH  (Today / Yesterday back-fill)
   -------------------------------------------------------------------------- */
.day-switch {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}
.day-switch .a4t-chip { min-height: var(--tap-min); }
.day-switch__hint { margin-left: var(--space-1); }
@media (max-width: 26rem) {
  .day-switch__hint { flex-basis: 100%; margin-left: 0; }
}

/* --------------------------------------------------------------------------
   WELCOME CARD  (first run)
   -------------------------------------------------------------------------- */
.welcome-card { margin-bottom: var(--space-5); }
.welcome-card__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-left: 1.1em;
  color: var(--text-muted);
}
.welcome-card__list strong { color: var(--text); }

/* --------------------------------------------------------------------------
   GOAL ROW  (progress toward a personal target)
   -------------------------------------------------------------------------- */
.goal-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.goal-row__bar { flex: 1; height: 0.45rem; }
.goal-row__label {
  flex: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.goal-row--met .a4t-progress__bar { background: var(--accent-strong); }
.goal-row--met .goal-row__label {
  color: var(--accent-strong);
  font-weight: var(--fw-bold);
}

.water-dots__extra {
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
  color: var(--accent-strong);
  align-self: center;
  line-height: 1;
}

/* --------------------------------------------------------------------------
   NOTE CARD  (one line about the day)
   -------------------------------------------------------------------------- */
.note-card { gap: var(--space-2); }

/* --------------------------------------------------------------------------
   SUPPORT CARD  (gentle, rare, never shouty)
   -------------------------------------------------------------------------- */
.support-card {
  margin-top: var(--space-6);
  border-left: 3px solid var(--c-teal);
  background: color-mix(in srgb, var(--c-teal) 6%, var(--c-white));
}
.support-card p { color: var(--text-muted); }
.support-card__line { color: var(--text); }

/* --------------------------------------------------------------------------
   HISTORY: STATS GRID
   -------------------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}
@media (min-width: 34rem) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}
.stat {
  align-items: center;
  text-align: center;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-3);
}
.stat__num {
  font-size: 2rem;
  font-weight: var(--fw-black);
  line-height: 1;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}
.stat__label {
  font-size: var(--fs-caption);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
}

/* --------------------------------------------------------------------------
   HISTORY: CALENDAR
   -------------------------------------------------------------------------- */
.cal-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.cal-nav__btn {
  width: var(--tap-min);
  height: var(--tap-min);
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--t-fast);
}
.cal-nav__btn:hover { background: color-mix(in srgb, var(--accent) 24%, var(--c-white)); }
.cal-nav__btn:focus-visible { outline: none; box-shadow: var(--ring-focus); }
.cal-nav__btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.cal-nav__label {
  min-width: 9ch;
  text-align: center;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-caption);
  color: var(--text);
}

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: var(--space-2);
}
.cal-week span {
  text-align: center;
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
  color: var(--text-faint);
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: var(--space-1);
}
.cal-blank { aspect-ratio: 1; }
.cal-day {
  aspect-ratio: 1;
  min-height: 2.2rem;
  display: grid;
  place-items: center;
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  background: var(--bg-sunken);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.cal-day:hover:not([disabled]) { transform: translateY(-1px); border-color: var(--surface-line-strong); }
.cal-day:focus-visible { outline: none; box-shadow: var(--ring-focus); }
.cal-day[disabled] { opacity: 0.35; cursor: default; background: transparent; }
.cal-day--l1 { background: color-mix(in srgb, var(--accent) 18%, var(--c-white)); color: var(--accent-strong); }
.cal-day--l2 { background: color-mix(in srgb, var(--accent) 38%, var(--c-white)); color: var(--accent-strong); }
.cal-day--l3 { background: color-mix(in srgb, var(--accent) 62%, var(--c-white)); color: var(--c-white); }
.cal-day--l4 { background: var(--accent-strong); color: var(--c-white); }
.cal-day--today { border-color: var(--accent-strong); }
.cal-day--selected { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }

.cal-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-sunken);
  border-radius: var(--radius-md);
  font-size: var(--fs-caption);
  color: var(--text-muted);
}
.cal-detail strong { color: var(--text); }
.cal-detail__note { font-style: italic; }

/* --------------------------------------------------------------------------
   HISTORY: GOAL EDITOR
   -------------------------------------------------------------------------- */
.goal-editor {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.goal-editor__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--surface-line);
}
.goal-editor__row:last-child { border-bottom: 0; }
.goal-editor__name {
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.stepper--compact { padding: 0; gap: var(--space-2); flex: none; }
.stepper--compact .stepper__btn { width: var(--tap-min); height: var(--tap-min); font-size: 1.2rem; }
.stepper--compact .stepper__value { font-size: 1.15rem; flex: none; min-width: 6.5rem; }
.stepper--compact .stepper__unit { font-size: var(--fs-caption); }

/* --------------------------------------------------------------------------
   FOOTER link-style button (review disclaimer)
   -------------------------------------------------------------------------- */
.a4t-footer__linkbtn {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: var(--fs-caption);
  color: var(--text-muted);
  cursor: pointer;
  min-height: var(--tap-min);
  display: inline-flex;
  align-items: center;
}
.a4t-footer__linkbtn:hover { color: var(--accent); text-decoration: underline; }
.a4t-footer__linkbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-xs); }

@media (prefers-reduced-motion: reduce) {
  .cal-day:hover:not([disabled]) { transform: none; }
}
