:root {
  --bg: #faf8f4;
  --bg-alt: #f1ede4;
  --surface: #ffffff;
  --ink: #1d2433;
  --ink-2: #4a5263;
  --muted: #6b7280;
  --line: #e2ddd2;
  --accent: #2f5bd3;
  --accent-ink: #ffffff;
  --accent-soft: #e6ecfb;
  --red: #c2362b;
  --red-soft: #fbe7e4;
  --green: #1f7a4d;
  --green-soft: #e1f3e9;
  --amber: #a86400;
  --amber-soft: #fdf0d9;
  --hl: #ffe58a;
  --shadow: 0 1px 2px rgba(20, 24, 33, 0.06), 0 6px 24px rgba(20, 24, 33, 0.06);
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151c;
    --bg-alt: #181c25;
    --surface: #1e2330;
    --ink: #eceef3;
    --ink-2: #c3c8d4;
    --muted: #9099ab;
    --line: #2d3343;
    --accent: #7fa2ff;
    --accent-ink: #0f1424;
    --accent-soft: #1f2a48;
    --red: #ff8a7e;
    --red-soft: #3a1f1d;
    --green: #6fd3a0;
    --green-soft: #173327;
    --amber: #f3b75a;
    --amber-soft: #3a2c14;
    --hl: #6b5a12;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 24px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; }
a { color: var(--accent); }
code { font-family: var(--mono); font-size: 0.88em; background: var(--accent-soft); padding: 0.1em 0.35em; border-radius: 5px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-family: var(--serif); font-size: clamp(2.1rem, 5vw, 3.4rem); letter-spacing: -0.01em; }
h2 { font-family: var(--serif); font-size: clamp(1.7rem, 3.5vw, 2.4rem); }
h3 { font-size: 1.15rem; }
h4 { font-size: 1.02rem; }
p { margin: 0 0 1em; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .wrap { padding: 0 28px; } }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.center { text-align: center; }
.bad-text { color: var(--red); }
.good-text { color: var(--green); font-weight: 600; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.brand-mark { display: block; width: 30px; height: 30px; }
.site-header nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.site-header nav a { color: var(--ink-2); text-decoration: none; font-size: 0.92rem; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.site-header nav a:hover { background: var(--bg-alt); color: var(--ink); }
@media (max-width: 760px) { .site-header nav { display: none; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 0.95rem;
  padding: 10px 16px; border-radius: 10px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.small { padding: 6px 12px; font-size: 0.85rem; }
.btn:focus-visible, button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

/* Hero */
.hero { padding: 56px 0 64px; }
.hero-grid { display: grid; gap: 40px; align-items: center; }
@media (min-width: 940px) { .hero-grid { grid-template-columns: 1.15fr 0.85fr; } }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.78rem; font-weight: 700; color: var(--accent); margin-bottom: 10px; }
.memo { margin: 0 0 24px; padding: 4px 0 4px 18px; border-left: 4px solid var(--accent); display: grid; gap: 4px; font-size: 1.15rem; }
.memo-row { display: grid; grid-template-columns: 4.2em 1fr; gap: 8px; align-items: baseline; }
@media (max-width: 520px) { .memo { font-size: 1.05rem; } .memo-row { grid-template-columns: 3.4em 1fr; } }
.memo dt { color: var(--muted); font-weight: 600; }
.memo dd { margin: 0; color: var(--ink); font-weight: 700; }
.memo-row + .memo-row dd { font-weight: 500; color: var(--ink-2); }
.hl { background: linear-gradient(transparent 62%, var(--hl) 62%); padding: 0 2px; }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: 38em; }

.phone {
  background: var(--surface); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow);
  padding: 16px; max-width: 440px; width: 100%; justify-self: center;
}
.phone-top { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; font-size: 0.9rem; padding: 2px 6px 10px; border-bottom: 1px solid var(--line); }
.feed { list-style: none; margin: 0; padding: 6px 0; max-height: 400px; overflow: auto; }
.feed-item { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; padding: 9px 6px; border-bottom: 1px dashed var(--line); font-size: 0.88rem; }
.feed-item:last-child { border-bottom: 0; }
.feed-item .chip { grid-row: span 2; align-self: start; }
.feed-text { color: var(--ink); line-height: 1.35; }
.feed-meta { color: var(--muted); font-size: 0.78rem; }
.feed-note { display: block; color: var(--red); font-weight: 600; font-size: 0.8rem; margin-top: 2px; }
.feed-item.key { background: var(--red-soft); border-radius: 10px; border-bottom-color: transparent; }
.feed-sum { font-size: 0.86rem; color: var(--ink-2); padding: 10px 6px 2px; border-top: 1px solid var(--line); line-height: 1.5; }

.chip { display: inline-block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 7px; border-radius: 6px; background: var(--bg-alt); color: var(--ink-2); min-width: 74px; text-align: center; }
.chip.from-district { background: #e7e3fb; color: #4b3aa8; }
.chip.from-teacher { background: var(--green-soft); color: var(--green); }
.chip.from-school { background: var(--accent-soft); color: var(--accent); }
.chip.from-pta { background: var(--amber-soft); color: var(--amber); }
.chip.from-coach, .chip.from-aftercare { background: var(--bg-alt); color: var(--ink-2); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip.from-district { background: #2a2350; color: #b9adff; }
}

/* Sections */
.section { padding: 72px 0; }
.section.alt { background: var(--bg-alt); }
.section-lede { font-size: 1.08rem; color: var(--ink-2); max-width: 44em; margin-bottom: 32px; }
.sub { margin-top: 48px; }

.cards { display: grid; gap: 16px; }
@media (min-width: 640px) { .cards.five { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .cards.five { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card p { color: var(--ink-2); margin: 0; font-size: 0.97rem; }
.card-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--red-soft); color: var(--red); margin-bottom: 14px; }
.card-icon svg { width: 30px; height: 30px; }
/* "The point comes last": the opening lines fade so the final line stands out. */
.card-icon .faint { opacity: 0.45; }
/* Shapes drawn on top of others (stacked messages, the padlock) are filled with the tile color
   so the lines behind them don't show through. */
.card-icon .mask { fill: var(--red-soft); }

.pull {
  margin: 40px 0 0; padding: 24px 28px; border-left: 4px solid var(--accent);
  background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--serif); font-size: 1.3rem; line-height: 1.45;
}
.pull cite { display: block; margin-top: 10px; font-family: var(--font); font-style: normal; font-size: 0.85rem; color: var(--muted); }

.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
@media (min-width: 760px) { .ticks.cols { grid-template-columns: 1fr 1fr; column-gap: 32px; } }
.ticks li { position: relative; padding-left: 26px; color: var(--ink-2); }
.ticks li::before { content: ""; position: absolute; left: 4px; top: 0.6em; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.ticks strong { color: var(--ink); }

/* Before / after */
.ba { display: grid; gap: 20px; margin-bottom: 16px; }
@media (min-width: 900px) { .ba { grid-template-columns: 1fr 1fr; } }
.msg { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.msg figcaption { font-size: 0.85rem; color: var(--muted); padding: 12px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.msg-head { padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 0.93rem; background: var(--bg-alt); }
.msg-body { padding: 16px 18px; font-size: 0.93rem; color: var(--ink-2); flex: 1; display: flex; flex-direction: column; }
.msg-body p { margin-bottom: 0.8em; }
.msg.after { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
.tag { font-weight: 800; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 6px; }
.tag.bad { background: var(--red-soft); color: var(--red); }
.tag.good { background: var(--green-soft); color: var(--green); }
mark.buried { background: var(--hl); color: inherit; padding: 1px 2px; border-radius: 3px; }
/* Pinned to the bottom so both cards' attachment rows line up. */
.attach { font-size: 0.82rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 10px; margin-top: auto; }

/* Practices */
.practice-group { margin-bottom: 40px; }
.group-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 1rem; color: var(--ink-2); font-weight: 600; margin-bottom: 16px; }
.pill { background: var(--ink); color: var(--bg); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 5px 10px; border-radius: 999px; }
.practices { list-style: none; counter-reset: p; padding: 0; margin: 0; display: grid; gap: 14px; }
@media (min-width: 760px) { .practices { grid-template-columns: 1fr 1fr; } }
.practices li { counter-increment: p; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 20px 18px 64px; }
.practices[start="7"] { counter-reset: p 6; }
.practices[start="11"] { counter-reset: p 10; }
.practices li::before { content: counter(p); position: absolute; left: 18px; top: 18px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.practices p { margin: 0; color: var(--ink-2); font-size: 0.96rem; }
.lbl { font-size: 0.78rem; font-weight: 700; padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.lbl.urgent { background: var(--red-soft); color: var(--red); }
.lbl.action { background: var(--amber-soft); color: var(--amber); }
.lbl.fyi { background: var(--accent-soft); color: var(--accent); }

.checklist-box { background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius); padding: 24px; margin-top: 16px; }
.checklist-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.checklist-head h3 { margin: 0; font-family: var(--serif); font-size: 1.5rem; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
@media (min-width: 860px) { .checklist { grid-template-columns: 1fr 1fr; column-gap: 28px; } }
.checklist label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; color: var(--ink-2); }
.checklist input { margin-top: 0.35em; width: 18px; height: 18px; accent-color: var(--green); flex: none; }
.checklist input:checked + * , .checklist label:has(input:checked) { color: var(--muted); text-decoration: line-through; }

/* Checker */
.checker { display: grid; gap: 24px; }
@media (min-width: 900px) { .checker { grid-template-columns: 1.05fr 0.95fr; align-items: start; } }
.checker-input, .checker-output { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.label { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 8px; }
textarea, input[type="number"] {
  width: 100%; font: inherit; font-size: 0.95rem; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; resize: vertical;
}
input[type="number"] { width: 80px; padding: 6px 8px; }
.ctx { border: 0; padding: 0; margin: 16px 0 12px; display: grid; gap: 8px; }
.ctx label { display: flex; gap: 10px; align-items: flex-start; font-size: 0.94rem; color: var(--ink-2); cursor: pointer; }
.ctx label.inline { align-items: center; }
.ctx input[type="checkbox"] { margin-top: 0.3em; width: 17px; height: 17px; flex: none; accent-color: var(--accent); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.grade-badge {
  width: 84px; height: 84px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--serif); font-size: 3rem; font-weight: 700; border: 4px solid currentColor;
  transform: rotate(-8deg);
}
.empty .grade-badge { margin: 0 auto 12px; }
.muted-badge { color: var(--line); }
.grade-A { color: var(--green); }
.grade-B { color: var(--green); }
.grade-C { color: var(--amber); }
.grade-D, .grade-F { color: var(--red); }
.report-top { display: flex; gap: 20px; align-items: center; margin-bottom: 18px; }
.score { font-size: 2rem; font-weight: 800; line-height: 1; }
.score span { font-size: 1rem; color: var(--muted); font-weight: 600; }
.verdict { margin: 6px 0 0; color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.stat-v { font-weight: 800; font-size: 1.05rem; }
.stat-l { font-size: 0.74rem; color: var(--muted); line-height: 1.3; }
.findings { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 10px; }
.findings li { display: flex; gap: 12px; align-items: flex-start; }
.findings p { margin: 2px 0 0; font-size: 0.9rem; color: var(--ink-2); }
.pts { flex: none; min-width: 42px; text-align: center; font-weight: 800; font-size: 0.85rem; color: var(--red); background: var(--red-soft); border-radius: 6px; padding: 2px 6px; }
.bonuses { list-style: none; padding: 0; margin: 0 0 14px; color: var(--green); font-size: 0.92rem; font-weight: 600; }
.tldr { border-top: 1px solid var(--line); padding-top: 14px; }
.tldr-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tldr-head h4, .tldr h4 { margin: 0; }
.tldr .small { margin: 4px 0 10px; }
.tldr-text { background: var(--green-soft); border-radius: 10px; padding: 12px 14px; font-size: 0.93rem; }
.tldr-text p { margin: 0 0 6px; }
.tldr-text p:last-child { margin: 0; }

/* Templates */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 0; }
.tabs button { font: inherit; font-weight: 600; font-size: 0.93rem; padding: 10px 16px; border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--bg-alt); color: var(--ink-2); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); }
.tpl { background: var(--surface); border: 1px solid var(--line); border-radius: 0 var(--radius) var(--radius) var(--radius); padding: 20px; }
.tpl pre { margin: 0 0 14px; font-family: var(--mono); font-size: 0.86rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; color: var(--ink); }

/* Share */
.share-grid { display: grid; gap: 32px; }
@media (min-width: 900px) { .share-grid { grid-template-columns: 0.9fr 1.1fr; align-items: start; } }
.note-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.note-card textarea { margin-bottom: 12px; }

/* Footer */
.site-footer { padding: 40px 0 56px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 0.93rem; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 0.92rem;
  transition: opacity 0.2s, transform 0.2s; z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .toast { transition: none; }
}

/* Print: just the "Before you hit send" checklist */
@media print {
  body { background: #fff; color: #000; font-size: 13pt; }
  .site-header, .site-footer, .toast, .hero, main > section:not(#practices), #practices > .wrap > :not(.checklist-box), .checklist-head button { display: none !important; }
  #practices { padding: 0; }
  .checklist-box { border: 2px solid #000; box-shadow: none; }
  .checklist { grid-template-columns: 1fr; }
  .checklist label { color: #000; text-decoration: none !important; }
  .checklist-box::after { content: "From The Parent Inbox: a guide to clearer school-to-parent communication"; display: block; margin-top: 16px; font-size: 10pt; color: #555; }
}
