/* DX Medical v5.0 — Tactile Spring Physics & Sliding Pill Motion
   15%-overshoot Apple spring feel on touch/click, composed & dignified at rest. */
:root {
  --dx-spring: cubic-bezier(.34,1.56,.64,1);
}
@supports (animation-timing-function: linear(0, 1)) {
  :root {
    --dx-spring: linear(0,.22 6%,.66 14%,1.05 24%,1.15 34%,1.10 45%,.985 60%,.975 72%,1.008 86%,1);
  }
}

.fx-control {
  position: relative;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
  translate: var(--mag-x, 0px) calc(var(--mag-y, 0px) + var(--lift-y, 0px));
  transition: translate .46s var(--dx-spring), scale .46s var(--dx-spring), transform .32s ease-out, color .18s ease, background-color .18s ease, border-color .2s ease, box-shadow .24s ease;
}

.fx-control:is(.btn,.choice-pill,.explore-toggle,.copy-draft,.photo-dot,.henan-tab,.footer-btn,.selection-open-btn,.wizard-step-tab):is(:active,:hover) {
  transform: none;
}

/* Warm silk sheen sweep on hover only */
.fx-control:where(.btn,.choice-pill,.explore-toggle,.copy-draft,.lang-wrap,.footer-btn,.selection-open-btn)::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, rgb(255 250 240 / .24) 50%, transparent 62%) -115% 0/46% 100% no-repeat;
}
@keyframes silkSheen {
  0% { background-position: -115% 0; }
  100% { background-position: 215% 0; }
}

.fx-control:not(.gallery-media-btn,.culture-media-btn,input,.cover-dot,#chapterNav a,.welcome-door)::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(110px ellipse at var(--shine-x,50%) var(--shine-y,50%), rgb(246 232 208 / .20), transparent 82%);
  transition: opacity .2s ease;
}

@media (hover:hover) and (pointer:fine) {
  html:not([data-quiet]) .fx-control.fx-hover {
    --lift-y: -2px;
    --rest-scale: 1.022;
    scale: var(--rest-scale);
  }
  html:not([data-quiet]) .fx-control:is(.btn,.choice-pill,.explore-toggle,.footer-btn,.selection-open-btn).fx-hover {
    --lift-y: -3.5px;
    --rest-scale: 1.032;
    scale: var(--rest-scale);
    box-shadow: 0 12px 26px -12px rgb(28 20 14 / .30);
  }
  html:not([data-quiet]) .fx-control:is(.gallery-media-btn,.culture-media-btn,summary,input).fx-hover {
    --lift-y: 0px;
    --rest-scale: 1.006;
    scale: var(--rest-scale);
  }
  html:not([data-quiet]) .glide-host .fx-control.fx-hover {
    --lift-y: -1px;
    --rest-scale: 1.012;
    scale: var(--rest-scale);
  }
  .fx-control.fx-hover:not(.gallery-media-btn,.culture-media-btn,input,.cover-dot,#chapterNav a,.welcome-door)::after {
    opacity: .65;
  }
  .fx-control.fx-hover:where(.btn,.choice-pill,.explore-toggle,.copy-draft,.footer-btn,.selection-open-btn)::before {
    animation: silkSheen .62s cubic-bezier(.22,1,.36,1) 1;
  }
  .fx-control :is(svg,.flow-arrow,.btn-arrow-down) {
    transition: scale .42s var(--dx-spring), translate .42s var(--dx-spring);
  }
  html:not([data-quiet]) .fx-control.fx-hover :is(svg):not(.lang-icon,.lang-chevron) {
    scale: 1.08;
  }
  html:not([data-quiet]) .fx-control.fx-hover .flow-arrow {
    translate: 3.5px 0;
  }
  html[dir=rtl]:not([data-quiet]) .fx-control.fx-hover .flow-arrow {
    translate: -3.5px 0;
  }
  html:not([data-quiet]) .fx-control.fx-hover .btn-arrow-down {
    translate: 0 3px;
  }
}

/* Tactile press squish + crisp upward spring hop on release */
html:not([data-quiet]) .fx-control.is-pressing,
html:not([data-quiet]) .fx-control.fx-hover.is-pressing {
  scale: .94;
  translate: var(--mag-x,0px) calc(var(--mag-y,0px) + 2px);
  transition-duration: .075s;
  transition-timing-function: ease-out;
}
.fx-control.is-jelly {
  --release-motion: jellyRebound .46s both;
  animation: var(--release-motion);
}
@keyframes jellyRebound {
  0% { scale: .94; translate: var(--mag-x,0px) calc(var(--mag-y,0px) + 2px); }
  35% { scale: 1.045; translate: var(--mag-x,0px) calc(var(--mag-y,0px) + var(--lift-y,0px) - 3.5px); }
  65% { scale: .994; translate: var(--mag-x,0px) calc(var(--mag-y,0px) + var(--lift-y,0px) + 0.8px); }
  100% { scale: var(--rest-scale,1); translate: var(--mag-x,0px) calc(var(--mag-y,0px) + var(--lift-y,0px)); }
}

/* Brushed-brass selection ring */
.is-pop-select > .fx-selection-ring {
  position: absolute;
  pointer-events: none;
  z-index: 2;
  inset: 1px;
  border-radius: inherit;
  border: 1.5px solid rgb(214 176 116 / .82);
  animation: selectionRing .5s cubic-bezier(.14,.62,.24,1) both;
}
@keyframes selectionRing {
  from { opacity: .92; scale: .97; }
  to { opacity: 0; scale: 1.06; }
}

/* Delicate champagne click micro-droplets */
#fxBurstLayer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  contain: strict;
  pointer-events: none;
  z-index: 95;
}
#fxBurstLayer .pop-bubble {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 32%, rgb(255 248 232 / .95), rgb(214 176 116 / .65) 65%, transparent 100%);
  box-shadow: inset 0 0 0 1px rgb(184 139 74 / .55);
  animation: popBurst .62s cubic-bezier(.16,.84,.36,1) both;
}
@keyframes popBurst {
  0% { opacity: .72; transform: translate(-50%,-50%) scale(.4); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx,0px)), calc(-50% + var(--dy,0px))) scale(1.1); }
}

/* Whisper-delicate warm champagne silk ripple */
.fx-wave-plane {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}
.fx-ripple {
  pointer-events: none;
  position: absolute;
  border-radius: 50%;
  translate: -50% -50%;
  background: radial-gradient(circle, transparent 26%, rgb(214 176 116 / .22) 68%, rgb(255 252 247 / .46) 94%, transparent 100%);
  animation: liquidRipple .52s cubic-bezier(.18,.64,.24,1) both;
}
@keyframes liquidRipple {
  from { scale: .04; opacity: .82; }
  to { scale: 1; opacity: 0; }
}

/* Matte Architectural Segmented Tracks + High-Contrast Sliding Pills */
.henan-tabs.glide-host,
.photo-switcher.glide-host {
  position: relative;
  isolation: isolate;
  overflow: clip;
  background: #241C16;
  border: 1px solid rgb(214 176 116 / .30);
  box-shadow: 0 4px 14px rgb(28 20 14 / .16);
}
.glide-host > .glide-pill {
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  opacity: 0;
  border-radius: 999px;
  background: #8C4126;
  border: 1px solid rgb(214 176 116 / .45);
  box-shadow: 0 2px 6px rgb(18 12 8 / .30);
  transform: translate3d(var(--glide-x,0), var(--glide-y,0), 0);
  transition: transform .46s var(--dx-spring), width .46s var(--dx-spring), height .46s var(--dx-spring), opacity .14s;
}
.glide-host > .glide-pill.placed { opacity: 1; }

.henan-tabs > .glide-pill {
  background: #D6B074;
  border-color: #E2BE84;
  box-shadow: 0 2px 8px rgb(18 12 8 / .30);
}
@media (max-width: 768px) {
  .henan-tabs > .glide-pill { border-radius: 13px; }
}
.photo-switcher > .glide-pill {
  background: #FFFCF7;
  border-color: #FFFCF7;
  box-shadow: 0 2px 8px rgb(18 12 8 / .28);
}

.glide-host > :is(.henan-tab,.photo-dot),
.glide-host > :is(.henan-tab,.photo-dot):is(.active,:hover,.glide-target) {
  position: relative;
  z-index: 1;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: #F6F1E9;
}
.glide-host > :is(.henan-tab,.photo-dot).glide-target {
  color: #1C1612;
  font-weight: 700;
}

@media (min-width: 960px) {
  #chapterNav.glide-host {
    position: relative;
    isolation: isolate;
  }
  #chapterNav .glide-pill {
    background: #EFE8DC;
    border: 1px solid rgb(36 27 20 / .09);
    box-shadow: none;
  }
  #chapterNav.glide-host > a {
    position: relative;
    z-index: 1;
    border-radius: 999px;
  }
}
@media (max-width: 959px) {
  #chapterNav > .glide-pill { display: none; }
}

/* Choreographed Gentle Entrances */
.spring-reveal {
  animation: springArrival .58s var(--dx-spring) calc(55ms * var(--stagger-idx, 0)) backwards;
}
@keyframes springArrival {
  from { opacity: .42; translate: 0 14px; }
  to { opacity: 1; translate: 0 0; }
}

.kpi-num.is-counted {
  display: inline-block;
  animation: kpiPop .44s var(--dx-spring);
}
@keyframes kpiPop {
  0% { scale: .96; }
  45% { scale: 1.05; }
  100% { scale: 1; }
}

#selectionPill.is-celebrating:not([hidden]) {
  animation: pillHop .5s;
}
#selectionCount.is-celebrating {
  display: inline-block;
  animation: badgePop .5s;
}
@keyframes pillHop {
  0%,100% { transform: translateX(-50%) translateY(0); }
  38% { transform: translateX(-50%) translateY(-6px); }
  75% { transform: translateX(-50%) translateY(1px); }
}
@keyframes badgePop {
  0%,100% { scale: 1; }
  45% { scale: 1.09; }
  75% { scale: .98; }
}

#liveDraftBox.is-updated {
  animation: draftShimmer .54s;
}
@keyframes draftShimmer {
  0%,100% { box-shadow: inset 0 0 0 1px transparent; }
  30% { box-shadow: inset 0 0 0 1px rgb(214 176 116 / .62); }
}

.motion-switch .switch-track { justify-content: flex-start; }
.motion-switch .switch-track::after { transition: translate .38s var(--dx-spring); }
.motion-switch[aria-pressed=true] .switch-track::after { translate: 11px 0; }
[dir=rtl] .motion-switch[aria-pressed=true] .switch-track::after { translate: -11px 0; }

.faq-item .faq-plus { transition: transform .42s var(--dx-spring); }
@supports (interpolate-size:allow-keywords) and selector(details::details-content) {
  .faq-item { interpolate-size: allow-keywords; }
  .faq-item::details-content {
    block-size: 0;
    overflow: clip;
    opacity: 0;
    transition: block-size .36s var(--dx-spring), opacity .22s, content-visibility .36s allow-discrete;
  }
  .faq-item[open]::details-content { block-size: auto; opacity: 1; }
}

html[data-quiet] .fx-control,
body.reduce-motion .fx-control {
  translate: none;
  scale: none;
  transform: none;
}
html[data-quiet] .fx-control::before,
html[data-quiet] .fx-control::after { animation: none; }
html[data-quiet] .fx-wave-plane,
html[data-quiet] #fxBurstLayer { display: none; }
html[data-quiet] details::details-content { transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  .fx-control { translate: none; scale: none; transform: none; }
  .fx-wave-plane, #fxBurstLayer { display: none; }
  details::details-content { transition: none !important; }
}

.motion-preference-sensor {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  contain: strict;
  visibility: hidden;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .motion-preference-sensor { height: 2px; }
}
