/* The Stepfamily Compass: warm, calm, readable.
   Colors come from the brand board. Teal, clay, and gold are used for large text and
   decoration only; small text uses evergreen, charcoal, or the darker "clay-ink" so it
   meets WCAG AA contrast on ivory. */
:root {
  /* Brand palette */
  --evergreen: #31584F;
  --teal: #537A78;
  --clay: #BC6D52;
  --gold: #C39B55;
  --ivory: #F7F2E8;
  --charcoal: #343A38;

  --bg: var(--ivory);
  --surface: #FFFDF8;
  --surface-soft: #EFE7D8;
  --ink: var(--charcoal);
  --ink-soft: #59605D;
  --primary: var(--evergreen);
  --primary-ink: #FFFDF8;
  --primary-soft: #E2ECE8;
  --accent: var(--clay);
  --clay-ink: #9A5640;       /* clay darkened for small text (4.9:1 on ivory) */
  --accent-soft: #F4E3DA;
  --gold-soft: #F3E8D2;
  --line: #E3D9C7;
  --focus: var(--clay);
  --warn-bg: #FBF0D6;
  --warn-line: var(--gold);
  --danger: #A3302A;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(52 58 56 / .06), 0 4px 16px rgb(52 58 56 / .06);
  /* Brand fonts are self-hosted in /static/fonts (fonts.css); fallbacks show while they load. */
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Cormorant Garamond", "Cormorant", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1.0625rem/1.65 var(--font-body); }
img { max-width: 100%; height: auto; }
a { color: var(--primary); text-underline-offset: .18em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4, .h3, .h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.2; color: var(--evergreen); margin: 1.6em 0 .5em; }
h1 { font-size: clamp(2.1rem, 5vw, 3rem); margin-top: 0; }
h2 { font-size: clamp(1.55rem, 3.2vw, 1.95rem); }
h3, .h3 { font-size: 1.35rem; }
.h4 { font-size: 1.15rem; }
code { font-size: .92em; background: var(--surface-soft); padding: .1em .35em; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: min(1120px, 100% - 2rem); margin-inline: auto; }
.narrow { max-width: 46rem; }
.wrap.narrow { width: min(46rem, 100% - 2rem); }
.narrow-inner { max-width: 46rem; }
main { display: block; padding-bottom: 3rem; }
main:focus { outline: none; }

.skip-link { position: absolute; left: -999px; top: .5rem; background: var(--primary); color: var(--primary-ink); padding: .6rem 1rem; border-radius: 8px; z-index: 10; }
.skip-link:focus { left: .5rem; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); }
.brand-logo { display: block; width: 210px; height: auto; }
.brand-symbol { display: block; width: 40px; height: auto; }
@media (max-width: 480px) { .brand-logo { width: 170px; } }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; }
.brand-tagline { font-size: .8rem; color: var(--ink-soft); line-height: 1.3; max-width: 30ch; }
.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem .4rem; margin: 0; padding: 0; }
.site-nav a, .link-button { display: inline-block; padding: .4rem .6rem; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: .95rem; }
.site-nav a:hover { background: var(--primary-soft); color: var(--primary); }
.site-nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-toggle { display: none; }
@media (max-width: 860px) {
  .nav-toggle:not([hidden]) { display: inline-flex; align-items: center; min-height: 44px; padding: .4rem 1rem; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; font: inherit; color: var(--ink); cursor: pointer; }
  .js .site-nav { display: none; width: 100%; }
  .js .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav a, .site-nav .link-button { display: block; padding: .7rem .5rem; border-bottom: 1px solid var(--line); border-radius: 0; }
  .admin .site-nav { display: block; }
}

.personal-bar { background: var(--primary-soft); border-top: 1px solid var(--line); font-size: .93rem; }
.personal-bar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; padding: .5rem 0; }
.personal-bar button, .link-button { background: none; border: 0; color: var(--primary); text-decoration: underline; cursor: pointer; font: inherit; padding: .2rem .3rem; min-height: 32px; }

/* Hero & page headers */
.hero { background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%); padding: clamp(2.5rem, 7vw, 5rem) 0 2rem; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem 3rem; align-items: center; }
.hero-inner { max-width: 46rem; }
.hero-art { width: clamp(220px, 26vw, 320px); height: auto; border-radius: 28px; box-shadow: var(--shadow); }
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { order: -1; width: 160px; border-radius: 20px; }
}
.lede { font-size: 1.18rem; color: var(--ink-soft); max-width: 42rem; }
.welcome-cta { margin-top: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.welcome-cta p { margin-top: 0; }
.page-header { padding: clamp(2rem, 5vw, 3.5rem) 0 1rem; }
.page-header .with-icon { display: flex; gap: 1.25rem; align-items: flex-start; }
.page-icon { flex: none; width: auto; height: 64px; margin-top: .3rem; }
@media (max-width: 520px) { .page-header .with-icon { flex-direction: column; gap: .5rem; } .page-icon { height: 52px; } }
.about-header { text-align: center; }
.about-header .lede { margin-inline: auto; }
.about-logo { display: block; width: 200px; height: auto; margin: 0 auto 1.25rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; font-weight: 700; color: var(--clay-ink); margin: 0 0 .4rem; }
.eyebrow-icon { display: flex; align-items: center; gap: .55rem; }
.inline-icon { width: auto; height: 28px; }
.post-meta, .card-meta, .muted { color: var(--ink-soft); font-size: .92rem; }

/* Buttons */
.button-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .55rem 1.2rem; border-radius: 999px; border: 2px solid var(--primary); background: var(--primary); color: var(--primary-ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.button:hover { background: #24433C; color: var(--primary-ink); border-color: #24433C; }
.button-quiet { background: transparent; color: var(--primary); }
.button-quiet:hover { background: var(--primary-soft); color: var(--primary); }
.button-small { min-height: 36px; padding: .3rem .9rem; font-size: .9rem; }
.button-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.button-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.inline-form { display: inline; margin: 0; }

/* Cards */
.card-grid { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; box-shadow: var(--shadow); }
.card h2, .card h3, .card .h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }
.section-card h3 a, .post-card h3 a { text-decoration: none; }
.section-icon { display: block; width: auto; height: 56px; margin-bottom: .75rem; }
.card-icon { display: block; width: auto; height: 36px; margin-bottom: .5rem; }
.section-card .suggested-badge + .section-icon, .post-card .suggested-badge + .card-icon { margin-top: .25rem; }
.section-card h3 a::after, .post-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.section-card:hover, .post-card:hover { border-color: var(--primary); }
.suggested { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft), var(--shadow); }
.suggested-badge { display: inline-block; background: var(--primary-soft); color: var(--primary); font-size: .78rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; margin-bottom: .5rem; }
.empty { color: var(--ink-soft); }

.note-grid { list-style: none; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.note { background: var(--accent-soft); border-radius: var(--radius); padding: 1.1rem 1.2rem; font-family: var(--font-head); font-size: 1.2rem; line-height: 1.45; position: relative; }
.note p { margin: 0; }
.note.suggested { box-shadow: 0 0 0 2px var(--accent); }

/* Next step */
.next-step { display: flex; gap: .9rem; align-items: flex-start; background: var(--primary-soft); border-left: 5px solid var(--gold); border-radius: 0 var(--radius) var(--radius) 0; padding: 1rem 1.25rem; margin: 2rem 0; }
.next-step > div { flex: 1; }
.next-step-symbol { flex: none; width: 32px; height: auto; margin-top: .1rem; }
.next-step-label { font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .06em; font-size: .82rem; margin: 0 0 .3rem; }
.next-step p:last-child { margin-bottom: 0; }
.home-step { margin-top: 0; }

/* Prose */
.prose { font-size: 1.1rem; }
.prose h2 { font-size: 1.45rem; }
.prose blockquote, .starter blockquote { margin: 1.2rem 0; padding: .8rem 1.1rem; background: var(--surface-soft); border-left: 4px solid var(--accent); border-radius: 0 10px 10px 0; }
.starter blockquote { font-size: 1rem; margin: .6rem 0; }
.ai-disclosure { font-size: .92rem; color: var(--ink-soft); border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 2rem; }
.back-link { margin-top: 2rem; }
mark.placeholder { background: var(--warn-bg); border: 1px dashed var(--warn-line); padding: .1em .35em; border-radius: 4px; color: var(--ink); }

.notice { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--accent); padding: .9rem 1.1rem; border-radius: 0 10px 10px 0; font-size: .97rem; }
.notice-warn { background: var(--warn-bg); border-left-color: var(--warn-line); }
.preview-banner { background: var(--warn-bg); border-bottom: 1px solid var(--warn-line); padding: .7rem 1rem; text-align: center; }

/* Tools */
.jump-links { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.jump-links a { background: var(--surface); border: 1px solid var(--line); padding: .4rem .9rem; border-radius: 999px; text-decoration: none; font-size: .95rem; }
.tool-section { padding-top: 1rem; }
.checklist { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: .8rem 1.1rem 1rem; margin: 0 0 1rem; }
.checklist legend { font-weight: 700; padding: 0 .4rem; font-family: var(--font-head); font-size: 1.1rem; }
.choice { display: flex; gap: .6rem; align-items: flex-start; padding: .45rem 0; cursor: pointer; }
.choice input { width: 1.25rem; height: 1.25rem; margin-top: .2rem; flex: none; accent-color: var(--primary); }
.choice.small { font-size: .93rem; padding: .2rem 0; }
.tip-list li { margin-bottom: .4rem; }
.why { font-size: .95rem; }
.meeting-cards { list-style: none; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.meeting-card { position: relative; background: var(--surface); border: 2px dashed var(--line); border-radius: var(--radius); padding: 1.1rem; min-height: 140px; font-family: var(--font-head); font-size: 1.1rem; break-inside: avoid; }
.meeting-card p { margin: .4rem 0 0; }
.card-kind { font-family: var(--font-body); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--clay-ink); font-weight: 700; }
.table-scroll { overflow-x: auto; max-width: 100%; }
.week-table, .admin-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.week-table th, .week-table td, .admin-table th, .admin-table td { border: 1px solid var(--line); padding: .6rem .7rem; text-align: left; vertical-align: top; }
.week-table td { height: 3rem; min-width: 7rem; }
.harmony-dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .8rem; font-size: .95rem; margin: .8rem 0 0; }
.harmony-dl dt { font-weight: 700; color: var(--primary); }
.harmony-dl dd { margin: 0; }
.aff-tag { font-size: .75rem; background: var(--accent-soft); padding: .1rem .45rem; border-radius: 999px; font-family: var(--font-body); font-weight: 600; }
@media (max-width: 480px) { .harmony-dl { grid-template-columns: 1fr; } .harmony-dl dd { margin-bottom: .4rem; } }

/* Welcome flow */
.welcome-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.5rem; box-shadow: var(--shadow); }
.welcome-step { border: 0; padding: 0; margin: 0 0 1rem; }
.welcome-step legend, .welcome-step h2 { font-family: var(--font-head); font-size: 1.35rem; font-weight: 700; margin: 0 0 .5rem; padding: 0; }
.hint { color: var(--ink-soft); font-size: .93rem; font-weight: normal; }
.subhead { font-weight: 700; margin: 1rem 0 .2rem; }
.step-count { color: var(--ink-soft); font-size: .9rem; margin-top: 0; }
.scale { display: grid; gap: .5rem; }
.scale input[type=range] { width: 100%; accent-color: var(--primary); min-height: 44px; }
.scale output { font-weight: 700; color: var(--primary); }
.skip-all { margin-bottom: 0; font-size: .95rem; }
.welcome-nav { margin-top: 1rem; }

/* Footer */
.site-footer { background: var(--evergreen); color: #EDE6D8; padding: 2.5rem 0; font-size: .93rem; border-top: 4px solid var(--gold); }
.site-footer a { color: #FFFDF8; }
.site-footer a:hover { color: var(--gold-soft); }
.site-footer :focus-visible { outline-color: var(--gold); }
.footer-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.footer-logo { display: block; width: 220px; height: auto; margin-bottom: .6rem; }
.footer-tagline { font-family: var(--font-head); font-size: 1.25rem; color: #FFFDF8; margin: 0 0 .8rem; }
.safety-note { margin-top: 0; }

/* Admin */
.admin-main { padding-top: 1.5rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.panel h2 { margin-top: 0; font-size: 1.3rem; }
.two-col { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.two-col .panel { margin-bottom: 0; }
.two-col + .two-col, .two-col + .panel { margin-top: 1.25rem; }
.big-status { font-size: 1.1rem; }
.status-list { list-style: none; padding: 0; margin: 0; }
.status-list li { display: grid; grid-template-columns: minmax(12rem, 16rem) 1fr; gap: .2rem 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.status-list li.ok strong { color: var(--primary); }
.status-list li.missing strong { color: var(--accent); }
@media (max-width: 640px) { .status-list li { grid-template-columns: 1fr; } }
.plain-list { padding-left: 1.2rem; }
.plain-list li { margin-bottom: .35rem; }
.small { font-size: .9rem; }
.log-error { color: var(--danger); }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .12rem .55rem; border-radius: 999px; background: var(--surface-soft); color: var(--ink-soft); vertical-align: middle; }
.badge-published { background: var(--primary-soft); color: var(--primary); }
.badge-pending_review, .badge-flag { background: var(--warn-bg); color: #6b4e00; }
.badge-scheduled { background: #e5ecf7; color: #234a7a; }
.badge-paused { background: var(--accent-soft); color: #7a3417; }
.badge-src-generated, .badge-src-starter { background: #efe6f5; color: #5a2f78; }
.badge-src-manual { background: var(--surface-soft); color: var(--ink); }
.title-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.title-row h1 { margin: 0; }
.filter-row { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.filter-row a { padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; }
.filter-row a[aria-current="page"] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.admin-table td.actions { white-space: nowrap; }
.admin-form label:not(.choice) { display: block; font-weight: 700; margin: 1rem 0 .3rem; }
.admin-form input:not([type=checkbox]):not([type=radio]), .admin-form textarea, .admin-form select, .login input {
  width: 100%; font: inherit; padding: .6rem .7rem; border: 1px solid #c9bfb2; border-radius: 10px; background: #fff; color: var(--ink); min-height: 44px; }
.admin-form textarea.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .95rem; line-height: 1.5; }
.admin-form fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 1.2rem 0; padding: .6rem 1rem 1rem; }
.admin-form legend { font-weight: 700; padding: 0 .3rem; }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.tag-groups { display: grid; gap: .5rem 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.tag-group { border: 0 !important; padding: 0 !important; margin: 0 !important; }
.tag-group legend { font-size: .85rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; }
.publish-box { background: var(--surface-soft); }
.danger-zone { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.flash { background: var(--primary-soft); border: 1px solid var(--primary); padding: .7rem 1rem; border-radius: 10px; }
.error { background: #fdecea; border: 1px solid var(--danger); color: #6d1f1b; padding: .7rem 1rem; border-radius: 10px; }
.login { margin: 2rem auto; }
.login button { margin-top: 1rem; }
.topic-list { padding-left: 1.4rem; }
.topic { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.topic-main { flex: 1 1 320px; }
.topic-main p { margin: .3rem 0 0; }
.topic-actions { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.topic.used, .topic.skipped { opacity: .75; }

@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

@media print {
  .site-header, .site-footer, .jump-links, .button, .button-row, .next-step, .personal-bar, .skip-link { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .card, .checklist, .meeting-card { box-shadow: none; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
