/* descent.css: the animated guide on the inguinal hernia pages.
   Uses the site tokens from style.css (--paper, --ink, --accent, --line ...).
   The drawing keeps its own anatomy colors, which are set inside the SVG. */

.descent-band { padding: 72px 0 88px; background: var(--paper-deep); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.descent-band .kicker { margin-bottom: 6px; }
.descent-band h2 { max-width: 30ch; }
.descent-band .section-lead { max-width: 680px; margin-bottom: 28px; }

.descent { display: grid; gap: 16px; }
.d-figure { margin: 0; background: #fff; border: 1px solid var(--line); position: relative; }
.d-figure svg { display: none; width: 100%; height: auto; }
.d-poster { display: block; width: 100%; height: auto; }
.descent.is-live .d-figure svg { display: block; }
.descent.is-live .d-poster { display: none; }
.d-note { font-size: 0.85rem; color: var(--ink-faint); padding: 8px 14px 10px; border-top: 1px solid var(--line); }

/* the caption: the narration script, one step at a time */
.d-cap { display: none; background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 18px 22px 20px; min-height: 9.5rem; }
.descent.is-live .d-cap { display: block; }
.d-cap-num { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.d-cap-title { font-size: 1.3rem; margin-bottom: 6px; }
.d-cap-text { font-size: 1.12rem; line-height: 1.6; max-width: 75ch; color: var(--ink); }

/* controls */
.d-bar { display: none; flex-wrap: wrap; gap: 10px 12px; align-items: center; }
.descent.is-live .d-bar { display: flex; }
.d-btn { font: 600 1rem/1 var(--sans); height: 48px; padding: 0 22px; border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; transition: background 0.2s ease, color 0.2s ease; }
@media (hover: hover) { .d-btn:hover:not(:disabled) { background: var(--ink); color: var(--paper); } }
.d-btn.d-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (hover: hover) { .d-btn.d-primary:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; } }
.d-btn.d-quiet { border-color: var(--line); color: var(--ink-soft); }
.d-btn:disabled { opacity: 0.4; cursor: default; }
.d-btn:focus-visible, .d-dot:focus-visible, .d-views button:focus-visible, .d-script summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.d-steps { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.d-dot { width: 26px; height: 26px; padding: 0; border: 0; background: transparent; cursor: pointer; position: relative; }
.d-dot::before { content: ""; position: absolute; left: 3px; right: 3px; top: 10px; height: 6px; border-radius: 3px; background: var(--line); transition: background 0.2s ease; }
.d-dot.done::before { background: var(--ink-faint); }
.d-dot.here::before { background: var(--accent); }
.d-dot:hover::before { background: var(--accent-dark); }

/* view switch: shown on phones only */
.d-views { display: none; gap: 6px; flex-wrap: wrap; }
.d-views button { font: 600 0.9rem/1 var(--sans); height: 40px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink-soft); cursor: pointer; }
.d-views button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }

/* the whole script, always readable, also with JavaScript off */
.d-script { border-top: 2px solid var(--ink); padding-top: 14px; }
.d-script summary { cursor: pointer; font-weight: 600; color: var(--accent); list-style-position: inside; }
.d-script ol { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 14px; }
.d-script li { border-top: 1px solid var(--line); padding-top: 12px; }
.d-script li.here h4 { color: var(--accent); }
.d-script h4 { font-family: var(--serif); font-weight: 550; font-size: 1.05rem; margin-bottom: 4px; }
.d-script p { max-width: 75ch; color: var(--ink-soft); }

/* the jump link and the pointer on the hub page */
.descent-pointer { margin: 18px 0 8px; padding: 14px 18px; border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--paper-deep); }
.descent-pointer a { font-weight: 600; }

@media (max-width: 700px) {
  .descent-band { padding: 52px 0 64px; }
  .descent.is-live .d-views { display: flex; }
  .d-steps { margin-left: 0; width: 100%; justify-content: space-between; }
  .d-dot { width: 100%; max-width: 32px; }
  .d-btn { padding: 0 18px; }
  .d-cap { padding: 16px 16px 18px; min-height: 12rem; }
  .d-cap-text { font-size: 1.05rem; }
}

/* Sept 26: fit drawing, caption and controls on one screen; big play button */
.descent.is-live .d-figure svg { height: clamp(240px, calc(100vh - 400px), 530px); width: auto; max-width: 100%; margin: 0 auto; }
.d-cap { min-height: 0; padding: 14px 20px 16px; }
.d-cap-title { font-size: 1.2rem; margin-bottom: 4px; }
.d-cap-text { font-size: 1.05rem; line-height: 1.55; }
.d-playover { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 12px; height: 64px; padding: 0 28px 0 12px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: 700 1.15rem/1 var(--sans); cursor: pointer; box-shadow: 0 10px 28px rgba(0,0,0,0.22); z-index: 2; }
.d-playover[hidden] { display: none; }
.d-po-ring { width: 44px; height: 44px; border-radius: 50%; background: #fff; position: relative; flex: none; }
.d-po-ring::after { content: ""; position: absolute; left: 17px; top: 13px; border-style: solid; border-width: 9px 0 9px 14px; border-color: transparent transparent transparent var(--accent); }
@media (hover: hover) { .d-playover:hover { background: var(--accent-dark); } }
.d-playover:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
@media (max-width: 700px) {
  .descent.is-live .d-figure svg { height: clamp(200px, calc(100vh - 560px), 480px); }
  .d-cap { min-height: 9rem; }
  .d-views { flex-wrap: nowrap; gap: 4px; }
  .d-views button { height: 34px; padding: 0 11px; font-size: 0.82rem; }
  .d-playover { height: 54px; font-size: 1.05rem; padding: 0 22px 0 10px; }
  .d-po-ring { width: 36px; height: 36px; }
  .d-po-ring::after { left: 14px; top: 10px; border-width: 8px 0 8px 12px; }
}

/* wide screens: caption beside the drawing so drawing, words and buttons share one screen */
@media (min-width: 1000px) {
  .descent.is-live { grid-template-columns: minmax(0, 1fr) 300px; align-items: stretch; }
  .descent.is-live .d-views, .descent.is-live .d-bar, .descent.is-live .d-script { grid-column: 1 / -1; }
  .descent.is-live .d-figure svg { height: auto; width: 100%; max-height: calc(100vh - 300px); }
  .descent.is-live .d-cap { display: flex; flex-direction: column; justify-content: center; }
}
