/*
 * Lumina Health · base: fonts, reset, the iOS screen anatomy, type roles.
 *
 * Anatomy of every screen (built by ui.js → screen()):
 *   .view            one route, absolutely filling the phone
 *     .nav           44pt bar under the status bar: back, centred title, actions
 *     .scroll        the only scrolling region
 *       .lt          the large title, which hands its text to .nav on scroll
 *     .foot          a sticky call to action, above the tab bar
 *     .tabbar        top-level navigation: one bar in the shell (app.js placeTabbar)
 *
 * Safe areas come from two variables the shell sets: in the desktop handset
 * they are the iPhone's (54 top for the Dynamic Island, 34 bottom for the
 * home indicator); full-bleed on a real phone they are env(safe-area-*).
 */

@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/inter-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/inter-latin-ext.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
h1,
h2,
h3,
h4,
p,
ul,
ol,
figure,
dl,
dd {
  margin: 0;
  padding: 0;
}
ul,
ol {
  list-style: none;
}
img,
svg {
  display: block;
  max-width: 100%;
}
.ic {
  flex: none;
}
a {
  color: inherit;
  text-decoration: none;
}
:focus {
  outline: none;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}
/* Headings receive focus on navigation so VoiceOver starts at the top of a
   new screen; they are not controls, so they never show a ring. */
h1[tabindex="-1"]:focus,
h2[tabindex="-1"]:focus,
[data-focus-title]:focus {
  outline: none;
}
.sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── The phone ──────────────────────────────────────────────────────────── */
.ios {
  --safe-top: 54px;
  --safe-bottom: 34px;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
  line-height: 1.35;
  isolation: isolate;
  container-type: inline-size;
}
.full .ios {
  --safe-top: max(env(safe-area-inset-top, 0px), 16px);
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), 12px);
}
.full.capture .ios {
  --safe-top: 54px;
  --safe-bottom: 34px;
}

/* Status bar: drawn in the handset and in captures, never over a real phone's
   own. Text colour follows the view underneath (data-sb on the view). */
.sb {
  position: absolute;
  inset: 0 0 auto;
  height: 54px;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 30px 0 46px;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.2px;
  pointer-events: none;
  color: var(--text);
  transition: color var(--d-fast) var(--ease-out);
}
.sb.light {
  color: #fff;
}
.sb-ind {
  display: flex;
  gap: 6px;
  align-items: center;
}
.full:not(.capture) .sb {
  display: none;
}
.home-ind {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 139px;
  height: 5px;
  margin-left: -69.5px;
  border-radius: 3px;
  background: var(--slate-900);
  z-index: 70;
  pointer-events: none;
  opacity: 0.92;
}
.home-ind.light {
  background: #fff;
}
.full:not(.capture) .home-ind {
  display: none;
}

/* ── A view ─────────────────────────────────────────────────────────────── */
.views {
  position: absolute;
  inset: 0;
}
.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  will-change: transform;
}
.view.dark {
  background: var(--navy-950);
  color: #fff;
}
.view.white {
  background: var(--bg);
}

.nav {
  position: relative;
  z-index: 20;
  flex: none;
  padding-top: var(--safe-top);
  background: transparent;
  transition: background var(--d-fast) var(--ease-out), box-shadow var(--d-fast) var(--ease-out);
}
.nav.solid,
.view.scrolled .nav {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0.5px 0 var(--line);
}
.view.white.scrolled .nav,
.view.white .nav.solid {
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}
.hc .view.scrolled .nav,
.hc .nav.solid {
  background: var(--bg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: 0 1px 0 var(--slate-400);
}
.nav-bar {
  height: 44px;
  display: grid;
  /* Sides keep their buttons at full size; the centred title gives way
     (and ellipsises) before a 44pt target ever shrinks. */
  grid-template-columns: minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr);
  align-items: center;
  padding: 0 8px;
}
.nav-l,
.nav-r {
  display: flex;
  align-items: center;
  min-width: 0;
}
.nav-r {
  justify-content: flex-end;
  gap: 2px;
}
.nav-title {
  font-size: var(--fs-head);
  font-weight: 600;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 62cqi;
  text-align: center;
  transition: opacity var(--d-fast) var(--ease-out);
}
.view.has-lt:not(.scrolled) .nav-title {
  opacity: 0;
}
.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 0;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 8px 0 2px;
  color: var(--brand-ink);
  font-size: var(--fs-body);
  border-radius: 10px;
}
.nav-back .ic {
  width: 28px;
  height: 28px;
  stroke-width: 2.25;
  margin-right: -2px;
}
.nav-back span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 28cqi;
}
.nav-text {
  min-height: var(--tap);
  padding: 0 10px;
  color: var(--brand-ink);
  font-size: var(--fs-body);
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
}
.nav-text.strong {
  font-weight: 600;
}
.icon-btn {
  flex: none;
  position: relative;
  width: var(--tap);
  height: var(--tap);
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: var(--brand-ink);
}
.icon-btn .dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red-600);
  box-shadow: 0 0 0 2px var(--bg);
}

.scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: var(--s8);
}
.scroll::-webkit-scrollbar {
  display: none;
}
.lt {
  padding: 2px var(--gutter) var(--s3);
}
.lt h1 {
  font-size: var(--fs-large);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.6px;
}
.lt .lt-kicker {
  display: block;
  font-size: var(--fs-sub);
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 2px;
}
.lt .lt-sub {
  margin-top: 4px;
  font-size: var(--fs-sub);
  color: var(--text-2);
  line-height: 1.4;
}

.foot {
  flex: none;
  position: relative;
  z-index: 15;
  padding: var(--s3) var(--gutter) calc(var(--s3) + var(--safe-bottom));
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 -0.5px 0 var(--line);
}
.view.white .foot {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}
.view.has-tabs .foot {
  padding-bottom: var(--s3);
}
.hc .foot {
  background: var(--bg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: 0 -1px 0 var(--slate-400);
}
.foot .note {
  margin-top: var(--s2);
  text-align: center;
  font-size: var(--fs-foot);
  color: var(--text-2);
}

/* The tab bar: ONE, in the shell (index.html #tabbar, app.js placeTabbar), over
   the bottom of whichever tabbed screen is current; each such screen reserves its
   height with .tabbar-space. The Figma's look: white, plain outline icons, the
   active one on a pale blue disc. Labels stay (see ui.js TABS). */
.ios {
  --tabbar-h: calc(64px + var(--safe-bottom));
}
.tabbar-space {
  flex: none;
  height: var(--tabbar-h);
}
.tabbar {
  position: absolute;
  inset: auto 0 0;
  height: var(--tabbar-h);
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px var(--safe-bottom);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 -0.5px 0 var(--line);
  will-change: transform;
}
.tabbar[hidden] {
  display: none;
}
.tabbar.mid {
  z-index: 1;
}
.hc .tabbar {
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: 0 -1px 0 var(--slate-400);
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 56px;
  color: var(--text-3);
  font-size: 12px; /* the floor; iOS uses 10 */
  font-weight: 500;
  letter-spacing: 0;
  border-radius: 12px;
}
.tab-disc {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: background var(--d-fast) var(--ease-out);
}
.hc .tab {
  color: var(--slate-600);
}
.tab[aria-current="page"] {
  color: var(--brand-ink);
  font-weight: 600;
}
.tab[aria-current="page"] .tab-disc {
  background: var(--tab-active);
}
.hc .tab[aria-current="page"] .tab-disc {
  box-shadow: inset 0 0 0 1.5px var(--brand-ink);
}
.tab:active .tab-disc {
  background: var(--surface-sunken);
}
.tab[aria-current="page"]:active .tab-disc {
  background: var(--tab-active);
}
.tab .badge {
  position: absolute;
  top: 0;
  left: calc(50% + 8px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red-600);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
/* larger text: the label wraps under the disc, never over the next tab */
.ts-ax .tab-l,
.ts-xl .tab-l {
  font-size: 12px;
}

/* ── Type roles ─────────────────────────────────────────────────────────── */
.t-large {
  font-size: var(--fs-large);
  font-weight: 700;
  letter-spacing: -0.6px;
  line-height: 1.15;
}
.t1 {
  font-size: var(--fs-t1);
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.18;
}
.t2 {
  font-size: var(--fs-t2);
  font-weight: 700;
  letter-spacing: -0.35px;
  line-height: 1.22;
}
.t3 {
  font-size: var(--fs-t3);
  font-weight: 600;
  letter-spacing: -0.3px;
  line-height: 1.25;
}
.head {
  font-size: var(--fs-head);
  font-weight: 600;
  letter-spacing: -0.25px;
  line-height: 1.3;
}
.body {
  font-size: var(--fs-body);
  line-height: 1.4;
}
.callout {
  font-size: var(--fs-callout);
  line-height: 1.4;
}
.sub {
  font-size: var(--fs-sub);
  line-height: 1.4;
}
.foot-t {
  font-size: var(--fs-foot);
  line-height: 1.38;
}
.cap {
  font-size: var(--fs-cap);
  line-height: 1.35;
}
.muted {
  color: var(--text-2);
}
.faint {
  color: var(--text-3);
}
.ink {
  color: var(--brand-ink);
}
.tnum {
  font-variant-numeric: tabular-nums;
}
.metric {
  font-family: var(--font-round);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-metric);
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
}
.metric-xl {
  font-family: var(--font-round);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-metric-xl);
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1;
}
.unit {
  font-size: var(--fs-sub);
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0;
  margin-left: 3px;
}
.eyebrow {
  font-size: var(--fs-foot);
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.w600 {
  font-weight: 600;
}

/* ── Layout helpers ─────────────────────────────────────────────────────── */
.pad {
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.stack {
  display: flex;
  flex-direction: column;
}
.row-flex {
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.between {
  justify-content: space-between;
}
.wrap {
  flex-wrap: wrap;
}
.grow {
  flex: 1;
  min-width: 0;
}
.gap1 {
  gap: var(--s1);
}
.gap2 {
  gap: var(--s2);
}
.gap3 {
  gap: var(--s3);
}
.gap4 {
  gap: var(--s4);
}
.mt1 {
  margin-top: var(--s1);
}
.mt2 {
  margin-top: var(--s2);
}
.mt3 {
  margin-top: var(--s3);
}
.mt4 {
  margin-top: var(--s4);
}
.mt5 {
  margin-top: var(--s5);
}
.mt6 {
  margin-top: var(--s6);
}
.mt8 {
  margin-top: var(--s8);
}
.center {
  text-align: center;
}
.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3);
}
/* At the largest text sizes two columns of readings cannot hold their
   numbers; the grid gives up a column rather than truncate. */
.ts-xl .grid2,
.ts-ax .grid2 {
  grid-template-columns: minmax(0, 1fr);
}

/* Accessibility text sizes: where the title sits in the bar, the back button
   gives up its label and keeps the chevron (iOS does the same when the bar is
   crowded), so the title isn't cut short. It is still announced as "Back". */
.ts-ax .view:not(.has-lt) .nav-back [data-backlabel] {
  display: none;
}
