/* /alternatives-to-surgery: its own sheet, loaded after site.css.
   Five objects run the page, one for each option a person weighs before a
   joint replacement: a dumbbell, a syringe, a spun tube of blood, a vial of
   cells and the implant itself. The hero stands them on one shelf, the
   options list hangs them on a line that fills as it is read, the tinted
   band draws one joint at three stages, the navy band is a clipboard of five
   questions, and the surgery part shows the hardware where the joint was.
   Script: scripts/alternatives-to-surgery.js. With that script absent every
   part is visible, every drawing holds its finished state and every link
   jumps. */

html:has(body.as) {
  --hc-nav-h: 64px;            /* fallback; the script sets the real header height */
  --hc-bar-h: 52px;
  /* every jump, anchor and Tab stop lands below the header and the bar */
  scroll-padding-top: calc(var(--hc-nav-h) + var(--hc-bar-h) + 12px);
}
.as {
  --as-ease: cubic-bezier(.16, 1, .3, 1);
  --as-gut: clamp(20px, 4vw, 56px);
}
.as main { overflow-x: clip; }

/* ============ GROUND RULES ============ */
.as-wrap { max-width: calc(1240px + 2 * var(--as-gut)); margin-inline: auto; padding-inline: var(--as-gut); }
/* text fills its column; the column sets the measure */
:where(.as main) p { max-width: none; margin: 0; }
.as main a:not(.btn) { border-bottom: 0; }
:where(.as main) :is(ul, ol) { list-style: none; margin: 0; padding: 0; }
:where(.as main) h2 {
  font-family: var(--font-display); font-weight: 300; color: var(--ink);
  font-size: clamp(1.9rem, 3.3vw, 3rem); line-height: 1.1; letter-spacing: -.01em;
  margin: 0; max-width: none; text-wrap: wrap;
}
:where(.as main) h3 { margin: 0; max-width: none; text-wrap: wrap; }
/* a heading that has to wrap breaks where the styling changes */
.as main :is(h1, h2) > :is(.h-lead, em) { display: inline-block; }
.as main :is(a, button, summary):focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 3px; border-radius: 4px; }
.as :is(.as-ask, .as-close) :is(a, button):focus-visible { outline-color: var(--accent-ice); }
/* a part that receives focus after a jump is not itself a control */
.as main :is(h1, h2, h3, section, li)[tabindex="-1"]:focus { outline: none; }

/* a word a reader may want to look up, inside a sentence */
.as-term { color: inherit; text-decoration: underline dotted; text-decoration-color: var(--accent-blue); text-decoration-thickness: 1.5px; text-underline-offset: 4px; transition: color 200ms, text-decoration-color 200ms; }
.as-term:hover { color: var(--accent-blue-hover); text-decoration-style: solid; }

/* the onward link: the arrow leans the way it points */
.as-go { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; font-weight: 600; color: var(--accent-blue-hover); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 5px; transition: color 200ms, text-decoration-color 260ms; }
.as-go span { display: inline-block; transition: transform 360ms var(--as-ease); }
.as-go:hover { color: var(--accent-blue); text-decoration-color: currentColor; }
.as-go:hover span { transform: translateX(6px); }
.as-go[href^="#"]:hover span { transform: translateY(4px) rotate(90deg); }
.as-go--back:hover span { transform: translateX(-6px); }
.as-close .as-go { color: var(--accent-ice); }
.as-close .as-go:hover { color: #fff; }

/* the five objects: one hand, one weight of line */
.as-ic { display: block; width: 100%; height: auto; overflow: visible; }
.as-ic .s { fill: none; stroke: var(--ink); stroke-width: var(--as-sw, 1.4); stroke-linecap: round; stroke-linejoin: round; }
.as-ic .f { fill: var(--accent-wash); }
.as-ic .b { stroke: var(--accent-blue); }
.as-ic :is(.bf, .c) { fill: var(--accent-blue); }
.as-ic .c { transform-box: fill-box; transform-origin: center; }

/* ============ REVEALS ============
   Hidden only once the script has said it is running (as-js on <html>), so
   with no script nothing is ever hidden. Each part comes in its own way;
   the drawings are never hidden, they draw. */
.as-js [data-r] { transition: opacity 620ms ease, transform 820ms var(--as-ease); }
.as-js [data-r]:not(.is-in) { opacity: 0; transform: translateY(18px); }
.as-js [data-r="left"]:not(.is-in) { transform: translateX(-28px); }
.as-js [data-r="right"]:not(.is-in) { transform: translateX(32px); }
.as-js [data-r="right"] { transition-delay: calc(var(--i, 0) * 70ms); }
.as-js :is([data-r="opt"], [data-r="stages"], [data-r="clip"], [data-r="cases"], [data-r="implant"]):not(.is-in) { opacity: 1; transform: none; }

@keyframes as-up { from { opacity: 0; transform: translateY(22px); } }
@keyframes as-fade { from { opacity: 0; } }
@keyframes as-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes as-land { from { opacity: 0; transform: translateY(-18px); } 60% { opacity: 1; transform: translateY(3px); } }
@keyframes as-rule { from { transform: scaleX(0); } }
@keyframes as-cell { from { opacity: 0; transform: scale(.2); } 70% { transform: scale(1.25); } }
/* the cells in the vial are alive: they drift, a little, while the vial is on screen */
@keyframes as-drift { 0%, 100% { transform: none; } 50% { transform: translate(1.6px, -2.2px); } }

/* ============ HERO ============ */
.as-hero { padding-block: clamp(20px, 3vw, 36px) clamp(40px, 5vw, 72px); }
.as-hero__h1 { font-family: var(--font-display); font-weight: 300; font-size: clamp(2.1rem, 4.3vw, 3.9rem); line-height: 1.06; letter-spacing: -.015em; color: var(--ink); margin: 0 0 clamp(22px, 2.6vw, 36px); max-width: none; text-wrap: wrap; }
.as-hero__h1 > em { color: var(--accent-blue); }
.as-hero__row { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(24px, 5vw, 88px); align-items: start; }
.as-hero__answer { font-size: clamp(1.12rem, 1.5vw, 1.32rem); line-height: 1.6; color: var(--ink); }
.as-hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.as-hero__reviewed { margin-top: 18px !important; font-size: 14px; line-height: 1.5; color: var(--ink-muted); }

/* the shelf: five objects on one line, each a way down to its own entry */
.as-shelf { position: relative; margin-top: clamp(32px, 4.4vw, 60px); }
.as-shelf ol { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.as-shelf ol::after { content: ""; position: absolute; left: 0; right: 0; top: clamp(98px, 10.4vw, 138px); height: 1.5px; background: var(--ink); transform-origin: left; }
.as-shelf__item { --as-sw: 1.15; display: grid; justify-items: center; gap: 0; padding: 0 8px 4px; color: var(--ink); text-align: center; }
.as-shelf__item .as-ic { width: clamp(76px, 8vw, 108px); margin-bottom: clamp(22px, 2.4vw, 30px); transition: transform 460ms var(--as-ease); }
.as-shelf__item span { position: relative; display: inline-flex; align-items: center; min-height: 44px; font-size: 16px; font-weight: 500; line-height: 1.25; transition: color 200ms; }
.as-shelf__item span::after { content: ""; position: absolute; left: 0; right: 0; bottom: 8px; height: 1.5px; background: var(--accent-blue); transform: scaleX(0); transform-origin: left; transition: transform 360ms var(--as-ease); }
.as-shelf__item:hover span, .as-shelf__item:focus-visible span { color: var(--accent-blue-hover); }
.as-shelf__item:hover span::after, .as-shelf__item:focus-visible span::after { transform: scaleX(1); }
/* pointed at, an object is picked up off the shelf */
.as-shelf__item:hover .as-ic, .as-shelf__item:focus-visible .as-ic { transform: translateY(-8px); }

/* first paint: the words rise, the shelf is ruled, and the five are set down
   on it left to right, each drawn as it lands */
.as-js .as-hero__h1 > * { animation: as-up 900ms var(--as-ease) both; }
.as-js .as-hero__h1 > em { animation-delay: 110ms; }
.as-js .as-hero__answer { animation: as-up 900ms var(--as-ease) 240ms both; }
.as-js .as-hero__side { animation: as-up 900ms var(--as-ease) 340ms both; }
.as-js .as-shelf ol::after { animation: as-rule 1100ms var(--as-ease) 380ms both; }
.as-js .as-shelf li { animation: as-land 620ms var(--as-ease) calc(620ms + var(--i) * 150ms) both; }
.as-js .as-shelf .as-ic .s { stroke-dasharray: 1; animation: as-draw 900ms var(--as-ease) calc(700ms + var(--i) * 150ms) both; }
.as-js .as-shelf .as-ic :is(.f:not(.s), .bf) { animation: as-fade 500ms ease calc(1200ms + var(--i) * 150ms) both; }
.as-js .as-shelf .as-ic .c { animation: as-cell 520ms var(--as-ease) calc(1750ms + var(--i) * 80ms) both; }
/* the pop-in is named again here, or the drift would replace it and the cells would be there before the vial */
.as-js .as-shelf.is-live .as-ic .c { animation: as-cell 520ms var(--as-ease) calc(1750ms + var(--i) * 80ms) both, as-drift 5.2s ease-in-out calc(2600ms + var(--i) * 420ms) infinite; }

/* ============ CONTENTS BAR (follows the reader) ============ */
.as .hc-bar {
  /* under the phone menu's sheet (55) and backdrop (50), over the page */
  position: fixed; left: 0; right: 0; top: var(--hc-nav-h); z-index: 49;
  height: var(--hc-bar-h);
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  transform: translateY(-8px); opacity: 0; visibility: hidden;
  transition: opacity 260ms, transform 360ms var(--as-ease), visibility 0s 360ms;
}
.as .hc-bar.is-on { transform: none; opacity: 1; visibility: visible; transition: opacity 260ms, transform 360ms var(--as-ease); }
body.as.nav-open .hc-bar { opacity: 0; visibility: hidden; }
.as .hc-bar__track {
  max-width: calc(1240px + 2 * var(--as-gut)); margin: 0 auto; padding: 0 var(--as-gut);
  height: 100%; display: flex; align-items: stretch; gap: clamp(18px, 2.4vw, 32px);
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; scroll-padding-inline: 28px;
}
.as .hc-bar__track::-webkit-scrollbar { display: none; }
.as .hc-bar__track a {
  position: relative; flex: none; display: flex; align-items: center;
  font-size: 14px; font-weight: 500; color: var(--ink-muted); white-space: nowrap;
  transition: color 200ms;
}
.as .hc-bar__track a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--accent-blue); transform: scaleX(0); transform-origin: left;
  transition: transform 360ms var(--as-ease);
}
.as .hc-bar__track a:hover, .as .hc-bar__track a[aria-current] { color: var(--ink); }
.as .hc-bar__track a:hover::after { transform: scaleX(.35); }
.as .hc-bar__track a[aria-current]::after { transform: scaleX(1); }
.as .hc-bar__track a:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: -4px; border-radius: 4px; }
.as .hc-bar__progress {
  position: absolute; left: 0; top: 0; height: 2px; width: 100%;
  background: var(--accent-ice); transform-origin: left; transform: scaleX(var(--hc-p, 0));
}
/* the track runs off a phone's edge: a fade says there is more */
.as .hc-bar::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 36px; background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff 80%); pointer-events: none; opacity: 0; transition: opacity 200ms; }
.as .hc-bar.has-more::after { opacity: 1; }

/* ============ THE OPTIONS: five entries on one line ============ */
.as-options { padding-block: clamp(48px, 6vw, 96px) clamp(56px, 7vw, 104px); border-top: 1px solid var(--border); }
.as-options__head { display: grid; gap: 18px; margin-bottom: clamp(28px, 4vw, 52px); }
.as-options__head p { font-size: clamp(1.08rem, 1.4vw, 1.25rem); line-height: 1.6; color: var(--ink-soft); }
.as-opt { --as-pad: clamp(16px, 2vw, 26px); --as-badge: 76px; position: relative; display: grid; grid-template-columns: var(--as-badge) minmax(0, 1fr) minmax(0, 220px); gap: 0 clamp(20px, 3vw, 44px); align-items: start; padding-block: var(--as-pad); scroll-margin-top: 8px; }
.as-opt__badge { --as-sw: 2; position: relative; z-index: 1; display: grid; place-items: center; width: var(--as-badge); height: var(--as-badge); border-radius: 50%; background: #fff; border: 1.5px solid var(--border-strong); transition: border-color 500ms, background 500ms; }
.as-opt__badge .as-ic { width: 46px; }
.as-opt__body { padding-top: 6px; }
.as-opt h3 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.45rem, 2.1vw, 1.9rem); line-height: 1.15; color: var(--ink); margin-bottom: 10px; }
.as-opt__body p { font-size: 17px; line-height: 1.68; color: var(--ink-soft); }
.as-opt__kind { padding-top: 16px; font-size: 15px; line-height: 1.4; color: var(--ink-muted); text-align: right; }
/* one connector per gap, badge to badge, and nothing after the last */
.as-opt:not(:last-child)::before, .as-opt:not(:last-child)::after { content: ""; position: absolute; left: calc(var(--as-badge) / 2 - 1px); top: calc(var(--as-pad) + var(--as-badge)); bottom: calc(-1 * var(--as-pad)); width: 2px; }
.as-opt:not(:last-child)::before { background: var(--border-strong); }
.as-opt:not(:last-child)::after { background: var(--accent-blue); transform-origin: top; transition: transform 700ms var(--as-ease); }
/* the line fills entry by entry as the reader passes each one */
.as-opts[data-live] .as-opt:not(.is-passed)::after { transform: scaleY(0); }
/* scripts off or reduced motion: the finished state, blue line and blue rings alike */
.as-opts:not([data-live]) .as-opt__badge, .as-opt.is-passed .as-opt__badge { border-color: var(--accent-blue); }
/* each object is drawn when its entry arrives, and the words follow it */
.as-js .as-opt:not(.is-in) .as-ic .s { stroke-dasharray: 1; stroke-dashoffset: 1; }
.as-js .as-opt:not(.is-in) .as-ic :is(.f:not(.s), .bf, .c) { opacity: 0; }
.as-js .as-opt:not(.is-in) :is(.as-opt__body, .as-opt__kind) { opacity: 0; transform: translateX(22px); }
.as-js .as-opt :is(.as-opt__body, .as-opt__kind) { transition: opacity 620ms ease 120ms, transform 820ms var(--as-ease) 120ms; }
.as-js .as-opt.is-in .as-ic .s { stroke-dasharray: 1; animation: as-draw 1000ms var(--as-ease) both; }
.as-js .as-opt.is-in .as-ic :is(.f:not(.s), .bf) { animation: as-fade 500ms ease 600ms both; }
.as-js .as-opt.is-in .as-ic .c { animation: as-cell 520ms var(--as-ease) calc(800ms + var(--i) * 80ms) both; }

/* ============ BY STAGE (the one tinted band) ============ */
.as-stage { background: var(--accent-wash); padding-block: clamp(56px, 7vw, 104px); }
.as-stage__head { display: grid; gap: 16px; margin-bottom: clamp(32px, 4vw, 56px); }
.as-stage__head p { font-family: var(--font-display); font-weight: 300; font-size: clamp(1.35rem, 2.1vw, 1.9rem); line-height: 1.28; color: var(--accent-blue-hover); }
/* every part of a stage starts level with the same part of its neighbours,
   down to each line of the three short lists */
.as-stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(7, auto); gap: 0 clamp(24px, 4vw, 64px); }
.as-stg { position: relative; display: grid; grid-row: span 7; grid-template-rows: subgrid; align-content: start; }
@supports not (grid-template-rows: subgrid) { .as-stg, .as-stg ul { grid-template-rows: none; } .as-stg ul { grid-row: auto; } }
.as-stg__when { position: relative; margin-top: clamp(18px, 2vw, 26px) !important; padding-top: 22px; font-size: 16px; font-weight: 600; color: var(--accent-blue-hover); }
/* the three stages sit on one line of time, drawn stop to stop */
.as-stg__when::before { content: ""; position: absolute; left: 0; top: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--accent-blue-hover); }
.as-stg:not(:last-child) .as-stg__when::after { content: ""; position: absolute; left: 12px; top: 5px; width: calc(100% + clamp(24px, 4vw, 64px) - 12px); height: 2px; background: var(--accent-blue-hover); transform-origin: left; }
.as-stg h3 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.4rem, 2vw, 1.8rem); line-height: 1.18; color: var(--ink); margin: 8px 0 10px; }
.as-stg > p:not(.as-stg__when) { font-size: 17px; line-height: 1.65; color: var(--ink-soft); }
.as-stg ul { grid-row: span 3; display: grid; grid-template-rows: subgrid; margin-top: 18px !important; padding-top: 12px !important; border-top: 1px solid var(--border-strong); }
.as-stg li { position: relative; padding: 4px 0 4px 16px; font-size: 16px; line-height: 1.5; color: var(--ink); }
.as-stg li::before { content: ""; position: absolute; left: 0; top: calc(4px + .62em); width: 6px; height: 6px; border-radius: 50%; background: var(--accent-blue); }

/* one joint, three times: the cartilage thins and the bones close */
.as-joint { display: block; width: min(100%, 164px); height: auto; overflow: visible; }
.as-joint__bone { fill: #fff; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.as-joint__cart { fill: none; stroke: var(--accent-blue); stroke-linecap: round; stroke-width: var(--as-cw); transition: stroke-width 1500ms var(--as-ease) var(--as-wait, 0ms), opacity 900ms ease var(--as-wait, 0ms); }
.as-joint__femur { transform: translateY(var(--as-dy)); transition: transform 1500ms var(--as-ease) var(--as-wait, 0ms); }
.as-joint--early { --as-cw: 9; --as-dy: 0px; }
.as-joint--middle { --as-cw: 4.5; --as-dy: 4.5px; --as-wait: 350ms; }
.as-joint--late { --as-cw: 0; --as-dy: 11px; --as-wait: 700ms; }
.as-joint--late .as-joint__cart { opacity: 0; }
/* until the band arrives all three are the early joint; then each wears to its own stage */
.as-js [data-r="stages"]:not(.is-in) .as-joint__cart { stroke-width: 9; opacity: 1; }
.as-js [data-r="stages"]:not(.is-in) .as-joint__femur { transform: none; }
.as-js [data-r="stages"]:not(.is-in) .as-stg > :not(svg) { opacity: 0; transform: translateY(14px); }
.as-js [data-r="stages"] .as-stg > :not(svg) { transition: opacity 620ms ease, transform 820ms var(--as-ease); }
.as-js [data-r="stages"] .as-stg:nth-child(2) > :not(svg) { transition-delay: 350ms; }
.as-js [data-r="stages"] .as-stg:nth-child(3) > :not(svg) { transition-delay: 700ms; }
.as-js [data-r="stages"]:not(.is-in) .as-stg__when::after { transform: scaleX(0); }
.as-js [data-r="stages"] .as-stg__when::after { transition: transform 900ms var(--as-ease) 300ms; }
.as-js [data-r="stages"] .as-stg:nth-child(2) .as-stg__when::after { transition-delay: 650ms; }

/* ============ ASK YOUR SURGEON (navy) ============ */
.as-ask { background: var(--navy-brand); color: #fff; padding-block: clamp(56px, 7vw, 104px); }
.as-ask h2 { color: #fff !important; }
.as-ask__head { display: grid; gap: 18px; margin-bottom: clamp(32px, 4vw, 56px); }
.as-ask__head p { font-size: clamp(1.08rem, 1.4vw, 1.25rem); line-height: 1.6; color: rgba(255, 255, 255, .86); }
.as-ask__grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(32px, 5vw, 88px); align-items: start; }
.as-ask__side { position: sticky; top: calc(var(--hc-nav-h) + var(--hc-bar-h) + 28px); display: grid; gap: clamp(20px, 2.4vw, 30px); }
.as-ask__allowed { display: grid; gap: 14px; }
.as-ask__allowed p { font-size: 17px; line-height: 1.65; color: rgba(255, 255, 255, .84); }
.as-ask__list li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 0 clamp(16px, 2vw, 24px); padding-block: clamp(20px, 2.4vw, 30px); border-top: 1px solid rgba(255, 255, 255, .2); }
.as-ask__list li:first-child { padding-top: 0; border-top: 0; }
.as-ask__list li:last-child { padding-bottom: 0; }
.as-ask__box { width: 22px; height: 22px; margin-top: 7px; border: 1.5px solid var(--accent-ice); border-radius: 4px; }
.as-ask__list h3 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.4rem, 2.1vw, 1.9rem); line-height: 1.18; color: #fff; margin-bottom: 8px; }
.as-ask__list p { font-size: 17px; line-height: 1.65; color: rgba(255, 255, 255, .84); }

/* the clipboard: five lines, one for each question; the one being read is lit */
.as-clip { display: block; width: min(100%, 230px); height: auto; overflow: visible; }
.as-clip__board { fill: rgba(255, 255, 255, .05); stroke: rgba(255, 255, 255, .5); stroke-width: 1.5; }
.as-clip__clasp { fill: var(--navy-brand); stroke: var(--accent-ice); stroke-width: 1.5; }
.as-clip__row rect { fill: none; stroke: rgba(255, 255, 255, .55); stroke-width: 1.5; transition: fill 400ms, stroke 400ms; }
.as-clip__row path { fill: none; stroke: rgba(255, 255, 255, .55); stroke-width: 2; stroke-linecap: round; transition: stroke 400ms; }
.as-clip__row.is-lit rect { fill: var(--accent-ice); stroke: var(--accent-ice); }
.as-clip__row.is-lit path { stroke: #fff; }
.as-js [data-r="clip"]:not(.is-in) .as-clip__row path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.as-js [data-r="clip"]:not(.is-in) .as-clip__row rect { opacity: 0; }
.as-js [data-r="clip"].is-in .as-clip__row path { stroke-dasharray: 1; animation: as-draw 700ms var(--as-ease) calc(200ms + var(--i) * 140ms) both; }
.as-js [data-r="clip"].is-in .as-clip__row rect { animation: as-fade 400ms ease calc(150ms + var(--i) * 140ms) both; }

/* ============ WHEN IT IS SURGERY ============ */
.as-surgery { padding-block: clamp(56px, 7vw, 104px) clamp(48px, 5vw, 72px); }
.as-surgery h2 { margin-bottom: clamp(24px, 3vw, 44px) !important; }
.as-surgery__grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 5vw, 88px); align-items: start; }
.as-surgery__text { display: grid; gap: 20px; }
.as-surgery__text p { font-size: 17px; line-height: 1.68; color: var(--ink-soft); }
.as-surgery__text .as-surgery__lead { font-size: clamp(1.12rem, 1.5vw, 1.3rem); line-height: 1.6; color: var(--ink); }
/* three cases, named whole, each closed by a ruled line */
.as-cases li { position: relative; padding-block: 14px; font-family: var(--font-display); font-weight: 400; font-size: clamp(1.3rem, 1.9vw, 1.7rem); line-height: 1.22; color: var(--ink); }
.as-cases li::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px; background: var(--ink); transform-origin: left; }
.as-js [data-r="cases"]:not(.is-in) li { opacity: 0; transform: translateX(-18px); }
.as-js [data-r="cases"]:not(.is-in) li::after { transform: scaleX(0); }
.as-js [data-r="cases"] li { transition: opacity 600ms ease calc(var(--n) * 160ms), transform 800ms var(--as-ease) calc(var(--n) * 160ms); }
.as-js [data-r="cases"] li::after { transition: transform 900ms var(--as-ease) calc(200ms + var(--n) * 160ms); }
.as-cases li:nth-child(1) { --n: 0; } .as-cases li:nth-child(2) { --n: 1; } .as-cases li:nth-child(3) { --n: 2; }

.as-surgery__side { display: grid; gap: clamp(24px, 3vw, 40px); }
.as-surgery__fig { margin: 0; display: grid; justify-items: center; }
.as-implant { display: block; width: min(100%, 230px); height: auto; overflow: visible; }
.as-implant__bone { fill: none; stroke: var(--ink-muted); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 3 6; }
.as-implant__metal { fill: #fff; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.as-implant__spacer { fill: var(--accent-wash); stroke: var(--accent-blue); stroke-width: 1.8; }
/* the bones are there first; the hardware is drawn into the place the joint was */
.as-js [data-r="implant"]:not(.is-in) .as-implant__metal { stroke-dasharray: 1; stroke-dashoffset: 1; fill-opacity: 0; }
.as-js [data-r="implant"]:not(.is-in) .as-implant__spacer { opacity: 0; }
.as-js [data-r="implant"].is-in .as-implant__metal { stroke-dasharray: 1; animation: as-draw 1300ms var(--as-ease) 200ms both, as-fill 600ms ease 1200ms both; }
.as-js [data-r="implant"].is-in .as-implant__spacer { animation: as-fade 600ms ease 1300ms both; }
@keyframes as-fill { from { fill-opacity: 0; } }
.as-surgery__say { font-family: var(--font-display); font-weight: 300; font-style: italic; font-size: clamp(1.3rem, 1.9vw, 1.7rem); line-height: 1.3; color: var(--ink); padding-left: clamp(18px, 2vw, 26px); border-left: 3px solid var(--accent-blue); }

/* ============ QUESTIONS ============ */
.as-faq { padding-block: 0 clamp(56px, 7vw, 104px); }
.as-faq__grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(24px, 5vw, 88px); align-items: start; }
.as-faq__grid::before { content: ""; grid-column: 1 / -1; height: 1px; background: var(--border); margin-bottom: clamp(32px, 4vw, 56px); }
.as-q { border-top: 1px solid var(--border-strong); }
.as-q:last-child { border-bottom: 1px solid var(--border-strong); }
.as-q summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 44px; padding-block: 20px; cursor: pointer; list-style: none; font-family: var(--font-display); font-weight: 400; font-size: clamp(1.25rem, 1.8vw, 1.55rem); line-height: 1.25; color: var(--ink); transition: color 200ms; }
.as-q summary::-webkit-details-marker { display: none; }
.as-q summary:hover { color: var(--accent-blue-hover); }
.as-q__ic { position: relative; flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border-strong); transition: border-color 200ms, background 200ms, transform 420ms var(--as-ease); }
.as-q__ic::before, .as-q__ic::after { content: ""; position: absolute; left: 50%; top: 50%; width: 11px; height: 1.5px; margin: -.75px 0 0 -5.5px; background: var(--ink); transition: transform 420ms var(--as-ease), background 200ms; }
.as-q__ic::after { transform: rotate(90deg); }
.as-q summary:hover .as-q__ic { border-color: var(--accent-blue); }
.as-q[open] .as-q__ic { transform: rotate(180deg); background: var(--ink); border-color: var(--ink); }
.as-q[open] .as-q__ic::before, .as-q[open] .as-q__ic::after { background: #fff; }
.as-q[open] .as-q__ic::after { transform: rotate(0deg); }
.as-q__a { padding-bottom: 22px; }
.as-q__a p { font-size: 17px; line-height: 1.68; color: var(--ink-soft); }
@keyframes as-unfold { from { opacity: 0; transform: translateY(-8px); } }
.as-q[open] .as-q__a { animation: as-unfold 420ms var(--as-ease); }

/* ============ CLOSING (navy) ============ */
.as-close { background: var(--navy-brand); color: #fff; padding-block: clamp(64px, 8vw, 120px) clamp(40px, 5vw, 64px); text-align: center; }
.as-close__inner { display: grid; justify-items: center; }
.as-close h2 { color: #fff !important; font-size: clamp(2.1rem, 4vw, 3.4rem) !important; margin-bottom: 20px !important; }
.as-close h2 em { color: var(--accent-ice); }
/* the one narrow, centred block on the page: the call */
.as-close__inner > p { max-width: 640px !important; font-size: 17px; line-height: 1.7; color: rgba(255, 255, 255, .84); margin-bottom: 32px !important; }
.as-close .as-close__fine { margin: 26px 0 0 !important; font-size: 13px; line-height: 1.6; color: rgba(255, 255, 255, .74); }
.as-more { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px clamp(20px, 3vw, 44px); width: 100%; margin-top: clamp(40px, 5vw, 64px); padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .18); }

/* ============ SMALL COURTESIES ============ */
/* the list can leave with the reader: copied, or printed on one sheet.
   The two controls exist only once the script that runs them does. */
.as-ask__tools { display: none; flex-wrap: wrap; gap: 12px; align-items: center; }
.as-ready .as-ask__tools { display: flex; }
.as-tool { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; white-space: nowrap; padding: 0 18px; background: transparent; color: #fff; font: 500 15px/1 var(--font-body); letter-spacing: .01em; border: 1px solid rgba(255, 255, 255, .5); border-radius: 4px; cursor: pointer; transition: background 200ms, border-color 200ms, transform 200ms var(--as-ease); }
.as-tool:hover { background: rgba(255, 255, 255, .08); border-color: var(--accent-ice); }
.as-tool:active { transform: scale(.97); }
.as-tool__ic { position: relative; flex: none; width: 18px; height: 18px; transition: transform 360ms var(--as-ease); }
.as-tool:hover .as-tool__ic { transform: translateY(-2px); }
.as-tool__ic svg { position: absolute; inset: 0; width: 18px; height: 18px; fill: none; stroke: var(--accent-ice); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: opacity 200ms; }
.as-tool__ic svg + svg { opacity: 0; stroke: #fff; stroke-width: 2; }
/* both wordings share one cell, so the control keeps its size when it answers */
.as-tool__label { display: grid; text-align: left; }
.as-tool__label > span { grid-area: 1 / 1; transition: opacity 200ms; }
.as-tool__label > span + span { opacity: 0; }
.as-tool.is-done .as-tool__label > span:first-child, .as-tool.is-done .as-tool__ic svg:first-child { opacity: 0; }
.as-tool.is-done .as-tool__label > span + span, .as-tool.is-done .as-tool__ic svg + svg { opacity: 1; }
.as-tool.is-done .as-tool__ic svg + svg path { stroke-dasharray: 1; animation: as-draw 420ms var(--as-ease) both; }
.as-ask__said { flex-basis: 100%; min-height: 1.5em; font-size: 15px !important; line-height: 1.5 !important; color: var(--accent-ice) !important; }
/* taken: every line on the clipboard is ticked, top to bottom */
.as-clip__tick { fill: none; stroke: var(--navy-brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.as-clip.is-taken .as-clip__row rect { fill: var(--accent-ice); stroke: var(--accent-ice); transition-delay: calc(var(--i) * 90ms); }
.as-clip.is-taken .as-clip__tick { opacity: 1; stroke-dasharray: 1; animation: as-draw 380ms var(--as-ease) calc(120ms + var(--i) * 90ms) both; }

/* a press is felt before the page answers it */
.as-go:active span { transform: translateX(2px) scale(.94); }
.as .hc-bar__track a:active { color: var(--accent-blue-hover); }
.as-shelf__item:active .as-ic { transform: translateY(-2px) scale(.96); }
.as-q summary:active .as-q__ic { transform: scale(.9); }
.as-q[open] summary:active .as-q__ic { transform: rotate(180deg) scale(.9); }
/* selected text takes the page's own blue, and stays legible on navy */
.as main ::selection { background: var(--accent-blue); color: #fff; }

/* a part reached by a jump says so, once */
@keyframes as-here { from { background-size: 100% .12em; } to { background-size: 0 .12em; } }
.as-js main :is(h2, h3).is-landed { background: linear-gradient(var(--accent-ice), var(--accent-ice)) left 100% / 0 .12em no-repeat; animation: as-here 1400ms var(--as-ease) 200ms backwards; }


/* ============ NARROWER ============ */
@media (max-width: 899px) {
  .as-hero__row, .as-ask__grid, .as-surgery__grid, .as-faq__grid { grid-template-columns: minmax(0, 1fr); }
  .as-ask__side { position: static; grid-template-columns: 120px minmax(0, 1fr); align-items: start; order: 2; }
  .as-ask__tools { grid-column: 1 / -1; }
  .as-opt { grid-template-columns: var(--as-badge) minmax(0, 1fr); --as-badge: 60px; }
  .as-opt__badge .as-ic { width: 36px; }
  .as-opt__badge { --as-sw: 2.4; }
  .as-opt__body { padding-top: 0; }
  .as-opt__kind { grid-column: 2; padding-top: 8px; text-align: left; }
  .as-surgery__side { grid-template-columns: 130px minmax(0, 1fr); align-items: center; }
}
@media (max-width: 759px) {
  /* down a phone the three stages follow one another, each with its own joint */
  .as-stages { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; gap: 40px; }
  .as-stg { grid-row: auto; grid-template-rows: none; grid-template-columns: 112px minmax(0, 1fr); gap: 0 20px; }
  .as-stg > * { grid-column: 2; }
  .as-stg > svg { grid-column: 1; grid-row: 1 / span 3; width: 112px; align-self: start; }
  .as-stg__when { margin-top: 0 !important; padding-top: 0; }
  .as-stg__when::before, .as-stg .as-stg__when::after { content: none !important; }
  .as-stg ul { grid-column: 1 / -1; grid-row: auto; grid-template-rows: none; }
  /* and the shelf keeps its five objects and drops their names: the entries
     they lead to are the next thing down the page */
  .as-shelf ol::after { top: 66px; }
  .as-shelf__item { --as-sw: 1.7; padding: 0 0 22px; min-height: 88px; }
  .as-shelf__item .as-ic { width: 48px; margin-bottom: 0; }
  .as-shelf__item span { position: absolute; width: 1px; height: 1px; min-height: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (max-width: 599px) {
  .as-hero__actions .btn { width: 100%; }
  .as-more { flex-direction: column; align-items: flex-start; }
  .as-close { text-align: left; }
  .as-close__inner { justify-items: start; }
  .as-close .btn { width: 100%; }
  .as-close__inner > div { width: 100%; }
}

/* ============ REDUCED MOTION: the end states, held ============
   The script adds as-js only when motion is welcome; these hold the page
   still if the setting changes while it is open. */
@media (prefers-reduced-motion: reduce) {
  .as main *, .as main *::before, .as main *::after { animation: none !important; transition: none !important; }
  .as-js [data-r], .as-js [data-r] :is(.as-opt__body, .as-opt__kind, .as-cases li), .as-js [data-r="stages"] .as-stg > :not(svg) { opacity: 1 !important; transform: none !important; }
  .as-js [data-r] :is(.as-ic *, .as-clip__row rect, .as-implant__spacer) { opacity: 1 !important; }
  .as-js [data-r] :is(.s, .as-clip__row path, .as-implant__metal) { stroke-dashoffset: 0 !important; fill-opacity: 1 !important; }
  .as-js [data-r="stages"] .as-joint__femur { transform: translateY(var(--as-dy)) !important; }
  .as-js [data-r="stages"] .as-joint__cart { stroke-width: var(--as-cw) !important; }
  .as-js [data-r="stages"] .as-joint--late .as-joint__cart { opacity: 0 !important; }
  .as .as-opt::after, .as .as-cases li::after, .as .as-stg__when::after { transform: none !important; }
  .as-clip.is-taken .as-clip__tick, .as-tool.is-done .as-tool__ic svg + svg path { stroke-dasharray: none; }
}

/* ============ PRINT: the finished page, dark on white ============ */
@media print {
  .as .hc-bar, .as-go[href^="#"], .as-q__ic { display: none !important; }
  .as main *, .as main *::before, .as main *::after { animation: none !important; transition: none !important; }
  .as-js [data-r], .as-js [data-r] :is(.as-opt__body, .as-opt__kind, .as-cases li), .as-js [data-r="stages"] .as-stg > :not(svg) { opacity: 1 !important; transform: none !important; }
  .as-js [data-r] :is(.as-ic *, .as-clip__row rect, .as-implant__spacer) { opacity: 1 !important; }
  .as-js [data-r] :is(.s, .as-clip__row path, .as-implant__metal) { stroke-dashoffset: 0 !important; fill-opacity: 1 !important; }
  .as-js [data-r="stages"] .as-joint__femur { transform: translateY(var(--as-dy)) !important; }
  .as-js [data-r="stages"] .as-joint__cart { stroke-width: var(--as-cw) !important; }
  .as-js [data-r="stages"] .as-joint--late .as-joint__cart { opacity: 0 !important; }
  .as .as-opt::after, .as .as-cases li::after, .as .as-stg__when::after { transform: none !important; }
  .as-stage, .as-ask, .as-close { background: none !important; color: var(--ink) !important; }
  .as :is(.as-ask, .as-close) :is(h2, h3, p, em, a, li) { color: var(--ink) !important; }
  .as-ask__box { border-color: var(--ink); }
  .as-ask__list li { border-color: var(--ink-muted); }
  .as-ask__fig { display: none; }
  .as-ask__side { position: static; }
  .as-opt__badge { border-color: var(--ink) !important; }
  .as-opt, .as-stg, .as-q, .as-ask__list li, .as-surgery__fig, .as-cases { break-inside: avoid; }
  .as-ask__tools { display: none !important; }
  .as-clip__tick { opacity: 0 !important; }
  /* "Print the list": the five questions and nothing else, on one sheet */
  .as-only-list body > :not(main), .as-only-list main > :not(.as-ask) { display: none !important; }
  .as-only-list .as-ask { padding: 0 !important; }
  .as-only-list .as-ask__grid { grid-template-columns: minmax(0, 1fr) !important; }
  .as-only-list .as-ask__side { order: 2; }
}
