/* services.css: services page styles (services.html). The sticky sub-nav component, moved here from
   styles.css in Phase 3 because only this page uses it (see notes/COMPONENTS.md 31); the service detail
   block (one chapter per treatment, with its emergency variant); and the patient quote's placement.
   Mobile first, built from the tokens and components in css/styles.css. */

/* == 31. Services sub-nav == */

.subnav { position: sticky; top: var(--header-h); z-index: var(--z-subnav); background: var(--color-surface); border-block: var(--border-hairline) solid var(--color-hairline); }
.subnav__inner { padding-inline: 0; }
.subnav__list {
  display: flex; align-items: center; gap: var(--space-1); min-height: var(--subnav-h);
  padding-inline: var(--gutter); overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
  mask-image: linear-gradient(to right, transparent, currentColor var(--gutter), currentColor calc(100% - var(--gutter)), transparent);
}
.subnav__list::-webkit-scrollbar { display: none; }
.subnav__list > li { flex: none; }
.subnav__link {
  display: inline-flex; align-items: center; min-height: var(--tap-target); padding: 0 var(--space-4); border-radius: var(--radius-pill);
  color: var(--color-text); font-weight: 700; font-size: var(--step-small); white-space: nowrap; text-decoration: none;
  transition: background-color var(--t-1), color var(--t-1);
}
.subnav__link:hover { background: var(--color-surface-2); }
.subnav__link[aria-current="true"] { background: var(--color-brand); color: var(--color-surface); --color-focus: var(--color-surface); }
.subnav__link:focus-visible { outline-offset: calc(-1 * var(--focus-ring)); }

/* Tablets: the seven links need about 910 px, so rather than hide Emergencies off the end of a
   sideways scroll they set as two centred rows, always split three over four. The ::after is a
   full-width line break (its height is the gap between the rows), placed after the third link by order.
   Browsers without range queries (Safari before 16.4) keep the sideways row. */
@media (43.75em <= width < 62.5em) {
  :root { --subnav-h: calc(2 * var(--tap-target) + var(--space-1) + 2 * var(--space-2)); }
  .subnav__list { flex-wrap: wrap; justify-content: center; align-content: center; row-gap: 0; overflow: visible; mask-image: none; }
  .subnav__list::after { content: ""; order: 1; flex-basis: 100%; height: var(--space-1); }
  .subnav__list > li:nth-child(n+4) { order: 2; }
}
@media (min-width: 62.5em) { .subnav__list { justify-content: center; mask-image: none; } }

/* Chapters land flush under the bars, so no strip of the previous band shows (focus targets
   inside keep the shared offset, 16 px lower) */
.service-chapters { --chapter-top: calc(var(--header-h) + var(--subnav-h) + 2 * var(--border-hairline)); }
.service-chapters > .section[id] { scroll-margin-top: var(--chapter-top); }

/* Short windows (a phone on its side): only the header sticks, so the bars never cover a third of
   the screen; services.js then reads the spy line from the header */
@media (max-height: 30em) {
  .subnav { position: relative; top: auto; }
  :root:has(.subnav) { --scroll-offset: calc(var(--header-h) + var(--space-4)); }
  .service-chapters { --chapter-top: var(--header-h); }
}

/* == Service detail block: one chapter per treatment ==
   Phones: one column, the media first as the chapter's opener, then the heading and lead, the facts
   strip (Usually takes, Visits, From, with the price link under From), the details and the two FAQs.
   From 56.25em: a 7/5 split whose sides alternate (service--media-left): the heading beside the media,
   both standing on the facts strip, which spans the page; then the details beside the FAQs, the
   questions always under the media. */

.service { --service-label: 10rem; } /* the label column of the facts and details */
.service__grid {
  display: grid; grid-template-columns: minmax(0, 1fr); row-gap: var(--space-6);
  grid-template-areas: "media" "head" "facts" "body" "faq";
}
/* Emergencies open with the heading and the Call button, then the facts and the triage and first-aid
   panels; the entrance photo waits until after What to do first */
.service--emergency .service__grid { grid-template-areas: "head" "facts" "triage" "firstaid" "media" "timing" "faq"; }
.service__head { grid-area: head; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); justify-items: start; }
.service__media { grid-area: media; }
.service__facts { grid-area: facts; }
.service__body, .service__triage, .service__timing { display: grid; gap: var(--space-6); align-content: start; }
.service__body { grid-area: body; }
.service__triage { grid-area: triage; }
.service__firstaid { grid-area: firstaid; }
.service__timing { grid-area: timing; }
.service__faq { grid-area: faq; align-self: start; }

.service__title { max-width: min(17ch, 100%); }
.service__lead { max-width: 26em; }
.service__actions { margin-top: var(--space-2); }

/* 3:2 photos and the kids' illustration take the small corner (the illustration is not a photo: no tint) */
.service__media .photo { aspect-ratio: 3 / 2; }
.service__illo { width: 100%; height: auto; border-radius: var(--radius-sm); }

/* The facts strip: a green rule over three facts, the price link under the From value */
.service__fact-list { border-top: var(--rule-motif) solid var(--color-heading); border-bottom: var(--border-hairline) solid var(--color-rule); }
.service__fact { display: grid; gap: var(--space-1); padding-block: var(--space-4); }
.service__fact + .service__fact { border-top: var(--border-hairline) solid var(--color-rule); }
/* The .eyebrow recipe (styles.css 4), in the heading colour */
.service__fact-label, .service__subhead {
  font-family: var(--font-display); font-weight: 500; font-size: var(--step-eyebrow);
  line-height: var(--leading-tight); letter-spacing: 0; color: var(--color-heading);
}
.service__fact-value { margin: 0; max-width: var(--measure); text-wrap: pretty; }
.service__price-link { display: flex; width: fit-content; margin-top: var(--space-1); }
.service__note { margin-top: var(--space-3); font-size: var(--step-small); color: var(--color-text-muted); }

/* The details: a sub-head over each block on phones, a label column where the width allows */
.service__block { display: grid; gap: var(--space-2); align-content: start; }
.service__subhead-note { display: block; margin-top: var(--space-1); font-family: var(--font-body); font-weight: 400; font-size: var(--step-small); color: var(--color-text-muted); }

/* Emergency lists: small green dots (never arch bullets: the motif has its four places), centred on
   the first line. Drawn as a border, which forced colours keep (a background would be repainted). */
.service__list { --dot: calc(var(--space-2) * 0.75); display: grid; gap: var(--space-2); }
.service__list > li { position: relative; padding-left: var(--space-5); }
.service__list > li::before {
  content: ""; position: absolute; left: var(--space-1); top: calc(var(--leading-body) * 0.5em - var(--dot) / 2);
  width: 0; aspect-ratio: 1; border: calc(var(--dot) / 2) solid var(--color-heading); border-radius: var(--radius-pill);
}

/* Go to hospital instead: a blush panel with the alert badge; What to do first: a sage panel. The
   transparent hairline shows only in forced colours, where the panels' backgrounds are repainted. */
.service__alert, .service__firstaid { border: var(--border-hairline) solid transparent; }
.service__alert { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-3) var(--space-4); align-items: center; }
.service__alert .icon-badge { background: var(--color-surface); }
.service__alert > p { grid-column: 1 / -1; }
.service__firstaid { align-self: start; gap: var(--space-2); }
.service__steps > li { padding-block: var(--space-4); border-top: var(--border-hairline) solid var(--color-rule); }
.service__steps > li:last-child { padding-bottom: 0; }
.service__steps strong { color: var(--color-heading); }

/* From 43.75em: a label column beside the text, in one column (tablet) and again in the wide main
   column from 68.75em (stacked while the main column is narrow, 56.25em to 68.75em) */
@media (min-width: 43.75em) {
  .service__fact, .service__block { grid-template-columns: var(--service-label) minmax(0, 1fr); column-gap: var(--space-5); align-items: baseline; }
  /* One column still: the media keeps to its side, so the alternation already shows */
  .service__media { justify-self: end; width: min(100%, 36rem); }
  .service--media-left .service__media { justify-self: start; }
  .service__alert > p { grid-column: 2; }
}

@media (min-width: 56.25em) {
  .service__grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: var(--space-8); row-gap: var(--space-8);
    grid-template-areas: "head media" "facts facts" "body faq";
  }
  .service--media-left .service__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-areas: "media head" "facts facts" "faq body"; }
  .service--emergency .service__grid { grid-template-areas: "head media" "facts facts" "triage firstaid" "timing faq"; }
  .service__head, .service__media { align-self: end; }
  .service__media, .service--media-left .service__media { justify-self: stretch; width: auto; }
  .service__block { grid-template-columns: minmax(0, 1fr); }

  .service__fact-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .service__fact { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-5) var(--space-5) var(--space-5) 0; }
  .service__fact + .service__fact { border-top: 0; border-left: var(--border-hairline) solid var(--color-rule); padding-left: var(--space-5); }
}
@media (min-width: 68.75em) { .service__block { grid-template-columns: var(--service-label) minmax(0, 1fr); } }

/* The two questions travel beside the longer details column instead of leaving an empty corner under
   them (only where the window is tall enough for them and the bars) */
@media (min-width: 56.25em) and (min-height: 50em) {
  .service__faq { position: sticky; top: var(--scroll-offset); }
}

/* == Patient quote (P4, on blush): set in from the left, so it sits off the page's axis == */

@media (min-width: 56.25em) {
  .service-quote__figure { margin-inline-start: calc(100% / 12 * 2); }
}
