:root {
  --bg: #fff4e8;
  --surface: #ffffff;
  --surface-2: #ffe4d1;
  --text: #33203a;
  --muted: #6d5470;
  --accent: #c4361f;
  --accent-ink: #ffffff;
  --accent-soft: #ffd9cc;
  --accent-strong: #a32d18;
  --sage: #1f7a45;
  --sage-soft: #dcf5e3;
  --sun: #fff0b8;
  --pink: #ffe0ec;
  --plum: #7a3b8f;
  --border: #f3d3bd;
  --radius: 20px;
  --shadow: 0 2px 0 rgba(122, 59, 143, .08), 0 10px 28px rgba(196, 54, 31, .08);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #22172a;
    --surface: #2d2036;
    --surface-2: #362741;
    --text: #fdf1e7;
    --muted: #d2bccf;
    --accent: #ff8a6e;
    --accent-ink: #22172a;
    --accent-soft: #4a2a2c;
    --accent-strong: #ff9d85;
    --sage: #7fdc9c;
    --sage-soft: #213a2c;
    --sun: #3d3220;
    --pink: #3d2337;
    --plum: #e0a8f0;
    --border: #45334f;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
}
img { max-width: 100%; }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; font-weight: 600; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); margin: 0 0 .5em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 0 0 .5em; }
h3 { font-size: 1.2rem; margin: 0 0 .4em; }
p { margin: 0 0 1em; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 720px; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); display: inline-grid; place-items: center; color: var(--accent-ink); font-size: .95rem; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: .95rem; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); font-weight: 600; }

/* Sections */
section { padding: 56px 0; }
.hero { padding: 72px 0 48px; }
.hero p.lead { font-size: 1.2rem; color: var(--muted); max-width: 640px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--sage); margin-bottom: .75em; }
.alt { background: var(--surface-2); }

.btn { display: inline-block; padding: 12px 20px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); text-decoration: none; font-weight: 600; border: 0; cursor: pointer; font: inherit; }
.btn:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

/* Cards */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.card p { color: var(--muted); }
.card .icon { font-size: 1.6rem; margin-bottom: 8px; }
.card .meta { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; padding-top: 8px; }
.tag { font-size: .78rem; padding: 3px 10px; border-radius: 999px; background: var(--sage-soft); color: var(--sage); font-weight: 600; }
.tag.region { background: var(--accent-soft); color: var(--accent); }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.steps li { counter-increment: step; position: relative; padding-left: 52px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; }

.note { background: var(--sage-soft); border-left: 4px solid var(--sage); padding: 16px 20px; border-radius: 8px; }
.note p:last-child { margin: 0; }

/* Filters */
.filters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.filters input, .filters select { font: inherit; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); min-width: 0; }
.filters input { flex: 1 1 240px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip { font: inherit; font-size: .9rem; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.count { color: var(--muted); font-size: .9rem; margin-bottom: 12px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }

/* Kits */
.kit { scroll-margin-top: 90px; }
.kit + .kit { border-top: 1px solid var(--border); }
.file-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.file-list a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-decoration: none; color: var(--text); }
.file-list a:hover { border-color: var(--accent); }
.file-list .ext { margin-left: auto; font-size: .78rem; color: var(--muted); }

.two-col { display: grid; gap: 32px; grid-template-columns: 1fr; }
@media (min-width: 820px) { .two-col { grid-template-columns: 1fr 1fr; } }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 32px 0; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* Ladder: small steps to co-living */
.ladder { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); counter-reset: rung; }
.rung { counter-increment: rung; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.rung::before { content: "Step " counter(rung); display: block; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--sage); margin-bottom: 6px; }
.rung p { color: var(--muted); margin: 0; font-size: .95rem; }

/* Stages (Your path) */
.stage-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; }
.stage { scroll-margin-top: 90px; padding: 40px 0; border-top: 1px solid var(--border); }
.stage-grid { display: grid; gap: 20px; grid-template-columns: 1fr; margin-top: 16px; }
@media (min-width: 820px) { .stage-grid { grid-template-columns: repeat(3, 1fr); } }
.stage-grid h3 { font-family: var(--font); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sage); }
.stage-grid ul { margin: 0; padding-left: 18px; color: var(--muted); }
.stage-grid li { margin-bottom: 6px; }
.stage-grid li a { color: var(--accent); }

/* Template viewer */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 24px; }
.toolbar .btn { padding: 9px 16px; font-size: .95rem; }
.prose { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(20px, 4vw, 44px); }
.prose h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.prose h2 { font-size: 1.35rem; margin-top: 1.6em; }
.prose blockquote { margin: 0 0 1em; padding: 12px 18px; background: var(--sage-soft); border-left: 4px solid var(--sage); border-radius: 8px; }
.prose blockquote p:last-child { margin: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1em; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; min-width: 100px; }
.prose hr { border: 0; border-top: 1px dashed var(--border); margin: 1.5em 0; }
.prose ul, .prose ol { padding-left: 22px; }

/* FAQ */
details { border-bottom: 1px solid var(--border); padding: 14px 0; }
details summary { cursor: pointer; font-weight: 600; }
details p { margin: 10px 0 0; color: var(--muted); }

@media print {
  .site-header, .site-footer, .toolbar, .no-print { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .prose { border: 0; padding: 0; }
  section, .hero { padding: 0; }
}
.tag.intl { background: var(--surface-2); color: var(--muted); }

/* ---------- Playful layer ---------- */
h1, h2, h3 { font-weight: 600; letter-spacing: -.01em; }
.brand img { width: 40px; height: 40px; }
.brand { font-family: var(--font-display); }

.hero { position: relative; overflow: hidden; }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; z-index: -1; filter: blur(2px); }
.hero::before { width: 340px; height: 340px; right: -80px; top: -60px; background: radial-gradient(circle, var(--sun) 0 60%, transparent 61%); }
.hero::after { width: 220px; height: 220px; right: 180px; bottom: -90px; background: radial-gradient(circle, var(--sage-soft) 0 60%, transparent 61%); }
main { position: relative; z-index: 0; }
.hero h1 { color: var(--text); }
.hero h1 em { color: var(--accent); font-style: normal; }

.eyebrow { color: var(--plum); }
.alt { background: var(--surface-2); }
main > section.alt:nth-of-type(4n+2) { background: var(--sage-soft); }
main > section.alt:nth-of-type(4n) { background: var(--pink); }

.btn { box-shadow: 0 3px 0 rgba(0,0,0,.15); transition: transform .12s ease, box-shadow .12s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 0 rgba(0,0,0,.15); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.btn.ghost { background: var(--surface); border: 2px solid var(--border); box-shadow: none; }

.card { border-width: 2px; transition: transform .15s ease; }
a.card:hover, .grid .card:hover { transform: translateY(-3px) rotate(-.3deg); }
.card .icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 1.6rem; background: var(--sun); }
.grid > .card:nth-child(3n+2) .icon { background: var(--sage-soft); }
.grid > .card:nth-child(3n) .icon { background: var(--pink); }
.grid > .card:nth-child(3n+1) { border-top: 6px solid #ffb199; }
.grid > .card:nth-child(3n+2) { border-top: 6px solid #5cc97a; }
.grid > .card:nth-child(3n) { border-top: 6px solid #f59ac0; }

.tag { background: var(--sage-soft); color: var(--sage); }
.tag.region { background: var(--accent-soft); color: var(--accent-strong); }
.tag.intl { background: var(--sun); color: var(--text); }

.rung { border-width: 2px; }
.rung:nth-child(1) { background: var(--sun); }
.rung:nth-child(2) { background: var(--pink); }
.rung:nth-child(3) { background: var(--sage-soft); }
.rung:nth-child(4) { background: var(--accent-soft); }
.rung::before { color: var(--plum); }

.steps li::before { background: var(--sun); color: var(--text); border: 2px solid var(--border); }
.steps li:nth-child(2)::before { background: var(--pink); }
.steps li:nth-child(3)::before { background: var(--sage-soft); }
.steps li:nth-child(4)::before { background: var(--accent-soft); }

.note { border-left-width: 6px; border-left-color: #5cc97a; }
.chip { border-width: 2px; }
.chip[aria-pressed="true"] { background: var(--plum); border-color: var(--plum); color: var(--bg); }
.file-list a { border-width: 2px; }
.prose { border-width: 2px; }
.site-header { background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); }
