/* =========================================================================
   Get help now (crisis.html)
   Still water at dusk, and two numbers you can't miss.

   For someone in crisis, clarity and speed come before anything else:
   - 911 and 988 sit high on the first screen at every width.
   - Every number is plain static HTML that works with no JavaScript.
   - Nothing with a phone number in it is ever hidden by a reveal.
   Tokens only (see styles.css). Hard-coded colors appear in print only.

   Contents
     1  Hero (compact water scene)
     2  911 and 988
     3  More help lines
     4  Take a breath
     5  What to do
     6  Preferences (dark, high contrast, motion)
     7  Print
   ========================================================================= */

/* ---------- 1. Hero ---------- */
/* The shared .page-hero, made compact so the call buttons come up high.
   The bottom padding keeps the drawn treeline below the title: the land is
   9.44vw tall on wide screens, and 0.309 of the hero's height once the
   scene scales by height (phones, tablets and large text). */
.page-hero {
  padding-top: calc(var(--header-h) + clamp(28px, 3.2vw, 44px));
  padding-bottom: max(calc(9.44vw + 24px), calc(52px + 3rem));
}
.page-hero + .page-intro { padding-top: clamp(20px, 2.6vw, 32px); }
/* Without JavaScript on narrow screens the shared header wraps its links onto
   a second row (taller than --header-h), and no land is drawn: give the title room. */
@media (max-width: 760px) {
  html:not(.js) .page-hero { padding-top: calc(var(--header-h) + 72px); }
}
/* The compact hero crops the top of the sky, which would leave the night
   scene's moon tucked behind the header. On wide screens (where the scene
   scales by width) lower it into open sky. CSS translate composes with the
   transform scenery.js sets on the same group. Units are the scene's own. */
@media (min-width: 1000px) {
  .page-hero .scene-svg .sc-night > [data-ny] { translate: 0 calc(6.9vw - 30px); }
}

/* ---------- 2. 911 and 988 ---------- */
.hotlines {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);   /* 988 carries three ways to reach it */
  gap: clamp(12px, 1.6vw, 20px);
  margin-top: clamp(20px, 2.6vw, 32px);
}
.hotline {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  padding: clamp(24px, 3.4vw, 44px);
  border-radius: var(--r-xl);
}
.hotline-title {
  display: flex;
  flex-direction: column;
  gap: clamp(4px, .8vw, 10px);
  margin: 0;
  font-size: inherit;
  line-height: inherit;
  letter-spacing: normal;
}
.hotline-what {
  color: var(--ink);
  font-size: clamp(1.0625rem, .95rem + .35vw, 1.25rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.016em;
}
.hotline-num {
  margin-left: -.045em;   /* optical: the numeral's side bearing */
  color: var(--ink);
  font-size: clamp(4.25rem, 2.4rem + 6.2vw, 7.5rem);
  font-weight: 600;
  line-height: .94;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "case";
}
.hotline-desc {
  max-width: 34ch;
  margin: clamp(12px, 1.4vw, 18px) 0 0;
  color: var(--text-2);
}
.hotline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  padding-top: clamp(22px, 2.6vw, 32px);
}
.hotline-actions .btn { min-height: 56px; padding: 0 26px; }
.hotline-actions .btn:first-child { min-width: 10em; }   /* the main call button, a little broader */
.hotline-actions .btn svg { width: 1.2em; height: 1.2em; }
.hotline-chat { --btn-fg: var(--link); }

/* 911: the deep pine field, with a whisper of light from the upper right */
.hotline--911 {
  background-image: radial-gradient(130% 90% at 100% 0%, color-mix(in srgb, var(--on-ground) 8%, transparent), transparent 62%);
}
.hotline--911 .hotline-what { color: var(--on-ground-2); }

/* 988: a calm surface */
.hotline--988 {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}
.hotline--988 .hotline-what { color: var(--moss); }
.hotline--988 .hotline-desc { max-width: 40ch; }

@media (max-width: 760px) {
  .hotlines { grid-template-columns: minmax(0, 1fr); }
}
/* Shorter laptop screens (1280×800, 1366×768): tighten so both cards still fit */
@media (min-width: 761px) and (max-height: 860px) {
  .page-hero { padding-top: calc(var(--header-h) + clamp(20px, 2vw, 28px)); }
  .page-hero + .page-intro { padding-top: 20px; }
  .hotlines { margin-top: 20px; }
  .hotline { padding: clamp(24px, 2.4vw, 32px); }
  .hotline-num { font-size: clamp(4.25rem, 2rem + 5vw, 6.25rem); }
  .hotline-desc { margin-top: 10px; }
  .hotline-actions { padding-top: 20px; }
}
/* Phones: thumb-sized buttons across the card. The main call button takes a
   full row; the others share a row when their words fit, and take a row
   each when they don't (narrow phones, large text). Labels never break. */
@media (max-width: 560px) {
  .hotline { border-radius: var(--r-lg); }
  .hotline-actions { width: 100%; gap: 10px; }
  .hotline-actions .btn { flex: 1 1 auto; padding: 0 14px; gap: 7px; white-space: nowrap; }
  .hotline-actions .btn:first-child { flex-basis: 100%; min-width: 0; }
}

/* ---------- 3. More help lines ---------- */
/* A directory, Apple-spec-sheet style: group names on the left, rows on the
   right, hairlines between. Each row is one big tap target. */
.lines { margin-top: clamp(72px, 9vw, 128px); }
.lines > h2 { margin: 0 0 clamp(16px, 2.4vw, 28px); }

.line-group {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: 4px clamp(24px, 4vw, 64px);
  padding-block: clamp(8px, 1.2vw, 14px);
  border-top: 1px solid var(--line);
}
.line-group:last-child { border-bottom: 1px solid var(--line); }
.line-group-title {
  align-self: start;
  margin: 0;
  padding-top: clamp(18px, 2vw, 22px);
  color: var(--ink);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.012em;
}
.line-list { margin: 0; padding: 0; list-style: none; }
.line-list > li + li { border-top: 1px solid var(--line); }

.line {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 44px;
  grid-template-areas:
    "name num call"
    "note num call";
  align-items: center;
  gap: 2px clamp(16px, 2.4vw, 32px);
  margin-inline: -16px;
  padding: clamp(16px, 1.8vw, 20px) 16px;
  border-radius: var(--r-md);
  color: var(--text);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-1) var(--ease-out);
}
.line:hover { background: var(--fill); }
.line:active { background: var(--fill-2); }
.line:focus-visible { outline-offset: 0; }
.line-name {
  grid-area: name;
  align-self: end;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.012em;
}
.line-note {
  grid-area: note;
  align-self: start;
  color: var(--text-2);
  font-size: .9375rem;
  line-height: 1.45;
  letter-spacing: 0;
}
.line-num {
  grid-area: num;
  justify-self: end;
  color: var(--pine);
  font-size: clamp(1.25rem, 1.05rem + .55vw, 1.5rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.018em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "case";   /* hyphens centered on the figures */
  white-space: nowrap;
}
.line-call {
  grid-area: call;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--lichen);
  color: var(--pine);
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out), transform var(--dur-2) var(--ease-spring);
}
.line-call svg { width: 19px; height: 19px; }
.line:hover .line-call { background: var(--pine); color: var(--on-pine); }
.line:active .line-call { transform: scale(.94); }

/* Tablets and phones: one column, the number under the name */
@media (max-width: 860px) {
  .line-group { grid-template-columns: minmax(0, 1fr); padding-block: 0 4px; }
  .line-group-title { padding-top: 22px; color: var(--moss); font-size: .9375rem; }
}
@media (max-width: 640px) {
  .line {
    grid-template-columns: minmax(0, 1fr) 44px;
    grid-template-areas:
      "name call"
      "num call"
      "note call";
    column-gap: 16px;
    row-gap: 3px;
    padding-block: 16px;
  }
  .line-name { align-self: end; }
  .line-num { justify-self: start; align-self: center; }
  .line-num--words { white-space: normal; }
}

/* ---------- 4. Take a breath ---------- */
.breath { margin-top: clamp(72px, 9vw, 128px); }
.breath-panel {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: 28px clamp(32px, 5vw, 72px);
  padding: clamp(28px, 4.4vw, 56px);
  border-radius: var(--r-xl);
  background-color: var(--mist);
}
/* A set width keeps the bloom and its words together (side by side from 30rem) */
.breath-panel .breathe { width: min(100%, 32rem); justify-self: center; }
.breath-copy h2 { margin: 0 0 12px; }
.breath-copy p { max-width: 36ch; margin: 0; color: var(--text-2); }
/* On the mist panel the bloom's lichen button would fade into the field:
   lift it to a white pill instead (this page only). */
.breath-panel .breathe-toggle { background: var(--surface-2); box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.breath-panel .breathe-toggle:hover { background: var(--surface-2); box-shadow: var(--shadow-2), 0 0 0 1px var(--line-2); }
@media (max-width: 860px) {
  .breath-panel { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .breath-copy p { margin-inline: auto; }
}
@media (max-width: 560px) {
  .breath-panel { border-radius: var(--r-lg); }
}

/* ---------- 5. What to do ---------- */
.todo { margin-top: clamp(72px, 9vw, 128px); }
.todo > h2 { margin: 0 0 clamp(16px, 2.4vw, 28px); }
.todo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 1.6vw, 20px);
}
.todo-panel {
  min-width: 0;
  padding: clamp(24px, 3.2vw, 40px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.todo-panel h3 {
  margin: 0 0 20px;
  font-size: clamp(1.1875rem, 1.05rem + .4vw, 1.375rem);
  letter-spacing: -0.02em;
}
.todo-panel .steps { gap: 14px; margin-bottom: 0; }
.todo-panel > :last-child { margin-bottom: 0; }
/* Numbers inside sentences: proportional figures read better in prose */
.todo-panel a[href^="tel:"] {
  font-weight: 600;
  font-feature-settings: "case";
  white-space: nowrap;
}
.nobr { white-space: nowrap; }
.todo-more { margin: 22px 0 0; }
.todo-more .link-arrow { white-space: normal; }   /* may wrap at large text sizes on phones */
.todo-note { margin: 16px 0 0; color: var(--text-2); font-size: .9375rem; line-height: 1.5; }
.todo-note + .todo-note { margin-top: 8px; }
.todo-note a { color: var(--link); }

/* Place to stay: who it's for, then where to call */
.stay-list { margin: 0; padding: 0; list-style: none; }
.stay-list > li { padding-block: 14px; border-top: 1px solid var(--line); }
.stay-list > li:first-child { padding-top: 0; border-top: 0; }
.stay-list > li:last-child { padding-bottom: 0; }
.stay-list strong {
  display: block;
  margin-bottom: 2px;
  color: var(--moss);
  font-size: .9375rem;
  line-height: 1.4;
}
@media (max-width: 860px) {
  .todo-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .todo-panel { border-radius: var(--r-lg); }
}

/* ---------- 6. Preferences ---------- */
/* Night: --ground is darker than the page, so the 911 field becomes a
   lifted, pine-tinted night panel instead of a hole in the page. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-contrast="high"]) .hotline--911 {
    --ground: color-mix(in srgb, var(--pine) 15%, var(--paper));
    box-shadow: inset 0 0 0 1px var(--ground-line), var(--shadow-2);
  }
}
:root[data-theme="dark"]:not([data-contrast="high"]) .hotline--911 {
  --ground: color-mix(in srgb, var(--pine) 15%, var(--paper));
  box-shadow: inset 0 0 0 1px var(--ground-line), var(--shadow-2);
}

/* High contrast: crisp black and white, 2px borders, no textures */
html[data-contrast="high"] :is(.hotline, .breath-panel, .todo-panel) { border: 2px solid var(--line); background-image: none; }
html[data-contrast="high"] .hotline--911 .hotline-what { color: var(--on-ground); }
html[data-contrast="high"] .line-group,
html[data-contrast="high"] .line-list > li + li,
html[data-contrast="high"] .stay-list > li { border-color: var(--line); }
html[data-contrast="high"] .line-group { border-top-width: 2px; }
html[data-contrast="high"] .line-call { border: 2px solid var(--line); background: var(--paper); color: var(--ink); }
html[data-contrast="high"] .line:hover .line-call { background: var(--ink); color: var(--paper); }
html[data-contrast="high"] .line:hover { background: none; text-decoration: underline; }
html[data-contrast="high"] .line-num { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .2em; }
html[data-contrast="high"] .steps > li::before { border: 2px solid var(--line); }

html[data-motion="reduce"] .line:active .line-call { transform: none; }
@media (prefers-reduced-motion: reduce) { .line:active .line-call { transform: none; } }

/* ---------- 7. Print ---------- */
@media print {
  .scene-toggle { display: none !important; }
  .page-hero { padding: 0 0 10pt; }
  .page-hero + .page-intro { padding-top: 0; }
  .hotlines { grid-template-columns: 1fr 1fr; margin-top: 12pt; }
  .hotline, .breath-panel, .todo-panel {
    padding: 12pt;
    border: 1px solid #999999;
    border-radius: 8pt;
    background: none;
    box-shadow: none;
    color: #000000;
    break-inside: avoid;
  }
  .hotline--911 { --ink: #000000; --text-2: #333333; --on-ground-2: #333333; }
  .hotline-num { font-size: 40pt; }
  .hotline-actions { display: none; }
  .lines, .breath, .todo { margin-top: 20pt; }
  .line-group { grid-template-columns: 1fr 3fr; break-inside: avoid; }
  .line { padding: 6pt 0; margin: 0; }
  .line-call { display: none; }
  .line-num { color: #000000; }
  .breath { display: none; }
  .todo-grid { grid-template-columns: 1fr 1fr; }
}
