/* ==========================================================================
   Services hero (.svh): a clinician at work, the copy on clean paper to her left.
   A light photo hero under the light-tone header (data-nav-tone="light"). The photo (a doctor examining a patient
   against teal walls) sits on a stage that keeps the picture's own 16:9 proportions; the stage is placed so the two
   people always land to the right of the copy (desktop) or above it (tablet, phone). A plain canvas gradient (.svh-veil)
   carries the copy: no blur, no fog. A reticle locks onto the examination and a pin links into the doctors section.
   Placement is in container units of .hero-media (cqw / cqh) and picture fractions, so it holds at every width.
   Shared hero rules (load-in, split, stagger) come from components.css (.hero-bleed / .page-hero).
   ========================================================================== */

.page-hero.svh {
  /* the stage: --svh-ax is a point across the picture (the clinician's hair, left of both people) and --svh-tx is
     where it lands on screen; --svh-fy shares the spare picture above / below (1 = all above, for the parallax) */
  --svh-ax: 0.395;
  --svh-tx: 50cqw;
  --svh-fy: 0.5;
  min-height: var(--hero-h);
  background: var(--canvas);
  color: var(--fg);
  justify-content: center;
  padding-top: calc(var(--nav-h) + var(--space-8));
  padding-bottom: var(--space-11);
}

/* ---- the photo stage ---- */
.svh .hero-media { container-type: size; background: var(--canvas); }
.svh .hero-media::after { content: none; }            /* no dark scrims: the veil below does the work on paper */
.svh .hero-media::before { opacity: 0.12; }
.svh-stage {
  --svh-w: max(108cqh * 16 / 9, 96cqw);
  --svh-h: calc(var(--svh-w) * 9 / 16);
  position: absolute; z-index: 0;
  width: var(--svh-w);
  height: var(--svh-h);
  left: calc(var(--svh-tx) - var(--svh-w) * var(--svh-ax));
  top: calc((100cqh - var(--svh-h)) * var(--svh-fy));
}
.svh-stage > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; max-width: none;
  object-fit: cover;
  /* warmer and a little deeper: the cool white room meets the cream canvas, the teal stays teal */
  --svh-grade: saturate(1.04) sepia(0.16) contrast(1.07) brightness(0.98);
  filter: var(--svh-grade);
}

/* the veil: clean paper on the copy's side, a soft band under the header, and a short handover to the canvas below */
.svh-veil {
  --svh-col-l: max(var(--gutter), (100cqw - var(--max)) / 2);
  --svh-col-w: min(100cqw - 2 * var(--gutter), var(--max));
  --svh-paper: calc(var(--svh-col-l) + var(--svh-col-w) * 0.34);   /* solid paper up to here */
  --svh-clear: calc(var(--svh-tx) - var(--space-2));                /* fully clear here, just left of the people */
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--canvas) 72%, transparent) 0, color-mix(in srgb, var(--canvas) 0%, transparent) 132px),
    linear-gradient(0deg, var(--canvas) 0, color-mix(in srgb, var(--canvas) 0%, transparent) var(--space-11)),
    linear-gradient(90deg,
      var(--canvas) 0,
      var(--canvas) var(--svh-paper),
      color-mix(in srgb, var(--canvas) 88%, transparent) calc(var(--svh-paper) + (var(--svh-clear) - var(--svh-paper)) * 0.35),
      color-mix(in srgb, var(--canvas) 52%, transparent) calc(var(--svh-paper) + (var(--svh-clear) - var(--svh-paper)) * 0.68),
      color-mix(in srgb, var(--canvas) 0%, transparent) var(--svh-clear));
}

/* ---- reticle on the examination (picture coordinates: the patient's head and the otoscope) ---- */
.svh-lock {
  position: absolute; z-index: 3;
  left: 59%; top: 25%; width: 16.5%; height: 26%;
  --reticle-inset: 0px;
  --reticle-len: 18px;
  --reticle-color: var(--teal-400);
}
/* a slow scan line sweeps the locked frame, resting between passes. Transform + opacity only; it starts once the
   load-in has settled, and is off for reduced motion */
.svh-sweep { position: absolute; inset: 0; overflow: hidden; }
.svh-sweep::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, var(--halo-faint) calc(100% - 40px), color-mix(in srgb, var(--teal-400) 22%, transparent) calc(100% - 2px), var(--teal-400) calc(100% - 2px), var(--teal-400) 100%);
  opacity: 0;
  translate: 0 -100%;
}
/* a scanner moves at an even pace: linear travel, and the line only brightens once it is inside the frame (so a
   still frame never shows it lying on the frame's top edge like a border) */
@media (prefers-reduced-motion: no-preference) {
  .svh-sweep::before { animation: svh-sweep 5.2s linear 2.4s infinite; }
}
@keyframes svh-sweep {
  0%        { translate: 0 -100%; opacity: 0; }
  12%       { translate: 0 -84%; opacity: 0; }
  20%       { translate: 0 -73%; opacity: 0.85; }
  54%       { translate: 0 0; opacity: 0.85; }
  64%, 100% { translate: 0 0; opacity: 0; }
}

/* the pin: a real link into the doctors section, hanging under the reticle like a reading label */
.svh-pin {
  position: absolute; z-index: 4;
  left: 61%; top: 57.5%;
  display: inline-flex; align-items: center; gap: var(--space-3);
  min-height: 56px; padding: var(--space-2) var(--space-5) var(--space-2) var(--space-4);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-sm);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  color: var(--ink);
  white-space: nowrap;
  transition: background-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), translate var(--dur-2) var(--ease-out);
}
.svh-pin-dot {
  position: relative; flex: none;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--teal-500);
  box-shadow: var(--halo);
}
.svh-pin-text { display: grid; line-height: 1.25; }
.svh-pin-text b { font-size: var(--fs-small); font-weight: var(--fw-ui); }
.svh-pin-text span { font-size: var(--fs-eyebrow); color: var(--ink-3); }
.svh-pin .icon-arrow { width: 16px; height: 16px; color: var(--teal-700); transition: translate var(--dur-2) var(--ease-out); }
@media (hover: hover) {
  .svh-pin:hover { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow-md); translate: 0 -1px; }
  .svh-pin:hover .icon-arrow { translate: 3px 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .svh-pin-dot::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%;
    background: var(--teal-400);
    animation: svh-ping 2.6s var(--ease-out) 1.6s infinite;
  }
}
@keyframes svh-ping {
  0%        { scale: 1; opacity: 0.6; }
  70%, 100% { scale: 2.8; opacity: 0; }
}

/* ---- the copy ---- */
.svh-content { width: min(var(--max), 100%); }
/* the copy column spans the container, so on desktop its empty right half lies over the photo and its pin: clicks
   pass through the column and land only on the copy itself */
.svh-content { pointer-events: none; }
.svh-content > :not(.hero-actions), .svh .hero-actions > * { pointer-events: auto; }
.svh-content > .eyebrow, .svh h1 { width: fit-content; }
.svh-content .eyebrow { margin-bottom: var(--space-7); }
/* (0,2,1): the home-hero size (display-1) on this page's h1, over the shared .page-hero h1 display-page rule */
.page-hero.svh h1 {
  font-size: var(--fs-display-1);
  line-height: 0.96;
  letter-spacing: var(--tracking-display);
  max-width: 10.5ch;
}
.svh h1 em { color: var(--fg-em); }
.svh .lede { color: var(--fg-2); max-width: 40ch; margin-top: var(--space-7); }
.svh .hero-actions { margin-top: var(--space-9); }

@media (min-width: 1600px) {
  .page-hero.svh { --svh-tx: 53cqw; }   /* the 125px headline runs wider: the people step right to keep their air */
}

/* ---- crisp at 1:1 on desktops ----
   The source is 1280px wide, so the cover stage enlarges it (1.2x at 1280, 1.6x at 1920) and the browser's upscale
   goes soft. A light unsharp mask (#svh-sharpen in hero.html: the photo minus a 1.4px blur of itself) restores the
   edges at screen-pixel scale. Desktop only: phones and tablets show the picture at or below its own size. */
@media (min-width: 981px) {
  .svh-stage > img { filter: url(#svh-sharpen-soft) var(--svh-grade); }
}
@media (min-width: 1600px) {
  .svh-stage > img { filter: url(#svh-sharpen) var(--svh-grade); }
}
/* the blur inside the unsharp mask is re-run on every frame while the photo itself is scaling in, so the load-in
   shows the plain graded photo and the edges sharpen once the reveal has settled (.is-done) */
@media (min-width: 981px) and (prefers-reduced-motion: no-preference) {
  html.js .svh-stage:not(.is-done) > img { filter: var(--svh-grade); }
}
.svh-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---- tablets and phones: the two people up top, the copy on paper below ---- */
@media (max-width: 980px) {
  .page-hero.svh {
    --svh-ax: 0.53;
    --svh-tx: 50cqw;
    --svh-fy: 0.6;
    justify-content: flex-end;
    padding-bottom: var(--space-10);
  }
  .svh-stage { --svh-w: max(72cqh * 16 / 9, 120cqw); top: 0; }   /* the picture starts at the top edge, under the header */
  /* only the soft band under the header here: the paper under the copy is anchored to the copy itself (below), so the
     photo always fades out just above the eyebrow, whatever the screen's height */
  .svh-veil { background: linear-gradient(180deg, color-mix(in srgb, var(--canvas) 56%, transparent) 0, color-mix(in srgb, var(--canvas) 0%, transparent) 120px); }
  .svh-content { --svh-fade: clamp(120px, 26vw, 220px); }
  .svh-content::before {
    content: "";
    position: absolute; z-index: -1; pointer-events: none;
    left: calc(-1 * var(--gutter)); right: calc(-1 * var(--gutter));
    top: calc(-1 * var(--svh-fade)); bottom: calc(-1 * var(--space-13));
    background: linear-gradient(180deg,
      color-mix(in srgb, var(--canvas) 0%, transparent) 0,
      color-mix(in srgb, var(--canvas) 52%, transparent) calc(var(--svh-fade) * 0.6),
      color-mix(in srgb, var(--canvas) 90%, transparent) var(--svh-fade),
      var(--canvas) calc(var(--svh-fade) * 1.35));
  }
  .page-hero.svh h1 { max-width: 14ch; }
}
@media (max-width: 640px) {
  .page-hero.svh { --svh-ax: 0.565; --svh-fy: 0.5; padding-bottom: var(--space-8); }
  .svh-stage { --svh-w: max(68cqh * 16 / 9, 200cqw); }
  .svh-veil { background: linear-gradient(180deg, color-mix(in srgb, var(--canvas) 50%, transparent) 0, color-mix(in srgb, var(--canvas) 0%, transparent) 104px); }
  .svh-lock, .svh-pin { display: none; }
  .svh-content .eyebrow { display: none; }   /* phones: the headline leads; the picture gets the room */
  .svh .lede { margin-top: var(--space-5); }
  .svh .hero-actions { margin-top: var(--space-7); }
  .svh .hero-actions .btn-secondary { display: none; }
}
