/* Today: the morning weigh-in first, then what the number means, then the route. Tokens from tokens.css. */
.today-main :is(button, a, input, summary, label.chip) { touch-action: manipulation; }
.today-header .day { font-size: 14px; font-weight: 700; }
.logged-mark { display: inline-flex; align-items: center; gap: var(--space-1-5); font-size: 14px; font-weight: 700; color: var(--green); white-space: nowrap; }
.logged-mark .link-button { color: var(--ink); font-size: 14px; min-height: var(--tap); padding: 0 var(--space-1); }

/* The input: one card, the number as big as the width allows, Save underneath. */
.today-form .entry { display: flex; flex-direction: column; gap: var(--space-1-5); padding: var(--card-pad) var(--card-pad) var(--space-1-5); }
.entry-label { display: block; font-size: 17px; font-weight: 700; }
.today-form .input-big input { font-size: clamp(64px, 24vw, 104px); padding: var(--space-1) 0; }
.today-form .input-big .unit { font-size: 18px; }
.today-form .btn { min-height: 56px; }
.entry-tips { margin: 0; text-align: center; line-height: 1.4; }
.entry-peek { align-self: center; color: var(--muted); font-weight: 700; font-size: 15px; min-height: var(--tap); padding: 0 var(--space-2); text-decoration: none; }
.entry-peek:focus-visible { color: var(--ink); text-decoration: underline; }
@media (hover: hover) and (pointer: fine) { .entry-peek:hover { color: var(--ink); text-decoration: underline; } }
.today-form .link-button:focus-visible, .logged-mark .link-button:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 4px; }

/* The true weight. */
.today-hero { --hero-size: clamp(96px, 32vw, 132px); display: flex; flex-direction: column; align-items: center; gap: var(--space-1-5); text-align: center; padding: var(--space-2) 0 var(--space-0-5); }
.hero-figure { position: relative; display: inline-block; }
/* The number typed, laid exactly over the true weight for the reveal: same face, same size, one slides into the chip. */
.hero-typed { position: absolute; inset: 0; font-family: var(--font-display); font-weight: 800; font-size: var(--hero-size); line-height: 0.9; letter-spacing: -1px; font-variant-numeric: tabular-nums; color: var(--ink); pointer-events: none; opacity: 0; }
.hero-label .label-scale { display: none; }
.scale-chip { font-size: 14px; font-weight: 700; color: var(--muted); background: var(--surface); border: var(--border) solid var(--line-soft); border-radius: var(--pill); padding: var(--space-1-5) var(--space-3); line-height: 1; }
.hero-number { font-family: var(--font-display); font-weight: 800; font-size: var(--hero-size); line-height: 0.9; letter-spacing: -1px; font-variant-numeric: tabular-nums; color: var(--ink); }
.hero-number.tone-green { color: var(--green); }
.hero-number.tone-warn { color: var(--signal-text); }
.hero-label-row { position: relative; display: flex; align-items: center; justify-content: center; gap: var(--space-0-5); }
.hero-label { font-size: 18px; font-weight: 700; }
/* What "true weight" means, one tap away: a small i that opens a line under the label, with the guide link. */
.hero-info > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); margin: -13px -13px -13px -8px; border-radius: 50%; color: var(--muted); }
.hero-info > summary::-webkit-details-marker { display: none; }
.hero-info[open] > summary { color: var(--ink); }
.hero-info > summary:focus-visible { outline: 2px solid var(--signal); outline-offset: -4px; }
.hero-info-pop { position: absolute; z-index: 2; top: calc(100% + 10px); left: 50%; transform: translateX(-50%); width: max-content; max-width: min(320px, calc(100vw - 2 * var(--gutter))); margin: 0; padding: var(--space-3) var(--space-4); text-align: center; text-wrap: balance; border: var(--border) solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.hero-info-pop a { font-weight: 700; color: inherit; }

/* The one-line message, in its tone. */
.morning { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--card-pad); border: var(--border) solid var(--line); border-radius: var(--radius-sm); background: var(--sky); }
.morning-green { background: var(--green-tint); border-color: var(--green-tint); }
.morning-warn { background: var(--warn-tint); border-color: var(--warn-line); }
.morning-dot { flex: none; width: 12px; height: 12px; margin-top: var(--space-1); border-radius: 50%; background: var(--blue); }
.morning-green .morning-dot { background: var(--green); }
.morning-warn .morning-dot { background: var(--warn); }
.morning-title { font-size: 16px; line-height: 1.25; text-wrap: balance; }
/* One big number leads, in the card's colour; the words shrink to a title and a short line beside it. */
.morning-number { align-items: center; gap: var(--space-4); --tone: var(--blue); }
.morning-number.morning-green { --tone: var(--green); }
.morning-number.morning-warn { --tone: var(--warn); }
.morning-big { flex: none; display: flex; flex-direction: column; min-width: 84px; max-width: 112px; }
.morning-big b { font-family: var(--font-display); font-weight: 800; font-size: 40px; line-height: .95; color: var(--tone); font-variant-numeric: tabular-nums; }
.morning-big span { margin-top: var(--space-1); font-size: 12px; line-height: 1.25; color: var(--muted); }
.morning-number .morning-text { padding-left: var(--space-4); border-left: 1.5px solid color-mix(in oklab, var(--tone) 30%, transparent); }

/* The day's tags, open or folded to one line (remembered on the device): the question and the switch, the chips, what they mean, the note, the week. */
#tag_card { display: block; }
.tag-card { display: flex; flex-direction: column; gap: var(--space-4); }
.tag-card-head { display: flex; gap: var(--space-2); align-items: center; justify-content: space-between; }
.tag-card-form { display: flex; flex-direction: column; gap: var(--space-4); }
.tag-learn { margin: 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.tag-learn b { color: var(--ink); }
.tag-card-body { display: flex; flex-direction: column; gap: var(--space-4); }
.tag-card.folded { padding-top: 0; padding-bottom: 0; }
.tag-card.folded .tag-card-body, .tag-card:not(.folded) .tag-fold-line { display: none; }
/* Folded: one line, the whole row a button. */
.tag-fold-line {
  display: flex; align-items: center; width: calc(100% + 2 * var(--card-pad)); min-height: 56px; margin: 0 calc(-1 * var(--card-pad));
  padding: 0 var(--card-pad); border: 0; border-radius: var(--radius); background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; touch-action: manipulation;
}
.tag-fold-line:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.tag-fold-text { display: flex; align-items: center; gap: var(--space-2); width: 100%; min-width: 0; }
.tag-fold-words { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.tag-fold-action { flex: none; font-weight: 700; font-size: 15px; text-decoration: underline; text-underline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .tag-fold-line:hover { background: var(--hover); } }
/* Open: "Last 7 days" and "Hide" share the card's last row. */
.tag-card-foot {
  display: flex; align-items: stretch; margin: 0 calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad));
  border-top: 1px solid var(--line-soft);
}
.tag-card-more {
  flex: 1; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); min-height: var(--tap);
  padding: 0 var(--space-3) 0 var(--card-pad); border-radius: 0 0 0 var(--radius);
  font-weight: 700; font-size: 15px; color: var(--ink); text-decoration: none;
}
.tag-card-hide {
  flex: none; min-height: var(--tap); padding: 0 var(--card-pad) 0 var(--space-3); border: 0; border-left: 1px solid var(--line-soft);
  border-radius: 0 0 var(--radius) 0; background: none; font: inherit; font-weight: 700; font-size: 15px; color: var(--muted); cursor: pointer; touch-action: manipulation;
}
.tag-card-hide:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .tag-card-hide:hover { background: var(--hover); color: var(--ink); } }
.tag-card-more:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.tag-card-icons { display: flex; gap: 3px; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .tag-card-more:hover { background: var(--hover); } }

/* The glimpse: a window on the route map or the loop, 170 of its units around the pin, the whole of it a link to the
   Route tab. Up to 1200px, where the whole map moves into the panel beside Today. */
.glimpse { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.glimpse-head, .glimpse-title, .route-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.glimpse-head { padding: var(--card-pad) var(--card-pad) var(--space-3); }
.glimpse-title { flex: 1; align-items: baseline; }
.route-head { align-items: baseline; }
.glimpse-map { position: relative; display: block; aspect-ratio: 360 / 170; overflow: hidden; border-block: 1px solid var(--line-soft); touch-action: manipulation; -webkit-touch-callout: none; }
.glimpse-svg { transform: translateY(var(--glimpse-top)); pointer-events: none; user-select: none; -webkit-user-select: none; }
/* The map is moved with a transform, which paints over an inset outline: the ring is its own layer on top, black
   with a white edge so it reads on any scenery, light or dark. */
.glimpse-map:focus-visible { outline: none; }
.glimpse-map:focus-visible::after { content: ""; position: absolute; inset: 3px; border: 2px solid #111418; border-radius: var(--radius-sm); box-shadow: 0 0 0 2px #fff, inset 0 0 0 2px #fff; pointer-events: none; }
/* A tap dims the map a moment: nothing moves, so reduced motion needs nothing else. */
.glimpse-map:active .glimpse-svg { filter: brightness(0.92); }
.glimpse-notes { padding: var(--space-3) var(--card-pad) var(--card-pad); }
@media (min-width: 1200px) { .glimpse { display: none; } }
/* Under the map, in the glimpse and in the laptop's panel: the lines, and the next checkpoint in one row. */
.route-notes p { margin: 0; }
.route-next { display: flex; align-items: center; gap: var(--space-3); font-size: 15px; line-height: 1.25; }
.route-next .shape { flex: none; }
.route-next-what { font-weight: 400; }
.route-next-end { flex: none; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
p.streak { display: block; text-align: center; }
p.streak-keep { text-align: center; text-wrap: balance; }
.week-in .btn-inline { align-self: flex-start; }

/* A phone, before the day is logged: only the input, centred in the space; the rest waits (or shows on "See where
   you stand"). Once logged the input folds away until Edit. From 900px everything is on screen, as on the desktop mock. */
@media (max-width: 899px) {
  .today-main { display: flex; flex-direction: column; min-height: calc(100dvh - 76px - env(safe-area-inset-bottom)); }
  .today-body { flex: 1; }
  .today-waiting:not(.today-peek) :is(.today-hero, .morning, .first-week, .first-week-done, .glimpse, .tag-card, .today-rest) { display: none; }
  .today-waiting:not(.today-peek) .today-form { flex: 1; justify-content: center; gap: var(--space-4); }
}
/* Once the day is logged the input folds away, on every screen size, until Edit; the header keeps only the day
   line and "Logged · Edit", so the true weight sits near the top. The header stays slim while editing too, so Edit
   opens the form below a header that doesn't move. Its top is --top-inset, like every other screen's. */
.today-logged:not(.today-editing) .today-form { display: none; }
/* Out of sight but still the page's heading for screen readers (as .visually-hidden). */
.today-logged .today-header h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.today-peek .entry-peek { display: none; }
@media (min-width: 900px) {
  .entry-peek { display: none; }
  /* On a laptop the input and the true weight share the column: the number typed stays smaller than the number it becomes. */
  .today-form .input-big input { font-size: 64px; }
  /* No status bar to clear on a laptop: once logged, the header is one slim line. */
  .today-logged .today-header { padding-top: var(--space-4); padding-bottom: var(--space-4); }
  .today-hero { --hero-size: 112px; }
}

/* The reveal, staged by the controller: 0 the typed number alone, "On the scale"; 1 it slides up into the Scale chip
   (a quick exit) and, a beat later, the true weight appears in its place with its colour; 2 the message; then the
   rest. Transform and opacity only, one strong ease-out, each step under 450ms; the holds between steps are the
   controller's values. */
.today-main[data-reveal-stage] :is(.scale-chip, .hero-label, .hero-info, .glimpse, .tag-card, .morning, .first-week, .first-week-done, .today-rest) {
  transition: opacity 350ms cubic-bezier(0.22, 1, 0.36, 1), transform 350ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s;
}
.today-main[data-reveal-stage] .hero-typed { transition: opacity 260ms cubic-bezier(0.32, 0.72, 0, 1), transform 260ms cubic-bezier(0.32, 0.72, 0, 1); will-change: transform, opacity; }
.today-main[data-reveal-stage] .hero-number { transition: opacity 450ms cubic-bezier(0.22, 1, 0.36, 1) 150ms, color 600ms ease-out 150ms; }
.today-main[data-reveal-stage="0"] .hero-typed { opacity: 1; }
.today-main[data-reveal-stage="0"] .hero-number { opacity: 0; color: var(--ink); }
.today-main[data-reveal-stage="0"] .label-scale { display: inline; }
.today-main[data-reveal-stage="0"] .label-true { display: none; }
.today-main[data-reveal-stage="0"] :is(.scale-chip, .hero-info) { opacity: 0; transform: translateY(8px); }
.today-main[data-reveal-stage="1"] .hero-typed { opacity: 0; transform: translateY(-64px) scale(0.18); }
/* On a phone the message and the rest wait their turn; on a laptop the columns are already there, so only the
   number moves and nothing else is held back. */
@media (max-width: 899px) {
  .today-main:is([data-reveal-stage="0"], [data-reveal-stage="1"]) :is(.glimpse, .tag-card) { opacity: 0; transform: translateY(12px); visibility: hidden; }
  .today-main:is([data-reveal-stage="0"], [data-reveal-stage="1"]) :is(.morning, .first-week, .first-week-done) { opacity: 0; transform: translateY(12px); visibility: hidden; }
  .today-main[data-reveal-stage] .today-rest { opacity: 0; transform: translateY(24px); visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .today-main[data-reveal-stage] * { transition: none !important; }
}

/* The weekly summary's question inside the first-week card: an optional aside in the signal orange, softened toward
   the surface so it doesn't shout, edged by a translucent orange ring rather than a border (it sits inside, not above).
   Its radius is the card's less the card's padding, never below 6px. */
.first-week-email {
  display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3);
  border-radius: max(calc(var(--radius) - var(--card-pad)), 6px);
  background: color-mix(in srgb, var(--surface) 45%, var(--signal-tint));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--signal) 25%, transparent);
  color: var(--muted);
}
.first-week-email svg { flex: none; margin-top: 2px; color: var(--signal-text); }
/* Its button stays as quiet as the aside: no white fill, the same orange ring, orange ink. */
.first-week-email .btn { background: transparent; border-color: transparent; box-shadow: 0 0 0 1px color-mix(in srgb, var(--signal) 40%, transparent); color: var(--signal-text); }
