/* =====================================================================
   Notbroken — shared app shell
   ---------------------------------------------------------------------
   Loaded by EVERY page, after the page's own stylesheet(s).

   1. Self-hosted fonts (Figtree + Literata, v2.37.0) — no Google Fonts
      request, so the app renders the same from files and inside Cordova.
   2. The unified navigation (left rail on desktop & landscape, tab bar
      on portrait phones). One markup, one look, on every page.
   3. Tool-page theme: the MetaKit tools (html.app pages) adopt the
      Notbroken palette — ink navy, sage, terracotta — and typography.
   4. Print: the nav is never printed.
   ===================================================================== */

/* ---------- 1. FONTS ---------- */
/* v2.37.0: Figtree for text and Literata for titles, replacing Inter and Playfair Display.
   Literata was drawn for reading on screens (Google Play Books): a large x-height and moderate stroke contrast, so
   titles and subtitles stay clear at every size and on the dark tool pages, where Playfair's hairlines thinned out.
   Figtree is a friendly, open sans with plain figures (tabular figures for timers) and clear shapes at small sizes.
   Both are SIL Open Font License 1.1 (fontsource 5.3.0 subsets; Literata at optical size 24). Latin-extended glyphs
   (ł, ő, ș …) are fetched only if a page uses them. Weights: titles 600 (as Playfair's 700 looked), text 400-800.
   v2.37.1: one static file per weight (cut from the variable files with fontTools, dev/make_web_fonts.py) on screen and
   in print, instead of one variable file per family on screen. On iPhone the variable files' semibold and bold text
   did not look right (reported on v2.37.0; desktop browsers drew it as designed); a static file is the exact designed
   weight in every browser and on Apple's text engine, cheaper to draw while scrolling, and what Chromium embeds as real text in
   discover.pdf and the chapter PDFs (a variable font would go in as Type 3 outlines). A browser fetches only the
   weights a page uses (about 46-68 KB for most pages, against 75 KB for the two variable files).
   dev/sw.py reads the url() references below for the service worker's list.
   The Inter and Playfair files and the variable Figtree/Literata files stay in fonts/ for pages a browser still holds
   from earlier releases and for the build tools (the nb mark is drawn from Playfair Display 800, dev/nb_logo.py). */
@font-face { font-family:'Figtree'; font-style:normal; font-weight:400; font-display:swap; src:url(fonts/figtree-latin-400-normal.woff2) format('woff2'); 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:'Figtree'; font-style:normal; font-weight:400; font-display:swap; src:url(fonts/figtree-latin-ext-400-normal.woff2) format('woff2'); 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; }
@font-face { font-family:'Figtree'; font-style:normal; font-weight:500; font-display:swap; src:url(fonts/figtree-latin-500-normal.woff2) format('woff2'); 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:'Figtree'; font-style:normal; font-weight:500; font-display:swap; src:url(fonts/figtree-latin-ext-500-normal.woff2) format('woff2'); 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; }
@font-face { font-family:'Figtree'; font-style:normal; font-weight:600; font-display:swap; src:url(fonts/figtree-latin-600-normal.woff2) format('woff2'); 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:'Figtree'; font-style:normal; font-weight:600; font-display:swap; src:url(fonts/figtree-latin-ext-600-normal.woff2) format('woff2'); 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; }
@font-face { font-family:'Figtree'; font-style:normal; font-weight:700; font-display:swap; src:url(fonts/figtree-latin-700-normal.woff2) format('woff2'); 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:'Figtree'; font-style:normal; font-weight:700; font-display:swap; src:url(fonts/figtree-latin-ext-700-normal.woff2) format('woff2'); 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; }
@font-face { font-family:'Figtree'; font-style:normal; font-weight:800; font-display:swap; src:url(fonts/figtree-latin-800-normal.woff2) format('woff2'); 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:'Figtree'; font-style:normal; font-weight:800; font-display:swap; src:url(fonts/figtree-latin-ext-800-normal.woff2) format('woff2'); 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; }
@font-face { font-family:'Literata'; font-style:normal; font-weight:400; font-display:swap; src:url(fonts/literata-latin-400-normal.woff2) format('woff2'); 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:'Literata'; font-style:normal; font-weight:400; font-display:swap; src:url(fonts/literata-latin-ext-400-normal.woff2) format('woff2'); 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; }
@font-face { font-family:'Literata'; font-style:normal; font-weight:500; font-display:swap; src:url(fonts/literata-latin-500-normal.woff2) format('woff2'); 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:'Literata'; font-style:normal; font-weight:500; font-display:swap; src:url(fonts/literata-latin-ext-500-normal.woff2) format('woff2'); 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; }
@font-face { font-family:'Literata'; font-style:normal; font-weight:600; font-display:swap; src:url(fonts/literata-latin-600-normal.woff2) format('woff2'); 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:'Literata'; font-style:normal; font-weight:600; font-display:swap; src:url(fonts/literata-latin-ext-600-normal.woff2) format('woff2'); 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; }
@font-face { font-family:'Literata'; font-style:normal; font-weight:700; font-display:swap; src:url(fonts/literata-latin-700-normal.woff2) format('woff2'); 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:'Literata'; font-style:normal; font-weight:700; font-display:swap; src:url(fonts/literata-latin-ext-700-normal.woff2) format('woff2'); 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; }

/* ---------- 2. THE APP NAVIGATION ---------- */
/* Tokens for the nav only. The nav is always dark (ink navy → deep sage),
   so it reads the same on the light directory, the dark directory and the
   immersive tool canvases. */
.app-footer-menu {
  --nav-w: 84px;              /* desktop rail */
  --nav-w-compact: 68px;      /* landscape phone rail */
  --nav-h: 64px;              /* portrait tab bar */
  --nav-bg-1: #161B2C;
  --nav-bg-2: #1B2A25;
  --nav-fg: rgba(242, 239, 234, 0.72);
  --nav-fg-hover: #F2EFEA;
  --nav-fg-active: #A6D2BC;
  --nav-accent: #84C0A0;
  --nav-active-bg: rgba(132, 192, 160, 0.14);
  --nav-border: rgba(255, 255, 255, 0.08);

  box-sizing: border-box;
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(180deg, var(--nav-bg-1) 0%, var(--nav-bg-2) 100%) !important;
  color: var(--nav-fg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: 0 !important;
  box-shadow: 4px 0 24px -12px rgba(0, 0, 0, 0.6) !important;
  contain: layout style;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.app-footer-menu * { box-sizing: border-box; }

.app-footer-menu a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  position: relative;
  text-decoration: none !important;
  color: var(--nav-fg);
  font-weight: 500;
  letter-spacing: .2px;
  line-height: 1;
  border-radius: 10px;
  transition: color .18s ease, background-color .18s ease;
  margin: 0;
  padding: 0;
  outline: none;
}
.app-footer-menu a::before { content: none !important; }   /* legacy hover overlay */
.app-footer-menu a:hover { color: var(--nav-fg-hover); background: rgba(255,255,255,.06); transform: none !important; }
.app-footer-menu a:focus-visible { box-shadow: 0 0 0 2px var(--nav-accent) inset; }
.app-footer-menu a.active,
.app-footer-menu a[aria-current="page"] {
  color: var(--nav-fg-active);
  background: var(--nav-active-bg);
  font-weight: 600;
}
.app-footer-menu a svg {
  display: block;
  width: 24px; height: 24px;
  min-width: 24px; min-height: 24px; max-width: 24px; max-height: 24px;
  flex: 0 0 auto;
  margin: 0;
  filter: none;
  transition: transform .18s ease;
  transform: none;
}
.app-footer-menu a:hover svg, .app-footer-menu a.active svg, .app-footer-menu a[aria-current="page"] svg { transform: scale(1.06); }
.app-footer-menu a span { font-size: 10.5px; font-weight: inherit; letter-spacing: inherit; white-space: nowrap; }
/* active indicator: a short sage bar (left edge on the rail, top edge on the tab bar) */
.app-footer-menu a.active::after,
.app-footer-menu a[aria-current="page"]::after {
  content: '';
  position: absolute;
  background: var(--nav-accent);
  border-radius: 3px;
}

/* brand mark — only shown on the desktop rail */
.app-footer-menu .app-nav-brand {
  display: none;
  gap: 8px;
  color: var(--nav-fg-active);
  background: none !important;
  border-radius: 0;
}
.app-footer-menu .app-nav-brand:hover { color: var(--nav-fg-hover); }
.app-footer-menu .app-nav-brand .brand-accent { display: block; width: 28px; height: 3px; background: var(--nav-accent); }
.app-footer-menu .app-nav-brand .brand-mark {
  font-family: 'Literata', Georgia, serif;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -.5px;
  line-height: 1;
}
.app-footer-menu .app-nav-brand::after { content: none !important; }

/* ----- Portrait phones / small tablets: bottom tab bar ----- */
@media (max-width: 999.5px) and (orientation: portrait) {
  .app-footer-menu {
    position: fixed !important;
    left: 0; right: 0; bottom: 0; top: auto;
    width: auto !important; min-width: 0 !important; max-width: none !important;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)) !important;
    min-height: 0 !important; max-height: none !important;
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px)) !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    justify-content: space-between !important;
    gap: 2px;
    border-top: 1px solid var(--nav-border) !important;
    box-shadow: 0 -8px 24px -12px rgba(0,0,0,.6) !important;
    z-index: 1000;
  }
  .app-footer-menu a {
    flex: 1 1 0 !important;
    width: auto !important; min-width: 0 !important;
    height: auto !important; min-height: 0 !important;
    padding: 6px 2px !important;
    margin: 0 !important;
    gap: 4px;
  }
  .app-footer-menu a span { font-size: 10px; }
  .app-footer-menu a svg { width: 23px; height: 23px; min-width: 23px; min-height: 23px; max-width: 23px; max-height: 23px; }
  .app-footer-menu a.active::after, .app-footer-menu a[aria-current="page"]::after {
    top: -4px; left: 22%; right: 22%; height: 3px;
  }
}

/* ----- Landscape phones (short viewports): compact left rail ----- */
@media (max-width: 999.5px) and (orientation: landscape) {
  .app-footer-menu {
    position: fixed !important;
    left: 0; top: 0; bottom: 0; right: auto;
    width: calc(var(--nav-w-compact) + env(safe-area-inset-left, 0px)) !important;
    min-width: 0 !important; max-width: none !important;
    height: auto !important; min-height: 0 !important; max-height: none !important;
    padding: calc(6px + env(safe-area-inset-top, 0px)) 4px calc(6px + env(safe-area-inset-bottom, 0px)) calc(4px + env(safe-area-inset-left, 0px)) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: space-evenly !important;
    gap: 2px;
    border-right: 1px solid var(--nav-border) !important;
    z-index: 1000;
  }
  .app-footer-menu a {
    width: auto !important; min-width: 0 !important;
    height: auto !important; min-height: 0 !important;
    padding: 5px 2px !important;
    margin: 0 !important;
    gap: 3px;
  }
  .app-footer-menu a span { font-size: 9.5px; }
  .app-footer-menu a svg { width: 19px; height: 19px; min-width: 19px; min-height: 19px; max-width: 19px; max-height: 19px; }
  .app-footer-menu a.active::after, .app-footer-menu a[aria-current="page"]::after {
    left: -4px; top: 18%; bottom: 18%; width: 3px;
  }
}

/* ----- Desktop & large tablets: full left rail ----- */
@media (min-width: 1000px) {
  .app-footer-menu {
    position: fixed !important;
    left: 0; top: 0; bottom: 0; right: auto;
    width: var(--nav-w) !important; min-width: var(--nav-w) !important; max-width: var(--nav-w) !important;
    height: auto !important; min-height: 0 !important; max-height: none !important;
    padding: calc(18px + env(safe-area-inset-top, 0px)) 8px calc(18px + env(safe-area-inset-bottom, 0px)) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 6px;
    border-right: 1px solid var(--nav-border) !important;
    z-index: 1000;
    order: 0;
  }
  .app-footer-menu .app-nav-brand { display: flex; padding: 6px 0 18px !important; margin-bottom: 6px; border-bottom: 1px solid var(--nav-border); }
  .app-footer-menu a {
    width: auto !important; min-width: 0 !important;
    height: auto !important; min-height: 0 !important;
    padding: 11px 4px !important;
    margin: 0 !important;
    gap: 6px;
  }
  .app-footer-menu a span { font-size: 11px; }
  .app-footer-menu a svg { width: 26px; height: 26px; min-width: 26px; min-height: 26px; max-width: 26px; max-height: 26px; }
  .app-footer-menu a.active::after, .app-footer-menu a[aria-current="page"]::after {
    left: -8px; top: 22%; bottom: 22%; width: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-footer-menu a, .app-footer-menu a svg { transition: none !important; }
}

/* ---------- 3. DIRECTORY PAGE (html.nb-site): make room for the nav ---------- */
@media screen and (min-width: 1000px) {
  html.nb-site body { padding-left: 84px; }
  html.nb-site .web-progress { left: 84px; }
  html.nb-site .skip-links { left: 84px; }
}
@media screen and (max-width: 999.5px) and (orientation: landscape) {
  html.nb-site body { padding-left: calc(68px + env(safe-area-inset-left, 0px)); }
  html.nb-site .web-progress { left: calc(68px + env(safe-area-inset-left, 0px)); }
  html.nb-site .skip-links { left: calc(68px + env(safe-area-inset-left, 0px)); }
}
@media screen and (max-width: 999.5px) and (orientation: portrait) {
  html.nb-site body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  html.nb-site .web-backtotop { bottom: calc(64px + 14px + env(safe-area-inset-bottom, 0px)); }
}
/* The directory's contents/filter drawer and its scrim live inside the sticky
   top bar (.web-side, z-index 200), so the nav must sit below that stacking
   context for the drawer and scrim to cover it. */
html.nb-site .app-footer-menu { z-index: 150 !important; }
@media screen and (max-width: 999.5px) {
  /* keep the sticky top bar clear of a notch in standalone / Cordova mode */
  html.nb-site .web-side { padding-top: calc(11px + env(safe-area-inset-top, 0px)); }
}

/* ---------- 4. TOOL PAGES (html.app): Notbroken palette + type ---------- */
html.app {
  /* the tools are dark canvases, so they use the directory's dark-mode tokens */
  --nb-sage: #84C0A0;
  --nb-sage-light: #A6D2BC;
  --nb-sage-deep: #4A7560;
  --nb-sage-tint: #22302A;
  --nb-ink: #F2EFEA;
  --nb-text: #DAE0E6;
  --nb-muted: #A5AFBC;
  --nb-terra: #E8A375;
  --nb-page: #15181D;
  --nb-surface: #1F242B;
  --nb-surface-2: #242A32;
  --nb-border: #3A424E;
  --nb-on-accent: #13171D;
  --nb-gradient: linear-gradient(-45deg, #151A2B, #1E3A2E, #1A1F36, #2A4A3A);
  background: var(--nb-page);
}
html.app body {
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  background-color: var(--nb-page) !important;
  -webkit-font-smoothing: antialiased;
}
/* The tool canvas: the four-colour gradient at 400 % size, still. Until v2.36.0 this rule also ran a 30 s
   background-position animation (and sleep, calm, move, journal, build and abstain carry a copy of it in their own
   CSS) — but it never moved anything: `background: … !important` above sets background-position too, and an
   !important declaration beats an animation in the cascade, so every browser drew the fixed 0 0 position while still
   recalculating style for the whole canvas 60 times a second (about 300 style recalculations and 0.9-1.3 s of
   main-thread time per 5 s on a 4x-slowed phone, idle, on every tool, recipe and video page — even with reduced motion
   on). The canvas looks exactly as it always has; the animation is simply gone, here and (overridden by this rule's
   higher specificity, loaded last) in every page's own copy. If a slow drift is ever wanted, animate a transform on a
   fixed layer behind the page rather than background-position. */
html.app .page-container,
html.app .gradient-bg,
html.app .nav-buttons {
  background: var(--nb-gradient) !important;
  background-size: 400% 400% !important;
  animation: none !important;
}
/* v2.36.0: the fixed bottom menu (and the cookie bar while it is open — html.nb-consent-open and --nb-consent-h are
   set by nb-analytics.js) must not hide whatever keyboard focus lands on (WCAG 2.4.11). scroll-padding on the scroll
   container makes the browser scroll a focused element into the part of the screen above those bars. On the directory
   and the info pages the page itself scrolls; on the tools it is the first <div> in <body> (the same selector
   style.css uses for it). */
@media (max-width: 999.5px) and (orientation: portrait) {
  html, html.app body > div:not(.modal-overlay):not(#app-footer-menu):not(#shareModal):not(.nb-consent):not(.nb-export):not(.nb-notice):not(.nb-layer):not([data-nb-layer]) {
    scroll-padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 16px);
  }
  html.nb-consent-open, html.app.nb-consent-open body > div:not(.modal-overlay):not(#app-footer-menu):not(#shareModal):not(.nb-consent):not(.nb-export):not(.nb-notice):not(.nb-layer):not([data-nb-layer]) {
    scroll-padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px) + var(--nb-consent-h, 160px) + 16px);
  }
}
@media (min-width: 1000px), (max-width: 999.5px) and (orientation: landscape) {
  html.nb-consent-open, html.app.nb-consent-open body > div:not(.modal-overlay):not(#app-footer-menu):not(#shareModal):not(.nb-consent):not(.nb-export):not(.nb-notice):not(.nb-layer):not([data-nb-layer]) {
    scroll-padding-bottom: calc(var(--nb-consent-h, 120px) + 16px);
  }
  /* Journal's fixed Back / Next bar (desktop and landscape only) */
  html.app[data-page="track"] body > div:not(.modal-overlay):not(#app-footer-menu):not(.nb-consent):not(.nb-export):not(.nb-notice):not(.nb-layer):not([data-nb-layer]) { scroll-padding-bottom: 104px; }
  html.app.nb-consent-open[data-page="track"] body > div:not(.modal-overlay):not(#app-footer-menu):not(.nb-consent):not(.nb-export):not(.nb-notice):not(.nb-layer):not([data-nb-layer]) { scroll-padding-bottom: calc(var(--nb-consent-h, 120px) + 104px); }
}
/* The last links on a page (the footer) sit in the room the page keeps clear of the menu, but not of the cookie bar
   stacked above it, and the page cannot scroll any further — so while the bar is open the scroll container grows by
   the bar's height (an empty block at its end; a flex item on the flex canvases). Screen only. */
@media screen {
  html.app.nb-consent-open body > div:not(.modal-overlay):not(#app-footer-menu):not(#shareModal):not(.nb-consent):not(.nb-export):not(.nb-notice):not(.nb-layer):not([data-nb-layer])::after,
  html.nb-site.nb-consent-open body::after {
    content: ''; display: block; flex: none; width: 100%; height: var(--nb-consent-h, 160px);
  }
}
/* Desktop: style.css moves every page off the rail with padding-left: 84px, but the rule's
   specificity (it names #app-footer-menu in :not()) beats the intended "2rem 3rem" page padding,
   so Calm / Sleep / Move sat flush against the rail on the left with a wide gap on the right.
   Give those pages an even gutter on both sides of the content. */
@media screen and (min-width: 1000px) {
  html.app body > .page-container { padding-left: calc(84px + 3rem) !important; padding-right: 3rem !important; }
}
@media screen and (max-width: 999.5px) and (orientation: landscape) {
  html.app body > .page-container { padding-left: calc(68px + env(safe-area-inset-left, 0px) + 1rem) !important; padding-right: calc(1rem + env(safe-area-inset-right, 0px)) !important; }
}
/* editorial display face for each tool's title (never for timers / numbers) */
html.app .header-text h1,
html.app #breathing-app-container h1,
html.app #current-mode,
html.app .summary-title,
html.app .modal-content h3,
html.app .modal-content h2,
html.app .modal-title,
html.app .export-modal-title {
  font-family: 'Literata', Georgia, 'Times New Roman', serif !important;
  font-weight: 600;
  letter-spacing: 0;
}
html.app #countdown-timer, html.app #stopwatch, html.app #timer-display {
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
html.app #current-mode { text-transform: none !important; letter-spacing: 0 !important; }
/* keyboard focus rings in the brand accent, matching the directory. v2.36.0: form fields too — the sliders (Calm's
   speed, Sleep's volumes), the drop-downs (Eat, Videos) and the number boxes (Walk) set outline: none and showed
   nothing on keyboard focus (WCAG 2.4.7); fields that draw their own sage glow now show both. Breathe's pattern pills
   are a hidden radio (.sr-only) followed by the visible pill, so the ring goes on the pill. */
html.app a:focus-visible, html.app button:focus-visible, html.app [tabindex]:focus-visible,
html.app input:focus-visible, html.app select:focus-visible, html.app textarea:focus-visible, html.app [role="slider"]:focus-visible,
html.app input.sr-only:focus-visible + *,
html.app .toggle-switch input:focus-visible + .toggle-slider, html.app .choice-option input:focus-visible + .choice-label,
html.app .scale-btn input:focus-visible + .scale-btn-label, html.app .toggle-option input:focus-visible + .toggle-label {
  outline: 3px solid var(--nb-terra);
  outline-offset: 2px;
}
/* v2.49.0 (keyboard pass, legal checklist A1): Sleep's switches and the journal's choice buttons are see-through inputs
   laid over (or hidden beside) the shape you see, so the ring goes on that shape, as with Breathe's pills above. */
html.app ::selection { background: rgba(132, 192, 160, .35); }

/* ---------- 5. PRINT ---------- */
@media print {
  .app-footer-menu { display: none !important; }
  html.nb-site body { padding: 0 !important; }

  /* The cover and the section-divider pages used a min-height worked out from
     A4 at 96 dpi (297mm - margins). WebKit (Safari on iPhone / iPad / Mac) lays
     print out at a different scale, so that height no longer fits on one sheet
     and every divider spilled over on to extra, blank pages. Each of these still
     gets a page of its own, but its content is anchored near the top so it can
     never overflow, whatever the paper size or browser. */
  /* The old full-bleed cover (width: 100% + 110px) also made every browser
     shrink the whole document to fit the sheet (x0.86). That is the scale the
     PDF has always had, so keep it explicitly now that nothing overflows. */
  html.nb-site body { zoom: 0.8615; }
  html.nb-site .cover-page,
  html.nb-site .section-divider {
    display: block !important; position: static !important;
    width: auto !important; min-height: 0 !important; height: auto !important;
    margin: 0 !important; overflow: visible !important;
    break-inside: auto !important; page-break-inside: auto !important;
  }
  html.nb-site .cover-page {
    padding: 30mm 24px 10mm !important; text-align: center;
    break-after: page !important; page-break-after: always !important;
  }
  html.nb-site .cover-page > * { margin-left: auto !important; margin-right: auto !important; }
  html.nb-site .cover-stats { display: flex; justify-content: center; }
  html.nb-site .cover-bottom-line,
  html.nb-site .cover-footer { position: static !important; }
  html.nb-site .cover-bottom-line { margin: 20mm auto 12px !important; }
  html.nb-site .section-divider {
    padding: 44mm 24px 10mm !important;
    break-before: page !important; page-break-before: always !important;
    break-after: page !important; page-break-after: always !important;
  }
  html.nb-site .section-divider > * { break-inside: avoid; page-break-inside: avoid; }
}

/* ---------- 6. SHARED UI: consent bar, file-ready dialog, first-run notice, credit line ---------- */
.nb-consent {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2000;
  display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  background: #161B2C; color: #DAE0E6;
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 13.5px; line-height: 1.5;
  border-top: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 -8px 30px -12px rgba(0,0,0,.6);
  transform: translateY(110%); visibility: hidden; pointer-events: none;
  transition: transform .28s ease, visibility 0s linear .28s;
}
.nb-consent.is-open { transform: none; visibility: visible; pointer-events: auto; transition: transform .28s ease, visibility 0s; }
.nb-consent strong { color: #F2EFEA; }
.nb-consent a { color: #A6D2BC; text-decoration: underline; }
.nb-consent__text { flex: 1 1 320px; }
.nb-consent__actions { display: flex; gap: 8px; flex: 0 0 auto; }
.nb-consent__btn {
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
  padding: 10px 16px; min-height: 40px; border-radius: 6px;
  background: #84C0A0; color: #13171D; border: 1px solid #84C0A0;
}
.nb-consent__btn:hover { background: #A6D2BC; border-color: #A6D2BC; }
/* v2.36.0: Decline and Accept are the same filled button — one choice is not dressed up over the other (the old
   .nb-consent__btn--quiet outline style is gone; nb-analytics.js no longer sets the class) */
.nb-consent__btn:focus-visible { outline: 3px solid #E8A375; outline-offset: 2px; }
@media (min-width: 1000px) { .nb-consent { left: 84px; } }
@media (max-width: 999.5px) and (orientation: landscape) { .nb-consent { left: calc(68px + env(safe-area-inset-left, 0px)); } }
@media (max-width: 999.5px) and (orientation: portrait) { .nb-consent { bottom: calc(64px + env(safe-area-inset-bottom, 0px)); padding-bottom: 14px; } }

.nb-export, .nb-notice {
  position: fixed; inset: 0; z-index: 3200;
  display: none; align-items: flex-start; justify-content: center;
  padding: 24px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: rgba(10, 13, 20, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.nb-export.is-open, .nb-notice.is-open { display: flex; }
.nb-export__card, .nb-notice__card {
  margin: auto; width: 100%; max-width: 440px;
  background: #FFFFFF; color: #2D3748; border-radius: 12px;
  border: 1px solid #DCE3E9; box-shadow: 0 24px 60px -20px rgba(0,0,0,.6);
  padding: 26px 26px 22px; text-align: left;
}
.nb-notice__card { max-width: 520px; }
.nb-export__eyebrow, .nb-notice__eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 2.5px; text-transform: uppercase; color: #4A7560; margin-bottom: 8px; }
.nb-export__title, .nb-notice__title { font-family: 'Literata', Georgia, serif; font-size: 22px; font-weight: 600; color: #1A1F36; margin: 0 0 10px; line-height: 1.2; }
.nb-export__name { font-size: 13.5px; font-weight: 600; color: #1A1F36; margin: 0 0 6px; word-break: break-word; }
.nb-export__hint, .nb-notice__body { font-size: 14px; line-height: 1.6; color: #2D3748; margin: 0 0 18px; }
.nb-notice__body p { margin: 0 0 10px; }
.nb-notice__body ul { margin: 0 0 10px; padding-left: 20px; list-style: disc; }
.nb-notice__body li { margin-bottom: 6px; }
.nb-notice__body a { color: #4A7560; font-weight: 600; }
.nb-export__actions, .nb-notice__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.nb-export__btn, .nb-notice__btn {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 11px 16px; min-height: 44px; border-radius: 6px; flex: 1 1 auto;
  background: #FFFFFF; color: #4A7560; border: 1px solid #DCE3E9;
}
.nb-export__btn:hover, .nb-notice__btn:hover { border-color: #5B8A72; }
.nb-export__btn--primary, .nb-notice__btn--primary { background: #4A7560; border-color: #4A7560; color: #FFFFFF; }
.nb-export__btn--primary:hover, .nb-notice__btn--primary:hover { background: #3D6350; border-color: #3D6350; }
.nb-export__btn--quiet { flex: 0 0 auto; border-color: transparent; color: #5F6F82; }
.nb-export__btn:focus-visible, .nb-notice__btn:focus-visible { outline: 3px solid #C17B4A; outline-offset: 2px; }
/* "Open" on a phone or tablet: the file laid out as it prints, on the page, with Save / Share at the top (nb-export.js) —
   Safari on iPhone can show a blank tab for a PDF (always in Lockdown Mode) and Android's browsers have no PDF viewer */
.nb-pv { position: fixed; inset: 0; z-index: 3300; display: none; flex-direction: column; background: #EEF1F4; color: #1B2233; font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif; }
.nb-pv.is-open { display: flex; }
.nb-pv__bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); background: #FFFFFF; border-bottom: 1px solid #DCE3E9; }
.nb-pv__close { flex: none; min-width: 44px; min-height: 44px; border: 0; background: none; color: #2F5A46; font-size: 28px; line-height: 1; cursor: pointer; border-radius: 8px; }
.nb-pv__head { flex: 1 1 auto; min-width: 0; }
.nb-pv__title { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.2; color: #1B2233; }
.nb-pv__sub { margin: 1px 0 0; font-size: 12px; line-height: 1.3; color: #5B6676; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-pv__save { flex: none; min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1px solid #4A7560; background: #4A7560; color: #FFFFFF; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.nb-pv__close:focus-visible, .nb-pv__save:focus-visible { outline: 3px solid #5B8A72; outline-offset: 2px; }
.nb-pv__scroll { flex: 1 1 auto; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 14px 10px calc(24px + env(safe-area-inset-bottom)); }
.nb-pv__page { max-width: 820px; margin: 0 auto; background: #FFFFFF; border-radius: 6px; box-shadow: 0 1px 4px rgba(16,24,40,.12); padding: 22px 18px; font-size: 14px; line-height: 1.45; color: #1B2233; text-align: left; }
.nb-pv__page a { color: #2F5A46; }
html.nb-pv-open, html.nb-pv-open body { overflow: hidden !important; }
@media print { .nb-pv { display: none !important; } }

/* Welcome tour — slides, one per section; first visit and from the "What's here?" footer link */
.nb-welcome { align-items: center; padding: 16px; }
.nb-welcome__card { max-width: 440px; padding: 18px 22px 18px; position: relative; max-height: calc(100% - 8px); display: flex; flex-direction: column; }
.nb-welcome__card:focus, .nb-welcome__card:focus-visible, html.app .nb-welcome__card:focus-visible { outline: none !important; box-shadow: 0 24px 60px -20px rgba(0,0,0,.6); }
.nb-welcome__skip { position: absolute; top: 10px; right: 12px; font: inherit; font-size: 13px; font-weight: 600; color: #5F6F82; background: none; border: 0; padding: 8px 10px; min-height: 36px; border-radius: 6px; cursor: pointer; z-index: 2; }
.nb-welcome__skip:hover { color: #1A1F36; background: #F3F6F4; }
.nb-welcome__skip:focus-visible { outline: 3px solid #C17B4A; outline-offset: 1px; }
.nb-welcome__viewport { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; flex: 1 1 auto; min-height: 0; margin: 0 -22px; }
.nb-welcome__track { display: flex; transition: transform .38s cubic-bezier(.2,.7,.2,1); will-change: transform; }
.nb-welcome__slide { flex: 0 0 100%; min-width: 100%; box-sizing: border-box; padding: 26px 22px 10px; text-align: center; visibility: hidden; transition: visibility 0s .4s; }
.nb-welcome__slide.is-active { visibility: visible; transition-delay: 0s; }
.nb-welcome__slide .nb-notice__title { font-size: 24px; margin: 0 0 10px; }
.nb-welcome__slide .nb-notice__eyebrow { margin-bottom: 10px; }
.nb-welcome__here { font-style: normal; color: #9A5F36; letter-spacing: 1px; }
.nb-welcome__lede { font-size: 15px; line-height: 1.6; color: #2D3748; margin: 0 0 8px; }
.nb-welcome__fine { font-size: 12.5px; line-height: 1.5; color: #5A6578; margin: 12px 0 0; }
.nb-welcome__fine a { color: inherit; text-decoration: underline; }
/* v2.49.1: while the first-time agreement is showing, a way out to the crisis lines, under the buttons on every slide */
.nb-welcome__help { flex: 0 0 auto; margin: 8px 0 0; text-align: center; font-size: 13px; line-height: 1.4; }
.nb-welcome__help a { display: inline-block; padding: 4px 8px; color: #8A5530; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; border-radius: 6px; }
.nb-welcome__help a:focus-visible, .nb-welcome__points a:focus-visible, .nb-welcome__fine a:focus-visible { outline: 3px solid #C17B4A; outline-offset: 1px; }
.nb-welcome__points a { color: #2F5A46; text-decoration: underline; }
.nb-welcome__hero {
  width: 88px; height: 88px; border-radius: 26px; margin: 2px auto 18px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #5B8A72, #7FB198); color: #FFFFFF; box-shadow: 0 14px 30px -14px rgba(91,138,114,.9);
}
.nb-welcome__hero.is-here { background: linear-gradient(135deg, #C17B4A, #E8A375); box-shadow: 0 14px 30px -14px rgba(193,123,74,.9); }
.nb-welcome__hero svg { width: 44px; height: 44px; stroke: currentColor; fill: none; }
.nb-welcome__icons { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 18px 0 6px; }
.nb-welcome__mini { width: 40px; height: 40px; border-radius: 12px; background: #EEF5F1; color: #4A7560; display: flex; align-items: center; justify-content: center; }
.nb-welcome__mini.is-here { background: #4A7560; color: #FFFFFF; }
.nb-welcome__mini svg { width: 20px; height: 20px; stroke: currentColor; fill: none; }
@media (max-width: 380px) { .nb-welcome__icons { gap: 5px; flex-wrap: nowrap; } .nb-welcome__mini { width: 34px; height: 34px; border-radius: 10px; flex: none; } .nb-welcome__mini svg { width: 18px; height: 18px; } }
.nb-welcome__go { display: inline-block; margin-top: 6px; font-size: 14px; font-weight: 600; color: #4A7560; text-decoration: none; padding: 8px 12px; border-radius: 6px; border: 1px solid #CFE2D7; }
.nb-welcome__go:hover { background: #EEF5F1; }
.nb-welcome__go:focus-visible { outline: 3px solid #C17B4A; outline-offset: 1px; }
.nb-welcome__points { list-style: none; margin: 4px 0 0; padding: 0; text-align: left; display: grid; gap: 10px; }
.nb-welcome__points li { font-size: 14px; line-height: 1.55; color: #2D3748; padding-left: 26px; position: relative; }
.nb-welcome__points li::before { content: ''; position: absolute; left: 0; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: #5B8A72; box-shadow: inset 0 0 0 3px #EEF5F1; }
.nb-welcome__points strong { color: #1A1F36; }
/* v2.36.0: each dot is a 24x24 button (WCAG 2.5.8) drawn as an 8 px dot — the dot itself is the button's ::before */
.nb-welcome__dots { display: flex; justify-content: center; gap: 0; padding: 4px 0 6px; }
.nb-welcome [hidden] { display: none !important; }   /* v2.49.1: the dots, Back and the help line hide while agreeing */
.nb-welcome__dot { position: relative; width: 24px; height: 24px; min-height: 0; padding: 0; border: 0; background: none; cursor: pointer; transition: width .2s; }
.nb-welcome__dot::before { content: ''; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: #DCE3E9; transition: background .2s, width .2s, margin .2s; }
.nb-welcome__dot.is-on { width: 38px; }
.nb-welcome__dot.is-on::before { background: #4A7560; width: 22px; margin-left: -11px; border-radius: 4px; }
.nb-welcome__dot:focus-visible { outline: 3px solid #C17B4A; outline-offset: -2px; border-radius: 8px; }
.nb-welcome__actions { flex: 0 0 auto; }
.nb-welcome__actions .nb-welcome__back { flex: 0 0 auto; min-width: 88px; }
@media (max-width: 420px) {
  .nb-welcome { padding: 12px; }
  .nb-welcome__card { padding: 16px 18px 14px; }
  .nb-welcome__viewport { margin: 0 -18px; }
  .nb-welcome__slide { padding: 24px 18px 8px; }
  .nb-welcome__slide .nb-notice__title { font-size: 21px; }
  .nb-welcome__lede { font-size: 14px; }
  .nb-welcome__hero { width: 76px; height: 76px; border-radius: 22px; margin-bottom: 14px; }
  .nb-welcome__hero svg { width: 38px; height: 38px; }
}
@media (max-height: 560px) {
  .nb-welcome__hero { width: 56px; height: 56px; border-radius: 16px; margin-bottom: 10px; }
  .nb-welcome__hero svg { width: 28px; height: 28px; }
  .nb-welcome__slide { padding-top: 18px; }
  .nb-welcome__dots { padding: 8px 0 10px; }
}
@media (prefers-reduced-motion: reduce) { .nb-welcome__track { transition: none; } .nb-welcome__slide { transition: none; } }

/* progress dialog (Track's PDF export) — built on the notice dialog */
.nb-progress__card { max-width: 440px; }
.nb-progress__bar { position: relative; height: 8px; border-radius: 999px; background: #E8F0EC; overflow: hidden; margin: 6px 0 14px; }
.nb-progress__fill { height: 100%; width: 0; border-radius: inherit; background: #5B8A72; transition: width .35s ease; }
.nb-progress.is-indeterminate .nb-progress__fill { width: 36% !important; animation: nbProgressSlide 1.4s ease-in-out infinite; }
@keyframes nbProgressSlide { 0% { transform: translateX(-110%); } 100% { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) { .nb-progress.is-indeterminate .nb-progress__fill { animation: none; width: 100% !important; opacity: .45; } }
.nb-progress__label { font-size: 14.5px; font-weight: 600; color: #1A1F36; margin: 0 0 4px; min-height: 1.4em; }
.nb-progress__eta { font-size: 13.5px; color: #4A7560; font-weight: 600; margin: 0 0 12px; min-height: 1.3em; }
.nb-progress__eta[hidden] { display: none; }
.nb-progress__note { font-size: 13px; line-height: 1.55; color: #5F6F82; margin: 0 0 16px; }
.nb-progress__actions { justify-content: flex-end; }
.nb-progress__cancel { flex: 0 0 auto; color: #5F6F82; }
.nb-progress__cancel[hidden] { display: none; }

/* Sleep: note under the volume sliders when the device ignores <audio>.volume */
html.app .nb-vol-note { font-size: 12px; line-height: 1.45; color: rgba(242, 239, 234, .62); margin: 6px 0 0; }
html.app .nb-vol-note[hidden] { display: none; }

/* footer credit / legal line on the tool pages */
.nb-credit {
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 11.5px; line-height: 1.6; text-align: center;
  color: rgba(242, 239, 234, .62);
  padding: 18px 16px 10px; margin: 0 auto; max-width: 640px;
}
.nb-credit a { color: rgba(242, 239, 234, .85); text-decoration: underline; text-underline-offset: 2px; }
.nb-credit a:hover { color: #A6D2BC; }
.nb-credit span { white-space: nowrap; }
html.app .nb-credit, html.app .page-container > .nb-credit { padding: 18px 16px 28px !important; margin: 0 auto !important; }
html.app[data-page="track"] .nb-credit { padding-bottom: 110px !important; }       /* clears Track's fixed Back / Next bar */
@media (max-width: 999.5px) and (orientation: portrait) {
  html.app .nb-credit, html.app .page-container > .nb-credit, html.app[data-page="track"] .nb-credit { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important; }
}
/* Breathe sizes its canvas to the viewport; let the footer add height instead of overflowing */
html.app[data-page="breathe"] .page-container { height: auto !important; min-height: 100%; }
html.app[data-page="breathe"] #breathing-app-container { height: auto !important; flex: 1 1 auto; min-height: 0; }
@media print { .nb-consent, .nb-export, .nb-notice, .nb-progress { display: none !important; } }

/* ---------- 7. DIRECTORY SIDEBAR: credit + legal links ---------- */
html.nb-site .side-credit { font-size: 12.5px; line-height: 1.6; color: var(--muted); padding-top: 18px; border-top: 1px solid var(--border); }
html.nb-site .side-credit .side-nav-label { display: block; margin-bottom: 10px; }
html.nb-site .side-credit p { margin: 0 0 8px; }
html.nb-site .side-credit a { color: var(--sage-dark); font-weight: 600; text-decoration: none; }
html.nb-site .side-credit a:hover { text-decoration: underline; }
html.nb-site .side-credit-links { font-size: 12px; }
@media screen and (max-width: 999.5px) { html.nb-site .side-credit .side-nav-label { display: block; } }
@media print { .side-credit { display: none !important; } }

/* ---------- 8. QUIET TOOL FOOTER, SHARE SHEET, INSTALL NUDGE ---------- */
.nb-foot {
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  text-align: center; margin: 0 auto; max-width: 560px;
  padding: 22px 16px 28px;
}
.nb-foot__actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.nb-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 12.5px; font-weight: 500; letter-spacing: .1px;
  color: rgba(242, 239, 234, .82); background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px;
  padding: 8px 14px; min-height: 36px; cursor: pointer; text-decoration: none;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.nb-chip:hover { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .3); color: #F2EFEA; }
.nb-chip:focus-visible { outline: 3px solid #E8A375; outline-offset: 2px; }
.nb-chip svg { width: 15px; height: 15px; }
.nb-chip[hidden] { display: none; }
.nb-foot__links { margin: 0; font-size: 11px; letter-spacing: .3px; color: rgba(242, 239, 234, .38); line-height: 1.9; }
.nb-foot__links a { color: inherit; text-decoration: none; }
.nb-foot__links a:hover { color: rgba(242, 239, 234, .8); }
.nb-foot__links span { white-space: nowrap; }
html.app .page-container > .nb-foot, html.app .nb-foot { padding: 22px 16px 30px !important; margin: 0 auto !important; }
html.app[data-page="track"] .nb-foot { padding-bottom: 110px !important; }
@media (max-width: 999.5px) and (orientation: portrait) {
  html.app .nb-foot, html.app .page-container > .nb-foot, html.app[data-page="track"] .nb-foot { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* bottom sheet (share / install) */
.nb-sheet {
  position: fixed; inset: 0; z-index: 3100; display: none; align-items: flex-end; justify-content: center;
  background: rgba(10, 13, 20, .6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.nb-sheet.is-open { display: flex; }
.nb-sheet__card {
  position: relative; width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: #FFFFFF; color: #2D3748; border-radius: 18px 18px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -20px 60px -20px rgba(0,0,0,.6);
  animation: nbSheetUp .26s ease;
}
@keyframes nbSheetUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) { .nb-sheet { align-items: center; padding: 20px; } .nb-sheet__card { border-radius: 14px; } }
.nb-sheet__close { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #F5F0EB; color: #5F6F82; font-size: 22px; line-height: 1; cursor: pointer; }
.nb-sheet__close:hover { background: #E8ECF0; color: #1A1F36; }
.nb-sheet__eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 2.5px; text-transform: uppercase; color: #4A7560; margin: 0 0 6px; }
.nb-sheet__title { font-family: 'Literata', Georgia, serif; font-size: 21px; font-weight: 600; color: #1A1F36; margin: 0 0 8px; line-height: 1.2; padding-right: 36px; }
.nb-sheet__hint { font-size: 13.5px; color: #5F6F82; margin: 0 0 14px; line-height: 1.5; }
.nb-sheet__rows { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nb-sheet__row {
  display: flex; align-items: center; gap: 10px; width: 100%; box-sizing: border-box;
  font: inherit; font-size: 14px; font-weight: 600; color: #1A1F36; text-decoration: none; text-align: left;
  background: #FFFFFF; border: 1px solid #DCE3E9; border-radius: 10px; padding: 11px 12px; min-height: 46px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.nb-sheet__row:hover { border-color: #5B8A72; background: #F7FAF8; }
/* v2.49.1: the sheet is white on every page, so pages' own link colours (Sing's a:hover is a light cream for its dark
   canvas) must never reach its rows — the row under the finger that tapped Share was drawn cream on white */
.nb-sheet__row:hover, .nb-sheet__row:focus, .nb-sheet__row:active, .nb-sheet__row:visited { color: #1A1F36; }
.nb-sheet__row--primary:hover, .nb-sheet__row--primary:focus, .nb-sheet__row--primary:active, .nb-sheet__row--primary:visited { color: #FFFFFF; }
.nb-sheet__hint a, .nb-sheet__hint a:hover, .nb-sheet__hint a:visited { color: #2F5A46; }
.nb-sheet__row:focus-visible { outline: 3px solid #C17B4A; outline-offset: 2px; }
.nb-sheet__row svg { width: 20px; height: 20px; flex: 0 0 auto; color: #4A7560; }
.nb-sheet__row--primary { grid-column: 1 / -1; background: #4A7560; border-color: #4A7560; color: #FFFFFF; justify-content: center; }
.nb-sheet__row--primary svg { color: #FFFFFF; }
.nb-sheet__row--primary:hover { background: #3D6350; border-color: #3D6350; }
.nb-sheet__row--soft { width: 100%; background: #F5F0EB; border-color: #F5F0EB; }
.nb-sheet__divider { height: 1px; background: #E8ECF0; margin: 16px 0 12px; }
/* sharing one thing (a recipe, a video): a small preview of what the link opens on; above any open recipe or video sheet */
.nb-sheet { z-index: 3200; }
.nb-sheet__item { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 10px; border: 1px solid #E8ECF0; border-radius: 12px; background: #FAFBFC; }
.nb-sheet__item img { flex: 0 0 auto; width: 96px; height: 54px; object-fit: cover; border-radius: 8px; background: #E8ECF0; }
.nb-sheet__item span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.nb-sheet__item strong { font-size: 14px; line-height: 1.3; color: #1A1F36; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.nb-sheet__item small { font-size: 12px; color: #5F6F82; line-height: 1.35; }
.nb-sheet__steps { margin: 0 0 12px; padding-left: 20px; font-size: 14px; line-height: 1.55; color: #2D3748; }
.nb-sheet__steps li { margin-bottom: 8px; }
.nb-sheet__steps strong { color: #1A1F36; }
@media (max-width: 420px) { .nb-sheet__rows { grid-template-columns: 1fr; } }

/* directory sidebar: share button sits with print + theme */
html.nb-site .side-share {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; min-height: 44px; color: var(--sage-dark); background: var(--surface);
  border: 1px solid var(--border-2); border-radius: 3px; cursor: pointer; transition: all .16s;
}
html.nb-site .side-share:hover { background: var(--sage); border-color: var(--sage); color: var(--on-accent); }
html.nb-site .side-share svg { width: 17px; height: 17px; }
@media print { .nb-foot, .nb-sheet, .side-share { display: none !important; } }

/* ---------- tool info dialogs: never taller than the screen — scroll inside the card instead of clipping
   the top and bottom (the Calm safety notice opens by itself on first use and must reach its button) ---------- */
html.app .modal-overlay > .modal-content {
  max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem);
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
/* the first-use safety notice sits above the cookie bar (z 2000), like the welcome tour, so its button is never covered */
html.app #info-modal.is-first-use { z-index: 3200; }

/* ---- Track: Journal | Abstain switch (same markup on both pages, from build/nav.py) ---- */
.nb-switch { display: flex; justify-content: center; width: 100%; margin: 0 auto 12px; padding-top: 2px; }
.nb-switch__inner { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 6px 24px rgba(0, 0, 0, .18); }
.nb-switch a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; min-height: 40px; border-radius: 999px; font: 600 14px/1 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: rgba(242, 239, 234, .8); text-decoration: none; transition: background .15s, color .15s; }
.nb-switch a:hover { color: #F2EFEA; background: rgba(255, 255, 255, .08); }
.nb-switch a[aria-current="page"] { background: #84C0A0; color: #13171D; }
.nb-switch a:focus-visible { outline: 3px solid #E8A375; outline-offset: 2px; }
.nb-switch svg { width: 17px; height: 17px; flex: 0 0 auto; }
@media (max-width: 379.5px) { .nb-switch a { padding: 8px 10px; font-size: 13px; } .nb-switch svg { width: 15px; height: 15px; } }
/* v2.36.0: four Track items (Journal | Abstain | Train | Plan), and since v2.44.1 four Recover items (Breathe | Calm | Sleep | Sing)
   — the icons go on the narrowest phones so all four fit at 320 px */
@media (max-width: 379.5px) { .nb-switch--4 svg { display: none; } .nb-switch--4 a { padding: 8px 9px; } }
@media print { .nb-switch { display: none !important; } }
/* The section switches (Breathe | Calm | Sleep | Sing, Journal | Abstain | Train | Plan, Walk | Videos) sit at exactly the same
   spot on every page, so changing tab never makes them jump. Each page's own padding and vertical centring used to
   decide where the switch landed; now it is pinned to the top of the page and the page keeps the room for it. */
html.app:is([data-page="breathe"], [data-page="calm"], [data-page="sleep"], [data-page="track"], [data-page="abstain"], [data-page="train"], [data-page="move"], [data-page="videos"], [data-page="sing"]) {
  --nb-sw-top: 14px; --nb-sw-h: 48px; --nb-sw-gap: 14px;
}
@media screen and (min-width: 1000px) {
  html.app:is([data-page="breathe"], [data-page="calm"], [data-page="sleep"], [data-page="track"], [data-page="abstain"], [data-page="train"], [data-page="move"], [data-page="videos"], [data-page="sing"]) { --nb-sw-top: 28px; --nb-sw-gap: 18px; }
}
/* v2.32.1: only the pages that show the switch keep room for it — a video's own page and the video collections
   (data-video / data-collection) have none, so they start right under the top edge like a recipe's page */
html.app:is([data-page="breathe"], [data-page="calm"], [data-page="sleep"], [data-page="track"], [data-page="abstain"], [data-page="train"], [data-page="move"], [data-page="videos"], [data-page="sing"]):not([data-video]):not([data-collection]) .page-container {
  position: relative !important; margin-top: 0 !important;
  padding-top: calc(var(--nb-sw-top) + var(--nb-sw-h) + var(--nb-sw-gap)) !important;
}
html.app .page-container > .nb-switch {
  position: absolute !important; top: 0 !important; left: 0 !important; right: 0 !important; width: auto !important;
  margin: 0 !important; padding: var(--nb-sw-top, 14px) 0 0 !important; padding-left: inherit !important; padding-right: inherit !important;
  box-sizing: border-box !important; z-index: 6; pointer-events: none;
}
html.app .page-container > .nb-switch .nb-switch__inner { pointer-events: auto; height: var(--nb-sw-h, 48px); box-sizing: border-box; }
/* the page keeps that room as padding, and sticky bars measure from inside it: Videos' results bar would stop 76px
   down the screen with cards showing above it. It sticks to the top of the screen like Eat's. */
@media (max-width: 999px) {
  html.app[data-page="videos"] .vd-bar { top: calc(env(safe-area-inset-top, 0px) + 6px - var(--nb-sw-top) - var(--nb-sw-h) - var(--nb-sw-gap)); }
}

/* iPhone and iPad zoom the whole page into any text field set smaller than 16px the moment it is tapped (Discover's
   search box, Journal's tag fields, the Abstain / Train forms, the Eat and Videos drop-downs). On touch screens and
   phones those fields are 16px; the larger ones (dates, timers, the Abstain wizard) keep their size. */
@media (pointer: coarse), (max-width: 760px) {
  html #searchInput, html .et-sel select, html.app[data-page="track"] .input:not([type="date"]),
  html .ab-field input[type="text"], html .ab-field input[type="number"], html .ab-field input[type="datetime-local"], html .ab-field input[type="date"],
  html .ab-field textarea, html .ab-field select { font-size: 16px; }
}
@media (max-width: 760px) { html #searchInput:placeholder-shown { padding-right: 8px; } }   /* the clear button only shows once something is typed */

/* moving between sections: a short cross-fade with the menu and the section switch held still, instead of a blank
   flash (browsers with cross-document view transitions; everywhere else pages change exactly as before) */
@view-transition { navigation: auto; }
::view-transition-group(root) { animation-duration: .18s; }
html.app #app-footer-menu { view-transition-name: nb-nav; }
html.app .page-container > .nb-switch { view-transition-name: nb-switch; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
/* a hidden toast (opacity 0) must not catch taps meant for what is under it (the section switch sits there) */
html.app .toast:not(.show) { pointer-events: none; }
/* toasts (Journal, Breathe): one compact line sized to the message — 'left: 50%' alone let the box shrink to half
   the screen, so on a phone a short message wrapped into a tall narrow box */
html.app .toast { width: max-content; max-width: calc(100vw - 32px); box-sizing: border-box; line-height: 1.35; }
html.app .toast #toastMessage, html.app .toast span { display: inline; }

/* v2.51.0: the one-time terms notice at the top of recipe, video, song and listing pages (dev/agree_note.py). In the
   page, not over it: it never covers anything, and the script in <head> hides it before it is drawn for anyone who
   has agreed (html.nb-agreed), so nothing moves for them. Never printed. */
.nb-agree {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  margin: 12px 0 4px; padding: 10px 12px 10px 16px; border-radius: 12px;
  background: rgba(132,192,160,.10); border: 1px solid rgba(132,192,160,.45); color: inherit;
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; line-height: 1.45;
}
.nb-agree__text { flex: 1 1 260px; margin: 0; }
.nb-agree__text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.nb-agree__ok {
  flex: 0 0 auto; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  padding: 8px 16px; min-height: 40px; border-radius: 8px;
  background: #84C0A0; color: #13171D; border: 1px solid #84C0A0;
}
.nb-agree__ok:hover { background: #A6D2BC; border-color: #A6D2BC; }
.nb-agree__ok:focus-visible { outline: 3px solid #E8A375; outline-offset: 2px; }
html.nb-agreed .nb-agree { display: none; }
@media print { .nb-agree { display: none !important; } }
main[tabindex="-1"]:focus { outline: none; }
