/* Unblended - mobile first, warm and calm.
   Palette intent: clay + sage on warm paper. Friendly, not chirpy. */

:root {
  --bg:        #faf6f1;
  --surface:   #ffffff;
  --surface-2: #f3ece4;
  --ink:       #2b2622;
  --ink-soft:  #6d635b;
  --ink-faint: #9b9089;
  --line:      #e6dcd1;
  --accent:    #b5673a;
  --accent-in: #ffffff;
  --accent-bg: #f8e7db;
  --sage:      #5f8469;
  --sage-bg:   #e2ecdf;
  --danger:    #a4483f;
  --shadow:    0 1px 2px rgba(58,42,30,.06), 0 6px 20px rgba(58,42,30,.05);
  --r:  14px;
  --r-lg: 20px;
  --tap: 46px;
}

:root[data-theme="dark"] {
  --bg:        #191614;
  --surface:   #221e1b;
  --surface-2: #2b2622;
  --ink:       #ece4dc;
  --ink-soft:  #a89c92;
  --ink-faint: #7d7168;
  --line:      #362e29;
  --accent:    #d98f5f;
  --accent-in: #1d1512;
  --accent-bg: #33241b;
  --sage:      #8bae94;
  --sage-bg:   #232d24;
  --danger:    #d3776c;
  --shadow:    0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.24);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#191614; --surface:#221e1b; --surface-2:#2b2622;
    --ink:#ece4dc; --ink-soft:#a89c92; --ink-faint:#7d7168; --line:#362e29;
    --accent:#d98f5f; --accent-in:#1d1512; --accent-bg:#33241b;
    --sage:#8bae94; --sage-bg:#232d24; --danger:#d3776c;
    --shadow:0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.24);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.55 ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { padding: env(safe-area-inset-top) 0 0; }

.app {
  max-width: 30rem;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: .25rem;
  padding: .5rem .6rem;
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }

.wordmark {
  flex: 1;
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -.01em;
  text-align: center;
}

.icon-btn {
  width: var(--tap); height: var(--tap);
  display: grid; place-items: center;
  border: 0; background: none; color: var(--ink-soft);
  border-radius: 50%; cursor: pointer;
  flex: 0 0 var(--tap);
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn[hidden] { visibility: hidden; display: grid; }

.ico {
  width: 1.3em; height: 1.3em;
  fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  flex: none;
}

/* ---------- layout ---------- */
main { flex: 1; }
.view { display: none; }
.view.is-active { display: block; animation: rise .26s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.pad { padding: 1rem 1.15rem 6.5rem; }
/* The 6.5rem tail clears the fixed tab bar. On views that hide it, that is
   104px of dead space shoving the call to action below the fold. */
#view-intro .pad, #view-breath .pad, #view-checkin .pad, #view-session .pad { padding-bottom: 1.75rem; }
.center { text-align: center; }

/* ---------- type ---------- */
.lede { font-size: 1.3rem; line-height: 1.35; font-weight: 600; letter-spacing: -.015em; margin: .6rem 0 .4rem; }
.muted { color: var(--ink-soft); }
.sm { font-size: .875rem; line-height: 1.5; }
.step-kicker { color: var(--accent); font-size: .78rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; margin: .4rem 0 .3rem; }
.step-title { font-size: 1.45rem; line-height: 1.25; letter-spacing: -.02em; margin: 0 0 .5rem; font-weight: 650; }
.step-body { color: var(--ink-soft); margin: 0 0 1.1rem; }
h3 { font-size: 1.0625rem; margin: 1.6rem 0 .4rem; letter-spacing: -.01em; }
p { margin: 0 0 .8rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: var(--tap);
  padding: 0 1.05rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit; font-weight: 550; font-size: .95rem;
  cursor: pointer;
  transition: transform .12s ease, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.975); }
/* .btn sets display, which outranks the UA [hidden] rule. Restore it. */
.btn[hidden] { display: none; }
.btn.primary { background: var(--accent); color: var(--accent-in); border-color: transparent; }
.btn.ghost { background: none; border-color: transparent; color: var(--ink-soft); }
.btn.danger { color: var(--danger); }
.btn.big { min-height: 3.4rem; font-size: 1.05rem; width: 100%; }
.btn.wide { width: 100%; }
.btn.sm { min-height: 2.4rem; font-size: .85rem; padding: 0 .85rem; }

.row { display: flex; gap: .5rem; flex-wrap: wrap; }
.nav-row { display: flex; gap: .6rem; margin-top: 1.2rem; }
.nav-row .btn { flex: 1; }
.nav-row .btn.ghost { flex: 0 1 auto; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: .95rem 1rem;
  margin: .75rem 0;
  box-shadow: var(--shadow);
}
.card.soft { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.card.tap { cursor: pointer; }
.card.tap:active { transform: scale(.99); }
.card h4 { margin: 0 0 .2rem; font-size: 1rem; letter-spacing: -.01em; }
.card .meta { color: var(--ink-faint); font-size: .8rem; }
.card p:last-child { margin-bottom: 0; }

.pill {
  display: inline-block;
  background: var(--sage-bg); color: var(--sage);
  border-radius: 999px; padding: .12rem .55rem;
  font-size: .74rem; font-weight: 600; letter-spacing: .01em;
}
.pill.clay { background: var(--accent-bg); color: var(--accent); }

.empty {
  text-align: center; color: var(--ink-faint);
  padding: 2.5rem 1rem; font-size: .92rem;
}

/* ---------- fields ---------- */
.field { display: block; margin: 1rem 0 0; }
/* .field sets display, which outranks the UA [hidden] rule. Restore it. */
.field[hidden] { display: none; }
.label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .35rem; }
input[type="text"], textarea {
  width: 100%;
  font: inherit; font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: .7rem .8rem;
  resize: vertical;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
::placeholder { color: var(--ink-faint); }

/* ---------- progress ---------- */
.progress { display: flex; gap: .3rem; padding: .2rem 1.15rem .5rem; }
.progress i {
  flex: 1; height: 3px; border-radius: 2px;
  background: var(--line); transition: background .3s;
}
.progress i.done { background: var(--accent); }

/* ---------- breath ---------- */
.breath-wrap { display: grid; place-items: center; padding: 1.6rem 0 1.1rem; }
.breath {
  position: relative;
  width: 12.5rem; height: 12.5rem; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 42%, var(--accent-bg), var(--sage-bg));
  color: var(--ink-soft); font-size: 1.15rem; font-weight: 600;
  /* Wider travel than v1 (.5 to 1 rather than .72 to 1) so the rhythm is
     unmistakable, with a slow symmetric ease so it still reads as calm. */
  transform: scale(.5);
  opacity: .7;
  transition: transform 4s cubic-bezier(.37,0,.35,1), opacity 4s ease;
}
.breath.inhale { transform: scale(1); opacity: 1; }

/* A faint ring that opens with the inhale. Adds presence without adding noise. */
.breath::after {
  content: ""; position: absolute; inset: -9%;
  border-radius: 50%; border: 1px solid var(--accent);
  opacity: 0; transform: scale(.8);
  transition: inherit;
}
.breath.inhale::after { opacity: .3; transform: scale(1); }

.breath span { display: block; }
.breath.counting { transform: scale(.78); opacity: 1; }
.breath.counting::after { opacity: .18; transform: scale(.95); }
.breath.counting span { font-size: 3.1rem; font-weight: 700; color: var(--accent); }
@keyframes popin { from { transform: scale(1.45); opacity: .15; } to { transform: scale(1); opacity: 1; } }
.breath span.pop { animation: popin .42s cubic-bezier(.2,.7,.3,1) both; }

.counter { color: var(--ink-faint); font-size: .85rem; }

@media (prefers-reduced-motion: reduce) {
  .view.is-active { animation: none; }
  .breath { transition-duration: .01s; }
  .breath span.pop { animation: none; }
  .btn:active { transform: none; }
}

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  max-width: 30rem; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  border: 0; background: none; cursor: pointer;
  color: var(--ink-faint);
  display: grid; justify-items: center; gap: .12rem;
  padding: .5rem 0 .45rem;
  font: inherit; font-size: .69rem; font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
.tab .ico { width: 1.45rem; height: 1.45rem; stroke-width: 1.6; }
.tab.is-active { color: var(--accent); }
.tabbar[hidden] { display: none; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 5.5rem;
  transform: translate(-50%, 1rem);
  background: var(--ink); color: var(--bg);
  padding: .6rem 1rem; border-radius: 999px;
  font-size: .875rem; font-weight: 550;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 40; max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- learn ---------- */
.note {
  border-left: 3px solid var(--sage);
  background: var(--sage-bg);
  border-radius: 0 var(--r) var(--r) 0;
  padding: .8rem .9rem; margin: 1rem 0;
  font-size: .9rem; line-height: 1.55;
}
.note.warn { border-left-color: var(--accent); background: var(--accent-bg); }
.note p:last-child { margin-bottom: 0; }

.qa { border-bottom: 1px solid var(--line); }
.qa summary {
  cursor: pointer; list-style: none;
  padding: .95rem .2rem; font-weight: 600; font-size: 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after {
  content: ""; width: .5rem; height: .5rem; flex: none;
  border-right: 2px solid var(--ink-faint); border-bottom: 2px solid var(--ink-faint);
  transform: rotate(45deg) translate(-2px,-2px); transition: transform .2s;
}
.qa[open] summary::after { transform: rotate(-135deg) translate(-2px,-2px); }
.qa .qa-body { padding: 0 .2rem 1rem; color: var(--ink-soft); font-size: .94rem; }
.qa .qa-body strong { color: var(--ink); }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  min-height: 2.5rem; padding: 0 .8rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: .85rem; font-weight: 550;
  cursor: pointer; transition: transform .12s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.chip:active { transform: scale(.97); }
.chip.on { background: var(--sage); color: var(--accent-in); border-color: transparent; }
.chip.on.warn { background: var(--accent); }

/* ---------- severity scale ---------- */
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; margin: .2rem 0 .1rem; }
.lvl {
  min-height: 3rem;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: var(--ink-soft);
  font: inherit; font-size: 1.05rem; font-weight: 650;
  cursor: pointer; transition: transform .12s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.lvl:active { transform: scale(.96); }
.lvl.on { background: var(--accent); color: var(--accent-in); border-color: transparent; }
.scale-word {
  text-align: center; font-size: .9rem; font-weight: 600;
  color: var(--accent); min-height: 1.4em; margin: .1rem 0 .4rem;
}

/* ---------- maintenance rows ---------- */
.mrow { margin: .7rem 0; }
.mlabel {
  display: block; font-size: .8rem; font-weight: 650;
  color: var(--ink-faint); letter-spacing: .05em; text-transform: uppercase;
  margin-bottom: .3rem;
}

/* ---------- facts list ---------- */
.facts { list-style: none; margin: 1.1rem 0; padding: 0; font-size: .92rem; }
.facts li {
  position: relative; padding: .3rem 0 .3rem 1.5rem; color: var(--ink-soft);
}
.facts li::before {
  content: ""; position: absolute; left: .25rem; top: .82rem;
  width: .42rem; height: .42rem; border-radius: 50%; background: var(--sage);
}
.facts strong { color: var(--ink); }

a { color: var(--accent); text-underline-offset: 2px; }

/* ---------- job legend ---------- */
.legend { margin: .5rem 0 0; font-size: .86rem; line-height: 1.45; }
.legend dt { font-weight: 650; color: var(--ink); margin-top: .55rem; }
.legend dt:first-child { margin-top: 0; }
.legend dd { margin: .05rem 0 0; color: var(--ink-soft); }

/* ---------- calendar ---------- */
.cal {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: .7rem .6rem .5rem;
  margin: .25rem 0 .9rem; box-shadow: var(--shadow);
}
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 0 .2rem .4rem; }
.cal-title { font-size: .95rem; font-weight: 650; letter-spacing: -.01em; }
.cal-nav { width: 2.2rem; height: 2.2rem; border: 0; background: none; color: var(--ink-soft);
  border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.cal-nav:disabled { opacity: .28; cursor: default; }
.cal-nav:not(:disabled):active { background: var(--surface-2); }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.cal-wd { text-align: center; font-size: .66rem; font-weight: 650; color: var(--ink-faint);
  letter-spacing: .04em; padding-bottom: .2rem; }

.cal-day {
  border: 0; background: none; font: inherit; color: var(--ink-soft);
  min-height: 2.6rem; padding: .2rem 0 .25rem; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: .16rem;
  font-size: .8rem; cursor: default; -webkit-tap-highlight-color: transparent;
}
.cal-day.has { cursor: pointer; color: var(--ink); font-weight: 600; }
.cal-day.has:active { background: var(--surface-2); }
.cal-day.today .num {
  outline: 1.5px solid var(--accent); outline-offset: 2px; border-radius: 50%;
}
.cal-day.sel { background: var(--accent-bg); }
.cal-day .num { line-height: 1.15rem; min-width: 1.15rem; text-align: center; }
.cal-day.empty { visibility: hidden; }

.dots { display: flex; gap: 2px; height: 5px; align-items: center; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.dot.down { background: var(--sage); }
.more { font-size: .6rem; color: var(--ink-faint); line-height: 1; }

.cal-key { display: flex; gap: .9rem; justify-content: center; padding-top: .45rem;
  font-size: .68rem; color: var(--ink-faint); }
.cal-key span { display: inline-flex; align-items: center; gap: .3rem; }

.filterbar {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  background: var(--accent-bg); color: var(--accent);
  border-radius: 999px; padding: .4rem .5rem .4rem .9rem; margin: 0 0 .7rem;
  font-size: .85rem; font-weight: 600;
}

/* ---------- disclaimer ---------- */
.disclaimer {
  margin-top: 2rem; text-align: center;
  font-size: .8rem; line-height: 1.5; color: var(--ink-faint);
}
.linky {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: inherit; color: var(--accent);
  text-decoration: underline; text-underline-offset: 2px;
}

.card.slim { padding: .7rem .85rem; margin: .5rem 0; }
.entry-answer { white-space: pre-wrap; }
.foot { color: var(--ink-faint); font-size: .78rem; text-align: center; margin-top: 2rem; }
