/* ═══════════════════════════════════════════════════════════════════════════
   Addy Bite — Base layer
   Typography, document chrome, focus, and the small resets the new visual
   language needs. Loads after the legacy sheets, so it corrects them rather
   than replacing them wholesale.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Document ─────────────────────────────────────────────────────────── */
body {
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: var(--t-body-lh);
  letter-spacing: var(--t-body-ls);
  font-weight: 400;
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Inter's default figures are proportional; the app is mostly numbers. */
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'cv05' 1, 'cv08' 1, 'ss03' 1;
  text-rendering: optimizeLegibility;
}

/* ── Headings ─────────────────────────────────────────────────────────────
   One scale, applied by role rather than by tag, so an <h3> used as a card
   title and a <div class="section-label"> land in the same place. */
h1,
.h1 {
  font-size: var(--t-h1);
  line-height: var(--t-h1-lh);
  letter-spacing: var(--t-h1-ls);
  font-weight: 600;
  color: var(--ink);
}
h2,
.h2 {
  font-size: var(--t-h2);
  line-height: var(--t-h2-lh);
  letter-spacing: var(--t-h2-ls);
  font-weight: 600;
  color: var(--ink);
}
h3,
.h3 {
  font-size: var(--t-h3);
  line-height: var(--t-h3-lh);
  letter-spacing: var(--t-h3-ls);
  font-weight: 600;
  color: var(--ink);
}
h4,
h5,
h6 {
  font-size: var(--t-body);
  line-height: 1.4;
  letter-spacing: -0.1px;
  font-weight: 600;
  color: var(--ink);
}

/* Bootstrap's display sizes, retuned to the app's scale. */
.fs-1 {
  font-size: var(--t-h1) !important;
  line-height: var(--t-h1-lh) !important;
  letter-spacing: var(--t-h1-ls) !important;
  font-weight: 600;
}
.fs-2 {
  font-size: var(--t-h2) !important;
  line-height: var(--t-h2-lh) !important;
  letter-spacing: var(--t-h2-ls) !important;
  font-weight: 600;
}

small,
.small {
  font-size: var(--t-xs);
  line-height: var(--t-xs-lh);
}

/* The old sheets set Montserrat on individual components. Rather than chase
   each one, re-point the family everywhere and keep the weights. */
body,
button,
input,
select,
textarea,
.topbar-title,
.section-label,
.stat-value,
.brand-text,
.nav-label {
  font-family: var(--font-sans);
}

/* Numbers that sit in columns, gauges or counters get the mono cut — the
   fixed advance width stops readouts jittering as they update. */
.stat-value,
.cal-num,
.calorie-summary-num,
.nutrient-value,
.steps-card-count,
.psc-val,
.tc-value,
.trc-val,
.vts-val,
.bmi-val,
.ms-val,
.day-num,
.weight-cell,
.cals-cell,
.level-num,
.rw-points,
.streak-count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* …but the unit that rides along inside those readouts is a word, not a
   number, so it goes back to the text face. */
.stat-value .stat-unit,
.vts-val .stat-unit,
.psc-val .stat-unit,
.tc-value .tc-unit,
.nutrient-value .nutrient-unit,
.cal-num span,
.pc-stat-n i,
.pc-big span {
  font-family: var(--font-sans);
  letter-spacing: 0;
}

/* ── Links ────────────────────────────────────────────────────────────── */
a {
  color: var(--accent);
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color var(--dur-1) var(--ease-out);
}
a:hover {
  color: var(--accent-hover);
}

/* ── Focus ────────────────────────────────────────────────────────────────
   One ring, drawn outside the element so it never reflows the layout. */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ── Selection ────────────────────────────────────────────────────────── */
::selection {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  color: var(--ink);
}

/* ── Scrollbars ───────────────────────────────────────────────────────────
   Thin and self-effacing; the content is the subject. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ink-faint);
  border: 3px solid transparent;
  background-clip: content-box;
}

/* ── Utility corrections ──────────────────────────────────────────────────
   Bootstrap's muted grey is fixed; ours has to follow the theme. */
.text-muted,
.text-body-secondary {
  color: var(--ink-subtle) !important;
}
.text-body,
.text-dark {
  color: var(--ink) !important;
}
hr {
  border-color: var(--line);
  opacity: 1;
}

/* ── Motion ───────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
