/* Habit Forever — one stylesheet, no fonts, no frameworks. Bump CSS_VERSION in _ops/build.py on change. */
:root {
  --paper: #f8f4ee; --card: #ffffff; --ink: #1c1917; --muted: #5d5650; --line: #e7e0d7;
  --accent: #e8455a; --accent-ink: #b42a40; --empty: #ebe4da;
  --c1: #e8455a; --c2: #4caf78; --c3: #5e81f4; --c4: #f2994a; --c5: #a770e6; --c6: #2fb5c9;
  --radius: 18px; --shadow: 0 1px 2px rgba(28,25,23,.05), 0 8px 24px rgba(28,25,23,.06);
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #171412; --card: #221e1b; --ink: #f4efe9; --muted: #b3aaa1; --line: #36302b;
    --accent-ink: #ff7d8e; --empty: #2e2925; --shadow: none; }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.65 var(--text); -webkit-tap-highlight-color: rgba(232,69,90,.12); }
img { max-width: 100%; height: auto; }
a { color: var(--accent-ink); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, .brand, .cta-title, .stat strong { font-family: var(--font); letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); margin: .2em 0 .35em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); margin: 2em 0 .6em; }
h3 { font-size: 1.18rem; margin: 1.6em 0 .4em; }
.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 16px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 10; }

/* header */
.site-header { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.brand img { border-radius: 8px; }
.main-nav { display: flex; gap: 18px; margin-left: auto; }
.main-nav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: .95rem; }
.main-nav a:hover { color: var(--accent-ink); }
.badge-link { display: inline-block; line-height: 0; flex: none; }
.badge-link img { height: 40px; width: auto; }
.header-badge img { height: 40px; }
@media (max-width: 720px) {
  /* phones: the header scrolls away; the bottom download bar (.app-bar) takes over as the persistent CTA */
  .site-header { position: static; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--paper); }
  .header-row { flex-wrap: wrap; gap: 0 14px; padding-top: 8px; min-height: 0; }
  .brand { min-height: 48px; }
  .header-row { flex-wrap: nowrap; padding-block: 4px; }
  .header-badge, .main-nav { display: none; }
  .site-header .nav-menu { display: block; margin-left: auto; position: relative; }
}
.nav-menu { display: none; background: none; border: 0; border-radius: 0; padding: 0; margin: 0; }
.nav-menu summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; font: 600 .95rem var(--font); color: var(--ink); background: var(--card); cursor: pointer; }
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu summary::before { content: ""; width: 16px; height: 12px; background: linear-gradient(currentColor 0 0) top/100% 2px no-repeat,
  linear-gradient(currentColor 0 0) center/100% 2px no-repeat, linear-gradient(currentColor 0 0) bottom/100% 2px no-repeat; }
.nav-menu[open] summary { background: var(--paper); }
.nav-menu nav { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 220px; display: grid; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 32px rgba(28,25,23,.16); }
.nav-menu nav a { padding: 12px 14px; min-height: 44px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 600; }
.nav-menu nav a:hover, .nav-menu nav a:focus-visible { background: var(--paper); }

/* mobile download bar: appears once the header's badge has scrolled away, hides while another CTA is on screen */
.app-bar { display: none; }
@media (max-width: 720px) {
  body.has-app-bar { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .app-bar { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px; position: fixed; z-index: 20;
    left: 0; right: 0; bottom: 0; padding: 10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: var(--card); background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(28,25,23,.08);
    transform: translateY(110%); transition: transform .28s cubic-bezier(.2,.8,.2,1); }
  .app-bar[hidden] { display: none; }
  .app-bar.show { transform: none; }
  .app-bar-icon { border-radius: 10px; }
  .app-bar-text { margin: 0; line-height: 1.25; min-width: 0; }
  .app-bar-text strong { display: block; font: 700 .98rem var(--font); }
  .app-bar-text > span { display: block; font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-bar-text .stars { display: inline; font-size: .78rem; letter-spacing: 0; }
  .app-bar .badge-link img { height: 40px; width: auto; }
}
@media (max-width: 389px) { .app-bar-free { display: none; } }
@media (max-width: 319px) { .app-bar-text > span { display: none; } }
@media (prefers-reduced-motion: reduce) { .app-bar { transition: none; } }
@media print { .app-bar { display: none !important; } }

/* desktop: scan to install on the phone */
.hero-qr { display: none; }
@media (min-width: 861px) and (hover: hover) {
  .hero-qr { display: flex; align-items: center; gap: 14px; margin-top: 22px; padding: 10px 14px 10px 10px; width: fit-content;
    background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
  .hero-qr img { border-radius: 8px; background: #fff; }
  .hero-qr p { margin: 0; font-size: .9rem; color: var(--muted); max-width: 17em; line-height: 1.45; }
  .hero-qr strong { color: var(--ink); }
}

/* home */
.hero { padding: clamp(32px, 6vw, 72px) 0 32px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; grid-template-areas: "copy media"; gap: 40px; align-items: center; }
.hero-copy { grid-area: copy; }
.hero-media { grid-area: media; position: relative; display: flex; justify-content: center; }
.hero .hero-film { width: min(340px, 100%); }
.hero .eyebrow { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; color: var(--muted); font-size: .95rem; margin: 0; }
.hero h1 { font-size: clamp(2.3rem, 6vw, 3.8rem); }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lead { font-size: 1.2rem; color: var(--muted); max-width: 34em; }
.hero-cta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 24px 0 8px; }
.hero-cta .app-icon { border-radius: 16px; box-shadow: var(--shadow); }
.hero-cta .badge-link img { height: 54px; }
.store-note { font-size: .9rem; color: var(--muted); margin: 6px 0 0; }
.rating { margin: 6px 0 0; color: var(--muted); font-size: .95rem; }
.stars { color: #f2a33a; letter-spacing: 1px; }
.stars[style*="--fill"] { background: linear-gradient(90deg, #f2a33a var(--fill), #e8dccb var(--fill));
  background: linear-gradient(90deg, #f2a33a var(--fill), color-mix(in srgb, #f2a33a 28%, var(--empty)) var(--fill));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (forced-colors: active) { .stars[style*="--fill"] { color: CanvasText; background: none; } }
.grid-art { position: absolute; left: -10px; bottom: 40px; background: var(--card); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); border: 1px solid var(--line); }
.grid-art p { margin: 0 0 8px; font: 600 .82rem var(--font); color: var(--muted); }
.squares { display: grid; grid-template-columns: repeat(12, 13px); gap: 4px; }
.squares i { width: 13px; height: 13px; border-radius: 3.5px; background: var(--empty); }
.squares i.on { background: var(--c, var(--c2)); animation: pop .5s both; animation-delay: calc(var(--d, 0) * 28ms); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .squares i.on { animation: none; } }
@media (max-width: 860px) {
  .hero { padding-top: 0; }
  .hero-grid { grid-template-columns: 1fr; grid-template-areas: "media" "copy"; gap: 22px; width: 100%; }
  .hero-copy { padding-inline: 16px; }
  .hero .hero-film { width: 100%; max-width: none; border-radius: 0; box-shadow: none; aspect-ratio: auto; background: #0b0a09; }
  .hero .hero-film video { width: min(100%, 520px); margin-inline: auto; height: auto; max-height: min(64svh, 600px); object-fit: cover; object-position: center top; }
  .grid-art { display: none; }
  .hero .eyebrow { font-size: .85rem; letter-spacing: .02em; text-transform: uppercase; color: var(--accent-ink); }
  .hero h1 { font-size: clamp(2.1rem, 9vw, 2.6rem); margin-top: .15em; }
  .hero .lead { font-size: 1.05rem; }
}

/* film: the app's own onboarding film (real screens), shown in the hero */
.film-frame { position: relative; border-radius: 28px; overflow: hidden; background: #000; box-shadow: 0 30px 60px rgba(0,0,0,.35);
  aspect-ratio: 640 / 866; width: 100%; }
.film-frame video { display: block; width: 100%; height: 100%; object-fit: cover; }
.film-toggle { position: absolute; right: 12px; bottom: 12px; width: 44px; height: 44px; padding: 0; border-radius: 50%;
  color: #fff; background: rgba(20,18,16,.55); border: 1px solid rgba(255,255,255,.25); cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: grid; place-items: center; }
.film-toggle::before { content: ""; width: 12px; height: 14px; background: linear-gradient(90deg, #fff 0 4px, transparent 4px 8px, #fff 8px 12px); }
.film-toggle[data-state="paused"]::before { width: 0; height: 0; background: none; border-style: solid; border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent #fff; margin-left: 3px; }
.film-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.band { padding: 56px 0; }
.band.alt { background: var(--card); border-block: 1px solid var(--line); }
.section-head { max-width: 40em; }
.section-head p { color: var(--muted); font-size: 1.08rem; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: s; padding: 0; list-style: none; }
.steps li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; counter-increment: s; }
.band.alt .steps li { background: var(--paper); }
.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent); color: #fff; font: 700 .95rem var(--font); margin-bottom: 10px; }
.steps h3 { margin: 0 0 6px; }
.steps p { margin: 0; color: var(--muted); }
.features { display: grid; gap: 48px; }
.feature { display: grid; grid-template-columns: 1fr 240px; gap: 40px; align-items: center; }
.feature:nth-child(even) { grid-template-columns: 240px 1fr; }
.feature:nth-child(even) .feature-img { order: -1; }
.feature-img img { width: 100%; filter: drop-shadow(0 18px 30px rgba(28,25,23,.14)); }
.feature h3 { font-size: 1.5rem; margin-top: 0; }
.feature ul { padding-left: 1.1em; color: var(--muted); }
@media (max-width: 760px) {
  .steps { grid-template-columns: 1fr; }
  .feature, .feature:nth-child(even) { grid-template-columns: 1fr; }
  .feature:nth-child(even) .feature-img { order: 0; }
  .feature-img { max-width: 220px; margin-inline: auto; }
}
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.plan { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.band.alt .plan { background: var(--paper); }
.plan.pro { border: 2px solid var(--accent); }
.plan h3 { margin-top: 0; }
.plan ul { padding-left: 1.1em; margin-bottom: 0; }
@media (max-width: 640px) { .plans { grid-template-columns: 1fr; } }
.reviews { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.review { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.review blockquote { margin: 8px 0 12px; font-size: 1.08rem; }
.review figcaption { color: var(--muted); font-size: .9rem; }
@media (max-width: 640px) { .reviews { grid-template-columns: 1fr; } }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; padding: 0; list-style: none; }
.cards li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.band.alt .cards li { background: var(--paper); }
.cards a { font: 650 1.05rem/1.35 var(--font); text-decoration: none; color: var(--ink); }
.cards a:hover { color: var(--accent-ink); }
.cards p { margin: 6px 0 0; color: var(--muted); font-size: .95rem; }
.kicker { display: block; font: 600 .78rem var(--text); text-transform: uppercase; letter-spacing: .06em; color: var(--accent-ink); margin-bottom: 4px; }

/* articles and pages */
.article, .page { padding: 24px 0 64px; }
.article article, .page { max-width: 760px; }
.crumbs { font-size: .88rem; color: var(--muted); margin: 8px 0 0; }
.crumbs a { color: var(--muted); }
.lead { font-size: 1.2rem; color: var(--muted); }
.byline { font-size: .92rem; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.toc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 20px; margin: 20px 0; }
.toc-title { margin: 0 0 4px; font: 600 .9rem var(--font); color: var(--muted); }
.toc ol { margin: 0; padding-left: 1.2em; }
.toc li { margin: 2px 0; }
article table, .page table { width: 100%; border-collapse: collapse; font-size: .95rem; margin: 16px 0; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 720px) { article table th:first-child, article table td:first-child { position: sticky; left: 0; background: var(--paper); z-index: 1; box-shadow: 1px 0 0 var(--line); } article table thead th:first-child { background: var(--card); } }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--font); background: var(--card); }
details { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin: 10px 0; }
summary { cursor: pointer; font-weight: 600; font-family: var(--font); padding: 4px 0; min-height: 32px; }
@media (pointer: coarse) { details { padding: 14px 16px; } .footer-links a { padding: 10px 0; } .crumbs a { padding: 8px 0; } }
details p { margin: 10px 0 2px; }
blockquote { margin: 16px 0; padding-left: 16px; border-left: 3px solid var(--accent); }
.note { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 12px 16px; }
.cta { display: grid; grid-template-columns: 64px 1fr auto; gap: 16px; align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 28px 0; box-shadow: var(--shadow); }
.cta-icon { border-radius: 14px; }
.cta-title { margin: 0; font-weight: 700; font-size: 1.1rem; }
.cta-text { margin: 2px 0 0; color: var(--muted); font-size: .95rem; }
.cta .rating { font-size: .88rem; }
@media (max-width: 600px) { .cta { grid-template-columns: 56px 1fr; } .cta .badge-link { grid-column: 1 / -1; } }
.facts { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 20px 8px; margin-top: 28px; }
.facts h2 { font-size: 1.1rem; margin: 16px 0 4px; }
.facts p { color: var(--muted); font-size: .95rem; }
.correction { font-size: .92rem; color: var(--muted); }

/* tools */
.tool-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 20px 0; box-shadow: var(--shadow); }
.tool-box label { display: block; font-weight: 600; margin: 0 0 6px; font-family: var(--font); }
.tool-box input, .tool-box select, .tool-box textarea { font: inherit; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); width: 100%; max-width: 360px; }
.tool-box textarea { max-width: 100%; min-height: 110px; }
.field { margin-bottom: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 14px 24px; }
.btn { font: 600 1rem var(--font); background: var(--accent); color: #fff; border: 0; border-radius: 12px; padding: 11px 18px; cursor: pointer; }
.btn.secondary { background: transparent; color: var(--accent-ink); border: 1.5px solid currentColor; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.stat { background: var(--paper); border-radius: 14px; padding: 14px; }
.stat strong { display: block; font-size: 1.35rem; }
.stat span { color: var(--muted); font-size: .9rem; }
.timeline { position: relative; height: 14px; border-radius: 7px; background: var(--empty); margin: 22px 0 6px; }
.timeline .band-range { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 7px; }
.timeline .mark { position: absolute; top: -6px; width: 4px; height: 26px; background: var(--accent); border-radius: 2px; }
.timeline .today { background: var(--ink); }
.legend { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); }
.print-sheet { background: #fff; color: #111; border-radius: 12px; padding: 18px; overflow-x: auto; }
.print-sheet h2 { margin: 0 0 10px; font-size: 1.3rem; color: #111; }
.print-sheet table { display: table; font-size: 12px; border-collapse: collapse; }
.print-sheet th, .print-sheet td { border: 1px solid #cfc8bf; padding: 0; height: 24px; min-width: 22px; text-align: center; background: #fff; color: #111; }
.print-sheet th.habit, .print-sheet td.habit { text-align: left; padding: 0 8px; min-width: 130px; font-weight: 600; }
.print-sheet .weekend { background: #f6f2ec; }
.print-sheet .foot { margin: 8px 0 0; font-size: 11px; color: #777; }
@media print {
  body { background: #fff; }
  .site-header, .site-footer, .crumbs, .no-print, .cta, .facts, h1, .lead, .page > :not(.print-area) { display: none !important; }
  .print-area { display: block !important; }
  .print-sheet { padding: 0; }
  @page { size: landscape; margin: 10mm; }
}

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 36px 0 48px; margin-top: 40px; }
.footer-cta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.footer-cta img:first-child { border-radius: 12px; }
.footer-cta p { margin: 0; flex: 1 1 220px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 22px 0 12px; }
.footer-links a { color: var(--muted); }
.fine { font-size: .8rem; color: var(--muted); }

/* tools added 2026-11 */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.small-note { color: var(--muted); font-size: .9rem; margin: 10px 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 0; }
.btn:focus-visible, .swatch:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.tool-box input[type="range"] { padding: 0; border: 0; background: none; accent-color: var(--accent); }
.tool-box input[type="color"] { width: 44px; height: 40px; padding: 3px; flex: none; cursor: pointer; }
.tool-box output { font-variant-numeric: tabular-nums; color: var(--accent-ink); }
.tool-box .tool-more { background: var(--paper); margin: 0 0 14px; }
.tool-box .tool-more .row { margin-top: 12px; }
.fill-set { border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px 14px; margin: 0 0 14px; min-width: 0; }
.fill-set legend { font: 600 1rem var(--font); padding: 0 6px; }
.swatch-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.hg-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 8px 0 4px; padding-bottom: 6px; }
.page .hg-table { display: table; width: auto; margin: 0; border-collapse: separate; border-spacing: 2px; font-size: .72rem; }
.hg-table th, .hg-table td { padding: 0; border: 0; background: none; line-height: 1; }
.hg-table .hg-m { position: relative; height: 16px; min-width: 10px; }
.hg-table .hg-m span { position: absolute; left: 0; bottom: 3px; white-space: nowrap; color: var(--muted); font-weight: 500; }
.hg-table .hg-wd, .hg-table thead td { position: sticky; left: 0; z-index: 1; background: var(--card); color: var(--muted); font-weight: 500; padding-right: 4px; text-align: right; white-space: nowrap; }
.hg-c { display: block; width: 10px; height: 10px; padding: 0; border: 0; border-radius: 2.5px; background: var(--empty); cursor: pointer; }
.hg-c.on { background: var(--hg-on, var(--c2)); }
.hg-c:disabled { opacity: .35; cursor: default; }
.hg-c:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.hg-x { width: 10px; }
@media (pointer: coarse) { .page .hg-table { border-spacing: 3px; } .hg-c, .hg-x, .hg-table .hg-m { width: 20px; min-width: 20px; } .hg-c { height: 20px; border-radius: 5px; } }
@media (forced-colors: active) { .hg-c { border: 1px solid CanvasText; } .hg-c.on { background: Highlight; } }
