/* ==========================================================================
   matrix.css: the town pages (generate_radius_pages.py) and the Addiction help
   library (generate_library.py). Built on style.css tokens only: forest, clay,
   sand, cream, ink; Fraunces for voice, Inter for information.
   Direction: an editorial local guide. Calm, typographic, trustworthy for a
   reader who may be anxious. Information is set as type and hairlines, not as
   stacks of identical cards.
   ========================================================================== */

/* ---- browser surfaces ---------------------------------------------------- */
::selection { background: rgba(197, 119, 79, .22); color: var(--ink); }
:focus-visible { outline: 2px solid var(--clay-text); outline-offset: 3px; border-radius: 4px; }
.mx a:not(.btn):not(.area-pill) { text-underline-offset: .18em; text-decoration-thickness: 1px; }
.mx a:not(.btn):not(.area-pill):hover { text-decoration-thickness: 2px; }
.mx { font-variant-numeric: lining-nums; }

/* ---- shared section rhythm ------------------------------------------------ */
.mx-section { padding-block: clamp(56px, 7vw, 96px); }
.mx-section--sand { background: var(--sand); }
.mx-wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }  /* identical to .container */
.mx-h2 { font-size: clamp(1.65rem, 2.8vw, 2.25rem); line-height: 1.15; max-width: 22ch; text-wrap: balance; }
.mx-h2--center { margin-inline: auto; text-align: center; }
.mx-intro { color: var(--ink-soft); max-width: 60ch; margin-top: .7rem; }

/* ---- practical facts: a definition list, not a card grid ------------------ */
.facts { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 2.1fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.facts__head p { color: var(--ink-soft); margin-top: .8rem; max-width: 32ch; }
.facts__list { background: var(--white); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-sm);
  padding: clamp(8px, 1.4vw, 14px) clamp(20px, 2.6vw, 34px); display: grid; grid-template-columns: 1fr 1fr; column-gap: clamp(24px, 3vw, 44px); }
.fact2 { display: grid; grid-template-columns: 34px 1fr; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.fact2:nth-last-child(-n+2) { border-bottom: 0; }
.fact2__icon { width: 34px; height: 34px; border-radius: 50%; background: var(--sand); color: var(--forest); display: grid; place-items: center; }
.fact2__icon svg { width: 17px; height: 17px; }
.fact2 dt { font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 4px; }
.fact2 dd { margin: 0; color: var(--ink); font-size: .98rem; line-height: 1.5; }
.fact2 dd strong { color: var(--forest); font-weight: 600; }

/* ---- scene: an opening paragraph with a serif lede ----------------------- */
.scene { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 2.1fr); gap: clamp(28px, 5vw, 72px); }
.scene__body { max-width: 68ch; }
.scene__lede { font-family: var(--serif); font-size: clamp(1.25rem, 2vw, 1.5rem); line-height: 1.45; color: var(--forest); font-weight: 400; margin-bottom: 1.1rem; text-wrap: pretty; }
.scene__body p + p { color: var(--ink-soft); line-height: 1.75; }

/* ---- angle + access: article with an aside -------------------------------- */
.angle { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.angle__main h2 { margin-bottom: 1rem; }
.angle__main p { line-height: 1.8; color: var(--ink-soft); max-width: 66ch; }
.aside-panel { background: var(--sand); border-radius: 22px; padding: clamp(24px, 3vw, 34px); position: sticky; top: 108px; }
.aside-panel h3 { font-size: 1.35rem; margin-bottom: .7rem; }
.aside-panel p { color: var(--ink-soft); font-size: .97rem; line-height: 1.7; }
.aside-panel .btn { margin-top: 1.2rem; }
.aside-panel__note { font-size: .88rem !important; border-top: 1px solid rgba(31, 58, 52, .12); padding-top: 1rem; margin-top: 1.1rem; }

/* ---- what people bring: an editorial 2x2, hairline-divided --------------- */
.bring { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid rgba(31, 58, 52, .14); margin-top: clamp(28px, 4vw, 44px); }
.bring__item { padding: clamp(22px, 3vw, 34px) clamp(4px, 2vw, 32px) clamp(22px, 3vw, 34px) 0; border-bottom: 1px solid rgba(31, 58, 52, .14); }
.bring__item:nth-child(odd) { border-right: 1px solid rgba(31, 58, 52, .14); padding-right: clamp(20px, 3vw, 40px); }
.bring__item:nth-child(even) { padding-left: clamp(20px, 3vw, 40px); }
.bring__item h3 { font-size: clamp(1.18rem, 1.8vw, 1.4rem); margin-bottom: .45rem; }
.bring__item p { color: var(--ink-soft); line-height: 1.7; max-width: 46ch; }

/* ---- public health figures: typographic rows ------------------------------ */
.figures { margin-top: clamp(24px, 3vw, 36px); border-top: 1px solid var(--line); }
.figure-row { display: grid; grid-template-columns: minmax(150px, .7fr) minmax(0, 2fr); gap: clamp(16px, 3vw, 40px); padding: 22px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.figure-row__num { font-family: var(--serif); font-size: clamp(1.7rem, 3vw, 2.3rem); color: var(--forest); font-variant-numeric: tabular-nums; line-height: 1.05; }
.figure-row__num small { display: block; font-family: var(--sans); font-size: .74rem; color: var(--ink-soft); letter-spacing: .02em; margin-top: 6px; }
.figure-row__text { color: var(--ink); line-height: 1.6; }
.figure-row__cmp { display: inline-block; font-size: .8rem; font-weight: 600; color: var(--forest); background: var(--sand); border-radius: var(--radius-pill); padding: .15em .7em; margin-left: .3em; white-space: nowrap; }
.figure-row__src { display: block; font-size: .82rem; color: var(--ink-soft); margin-top: 6px; }
.figures__note { font-size: .88rem; color: var(--ink-soft); margin-top: 1rem; max-width: 70ch; }

/* ---- safety panels (couples, top-of-page pointer) ------------------------- */
.safety { display: grid; grid-template-columns: 44px 1fr; gap: 18px; background: #fbf3ec; border: 1px solid #ecd5c4; border-radius: 22px; padding: clamp(22px, 3vw, 32px); max-width: 860px; margin-inline: auto; }
.safety__icon { width: 44px; height: 44px; border-radius: 50%; background: #f3e1d3; color: var(--clay-text-dark); display: grid; place-items: center; }
.safety__icon svg { width: 22px; height: 22px; }
.safety h2 { font-size: 1.3rem; margin-bottom: .5rem; }
.safety p { color: var(--ink); line-height: 1.7; font-size: .97rem; }
.safety p + p { margin-top: .7rem; }
.pointer { display: flex; gap: 12px; align-items: flex-start; max-width: 760px; margin: 0 auto; background: #fbf3ec; border: 1px solid #ecd5c4; border-radius: 14px; padding: 14px 18px; font-size: .95rem; color: var(--ink); }
.pointer svg { flex: 0 0 20px; width: 20px; height: 20px; color: var(--clay-text-dark); margin-top: 2px; }

/* ---- free support: a contact list + the crisis panel ---------------------- */
.support { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 56px); align-items: start; }
.support__note { color: var(--ink-soft); line-height: 1.75; margin-top: .9rem; max-width: 62ch; }
.routes { list-style: none; padding: 0; margin: 1.4rem 0 0; border-top: 1px solid var(--line); }
.route { display: grid; grid-template-columns: 1fr auto; gap: 6px 18px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.route__label { grid-column: 1 / -1; font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.route__name { font-weight: 600; color: var(--forest); line-height: 1.45; }
.route__phone { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--forest); white-space: nowrap; text-decoration: none !important; align-self: start; }
.route__desc { grid-column: 1 / -1; font-size: .92rem; color: var(--ink-soft); line-height: 1.6; }
.support__extra { color: var(--ink-soft); font-size: .93rem; line-height: 1.7; margin-top: 1rem; }
.support__extra + .support__extra { margin-top: .7rem; }

/* crisis panel: dark forest, an icon instead of a coloured side border */
.crisis { background: #14241f; color: #dbe7e1; border-radius: 22px; padding: clamp(24px, 3vw, 34px); position: sticky; top: 108px; }
.crisis__head { display: flex; align-items: center; gap: 12px; margin-bottom: .9rem; }
.crisis__head svg { width: 26px; height: 26px; color: #f0b48f; flex: 0 0 26px; }
.crisis h2 { color: #fff; font-size: 1.3rem; margin: 0; }
.crisis p { font-size: .95rem; line-height: 1.7; color: #dbe7e1; margin: 0; }
.crisis p + p { margin-top: .9rem; }
.crisis strong { color: #fff; }
.crisis a { color: #fff; }
.crisis__nums { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 1rem; }
.crisis__num { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); border-radius: 12px; padding: 10px 12px; }
.crisis__num b { display: block; font-family: var(--serif); font-weight: 500; font-size: 1.35rem; color: #fff; font-variant-numeric: tabular-nums; }
.crisis__num span { font-size: .78rem; color: #b7cbc2; }
.crisis__wd { border-top: 1px solid rgba(255, 255, 255, .12); padding-top: .9rem; margin-top: .9rem; }

/* ---- related pages navigation --------------------------------------------- */
.related { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3vw, 40px); margin-top: clamp(32px, 4vw, 48px); padding-top: clamp(24px, 3vw, 36px); border-top: 1px solid var(--line); }
.related h2 { font-family: var(--sans); font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: .9rem; }
.related .area-pills { gap: 8px; }
.related .area-pill:first-child { background: var(--sand); color: var(--forest); }
.related .area-pill:first-child:hover { background: var(--forest); color: #fff; }
.related__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.related__list a { color: var(--forest); font-weight: 500; line-height: 1.45; }
.related__more { grid-column: 1 / -1; font-size: .92rem; color: var(--ink-soft); }

/* ---- FAQ width ------------------------------------------------------------- */
.mx-faq { max-width: 860px; margin-inline: auto; }

/* ==========================================================================
   Library articles (Read mode)
   ========================================================================== */
.art-head { max-width: 860px; }
.art-head h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); max-width: 20ch; text-wrap: balance; }
.art-head .lead { font-size: clamp(1.08rem, 1.6vw, 1.22rem); color: var(--ink); max-width: 62ch; margin-top: .4rem; }
.byline { display: flex; align-items: center; gap: 14px; margin-top: 1.4rem; }
.byline img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow-sm); }
.byline__who { font-size: .92rem; line-height: 1.45; color: var(--ink-soft); }
.byline__who b { color: var(--ink); font-weight: 600; }

.art { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: clamp(32px, 5vw, 72px); align-items: start; }
.art__main { min-width: 0; max-width: 70ch; }
.toc { position: sticky; top: 108px; font-size: .9rem; }
.toc h2 { font-family: var(--sans); font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: .7rem; }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--line); }
.toc li a { display: block; padding: 6px 0 6px 14px; color: var(--ink-soft); text-decoration: none; line-height: 1.4; margin-left: -1px; border-left: 1px solid transparent; }
.toc li a:hover { color: var(--forest); border-left-color: var(--clay); }
.toc__cta { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.toc__cta p { color: var(--ink-soft); font-size: .88rem; margin-bottom: .7rem; }

.summary { background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: clamp(20px, 3vw, 30px); box-shadow: var(--shadow-sm); margin-bottom: 1.6rem; }
.summary h2 { font-family: var(--serif); font-size: 1.25rem; margin-bottom: .8rem; }
.summary ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.summary li { display: grid; grid-template-columns: 20px 1fr; gap: 12px; line-height: 1.6; color: var(--ink); }
.summary li svg { width: 18px; height: 18px; color: var(--clay-text); margin-top: 4px; }

.prose2 { color: var(--ink); line-height: 1.8; font-size: 1.04rem; }
.prose2 h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.2; margin: 2.4em 0 .7em; scroll-margin-top: 110px; text-wrap: balance; }
.prose2 h2:first-child { margin-top: 0; }
.prose2 p { margin: 0 0 1.1em; }
.prose2 ul, .prose2 ol { margin: 0 0 1.3em; padding-left: 1.3em; }
.prose2 li { margin: .35em 0; padding-left: .3em; }
.prose2 ul li::marker { color: var(--clay); }
.prose2 ol li::marker { color: var(--clay-text); font-weight: 600; }
.prose2 sup a { font-size: .72em; color: var(--clay-text-dark); text-decoration: none; font-weight: 600; padding: 0 1px; }
.prose2 .accordion { margin-top: .6rem; }
.sources { font-size: .9rem; color: var(--ink-soft); padding-left: 1.4em; }
.sources li { margin: .5em 0; line-height: 1.55; }
.sources li::marker { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.sources li:target { background: #fbf3ec; border-radius: 6px; }
.author-note { display: grid; grid-template-columns: 56px 1fr; gap: 16px; align-items: start; background: var(--sand); border-radius: 18px; padding: 20px 22px; margin-top: 2rem; font-size: .93rem; line-height: 1.65; color: var(--ink-soft); }
.author-note img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.author-note b { color: var(--ink); }
.art-related { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.art-related li { border-bottom: 1px solid var(--line); }
.art-related a { display: flex; justify-content: space-between; gap: 16px; padding: 14px 2px; color: var(--forest); font-weight: 500; text-decoration: none; }
.art-related a::after { content: ""; flex: 0 0 18px; height: 18px; margin-top: 3px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform .25s var(--ease); }
.art-related a:hover::after { transform: translateX(4px); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .art { grid-template-columns: 1fr; }
  .toc { position: static; order: -1; border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; background: var(--white); }
  .toc__cta { display: none; }
}
@media (max-width: 920px) {
  .facts, .scene, .angle, .support { grid-template-columns: 1fr; }
  .aside-panel, .crisis { position: static; }
  .related { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .facts__list { grid-template-columns: 1fr; }
  .fact2:nth-last-child(2) { border-bottom: 1px solid var(--line); }
  .bring { grid-template-columns: 1fr; }
  .bring__item, .bring__item:nth-child(odd), .bring__item:nth-child(even) { border-right: 0; padding-left: 0; padding-right: 0; }
  .figure-row { grid-template-columns: 1fr; gap: 6px; }
  .crisis__nums { grid-template-columns: 1fr 1fr; }
  .safety { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .art-related a::after { transition: none; }
}

/* inline crisis panel inside an article column */
.crisis--inline { position: static; }
.crisis--inline .crisis__nums { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 680px) { .crisis--inline .crisis__nums { grid-template-columns: 1fr 1fr; } }
.summary li span { min-width: 0; }

/* site reset removes list markers; restore them for reading */
.prose2 ul { list-style: disc; }
.prose2 ol { list-style: decimal; }
.prose2 p, .prose2 li { color: var(--ink); }
.prose2 li::marker { font-size: 1.05em; }
.sources { list-style: decimal; }

/* areas hub: breathing room between distance bands */
.area-region { margin-top: clamp(48px, 6vw, 80px); }
.area-region:first-child { margin-top: 0; }
.area-region h2 { margin-bottom: clamp(18px, 2.4vw, 28px); }

/* detector fixes: no all-caps on long labels; clay hover meets 4.5:1 with white text */
.fact2 dt, .route__label, .related h2, .toc h2 { text-transform: none; letter-spacing: 0; font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.area-pill:first-child:hover { background: var(--clay-text-dark); color: #fff; }

/* ---- hero trust row: ticked items that wrap cleanly (no orphaned divider dots) ---- */
.hero__trust { gap: 10px 22px; }
.hero__trust .divider-dot { display: none; }
.hero__trust > span { position: relative; padding-left: 24px; white-space: nowrap; }
.hero__trust > span::before { content: ""; position: absolute; left: 0; top: 50%; margin-top: -8px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--sage) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 8.2l2.2 2.2 4.8-4.8'/%3E%3C/svg%3E") center/12px no-repeat; }
/* facts heading travels with the long list instead of leaving an empty column */
.facts__head { position: sticky; top: 108px; }
@media (max-width: 980px) { .facts__head { position: static; } }
