/* ============================================================
   RAR PATHOLOGY · "Pulmonary Embolism: Outcome by Size" interactive
   Scoped under .rar-topic-content (black text / no grey rule holds).
   Bespoke to this page — not shared.
   ============================================================ */

/* ============================================================
   Page-2 section styling (Overview / Congestion / PH) — reuses the
   shared .atl-* card system; only the page-specific bits live here.
   ============================================================ */

/* cap figure rows so a lone figure doesn't stretch the full card */
.rar-topic-content .atl-figrow--two {
    grid-template-columns: repeat(auto-fit, minmax(220px, 320px));
    justify-content: start;
}

/* WHO 5-group cards — roman-numeral badge */
.rar-topic-content .atl-grid--ph { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.rar-topic-content .vasc-phgroup .atl-card__h { display: flex; align-items: center; gap: 9px; }
.rar-topic-content .vasc-phgroup__n {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 26px;
    padding: 0 7px;
    border-radius: 8px;
    background: #5e5ce6;
    color: #fff;
    font-size: 13px;
    font-weight: 850;
    letter-spacing: 0.02em;
}

/* Mechanism → drug target map (bespoke, code-drawn) */
.rar-topic-content .vasc-target {
    margin: 4px 0 0;
    padding: 16px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(244, 248, 255, 0.9), rgba(255, 255, 255, 0.97));
    border: 1px solid rgba(10, 132, 255, 0.16);
}
.rar-topic-content .vasc-target__title {
    color: var(--text, #111318);
    font-size: 15px;
    font-weight: 850;
    margin-bottom: 6px;
}
.rar-topic-content .vasc-target__mech {
    margin: 0 0 12px;
    color: var(--text, #111318);
    font-size: 14px;
    line-height: 1.55;
}
.rar-topic-content .vasc-target__arms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.rar-topic-content .vasc-arm {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.1);
}
.rar-topic-content .vasc-arm--constrict { border-top: 3px solid #d6336c; }
.rar-topic-content .vasc-arm--dilate { border-top: 3px solid #0a84ff; }
.rar-topic-content .vasc-arm--prosta { border-top: 3px solid #1f8f43; }
.rar-topic-content .vasc-arm__head {
    color: var(--text, #111318);
    font-size: 14px;
    font-weight: 850;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.rar-topic-content .vasc-arm__tag {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--text, #111318);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.rar-topic-content .vasc-drug {
    padding: 9px 11px;
    border-radius: 11px;
    background: rgba(10, 132, 255, 0.06);
    border: 1px solid rgba(10, 132, 255, 0.16);
    color: var(--text, #111318);
    font-size: 13.5px;
    line-height: 1.45;
}
.rar-topic-content .vasc-drug strong { font-weight: 800; }
.rar-topic-content .vasc-drug__x,
.rar-topic-content .vasc-drug__up {
    display: inline-block;
    margin-right: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 850;
    letter-spacing: 0.02em;
}
.rar-topic-content .vasc-drug--block .vasc-drug__x { background: rgba(214, 51, 108, 0.14); color: #b01050; }
.rar-topic-content .vasc-drug--boost .vasc-drug__up { background: rgba(31, 143, 67, 0.14); color: #1f8f43; }
.rar-topic-content .vasc-target__out {
    margin-top: 12px;
    padding: 9px 14px;
    border-radius: 12px;
    background: rgba(94, 92, 230, 0.1);
    border: 1px solid rgba(94, 92, 230, 0.28);
    color: var(--text, #111318);
    font-size: 14px;
    font-weight: 800;
    text-align: center;
}

/* ---------- page-shell bits for the Vascular Disorders page ---------- */
.rar-topic-content .pe-lead {
    margin: 0 0 14px;
    color: var(--text, #111318);
    font-size: 15px;
    line-height: 1.65;
}
.rar-topic-content .pe-lead strong { font-weight: 800; }
.rar-topic-content .vasc-tbd {
    margin: 4px 0 0;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px dashed rgba(15, 23, 42, 0.22);
    background: rgba(15, 23, 42, 0.03);
    color: var(--text, #111318);
    font-size: 14px;
    line-height: 1.55;
}
.rar-topic-content .vasc-tbd__icon { margin-right: 8px; }
.rar-topic-content .vasc-tbd strong { font-weight: 800; }

/* ---------- two-column layout: controls left, image right ---------- */
.rar-topic-content .pe-layout {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(320px, 1.05fr);
    gap: 22px;
    align-items: start;
    margin-top: 4px;
}
@media (max-width: 860px) {
    .rar-topic-content .pe-layout { grid-template-columns: 1fr; }
}
.rar-topic-content .pe-col--controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}
/* gap owns the spacing — drop each child's own vertical margins */
.rar-topic-content .pe-col--controls > * { margin-top: 0; margin-bottom: 0; }
.rar-topic-content .pe-col--figure { min-width: 0; }
/* image fills its column now (no longer the 720px centered block) */
.rar-topic-content .pe-layout .pe-stage {
    max-width: 560px;
    margin: 0 auto;
}
@media (min-width: 861px) {
    .rar-topic-content .pe-layout .pe-stage { max-width: 100%; }
}

/* ---------- size selector ---------- */
.rar-topic-content .pe-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
    margin-top: 4px;
}
.rar-topic-content .pe-size-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 11px 16px;
    border-radius: 14px;
    background: #fff;
    border: 1.5px solid rgba(15, 23, 42, 0.14);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.rar-topic-content .pe-size-btn:hover { border-color: rgba(214, 51, 108, 0.5); transform: translateY(-1px); }
.rar-topic-content .pe-size-btn:focus-visible { outline: 3px solid rgba(10, 132, 255, 0.5); outline-offset: 2px; }
.rar-topic-content .pe-size-btn__label {
    color: var(--text, #111318);
    font-size: 15px;
    font-weight: 850;
    line-height: 1.15;
}
.rar-topic-content .pe-size-btn__range {
    color: var(--text, #111318);
    font-size: 12.5px;
    font-weight: 700;
    opacity: 0.72;
}
.rar-topic-content .pe-size-btn.is-active {
    border-color: #d6336c;
    background: rgba(214, 51, 108, 0.08);
    box-shadow: 0 8px 20px rgba(214, 51, 108, 0.16);
}
.rar-topic-content .pe-size-btn.is-active .pe-size-btn__range { opacity: 0.95; color: #b01050; }

.rar-topic-content .pe-replay {
    margin-left: auto;
    align-self: center;
    padding: 9px 15px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.14);
    color: var(--text, #111318);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease;
}
.rar-topic-content .pe-replay:hover:not(:disabled) { background: rgba(15, 23, 42, 0.1); }
.rar-topic-content .pe-replay:disabled { opacity: 0.4; cursor: default; }
.rar-topic-content .pe-replay:focus-visible { outline: 3px solid rgba(10, 132, 255, 0.5); outline-offset: 2px; }

.rar-topic-content .pe-prompt {
    margin: 12px 0 10px;
    color: var(--text, #111318);
    font-size: 14.5px;
    font-style: italic;
    line-height: 1.5;
}

/* ---------- figure stage: base image + scaling overlay ---------- */
.rar-topic-content .pe-stage {
    position: relative;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    aspect-ratio: 1116 / 1016;
    border-radius: 18px;
    overflow: hidden;
    background: #f4f8ff;
    border: 1px solid rgba(15, 23, 42, 0.1);
}
.rar-topic-content .pe-base {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}
.rar-topic-content .pe-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
/* invisible motion-guide paths kept only for getTotalLength/getPointAtLength —
   never painted (default SVG path fill is black). visibility:hidden preserves
   the geometry APIs; display:none would break them. */
.rar-topic-content .pe-measure { visibility: hidden; }
.rar-topic-content .pe-measure path { fill: none; stroke: none; }

/* ---------- perfusion territory shading ---------- */
.rar-topic-content .pe-terr--massive { fill: #d6336c; }
.rar-topic-content .pe-terr--wedge { fill: rgba(139, 0, 21, 0.55); stroke: #8b0015; stroke-width: 2.5; }
.rar-topic-content .pe-terr-label {
    fill: #fff;
    font-size: 22px;
    font-weight: 800;
    text-anchor: middle;
    paint-order: stroke;
    stroke: rgba(120, 0, 18, 0.9);
    stroke-width: 4;
}
.rar-topic-content .pe-territory ellipse,
.rar-topic-content .pe-territory polygon { animation: peTerrIn 0.45s ease both; }
@keyframes peTerrIn { from { opacity: 0; } }

/* ---------- impaction glow ---------- */
.rar-topic-content .pe-region {
    fill: #ff5a3c;
    stroke: #ffd23c;
    stroke-width: 2;
    filter: drop-shadow(0 0 8px rgba(255, 90, 60, 0.9));
    animation: peRegionPulse 1.1s ease-in-out infinite;
}
@keyframes peRegionPulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 0.95; }
}
.rar-topic-content .pe-pulse {
    fill: none;
    stroke: #ffd23c;
    stroke-width: 4;
    transform-box: fill-box;
    transform-origin: center;
    animation: pePulse 0.7s ease-out forwards;
}
@keyframes pePulse {
    0% { r: 8px; opacity: 0.95; stroke-width: 6; }
    100% { r: 60px; opacity: 0; stroke-width: 1; }
}

/* ---------- embolus clot ---------- */
.rar-topic-content .pe-clot__body {
    fill: #5c0a1a;
    stroke: #360610;
    stroke-width: 2;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.45));
}
.rar-topic-content .pe-clot.is-lodged .pe-clot__body { animation: peLodge 0.5s ease-out; }
@keyframes peLodge {
    0% { transform: scale(1); }
    40% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* ---------- persistent caption ---------- */
.rar-topic-content .pe-caption {
    margin: 14px 0 0;
    padding: 12px 16px;
    border-radius: 14px;
    border-left: 4px solid rgba(15, 23, 42, 0.25);
    background: rgba(15, 23, 42, 0.04);
    color: var(--text, #111318);
    font-size: 14px;
    line-height: 1.6;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.rar-topic-content .pe-caption strong { font-weight: 850; }
.rar-topic-content .pe-caption.is-emphasized {
    border-left-color: #1f8f43;
    background: rgba(52, 199, 89, 0.09);
}

/* ---------- callout: red "key" tag variant ---------- */
.rar-topic-content .pe-callout { margin-top: 16px; }
.rar-topic-content .pe-tag--key {
    background: rgba(214, 51, 108, 0.14);
    color: #b01050;
    border: 1px solid rgba(214, 51, 108, 0.4);
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .rar-topic-content .pe-region,
    .rar-topic-content .pe-pulse,
    .rar-topic-content .pe-clot.is-lodged .pe-clot__body,
    .rar-topic-content .pe-territory ellipse,
    .rar-topic-content .pe-territory polygon { animation: none; }
    .rar-topic-content .pe-region { opacity: 0.8; }
}
