:root {
  /* Sophia Healing Centre palette */
  --plum: #4B1B47;         /* deep plum — headers, brand */
  --plum-soft: #6b3167;
  --ruby: #8B1A3A;         /* thick red ring — accent */
  --ruby-soft: #c04563;
  --blue: #24408E;         /* thin blue ring — accent */
  --red-dot: #D12229;
  --gold: #C8985F;         /* warm secondary accent */
  --parchment: #f6f1ea;    /* background */
  --parchment-alt: #ede6d9;
  --paper: #ffffff;
  --ink: #1a1a1a;          /* pure black-ish body per brand rule */
  --ink-soft: #4a4a4a;
  --line: #d9d1c1;
  --shadow: 0 1px 2px rgba(75,27,71,0.05), 0 8px 24px rgba(75,27,71,0.08);
  --radius: 14px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Lato', system-ui, sans-serif;
  color: var(--ink);
  background: var(--parchment);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: 'Lato', system-ui, sans-serif; font-weight: 700; letter-spacing: -0.005em; line-height: 1.15; color: var(--plum); }
h1 { font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif; font-weight: 500; font-size: clamp(2.2rem, 4.2vw, 3.5rem); margin: 0 0 1rem; letter-spacing: -0.01em; line-height: 1.1; }
h2 { font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif; font-weight: 500; font-size: clamp(1.8rem, 3vw, 2.6rem); margin: 0 0 0.5rem; }
h3 { font-size: 1.25rem; margin: 0 0 0.5rem; }
em { font-style: italic; color: var(--ruby); }
h1 em { color: var(--ruby); font-style: italic; }
a { color: var(--ruby); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--plum); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 1.4rem; }

/* header */
header.site { position: sticky; top: 0; z-index: 20; background: #ffffff; color: var(--ink); border-bottom: 1px solid rgba(75,27,71,0.12); box-shadow: 0 1px 3px rgba(75,27,71,0.06); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; padding-top: 0.9rem; padding-bottom: 0.9rem; }
.brand { display: inline-flex; align-items: center; gap: 0.9rem; color: var(--plum); text-decoration: none; font-weight: 700; }
/* keep the canonical blue/red circles; sit them on a soft translucent tile so they read against the plum header */
.brand img { height: 54px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; padding-left: 0.6rem; border-left: 1px solid rgba(75,27,71,0.18); }
.brand-text .top { font-family: 'Cormorant Garamond', serif; font-size: 1.15rem; font-weight: 500; letter-spacing: 0.01em; }
.brand-text .bot { font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.65; font-weight: 500; margin-top: 0.15rem; color: var(--ink-soft, #4a4a4a); }
header nav { display: flex; align-items: center; gap: 1.4rem; }
header nav a { color: var(--plum); text-decoration: none; font-size: 0.94rem; opacity: 0.8; transition: opacity 0.15s ease, background 0.15s ease; }
header nav a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
header nav a.nav-back {
  border: 1px solid rgba(75,27,71,0.35);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  opacity: 1;
  font-weight: 500;
  margin-left: 0.4rem;
}
header nav a.nav-back:hover { background: var(--plum); color: #fff; text-decoration: none; }
@media (max-width: 820px) {
  header nav a:not(.nav-back) { display: none; }
  header nav a.nav-back { padding: 0.35rem 0.75rem; font-size: 0.88rem; }
}

/* hero */
.hero { padding: 4rem 0 3rem; background: var(--parchment); border-bottom: 1px solid var(--line); position: relative; }
.hero::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--blue) 0%, var(--ruby) 100%); }
.hero .grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 3rem; align-items: center; }
@media (max-width: 900px) { .hero .grid { grid-template-columns: 1fr; gap: 2rem; } }
.eyebrow { color: var(--ruby); text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.78rem; margin: 0 0 1rem; font-weight: 700; }
.lede { font-size: 1.08rem; color: var(--ink); max-width: 55ch; }
.lede a { color: var(--plum); }
.hero-ctas { display: flex; gap: 0.8rem; margin-top: 1.6rem; }

.btn { display: inline-block; padding: 0.75rem 1.3rem; border-radius: 4px; text-decoration: none; font-weight: 700; border: 1.5px solid transparent; cursor: pointer; font-family: inherit; font-size: 0.95rem; letter-spacing: 0.02em; transition: transform 0.15s ease, background 0.15s ease; }
.btn.primary { background: var(--plum); color: #fff; }
.btn.primary:hover { background: var(--ruby); }
.btn.ghost { background: transparent; color: var(--plum); border-color: var(--plum); }
.btn.ghost:hover { background: var(--plum); color: #fff; }
.btn.large { padding: 0.95rem 1.7rem; font-size: 1rem; margin-top: 0.5rem; }

.stat-stack { display: grid; gap: 0.9rem; }
.stat { background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: var(--radius); padding: 1.1rem 1.3rem; box-shadow: var(--shadow); }
.stat:nth-child(1) { border-left-color: var(--ruby); }
.stat:nth-child(2) { border-left-color: var(--plum); }
.stat:nth-child(3) { border-left-color: var(--blue); }
.stat:nth-child(4) { border-left-color: var(--gold); }
.stat .num { font-family: 'Cormorant Garamond', serif; font-size: 2.2rem; font-weight: 500; color: var(--plum); line-height: 1; }
.stat:nth-child(1) .num { color: var(--ruby); }
.stat:nth-child(3) .num { color: var(--blue); }
.stat:nth-child(4) .num { color: var(--gold); }
.stat .lbl { color: var(--ink); font-size: 0.92rem; margin-top: 0.4rem; }

/* section defaults */
.section { padding: 4.5rem 0; border-bottom: 1px solid var(--line); }
.section.alt { background: var(--parchment-alt); }
.section-lede { color: var(--ink); max-width: 70ch; margin: 0.6rem 0 2.2rem; font-size: 1.02rem; }

/* cards */
.cards { display: grid; gap: 1.4rem; margin-top: 2rem; }
.cards.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 800px) { .cards.two { grid-template-columns: 1fr; } }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem 1.7rem; box-shadow: var(--shadow); }
.card-tag { display: inline-block; font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: #fff; background: var(--ruby); padding: 0.3rem 0.75rem; border-radius: 3px; margin-bottom: 0.9rem; font-weight: 700; }
.card-tag.alt { background: var(--blue); }
.card h3 { color: var(--plum); }

/* controls */
.controls { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: center; margin-bottom: 1.2rem; }
.controls label { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.95rem; font-weight: 500; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; margin-left: auto; background: var(--paper); }
.seg { border: none; background: none; padding: 0.5rem 1rem; font-size: 0.9rem; cursor: pointer; color: var(--ink-soft); font-family: inherit; font-weight: 500; }
.seg.active { background: var(--plum); color: #fff; }

/* chart */
.chart-shell { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow); margin-bottom: 2rem; }

/* outcome cards grid */
.outcome-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.outcome { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; }
.outcome h4 { margin: 0 0 0.4rem; font-family: 'Lato', sans-serif; font-size: 1.05rem; font-weight: 700; color: var(--plum); }
.outcome .scores { display: flex; gap: 0.8rem; margin: 0.5rem 0 0.6rem; }
.outcome .score { flex: 1; }
.outcome .score .bar { height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 3px; }
.outcome .score .bar span { display: block; height: 100%; border-radius: 4px; }
.outcome .score.social .bar span { background: var(--ruby); }
.outcome .score.nature .bar span { background: var(--blue); }
.outcome .lbl { font-size: 0.72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.08em; display: flex; justify-content: space-between; font-weight: 700; }
.outcome .lbl b { color: var(--ink); font-weight: 700; }
.outcome p { margin: 0.4rem 0 0; font-size: 0.9rem; color: var(--ink); }

/* map */
.map-controls { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-bottom: 1rem; }
.map-controls label { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.94rem; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--blue); }
.dot.social { background: var(--ruby); }
.dot.both { background: var(--plum); }
#leafletMap { height: 520px; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
.poi-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 0.9rem; margin-top: 1.6rem; }
.poi { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem 1rem; font-size: 0.92rem; }
a.poi-link { display: block; color: inherit; text-decoration: none; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; cursor: pointer; }
a.poi-link:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(75,27,71,0.14); border-color: var(--plum); }
a.poi-link:focus-visible { outline: 2px solid var(--plum); outline-offset: 2px; }
.poi-cta { margin: 0.55rem 0 0 !important; color: var(--ruby); font-weight: 700; font-size: 0.82rem; letter-spacing: 0.02em; }
a.poi-link:hover .poi-cta { color: var(--plum); }
.poi h4 { margin: 0 0 0.2rem; font-size: 1rem; font-family: 'Lato', sans-serif; font-weight: 700; color: var(--plum); }
.poi .type { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft); font-weight: 700; }
.poi .type.green { color: var(--blue); }
.poi .type.social { color: var(--ruby); }
.poi .type.both { color: var(--plum); }
.poi p { margin: 0.4rem 0 0; color: var(--ink); }

/* plan form */
.plan-form { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); display: grid; gap: 1.3rem; }
.plan-form fieldset { border: none; padding: 0; margin: 0; }
.plan-form legend { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.6rem; color: var(--plum); }
.chips { display: inline-flex; flex-wrap: wrap; gap: 0.5rem; }
.chips.wrap-chips { flex-wrap: wrap; }
.chips label { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0.9rem; border: 1px solid var(--line); border-radius: 3px; background: var(--parchment); font-size: 0.9rem; cursor: pointer; transition: all 0.15s ease; font-weight: 500; }
.chips label:has(input:checked) { background: var(--plum); color: #fff; border-color: var(--plum); }
.chips input { display: none; }

.name-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .name-row { grid-template-columns: 1fr; } }
.name-row label { display: block; font-weight: 700; font-size: 0.95rem; color: var(--plum); margin-bottom: 0.4rem; }
.name-row input { width: 100%; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: 3px; font-family: inherit; font-size: 0.95rem; background: var(--parchment); color: var(--ink); }
.name-row input:focus { outline: 2px solid var(--plum); outline-offset: 1px; }

/* plan output */
.plan-output { margin-top: 1.6rem; }
.plan-output:empty { display: none; }
.plan-actions { display: flex; gap: 0.6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.plan-card { background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--plum); border-radius: var(--radius); padding: 1.6rem 1.8rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.plan-card h3 { font-family: 'Cormorant Garamond', serif; font-weight: 500; font-size: 1.6rem; }
.plan-card .row { display: grid; grid-template-columns: 130px 1fr; gap: 1rem; padding: 0.75rem 0; border-top: 1px solid var(--line); }
.plan-card .row:first-of-type { border-top: none; }
.plan-card .row .day { font-weight: 700; color: var(--plum); }
.plan-card .row .day span { display: block; font-weight: 500; font-size: 0.82rem; color: var(--ruby); margin-top: 0.15rem; }
.plan-card .row .detail b { display: block; margin-bottom: 0.2rem; color: var(--ink); }
.plan-card .row .detail small { color: var(--ink-soft); font-size: 0.87rem; }
.plan-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.9rem; margin: 1rem 0; }
.plan-summary .metric { padding: 0.9rem 1.1rem; background: var(--parchment); border-radius: 8px; border-left: 3px solid var(--gold); }
.plan-summary .metric .k { font-size: 0.75rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; }
.plan-summary .metric .v { font-family: 'Cormorant Garamond', serif; font-size: 1.6rem; margin-top: 0.2rem; color: var(--plum); }

.plan-header-print { display: none; }
.plan-footer-print { display: none; }

/* refs */
details { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; margin-bottom: 0.8rem; }
details summary { cursor: pointer; font-weight: 700; color: var(--plum); }
details[open] summary { margin-bottom: 0.5rem; }
.refs { padding-left: 1.2rem; }
.refs li { margin-bottom: 0.5rem; font-size: 0.93rem; color: var(--ink); }
.refs a { color: var(--ruby); }
.footnote { font-size: 0.85rem; color: var(--ink-soft); margin-top: 1.4rem; font-style: italic; }

footer.site-footer { background: var(--plum); color: rgba(255,255,255,0.85); padding: 2rem 0; font-size: 0.9rem; text-align: center; }
footer.site-footer .brand-line { color: #fff; font-family: 'Cormorant Garamond', serif; font-size: 1.15rem; margin-bottom: 0.3rem; }
footer.site-footer a { color: #fff; }

/* leaflet tweaks */
.leaflet-popup-content { font-family: 'Lato', sans-serif; font-size: 0.9rem; }
.leaflet-popup-content b { display: block; font-size: 1rem; margin-bottom: 0.2rem; font-family: 'Lato', sans-serif; color: var(--plum); }
.leaflet-popup-content em { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ruby); margin-bottom: 0.3rem; font-style: normal; font-weight: 700; }

/* ============ PRINT STYLES ============ */
@media print {
  /* hide everything except the plan output */
  body { background: #fff; color: #000; font-size: 10.5pt; }
  header.site, .hero, #evidence, #compare, #map, #sources, footer.site-footer, .plan-form, #plan > .wrap > h2, #plan > .wrap > .section-lede, .plan-actions { display: none !important; }

  #plan { padding: 0; border: none; background: #fff; }
  .plan-output { margin: 0; }
  .plan-card { box-shadow: none; border: none; border-top: 3px solid var(--plum); padding: 0.4rem 0 1.2rem; margin-bottom: 1rem; page-break-inside: avoid; }
  .plan-card h3 { font-size: 1.3rem; margin-bottom: 0.4rem; }
  .plan-card .row { padding: 0.35rem 0; grid-template-columns: 90px 1fr; }
  .plan-card .row .day { font-size: 0.9rem; }
  .plan-card .row .detail b { font-size: 0.95rem; }
  .plan-card .row .detail small { font-size: 0.8rem; }
  .plan-summary { gap: 0.4rem; margin: 0.5rem 0; }
  .plan-summary .metric { padding: 0.4rem 0.6rem; }
  .plan-summary .metric .v { font-size: 1.15rem; }
  .poi-list { grid-template-columns: 1fr 1fr; gap: 0.4rem; }
  .poi { padding: 0.5rem 0.7rem; break-inside: avoid; font-size: 0.85rem; }
  .poi h4 { font-size: 0.92rem; }

  /* show the print-only branded header and footer */
  .plan-header-print {
    display: block !important;
    padding-bottom: 0.8rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--plum);
  }
  .plan-header-print .pl-brand {
    display: flex; align-items: center; gap: 0.9rem;
  }
  .plan-header-print .pl-brand img { height: 58px; opacity: 1; }
  .plan-header-print .pl-brand .pl-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem; color: var(--plum); line-height: 1.1;
  }
  .plan-header-print .pl-brand .pl-sub {
    font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ruby); font-weight: 700; margin-top: 0.2rem;
  }
  .plan-header-print .pl-meta {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-top: 0.8rem; font-size: 0.85rem; color: #333;
  }
  .plan-header-print .pl-meta .patient { font-weight: 700; color: var(--plum); font-size: 1.05rem; }

  .plan-footer-print {
    display: block !important;
    margin-top: 1rem; padding-top: 0.6rem;
    border-top: 1px solid var(--line);
    font-size: 0.78rem; color: #444;
    display: flex !important; justify-content: space-between; gap: 1rem;
  }
  .plan-footer-print .pl-address { font-style: italic; }

  a { color: #000 !important; text-decoration: none; }
  a::after { content: ""; }
  @page { margin: 12mm 14mm; }
}
