: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;
  --control-border: #a07a63;
  --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;
    --control-border: #8a7396;
    --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; }
.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; }
.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: 1px solid color-mix(in srgb, var(--sage) 30%, transparent); padding: 18px 22px; border-radius: 14px; }
.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; }
/* Circles: shown while no circles are listed */
.start { display: grid; gap: 32px; align-items: center; grid-template-columns: 1fr; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: clamp(24px, 4vw, 44px); }
.start[hidden] { display: none; }
.start-copy > p { color: var(--muted); max-width: 60ch; }
.start .steps { margin: 24px 0 8px; }
.start-art { width: 140px; height: 140px; justify-self: center; grid-row: 1; }
@media (min-width: 820px) {
  .start { grid-template-columns: 1fr 220px; }
  .start-art { width: 220px; height: 220px; grid-row: auto; }
}
.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: 14px 18px; background: var(--sage-soft); border: 1px solid color-mix(in srgb, var(--sage) 30%, transparent); border-radius: 12px; }
.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: 44px; height: 44px; }
.brand { font-family: var(--font-display); }

.hero-grid { display: grid; gap: 32px; align-items: center; }
.hero-art { width: 100%; max-width: 440px; height: auto; justify-self: center; -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent); mask-image: linear-gradient(to bottom, #000 82%, transparent); }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.1fr .9fr; } }
.hero h1 { color: var(--text); }
.hero h1 em { color: var(--accent); font-style: normal; }

.alt { background: var(--surface-2); }
.lead { color: var(--muted); }

.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 { transform: translateY(-3px); }
.card .icon { margin-bottom: 10px; color: var(--accent); }
.card .icon .i { width: 40px; height: 40px; }

.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::before { color: var(--plum); }

.steps li::before { background: var(--accent-soft); color: var(--accent-strong); border: 2px solid var(--border); }

.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); }

/* Icons (assets/icons.svg) */
:root { --icon-fill: #ffd9cc; }
@media (prefers-color-scheme: dark) { :root { --icon-fill: #4a2a2c; } }
.i { width: 1.25em; height: 1.25em; flex-shrink: 0; vertical-align: -.25em; }
h2 .i { width: 1.1em; height: 1.1em; margin-right: .35em; vertical-align: -.15em; color: var(--accent); }
.file-list .i { color: var(--accent); }
.chip .i { margin-right: .35em; color: var(--plum); }
.stage h2 .i { color: var(--plum); }
.tag .i { width: 1.1em; height: 1.1em; margin-right: .3em; }
.place { display: flex; gap: 6px; align-items: center; }
.place .i { color: var(--accent); }
.kit-meta { margin: -.2em 0 1em; color: var(--muted); font-weight: 700; font-size: .95rem; }

/* Phone menu (button added by site.js) */
.menu-btn { display: none; }
@media (max-width: 699px) {
  .has-menu .menu-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; font: inherit; font-weight: 700; color: var(--text); background: var(--surface); border: 2px solid var(--border); border-radius: 999px; cursor: pointer; }
  .has-menu .nav { display: none; flex-basis: 100%; flex-direction: column; gap: 2px; padding-bottom: 12px; }
  .has-menu.menu-open .nav { display: flex; }
  .has-menu .nav a { display: flex; align-items: center; min-height: 48px; padding: 0 16px; font-size: 1.05rem; border-radius: 14px; }
}

/* Tap targets: at least 44px for everything you press with a thumb */
.chip { display: inline-flex; align-items: center; min-height: 44px; }
.site-footer a { display: inline-block; padding: 12px 4px; }
details { padding: 4px 0; }
details summary { padding: 10px 0; }
.card .meta a { display: inline-block; padding: 10px 0; }
.chip[aria-current="true"] { background: var(--plum); border-color: var(--plum); color: var(--bg); }
.chip[aria-current="true"] .i { color: var(--bg); }

/* Your path: one stage at a time (stage switching in path.html) */
.stage[hidden] { display: none; }
.stage-nav { scroll-margin-top: 80px; }
.stage-steps { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 28px; padding-top: 20px; border-top: 1px dashed var(--border); }
.stage-steps a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
.stage-steps .next { margin-left: auto; }
a.chip { text-decoration: none; color: var(--text); }
.site-header.menu-open { background: var(--bg); }

/* Contact fallback under email buttons */
.contact-alt { margin-top: 14px; font-size: .95rem; color: var(--muted); }
.copyable { color: var(--text); user-select: all; }

/* Form controls and secondary buttons need a 3:1 visible edge */
.filters input, .filters select, .btn.ghost, .has-menu .menu-btn { border-color: var(--control-border); }

/* Keyboard focus */
:focus-visible { outline: 3px solid var(--plum); outline-offset: 3px; }
.btn:focus-visible, .chip:focus-visible, .menu-btn:focus-visible { outline-offset: 4px; }
::selection { background: var(--accent-soft); color: var(--text); }

/* Standalone links get a full tap target */
.more-link, .stage-grid li a { display: inline-block; padding: 10px 0; }
.stage-grid li:has(> a:only-child) { margin-bottom: 0; }
.card-title { font-size: 1.2rem; margin: 0 0 .4em; }

/* Home page */
.trust-line { margin-top: 20px; color: var(--muted); font-size: .95rem; max-width: 52ch; }
ol.ladder { list-style: none; padding: 0; margin: 0; }
.rung { display: flex; flex-direction: column; }
.rung > a { margin-top: auto; padding-top: 12px; font-weight: 700; display: inline-block; padding-bottom: 10px; }
.rung p { margin-bottom: 0; }
.chips-label { font-weight: 700; margin: 24px 0 0; }
.closing { text-align: center; }
.closing img { margin: 0 auto 8px; display: block; }
.closing .actions { justify-content: center; }
.closing .safety { margin: 32px auto 0; max-width: 60ch; font-size: .92rem; color: var(--muted); }

/* SMBC country map (smbc.html) */
:root {
  --tier-supported: #2f9a5d;
  --tier-possible: #a8d88f;
  --tier-hard: #f2b45a;
  --tier-closed: #c95470;
  --tier-none: #eadccf;
}
@media (prefers-color-scheme: dark) {
  :root {
    --tier-supported: #4fb87c;
    --tier-possible: #b9cf7a;
    --tier-hard: #d8954a;
    --tier-closed: #c25670;
    --tier-none: #3d2e47;
  }
}
.map-card { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: clamp(16px, 3vw, 28px); box-shadow: var(--shadow); display: grid; gap: 20px; }
.map-legend { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tier-chip { gap: 8px; color: var(--text); }
.tier-chip .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.tier-chip[aria-pressed="true"] { background: var(--surface-2); border-color: var(--text); color: var(--text); }
.tier-chip[aria-pressed="true"] .n { color: var(--text); }
.chip-static { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); padding: 6px 4px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; background: var(--tier-none); flex-shrink: 0; display: inline-block; border: 1px solid color-mix(in srgb, var(--text) 15%, transparent); }
.swatch[data-tier="supported"], .tier-pill[data-tier="supported"] { background: var(--tier-supported); }
.swatch[data-tier="possible"], .tier-pill[data-tier="possible"] { background: var(--tier-possible); }
.swatch[data-tier="hard"], .tier-pill[data-tier="hard"] { background: var(--tier-hard); }
.swatch[data-tier="closed"], .tier-pill[data-tier="closed"] { background: var(--tier-closed); }

.map-frame svg { display: block; width: 100%; height: auto; }
.map-frame path { fill: var(--tier-none); stroke: var(--surface); stroke-width: .6; transition: opacity .15s ease; }
.map-frame path[data-tier] { cursor: pointer; }
.map-frame path[data-tier="supported"] { fill: var(--tier-supported); }
.map-frame path[data-tier="possible"] { fill: var(--tier-possible); }
.map-frame path[data-tier="hard"] { fill: var(--tier-hard); }
.map-frame path[data-tier="closed"] { fill: var(--tier-closed); }
.map-frame path[data-tier]:hover { opacity: .8; }
.map-frame path.dim { opacity: .2; }
.map-frame path.selected { stroke: var(--text); stroke-width: 1.6; opacity: 1; }

.map-detail { border-top: 1px dashed var(--border); padding-top: 18px; }
.detail-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.detail-head h2 { margin: 0; }
.tier-pill { font-size: .85rem; font-weight: 700; padding: 6px 14px; border-radius: 999px; color: #2a1830; }
.map-detail dl { display: grid; gap: 14px; margin: 0; grid-template-columns: 1fr; }
@media (min-width: 760px) { .map-detail dl { grid-template-columns: repeat(3, 1fr); } }
.map-detail dl > div { min-width: 0; }
.map-detail dt { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--sage); margin-bottom: 4px; }
.map-detail dd { margin: 0; }
.detail-note { margin: 16px 0 0; padding: 12px 16px; background: var(--sun); border-radius: 12px; }
.map-foot { margin: 0; font-size: .9rem; color: var(--muted); }

.factors { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-top: 16px; }
.factors h3 { font-family: var(--font); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--plum); }
.factors p { color: var(--muted); margin: 0; }
.factors-src { margin: 28px 0 0; font-size: .92rem; color: var(--muted); max-width: 75ch; }

.tier-lists { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 16px; }
.tier-list { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 20px; }
.tier-list h3 { display: flex; align-items: center; gap: 10px; }
.tier-list > p { color: var(--muted); font-size: .92rem; }
.tier-list ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.country-btn { font: inherit; font-size: .95rem; background: none; border: 0; padding: 6px 8px; min-height: 36px; border-radius: 8px; color: var(--accent-strong); cursor: pointer; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
.country-btn:hover { background: var(--surface-2); }

.res-group + .res-group { margin-top: 32px; }
.res-group h3 { margin-bottom: 14px; }
.private-cost { margin-top: 18px; padding: 16px 18px; background: var(--surface-2); border-radius: 14px; }
.private-cost h3 { font-family: var(--font); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--plum); margin-bottom: 10px; }
.private-cost dl { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.private-cost dt { color: var(--muted); text-transform: none; letter-spacing: 0; font-size: .85rem; }
.private-cost dd { font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.private-cost p { margin: 12px 0 0; font-size: .9rem; color: var(--muted); }
