:root {
  --bg: #f7f5ef;
  --surface: #ffffff;
  --tint: #ecefe7;
  --text: #1d2420;
  --muted: #5c6660;
  --line: #dfe2da;
  --accent: #2f6f5e;
  --accent-ink: #ffffff;
  --accent-soft: #dcebe5;
  --bad: #b5523b;
  --bad-soft: #f6e3dc;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 8px 24px rgba(20, 30, 25, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121614;
    --surface: #1a201d;
    --tint: #171c19;
    --text: #e8ece9;
    --muted: #9aa49e;
    --line: #2b332f;
    --accent: #6cc0a5;
    --accent-ink: #0d1411;
    --accent-soft: #1f3a31;
    --bad: #e48a71;
    --bad-soft: #3a2420;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: Fraunces, Georgia, serif; line-height: 1.15; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); letter-spacing: -.01em; }
h3 { font-size: 1.2rem; font-weight: 500; }
p { margin: 0 0 1em; }
a { color: var(--accent); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 600; color: var(--accent); margin-bottom: .75em; }
.muted { color: var(--muted); }
.section { padding: 80px 0; }
.section-tint { background: var(--tint); }
.section-lede { color: var(--muted); max-width: 640px; font-size: 1.08rem; margin-bottom: 2.2em; }

/* nav */
.nav { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: Fraunces, Georgia, serif; font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: .9rem; }
.nav-links { display: flex; gap: 22px; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: .92rem; font-weight: 500; }
.nav-links a:hover { color: var(--text); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 20px; border-radius: 999px; font: inherit; font-weight: 600; font-size: .95rem; text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: transform .15s ease, background .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { border-color: var(--line); color: var(--text); background: var(--surface); }

/* hero */
.hero { padding: 90px 0 70px; }
.hero-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: center; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 560px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.hero-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.hero-card-label { font-size: .85rem; font-weight: 600; margin: 0; }
.hero-card-num { font-family: Fraunces, Georgia, serif; font-size: 3.4rem; font-weight: 700; color: var(--accent); margin: 4px 0 0; line-height: 1; }
.hero-card-num.small { font-size: 2rem; color: var(--bad); }
.hero-card-sub { color: var(--muted); font-size: .9rem; margin: 6px 0 14px; }
.bar { height: 10px; border-radius: 99px; background: var(--tint); overflow: hidden; margin-bottom: 26px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar-down span { background: var(--bad); }
.bar-down { margin: 10px 0 0; }

/* loop */
.loop { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; counter-reset: none; }
.loop li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; position: relative; }
.loop li p { color: var(--muted); margin: 0; font-size: .95rem; }
.loop-num { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 600; margin-bottom: 14px; }

/* build / break */
.split { padding-top: 0; }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.panel { border-radius: 20px; padding: 36px; border: 1px solid var(--line); }
.panel-good { background: var(--accent-soft); }
.panel-bad { background: var(--bad-soft); }
.panel-bad .eyebrow { color: var(--bad); }
.panel h2 { font-size: 1.6rem; }
.rules { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.rules li { padding-left: 18px; border-left: 3px solid var(--accent); }
.panel-bad .rules li { border-left-color: var(--bad); }

/* swaps */
.swaps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.swap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.swap p { margin: 0; }
.swap-cue { font-weight: 600; margin-bottom: 12px !important; }
.swap-bad { color: var(--bad); text-decoration: line-through; font-size: .92rem; }
.swap-good { color: var(--accent); font-weight: 500; font-size: .95rem; margin-top: 6px !important; }
.swap-good::before { content: "\2192  "; }

/* stack */
.stack-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: start; }
.examples { padding-left: 1.2em; color: var(--muted); }
.examples li { margin-bottom: 8px; }
.stacker { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 8px; }
.stacker label { font-weight: 600; font-size: .9rem; }
input[type="text"] { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.stacker .btn { margin-top: 10px; }
.stack-out { margin: 8px 0 0; font-family: Fraunces, Georgia, serif; font-size: 1.15rem; color: var(--accent); min-height: 1.4em; }

/* tracker */
.add-habit { display: flex; gap: 10px; max-width: 520px; margin-bottom: 24px; }
.tracker-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tracker { width: 100%; border-collapse: collapse; min-width: 560px; }
.tracker th, .tracker td { padding: 12px 10px; text-align: center; border-bottom: 1px solid var(--line); }
.tracker tr:last-child td { border-bottom: 0; }
.tracker th:first-child, .tracker td:first-child { text-align: left; padding-left: 18px; }
.tracker th { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.tracker th.today { color: var(--accent); }
.habit-name { font-weight: 500; }
.streak { display: block; font-size: .78rem; color: var(--muted); font-weight: 400; }
.day { width: 34px; height: 34px; border-radius: 10px; border: 1.5px solid var(--line); background: transparent; cursor: pointer; color: var(--accent-ink); font-size: 1rem; transition: background .15s ease, border-color .15s ease; }
.day:hover { border-color: var(--accent); }
.day.done { background: var(--accent); border-color: var(--accent); }
.remove { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1.1rem; padding: 4px 8px; border-radius: 6px; }
.remove:hover { color: var(--bad); }
.empty { color: var(--muted); margin-top: 16px; }
.empty[hidden] { display: none; }

/* tips */
.tips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.tip { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.tip p { color: var(--muted); margin: 0; font-size: .95rem; }

.footer { border-top: 1px solid var(--line); padding: 32px 0; color: var(--muted); font-size: .9rem; text-align: center; }
.footer p { margin: 0; }

@media (max-width: 900px) {
  .hero-grid, .split-grid, .stack-grid { grid-template-columns: 1fr; }
  .loop, .swaps, .tips { grid-template-columns: 1fr 1fr; }
  .nav-links { display: none; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .section { padding: 56px 0; }
  .hero { padding: 56px 0 40px; }
  .loop, .swaps, .tips { grid-template-columns: 1fr; }
  .panel { padding: 24px; }
  .add-habit { flex-direction: column; }
}
