/* Routipie — the parent's felt board (grey-blue board, cream felt, mustard, stitched edges)
   with the child's pie colours as the only accents. Rounded type. Light first.
   Theme: data-theme on <html> ("light" | "dark"), set before paint from the saved
   choice or the system setting; the header toggle switches and remembers it. */
:root, :root[data-theme="light"] {
  --bg: #DCE3E8; --board: #D2DAE0; --card: #F7EEDD; --paper: #FBF6EC; --stitch: #B8AE9A; --border: #C9CFD4;
  --text: #1F2328; --dim: #555B62; --faint: #6F767D; --link: #1B5E8C;
  --mustard: #E8A820; --on-mustard: #231A10; --mustard-soft: #F6E3B4; --mustard-text: #8A5E00;
  --morning: #FFC928; --afternoon: #2BC4B6; --pie: #FF4FA3; --night: #241F63; --line: #231A4B;
  --teal-text: #0E7068; --pink-text: #B8236C;
  --track: #E7DFCF; --input: #FFFFFF;
  --shadow: 0 18px 44px rgba(31, 35, 40, .16); --shadow-sm: 0 4px 14px rgba(31, 35, 40, .09);
  --measure: 700px; --wide: 1120px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1E2329; --board: #232931; --card: #2A3038; --paper: #252B33; --stitch: #566070; --border: #343B44;
  --text: #F7EEDD; --dim: #AEB4BA; --faint: #8F969D; --link: #8CC4EA;
  --mustard: #E8A820; --on-mustard: #231A10; --mustard-soft: #3B3220; --mustard-text: #F0C35A;
  --night: #6F67C9; --line: #F7EEDD;
  --teal-text: #5FD9CD; --pink-text: #FF8CC3;
  --track: #353C45; --input: #1A1F25;
  --shadow: 0 18px 44px rgba(0, 0, 0, .45); --shadow-sm: 0 4px 14px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text);
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
  font-size: 17px; line-height: 1.65;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: 2px; }
.narrow { max-width: var(--measure); margin: 0 auto; padding: 0 20px; }
.wide { max-width: var(--wide); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 9; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.only-dark { display: none !important; }
:root[data-theme="dark"] .only-dark { display: block !important; }
:root[data-theme="dark"] .only-light { display: none !important; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--afternoon); outline-offset: 2px; }

/* ---------- Header and footer ---------- */
.site-head { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 2px dashed color-mix(in srgb, var(--stitch) 70%, transparent); }
.site-head .wide { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; }
.mark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.mark img { width: 32px; height: 32px; border-radius: 8px; }
.mark span { font-weight: 800; letter-spacing: -.01em; font-size: 19px; }
.site-nav { display: flex; align-items: center; gap: 14px; font-size: 15.5px; }
.site-nav > a:not(.chip) { color: var(--dim); text-decoration: none; font-weight: 600; }
.site-nav > a:not(.chip):hover { color: var(--text); }
.chip { display: inline-flex; align-items: center; padding: 6px 14px; border-radius: 999px; background: var(--mustard); color: var(--on-mustard); font-weight: 700; font-size: 14.5px; text-decoration: none; white-space: nowrap; border: 2px solid var(--on-mustard); box-shadow: 0 2px 0 var(--on-mustard); }
.toggle { width: 36px; height: 36px; border-radius: 999px; border: 2px solid var(--border); background: var(--card); color: var(--dim); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.toggle:hover { color: var(--text); }
.toggle svg { width: 16px; height: 16px; }
.toggle .sun { display: none; }
:root[data-theme="dark"] .toggle .sun { display: block; }
:root[data-theme="dark"] .toggle .moon { display: none; }
.site-foot { margin-top: 72px; padding: 0 0 56px; }
.site-foot .wide { display: flex; flex-wrap: wrap; gap: 14px 20px; justify-content: space-between; color: var(--dim); font-size: 14px; border-top: 2px dashed var(--stitch); padding-top: 26px; }
.site-foot a { color: var(--dim); text-decoration: none; }
.site-foot a:hover { color: var(--text); }
.site-foot .links { display: flex; flex-wrap: wrap; gap: 18px; }

/* ---------- Type ---------- */
.eyebrow { font-size: 13px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--link); margin-bottom: 10px; }
strong { font-weight: 700; }
p.lead { font-size: 1.15rem; margin-bottom: 22px; }

/* ---------- Signup form ---------- */
.signup { max-width: 520px; }
.su-row { display: flex; gap: 10px; }
.signup input[type="email"] { flex: 1; min-width: 0; font: inherit; font-size: 17px; color: var(--text); background: var(--input); border: 2px solid var(--line); border-radius: 999px; padding: 11px 18px; }
.signup input[type="email"]::placeholder { color: var(--faint); }
.signup button { font: inherit; font-weight: 800; font-size: 16px; white-space: nowrap; padding: 11px 20px; border-radius: 999px; cursor: pointer; background: var(--mustard); color: var(--on-mustard); border: 2px solid var(--on-mustard); box-shadow: 0 3px 0 var(--on-mustard); }
.signup button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--on-mustard); }
.signup button:disabled { opacity: .6; cursor: default; }
.signup .hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }
.su-consent { font-size: 13.5px; line-height: 1.5; color: var(--dim); margin: 12px 4px 0; }
.su-consent a { color: inherit; }
.su-msg { font-size: 15px; font-weight: 700; margin: 8px 4px 0; min-height: 0; }
.su-msg:empty { display: none; }
.signup.is-error .su-msg { color: var(--pink-text); }
.signup.is-done .su-msg { color: var(--teal-text); }
.signup.is-done .su-row { display: none; }

/* ---------- Home: hero ---------- */
.hero .wide { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; padding-top: 56px; }
.hero h1 { font-size: clamp(2.4rem, 5.4vw, 3.9rem); line-height: 1.04; letter-spacing: -.035em; font-weight: 900; margin-bottom: 18px; }
.hero h1 .pie-word { color: var(--pink-text); }
.hero .lead { font-size: 1.2rem; color: var(--dim); max-width: 31em; }
.soon { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--teal-text); background: var(--card); border-radius: 999px; padding: 5px 14px 5px 10px; margin-bottom: 16px; outline: 2px dashed var(--stitch); outline-offset: -5px; }
.soon svg { width: 18px; height: 18px; }
.hero .signup { margin-top: 26px; }
.hero .meta { color: var(--dim); font-size: 14px; margin-top: 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.hero .meta span { background: var(--card); border-radius: 999px; padding: 3px 12px; }
.hero-phone { position: relative; justify-self: center; width: min(320px, 78vw); }
.phone { border-radius: 46px; border: 9px solid #15181C; background: #15181C; overflow: hidden; box-shadow: var(--shadow); }
.phone img { width: 100%; border-radius: 37px; }
.hero-phone .phone.back { position: absolute; width: 74%; right: -34%; top: 13%; z-index: -1; transform: rotate(5deg); opacity: .96; }
.hero-phone .pie-badge { position: absolute; left: -84px; top: 46%; background: var(--card); border-radius: 22px; padding: 12px 14px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; font-size: 13.5px; line-height: 1.3; outline: 2px dashed var(--stitch); outline-offset: -6px; }
.pie-badge svg { width: 40px; height: 40px; flex: none; }
.pie-badge b { display: block; font-size: 16px; }
.pies-row { display: flex; gap: 12px; margin: 0 0 18px; }
.pies-row svg, .pie-badge svg, .step svg { overflow: visible; }
.pies-row svg { width: 38px; height: 38px; }
.rim { fill: none; stroke: var(--line); stroke-width: 3; }
.wedge { stroke: var(--line); stroke-width: 3; stroke-linejoin: round; }

/* ---------- Home: sections ---------- */
.section { padding: 84px 0 0; }
.section h2 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); letter-spacing: -.03em; line-height: 1.12; margin-bottom: 10px; font-weight: 850; }
.section p.sub { color: var(--dim); max-width: 40em; margin-bottom: 30px; font-size: 1.07rem; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: s; }
.step { background: var(--card); border-radius: 24px; padding: 24px 24px 22px; outline: 2px dashed var(--stitch); outline-offset: -8px; }
.step svg { width: 56px; height: 56px; margin-bottom: 14px; }
.step h3 { font-size: 1.12rem; font-weight: 800; margin-bottom: 6px; }
.step p { color: var(--dim); font-size: 15.5px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card { background: var(--card); border-radius: 20px; padding: 22px 22px 20px; outline: 2px dashed var(--stitch); outline-offset: -7px; }
.card h3 { font-size: 1.06rem; font-weight: 800; margin-bottom: 5px; }
.card p { color: var(--dim); font-size: 15.5px; }
.card .dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--line); margin-bottom: 12px; }
.shots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.shots figure { margin: 0; }
.shots .phone { border-width: 7px; border-radius: 34px; box-shadow: var(--shadow-sm); }
.shots .phone img { border-radius: 27px; }
.shots figcaption { color: var(--dim); font-size: 14.5px; margin-top: 12px; text-align: center; line-height: 1.45; }
.shots-note { color: var(--faint); font-size: 13.5px; margin-top: 18px; }
.grownups { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.board { background: var(--board); border-radius: 26px; padding: 28px; border: 2px dashed var(--stitch); }
.board h3 { font-size: 1.15rem; font-weight: 800; margin-bottom: 8px; }
.board p, .board li { color: var(--dim); font-size: 15.5px; }
.board ul { margin: 6px 0 0 20px; }
.board li { margin-bottom: 6px; }
.guides-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.guide-card { display: flex; flex-direction: column; gap: 8px; background: var(--card); border-radius: 22px; padding: 0 0 22px; overflow: hidden; text-decoration: none; color: var(--text); transition: transform .15s; }
.guide-card:hover { transform: translateY(-2px); }
.guide-card .tag, .guide-card h3, .guide-card p { margin-left: 22px; margin-right: 22px; }
.guide-card .thumb { display: block; aspect-ratio: 16 / 9; margin-bottom: 8px; }
.guide-card .tag { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--teal-text); }
.guide-card h3 { font-size: 1.14rem; line-height: 1.3; letter-spacing: -.01em; font-weight: 800; }
.guide-card p { color: var(--dim); font-size: 15px; }
.more { margin-top: 20px; display: inline-block; font-weight: 700; text-decoration: none; }
.faq details { border-top: 2px dashed var(--stitch); padding: 16px 0; }
.faq details:last-of-type { border-bottom: 2px dashed var(--stitch); }
.faq summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--faint); font-weight: 400; font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--dim); margin-top: 8px; }
.signup-band { margin-top: 84px; }
.signup-band .inner { background: var(--card); border-radius: 30px; padding: 40px 40px 36px; display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center; outline: 2px dashed var(--stitch); outline-offset: -10px; }
.signup-band h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); letter-spacing: -.03em; line-height: 1.12; font-weight: 850; margin-bottom: 8px; }
.signup-band p.sub { color: var(--dim); }

/* ---------- Documents and articles ---------- */
.doc, .article { padding-top: 48px; }
.doc h1, .article h1 { font-size: clamp(2rem, 4.6vw, 2.8rem); font-weight: 900; letter-spacing: -.03em; line-height: 1.1; margin-bottom: 14px; }
.updated, .byline { color: var(--dim); font-size: 14.5px; margin-bottom: 30px; }
.doc h2, .article h2 { font-size: 1.4rem; font-weight: 850; letter-spacing: -.015em; margin: 44px 0 12px; scroll-margin-top: 84px; }
.doc h2 { font-size: 1.2rem; padding-top: 22px; border-top: 2px dashed var(--stitch); margin-top: 32px; }
.article h3 { font-size: 1.1rem; font-weight: 800; margin: 26px 0 8px; }
.doc p, .article p { margin-bottom: 15px; }
.article p.lead { font-size: 1.22rem; line-height: 1.55; }
.doc ul, .doc ol, .article ul, .article ol { margin: 0 0 16px 22px; }
.doc li, .article li { margin-bottom: 7px; }
.article table { width: 100%; border-collapse: collapse; font-size: 15.5px; font-variant-numeric: tabular-nums; }
.article th, .article td { text-align: left; padding: 10px 10px; border-bottom: 2px dashed var(--border); vertical-align: top; }
.article th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); font-weight: 750; }
.table-wrap { overflow-x: auto; background: var(--card); border-radius: 16px; padding: 4px 12px; margin: 10px 0 24px; }
.table-wrap tr:last-child td { border-bottom: 0; }
.callout { background: var(--card); border-left: 5px solid var(--afternoon); border-radius: 14px; padding: 16px 18px; margin: 22px 0; }
.callout p:last-child { margin-bottom: 0; }
.example { background: var(--mustard-soft); border-radius: 18px; padding: 18px 20px; margin: 22px 0; font-variant-numeric: tabular-nums; }
.example p:last-child, .example ul:last-child { margin-bottom: 0; }
.toc { background: var(--card); border-radius: 18px; padding: 16px 20px; margin: 0 0 30px; font-size: 15.5px; outline: 2px dashed var(--stitch); outline-offset: -6px; }
.toc strong { display: block; margin-bottom: 6px; font-size: 12.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--dim); }
.toc ol { margin: 0 0 0 20px; }
.notice { color: var(--dim); font-size: 14.5px; border-left: 4px solid var(--mustard); padding: 4px 0 4px 14px; margin: 28px 0 0; }
.sources { font-size: 14.5px; color: var(--dim); border-top: 2px dashed var(--stitch); margin-top: 38px; padding-top: 18px; }
.sources ol { margin: 8px 0 0 20px; }
.sources li { margin-bottom: 6px; }
.crumbs { font-size: 14px; color: var(--faint); margin-bottom: 14px; }
.crumbs a { color: var(--faint); }
.posts { list-style: none; margin: 8px 0 0; }
.doc ul.posts { margin: 8px 0 0; }
.posts li { border-top: 2px dashed var(--stitch); padding: 22px 0; margin-bottom: 0 !important; }
.posts li:last-child { border-bottom: 2px dashed var(--stitch); }
.posts a { display: grid; grid-template-columns: 168px 1fr; gap: 20px; align-items: start; text-decoration: none; color: var(--text); }
.posts a:hover h2 { color: var(--link); }
.posts .thumb { display: block; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-sm); }
.posts .txt { display: block; }
.posts .tag { display: block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--teal-text); margin-bottom: 4px; }
.doc .posts h2, .posts h2 { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; margin: 0 0 4px; border: 0; padding-top: 0; }
.posts p { color: var(--dim); font-size: 15.5px; margin: 0 0 6px; }
.posts time { display: block; color: var(--faint); font-size: 13.5px; }
.cover { aspect-ratio: 16 / 8; border-radius: 24px; overflow: hidden; margin: 6px 0 30px; box-shadow: var(--shadow-sm); }
.cover img, .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.credit { font-size: 12px; color: var(--faint); margin: -22px 0 26px; text-align: right; }

/* ---------- Figures (inline SVG from tools/figs.py) ---------- */
.fig { margin: 26px 0 30px; }
.fig svg { display: block; width: 100%; max-width: 560px; margin: 0 auto; height: auto; background: var(--card); border-radius: 20px; }
.fig text { font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums; }
.fig figcaption { font-size: 14px; color: var(--dim); margin-top: 10px; text-align: center; line-height: 1.5; }
.fig.shot img { width: min(290px, 72%); margin: 0 auto; border-radius: 34px; border: 7px solid #15181C; box-shadow: var(--shadow); }
.fig.photo img { width: 100%; border-radius: 20px; aspect-ratio: 3 / 2; object-fit: cover; box-shadow: var(--shadow-sm); }
.fig.photo figcaption .credit { display: block; margin: 4px 0 0; text-align: center; }
.k-t { fill: var(--text); } .k-d { fill: var(--dim); } .k-f { fill: var(--faint); }
.k-morning { fill: var(--morning); } .k-afternoon { fill: var(--afternoon); } .k-pie { fill: var(--pie); } .k-night { fill: var(--night); }
.k-mustard { fill: var(--mustard); } .k-track { fill: var(--track); } .k-paper { fill: var(--paper); }
.k-teal-t { fill: var(--teal-text); } .k-pink-t { fill: var(--pink-text); } .k-must-t { fill: var(--mustard-text); }
.k-ink { fill: #231A10; } .k-white { fill: #FFFFFF; }
.k-line { stroke: var(--line); fill: none; } .k-stitch { stroke: var(--stitch); fill: none; } .k-rule { stroke: var(--border); fill: none; }

/* ---------- End-of-guide box ---------- */
.app-box { position: relative; display: grid; grid-template-columns: 1fr 200px; gap: 24px; align-items: end; background: var(--card); border-radius: 28px; padding: 30px 0 0 32px; margin: 48px 0 8px; overflow: hidden; outline: 2px dashed var(--stitch); outline-offset: -9px; scroll-margin-top: 84px; }
.ab-text { position: relative; padding-bottom: 30px; }
.ab-eyebrow { display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--link); margin: 0 0 14px !important; }
.ab-eyebrow img { width: 30px; height: 30px; border-radius: 8px; }
.ab-title { font-size: 1.45rem; font-weight: 850; letter-spacing: -.02em; line-height: 1.22; margin: 0 0 10px !important; }
.ab-body { font-size: 15.5px; line-height: 1.6; color: var(--dim); margin: 0 0 18px !important; }
.app-box .su-row { flex-direction: column; }
.app-box .signup button { align-self: flex-start; }
.ab-phone { position: relative; height: 300px; overflow: hidden; margin-right: 28px; }
.ab-phone img { width: 200px; border-radius: 30px 30px 0 0; border: 7px solid #15181C; border-bottom: 0; }

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  .features, .steps { grid-template-columns: 1fr 1fr; }
  .shots { grid-template-columns: repeat(4, 58%); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; }
  .shots figure { scroll-snap-align: start; }
}
@media (max-width: 760px) {
  .hero .wide { grid-template-columns: 1fr; gap: 40px; padding-top: 36px; }
  .hero-phone { width: min(250px, 62vw); margin-right: 22%; }
  .hero-phone .pie-badge { display: none; }
  .features, .steps, .guides-grid, .grownups { grid-template-columns: 1fr; }
  .signup-band .inner { grid-template-columns: 1fr; padding: 30px 24px 28px; gap: 10px; }
}
@media (max-width: 560px) {
  .su-row { flex-direction: column; }
  .signup button { width: 100%; }
  .shots { grid-template-columns: repeat(4, 72%); }
  .app-box { grid-template-columns: 1fr; gap: 0; padding: 26px 22px 0; }
  .app-box .signup button { align-self: stretch; }
  .ab-text { padding-bottom: 24px; }
  .ab-phone { justify-self: center; height: 190px; margin: 0; }
  .ab-phone img { width: 190px; border-radius: 26px 26px 0 0; border-width: 6px; }
  .ab-title { font-size: 1.28rem; }
  .posts a { grid-template-columns: 96px 1fr; gap: 14px; }
  .posts .thumb { border-radius: 12px; }
  .cover { aspect-ratio: 3 / 2; border-radius: 18px; }
  .fig figcaption { font-size: 13px; }
  .site-nav { gap: 10px; }
  .chip { padding: 5px 11px; font-size: 13.5px; }
}
@media (max-width: 400px) {
  .site-head .wide { padding: 0 14px; gap: 8px; }
  .site-nav .chip { display: none; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .guide-card { transition: none; } }
