/* ==========================================================================
   GWANGGYO BARUN — SLIDE MASTER & COMPONENT LIBRARY v2
   Superhuman-inspired patterns for clinical patient education.
   ========================================================================== */

/* ------------------------------------------------------------------------
   RESET
   ------------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-family);
  font-size: var(--text-body);
  line-height: var(--lh-normal);
  color: var(--color-ink);
  background: var(--color-canvas-warm);
  font-feature-settings: "ss01", "tnum"; /* Stylistic set + tabular numerals */
  word-break: keep-all;        /* Korean wraps at word(어절=의미) units, not mid-syllable */
  overflow-wrap: break-word;   /* safety: an over-long token still breaks instead of overflowing */
}


/* ------------------------------------------------------------------------
   DECK CONTAINER
   ------------------------------------------------------------------------ */
.deck {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-10) var(--space-8);
}


/* ==========================================================================
   SLIDE MASTER
   Every slide is exactly 1280x720, with a fixed 4-region grid:
   - HEADER (logo + chapter eyebrow)  — same position on every slide
   - TITLE BLOCK (title + subtitle)   — same position on every slide
   - BODY (pattern-specific content)  — fills remaining space
   - FOOTER (source + page number)    — same position on every slide
   ========================================================================== */

.slide {
  width: var(--slide-width);
  height: var(--slide-height);
  background: var(--color-canvas);
  color: var(--color-ink);
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);

  display: grid;
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas:
    "header"
    "title"
    "body"
    "footer";
  padding: var(--slide-pad-y) var(--slide-pad-x);
  gap: 0;
}


/* ----- HEADER -------------------------------------------------------- */

.slide__header {
  grid-area: header;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-10);
}

.slide__logo {
  height: 32px;
  width: auto;
  display: block;
}

.slide__chapter {
  font-size: var(--text-micro);
  font-weight: var(--weight-semibold);
  color: var(--color-slate);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.slide__chapter strong {
  color: var(--color-navy);
  font-weight: var(--weight-bold);
}


/* ----- TITLE BLOCK --------------------------------------------------- */

.slide__title-block {
  grid-area: title;
  margin-bottom: var(--space-8);
  max-width: 920px;
}

.slide__title {
  font-size: var(--text-display);
  font-weight: var(--weight-540);
  line-height: var(--lh-display);
  letter-spacing: var(--tracking-tight);
  color: var(--color-navy);
  margin-bottom: var(--space-3);
}

.slide__title em {
  font-style: normal;
  color: var(--color-steel);
}

.slide__subtitle {
  font-size: var(--text-h2);
  font-weight: var(--weight-450);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-snug);
  color: var(--color-slate);
}


/* ----- BODY ---------------------------------------------------------- */

.slide__body {
  grid-area: body;
  position: relative;
  min-height: 0;          /* allow grid 1fr to shrink */
  min-width: 0;
  display: flex;
  flex-direction: column;
}


/* ----- FOOTER -------------------------------------------------------- */

.slide__footer {
  grid-area: footer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-soft);
  font-size: var(--text-xs);
  color: var(--color-slate);
}

.slide__source {
  font-style: normal;
  letter-spacing: 0;
  max-width: 80%;
}

.slide__page {
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-wide);
  font-weight: var(--weight-semibold);
  color: var(--color-slate);
  text-transform: uppercase;
  font-size: var(--text-micro);
}


/* ----- DECORATIVE BACKGROUND CHAPTER NUMBER --------------------------
   A massive, low-opacity chapter number sits behind the body content.
   Fills "empty" space and creates editorial rhythm without noise.
   ----------------------------------------------------------------------*/

.slide__bg-num {
  position: absolute;
  right: -32px;
  bottom: -80px;
  font-size: 26rem;
  font-weight: var(--weight-black);
  line-height: 1;
  letter-spacing: -0.06em;
  color: var(--color-navy);
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
  font-feature-settings: "tnum";
  user-select: none;
}


/* ==========================================================================
   COVER SLIDE — the only "dramatic" gesture in the deck
   Deep navy gradient, white type. Inspired by Superhuman's hero curtain.
   ========================================================================== */

.slide--cover {
  background:
    radial-gradient(ellipse at top right, rgba(91, 155, 213, 0.25) 0%, transparent 50%),
    linear-gradient(135deg, var(--color-navy-deep) 0%, var(--color-navy) 55%, var(--color-navy-mid) 100%);
  color: var(--color-white-95);
}

.slide--cover .slide__logo {
  filter: brightness(0) invert(1);
  height: 36px;
}

.slide--cover .slide__chapter {
  color: var(--color-white-60);
}

.slide--cover .slide__chapter strong {
  color: var(--color-sky);
}

.slide--cover .slide__title {
  font-size: var(--text-display-lg);
  color: var(--color-white-95);
  font-weight: var(--weight-540);
  margin-top: auto;
  margin-bottom: var(--space-4);
}

.slide--cover .slide__title em {
  color: var(--color-sky);
}

.slide--cover .slide__subtitle {
  color: var(--color-white-80);
  font-size: var(--text-h2);
  margin-bottom: var(--space-10);
}

.slide--cover .slide__title-block {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.slide--cover {
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "header"
    "title"
    "footer";
}

.slide--cover .slide__body { display: none; }

.slide--cover .slide__footer {
  border-top: 1px solid var(--color-white-15);
  color: var(--color-white-60);
}

.slide--cover .slide__page {
  color: var(--color-white-60);
}


/* ==========================================================================
   CLOSING SLIDE
   Mirrors the cover's gravitas with a soft cream backdrop and contact card.
   ========================================================================== */

.slide--closing {
  background:
    radial-gradient(ellipse at bottom left, rgba(91, 155, 213, 0.10) 0%, transparent 50%),
    var(--color-canvas);
}

.slide--closing .slide__title {
  font-size: var(--text-display-lg);
  margin-top: auto;
}

.slide--closing .slide__title-block {
  margin-bottom: 0;
}

.slide--closing {
  grid-template-rows: auto 1fr auto auto;
  grid-template-areas:
    "header"
    "title"
    "body"
    "footer";
}

.contact-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
  padding: var(--space-8);
  background: var(--color-canvas-warm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}

.closing-grid {
  display: grid;
  grid-template-columns: 2.4fr 1fr;
  gap: var(--space-5);
  align-items: stretch;
}

.closing-grid > .contact-card {
  margin-bottom: 0;
}

/* Inside closing-grid, contact-card stacks vertically (3 rows × 1 col) */
.closing-grid > .contact-card {
  grid-template-columns: 1fr;
  gap: var(--space-5);
  padding: var(--space-6) var(--space-8);
}

.contact-card__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.contact-card__label {
  font-size: var(--text-micro);
  font-weight: var(--weight-semibold);
  color: var(--color-slate);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.contact-card__value {
  font-size: var(--text-h3);
  font-weight: var(--weight-540);
  color: var(--color-navy);
  line-height: var(--lh-snug);
}


/* ----- QR BLOCK -----------------------------------------------------------
   Marketing-grade QR code on closing slide for in-clinic patient handoff.
   Renders client-side via qrcode.js using og:url meta as source of truth.
   ----------------------------------------------------------------------- */

.qr-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--color-canvas-warm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-align: center;
}

.qr-block__code {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
  background: var(--color-canvas);
  border-radius: var(--radius-sm);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-block__code svg,
.qr-block__code canvas,
.qr-block__code img {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.qr-block__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  align-items: center;
}

.qr-block__label {
  font-size: var(--text-micro);
  font-weight: var(--weight-semibold);
  color: var(--color-slate);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.qr-block__heading {
  font-size: var(--text-body);
  font-weight: var(--weight-540);
  color: var(--color-navy);
  letter-spacing: var(--tracking-snug);
  line-height: var(--lh-tight);
}

.qr-block__hint {
  font-size: var(--text-xs);
  color: var(--color-slate);
  font-weight: var(--weight-450);
  line-height: var(--lh-snug);
}


/* ==========================================================================
   BODY PATTERNS
   The body region uses one of these patterns per slide.
   Patterns are mutually exclusive — pick one per slide.
   ========================================================================== */


/* ------------------------------------------------------------------------
   PATTERN A — HERO NUMBER
   Asymmetric: Mega digit on left (60%), supporting copy on right (40%).
   Best for: prevalence stats, key metrics, single dominant fact.
   ------------------------------------------------------------------------ */

.pattern-hero-number {
  display: grid;
  grid-template-columns: 5fr 4fr;
  gap: var(--space-12);
  align-items: center;
  height: 100%;
  position: relative;
  z-index: 1;
}

.pattern-hero-number__numeric {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.pattern-hero-number__value {
  font-size: var(--text-display-xl);
  font-weight: var(--weight-black);
  line-height: 0.92;
  letter-spacing: var(--tracking-mega);
  color: var(--color-navy);
  font-feature-settings: "tnum";
}

.pattern-hero-number__value em {
  color: var(--color-steel);
  font-style: normal;
}

.pattern-hero-number__caption {
  font-size: var(--text-h3);
  font-weight: var(--weight-450);
  color: var(--color-ink-soft);
  line-height: var(--lh-snug);
  max-width: 90%;
}

.pattern-hero-number__detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  border-left: 2px solid var(--color-steel);
  padding-left: var(--space-6);
}

.pattern-hero-number__detail-label {
  font-size: var(--text-micro);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-steel);
}

.pattern-hero-number__detail-text {
  font-size: var(--text-body-lg);
  font-weight: var(--weight-450);
  color: var(--color-ink);
  line-height: var(--lh-normal);
}


/* ------------------------------------------------------------------------
   PATTERN B — ASYMMETRIC SPLIT
   Left column: dominant statement / quote (55%)
   Right column: supporting detail list (45%)
   Best for: definitions, key concepts with supporting evidence.
   ------------------------------------------------------------------------ */

.pattern-split {
  display: grid;
  grid-template-columns: 11fr 9fr;
  gap: var(--space-12);
  height: 100%;
  position: relative;
  z-index: 1;
}

/* ------------------------------------------------------------------------
   SYMMETRIC SPLIT — equal-weight peers (e.g. 1단계 vs 2단계, 증상유형 A vs B).
   The default .pattern-split is 11fr 9fr (asymmetric statement+supporting).
   When the two columns are PEERS of equal weight, that 55/45 makes the right
   column look cramped — worse when a visual sits next to it (visual-focus).
   Use .pattern-split--even, OR rely on the :has() auto-detect below: any
   .pattern-split holding both .split__left and .split__right (the symmetric
   convention) is treated as 50/50 automatically so this can't recur.
   ------------------------------------------------------------------------ */
.pattern-split--even,
.pattern-split:has(> .split__left):has(> .split__right) {
  grid-template-columns: 1fr 1fr;
}

.pattern-split__primary {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.pattern-split__statement {
  font-size: var(--text-h1);
  font-weight: var(--weight-540);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-snug);
  color: var(--color-navy);
}

.pattern-split__statement em {
  color: var(--color-steel);
  font-style: normal;
}

.pattern-split__supporting {
  font-size: var(--text-body-lg);
  font-weight: var(--weight-450);
  color: var(--color-ink-soft);
  line-height: var(--lh-relaxed);
  max-width: 95%;
}

.pattern-split__detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pattern-split__metric {
  padding: var(--space-5);
  background: var(--color-canvas-warm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.pattern-split__metric-label {
  font-size: var(--text-micro);
  font-weight: var(--weight-semibold);
  color: var(--color-slate);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.pattern-split__metric-value {
  font-size: var(--text-h2);
  font-weight: var(--weight-540);
  color: var(--color-navy);
  letter-spacing: var(--tracking-snug);
  line-height: var(--lh-tight);
}

.pattern-split__metric-detail {
  font-size: var(--text-sm);
  color: var(--color-slate);
  margin-top: var(--space-1);
}


/* ------------------------------------------------------------------------
   PATTERN C — DENSITY GRID
   3-column or 2x3 card grid. Each card is minimal: icon + title + body.
   Cards use 1px border and the 16px radius — no inner shadows.
   Best for: enumerations of equal-weight items (causes, lifestyle tips).
   ------------------------------------------------------------------------ */

.pattern-grid {
  display: grid;
  gap: var(--space-4);
  height: 100%;
  position: relative;
  z-index: 1;
  align-content: stretch;
}

.pattern-grid--3 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1fr 1fr;
}

.pattern-grid--2 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: 1fr 1fr;
}

.pattern-grid--2x4 {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: 1fr 1fr;
}

.tile {
  background: var(--color-canvas);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  position: relative;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

@media (hover: hover) {
  .tile:hover {
    border-color: var(--color-steel);
    transform: translateY(-1px);
  }
}

.tile__index {
  font-size: var(--text-micro);
  font-weight: var(--weight-semibold);
  color: var(--color-steel);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.tile__title {
  font-size: var(--text-h3);
  font-weight: var(--weight-540);
  color: var(--color-navy);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-snug);
}

.tile__body {
  font-size: var(--text-body);
  font-weight: var(--weight-450);
  color: var(--color-ink-soft);
  line-height: var(--lh-normal);
  margin-top: auto;
}

.tile--alert {
  border-color: var(--color-danger);
  background: var(--color-danger-bg);
}

.tile--alert .tile__title { color: var(--color-danger); }
.tile--alert .tile__index { color: var(--color-danger); }

.tile--accent {
  background: var(--color-canvas-warm);
  border-color: var(--color-steel);
  border-width: 1px;
}


/* ----- TILE EXTENSION: drug regimen list ---------------------------------
   For tiles that show a medication regimen (drug name + dose + frequency).
   Used in H. pylori eradication, antibiotic protocols, etc.
   ------------------------------------------------------------------------ */

.tile__regimen {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-top: var(--space-3);
  margin-top: var(--space-2);
  border-top: 1px solid var(--color-border-soft);
}

.tile__regimen li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-3);
  font-size: var(--text-sm);
  align-items: baseline;
}

.tile__regimen-name {
  font-weight: var(--weight-540);
  color: var(--color-navy);
  letter-spacing: var(--tracking-snug);
}

.tile__regimen-dose {
  color: var(--color-slate);
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-450);
  white-space: nowrap;
}

.tile__duration {
  margin-top: auto;
  padding-top: var(--space-3);
  font-size: var(--text-micro);
  font-weight: var(--weight-semibold);
  color: var(--color-steel);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.tile__duration::before {
  content: "";
  width: 16px;
  height: 1px;
  background: var(--color-steel);
}


/* ------------------------------------------------------------------------
   PATTERN D — COMPARISON
   Two columns with navy/steel header bars (per design system §4.9).
   Best for: DO/DON'T, recommended vs avoid, before/after.
   ------------------------------------------------------------------------ */

.pattern-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  height: 100%;
  position: relative;
  z-index: 1;
}

.compare-col {
  background: var(--color-canvas);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.compare-col__header {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-h3);
  font-weight: var(--weight-540);
  color: var(--color-canvas);
  letter-spacing: var(--tracking-snug);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.compare-col--avoid .compare-col__header { background: var(--color-navy); }
.compare-col--prefer .compare-col__header { background: var(--color-steel); }

.compare-col__marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-white-15);
  font-size: var(--text-body);
  font-weight: var(--weight-bold);
}

.compare-col__list {
  list-style: none;
  padding: var(--space-5) var(--space-6) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex: 1;
}

.compare-col__list li {
  font-size: var(--text-body-lg);
  font-weight: var(--weight-450);
  color: var(--color-ink);
  line-height: var(--lh-snug);
  padding-left: var(--space-6);
  position: relative;
}

.compare-col--avoid .compare-col__list li::before {
  content: "—";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--color-navy);
  font-weight: var(--weight-bold);
}

.compare-col--prefer .compare-col__list li::before {
  content: "+";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--color-steel);
  font-weight: var(--weight-bold);
  font-size: var(--text-h3);
  line-height: 0.9;
}


/* ------------------------------------------------------------------------
   PATTERN E — TIMELINE / PROCESS
   Horizontal stepped flow with numbered nodes.
   Best for: diagnostic pathways, treatment escalation, decision trees.
   ------------------------------------------------------------------------ */

.pattern-timeline {
  --timeline-gap: var(--space-4);   /* 연결자(선+화살촉)가 이 값을 추적 — visual-focus에선 좁아짐 */
  display: grid;
  /* 열 수는 카드 수를 따라간다 — 고정 template 금지.
     종전 `repeat(4, 1fr)` 은 카드가 3장인 슬라이드에서 4번째 트랙(273.5px)과 gap(14px)을
     빈 채로 예약해, 타임라인이 본문 폭의 72%만 채우고 왼쪽으로 쏠렸다(2026-08-16 실측:
     MRONJ 협진 슬라이드에서 오른쪽 287.5px 공백 + 카드가 369.3px 대신 273.5px = 1:1.54
     세로 직사각형). 오버플로가 아니라 미충전이라 레이아웃 게이트의 bbox 검사에도 안 잡혔다.
     자식은 전부 step 카드다(비-step 직계자식 레포 전수 0건) — auto-flow 로 두면 3·4·6장
     어느 쪽이든 폭을 꽉 채운다. 명시 오버라이드가 있는 덱은 그쪽이 그대로 우선한다. */
  /* ⚠️ 2026-08-16 3차 교정 — 앞의 두 시도가 모두 **다른 덱을 망가뜨렸다.**
     1차 `grid-auto-flow:column`: 3장은 고쳤지만 줄바꿈을 없애 5·6장 덱이
       2행→1행으로 붕괴(275x212 → 179x418, 원래 결함보다 나쁜 비율).
     2차 `auto-fit minmax(240px,1fr)`: 이 격자는 **컨테이너 폭이 두 종류**다 —
       본문 전폭(1136)과 visual-focus 의 좁은 열(~600). 240px 하한이 좁은 열에서
       4장을 2행으로 쪼개 19개 덱이 회귀했다.
     결론: 기본값 repeat(4,1fr) 은 **건드리지 않는다.** 실제 결함은 '카드가 4장보다
     적을 때 빈 트랙이 예약되는 것' 하나뿐이므로, 그 경우에만 열 수를 카드 수에
     맞춘다. `:last-child:nth-child(N)` 은 자식이 정확히 N개일 때만 맞는다.
     → 4장 이상은 한 픽셀도 안 바뀐다(줄바꿈 포함). 3장 이하만 꽉 찬다. */
  grid-template-columns: repeat(4, 1fr);
  gap: var(--timeline-gap);
  height: 100%;
  position: relative;
  z-index: 1;
  align-items: stretch;
}

/* 카드가 4장 미만일 때만 열 수를 카드 수에 맞춘다(빈 트랙 예약 방지).
   직계 자식은 전부 step 카드다(레포 전수 확인: 비-step 직계자식 0건). */
.pattern-timeline:has(> :last-child:nth-child(3)) { grid-template-columns: repeat(3, 1fr); }
.pattern-timeline:has(> :last-child:nth-child(2)) { grid-template-columns: repeat(2, 1fr); }
.pattern-timeline:has(> :last-child:nth-child(1)) { grid-template-columns: 1fr; }

/* 타임라인 단계 카드 — timeline-step + step-card 변형 모두 같은 시각 언어:
   카드 내부 콘텐츠(번호·제목·본문)를 가로/세로 중앙 정렬한다(좌측 쏠림 금지, [Gotcha 20] 정합). */
.pattern-timeline > .timeline-step,
.pattern-timeline > .step-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--color-canvas);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  position: relative;
}

/* 단계 번호 = navy 원형 badge. 구 변형 step-card__num 도 동일 계열로 통일. */
.timeline-step__node,
.timeline-step__num,
.step-card__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-navy);
  color: var(--color-canvas);
  font-size: var(--text-body);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.timeline-step__title,
.step-card__title {
  font-size: var(--text-body-lg);
  font-weight: var(--weight-540);
  color: var(--color-navy);
  letter-spacing: var(--tracking-snug);
}

.timeline-step__body,
.step-card__body {
  font-size: var(--text-body);
  font-weight: var(--weight-450);
  color: var(--color-ink-soft);
  line-height: var(--lh-normal);
}

/* 카드 사이 연결자 — 텍스트 화살표(→) 금지.
   ::after = 카드 사이 gap 정중앙의 얇은 Steel Blue 선, ::before = 작은 CSS 화살촉. */
.pattern-timeline > .timeline-step:not(:last-child)::after,
.pattern-timeline > .step-card:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: calc(-1 * var(--timeline-gap));
  width: var(--timeline-gap);
  height: 2px;
  transform: translateY(-50%);
  background: var(--color-steel);
  z-index: 2;
}

.pattern-timeline > .timeline-step:not(:last-child)::before,
.pattern-timeline > .step-card:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 50%;
  right: calc(-1 * var(--timeline-gap) + 1px);
  width: 0;
  height: 0;
  transform: translateY(-50%);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--color-steel);
  z-index: 3;
}


/* ------------------------------------------------------------------------
   PATTERN F — CHECKLIST
   Bold typography list. Each item is a clear, actionable statement.
   Best for: action items, key takeaways, instructions.
   ------------------------------------------------------------------------ */

.pattern-checklist {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3) var(--space-8);
  height: 100%;
  position: relative;
  z-index: 1;
  align-content: center;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-soft);
}

.check-item__num {
  font-size: var(--text-h3);
  font-weight: var(--weight-540);
  color: var(--color-steel);
  letter-spacing: var(--tracking-snug);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
}

.check-item__text {
  font-size: var(--text-body-lg);
  font-weight: var(--weight-450);
  color: var(--color-ink);
  line-height: var(--lh-snug);
  padding-top: 4px;
}

.check-item__text strong {
  color: var(--color-navy);
  font-weight: var(--weight-bold);
}


/* ==========================================================================
   ALERT — used as an inline strip, not a pattern
   Sits at the bottom of any pattern when needed.
   ========================================================================== */

.alert-strip {
  margin-top: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-danger-bg);
  border-left: 3px solid var(--color-danger);
  border-radius: var(--radius-sm);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  font-size: var(--text-body);
  line-height: var(--lh-normal);
}

.alert-strip__label {
  font-weight: var(--weight-bold);
  color: var(--color-danger);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  font-size: var(--text-xs);
  flex-shrink: 0;
  padding-top: 2px;
}

.alert-strip__text {
  color: var(--color-ink);
  font-weight: var(--weight-450);
}


/* ==========================================================================
   PRESENTING MODE — fullscreen one-slide-at-a-time
   ========================================================================== */

body.presenting {
  background: #000;
  overflow: hidden;
}

body.presenting .deck {
  min-height: 0;
  height: 100vh;
  height: 100dvh;
  padding: 0;
  gap: 0;
  justify-content: center;
  align-items: center;
}

body.presenting .slide {
  display: none;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  /* Slide stays at native 1280x720; CSS transform scales to viewport */
  transform: scale(var(--present-scale, 1));
  transform-origin: center center;
}

body.presenting .slide.is-active {
  display: grid;
}


/* ==========================================================================
   GENERATED VISUALS
   ========================================================================== */

.ai-visual {
  margin: 0;
  width: 100%;
  min-height: 0;
  aspect-ratio: 17 / 10;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-canvas);
  box-shadow: var(--shadow-card);
}

.ai-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fbfdff;
}

.ai-visual--fill img {
  object-fit: cover;
}

.ai-visual--split {
  height: 100%;
  aspect-ratio: auto;
}

.ai-visual--focus,
.ai-visual--strip {
  align-self: center;
  height: auto;
  min-height: 0;
  aspect-ratio: 16 / 9;
}

.slide__body--visual-focus,
.slide__body--visual-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(500px, 0.84fr);
  grid-auto-rows: minmax(0, auto);
  gap: var(--space-4);
  align-items: stretch;
}

.slide__body--visual-focus > :not(.ai-visual--focus):not(.ai-visual--strip),
.slide__body--visual-strip > :not(.ai-visual--focus):not(.ai-visual--strip) {
  grid-column: 1;
  min-height: 0;
  min-width: 0;
}

.slide__body--visual-focus > .ai-visual--focus,
.slide__body--visual-focus > .ai-visual--strip,
.slide__body--visual-strip > .ai-visual--focus,
.slide__body--visual-strip > .ai-visual--strip {
  grid-column: 2;
  grid-row: 1 / -1;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  border-radius: var(--radius-lg);
  opacity: 1;
}

.slide__body--visual-focus > .ai-visual--focus img,
.slide__body--visual-focus > .ai-visual--strip img,
.slide__body--visual-strip > .ai-visual--focus img,
.slide__body--visual-strip > .ai-visual--strip img {
  object-fit: cover;
}

.slide__body--visual-focus > .pattern-grid,
.slide__body--visual-focus > .pattern-compare,
.slide__body--visual-focus > .pattern-timeline,
.slide__body--visual-focus > .pattern-checklist,
.slide__body--visual-strip > .pattern-grid,
.slide__body--visual-strip > .pattern-compare,
.slide__body--visual-strip > .pattern-timeline,
.slide__body--visual-strip > .pattern-checklist {
  height: auto;
  min-height: 0;
}

.slide__body--visual-focus .pattern-grid,
.slide__body--visual-focus .pattern-timeline,
.slide__body--visual-strip .pattern-grid,
.slide__body--visual-strip .pattern-timeline {
  gap: var(--space-3);
}

.slide__body--visual-focus .tile,
.slide__body--visual-strip .tile {
  padding: var(--space-4);
  gap: var(--space-2);
}

.slide__body--visual-focus .tile__title,
.slide__body--visual-strip .tile__title {
  font-size: var(--text-body-lg);
}

.slide__body--visual-focus .tile__body,
.slide__body--visual-strip .tile__body {
  font-size: var(--text-sm);
  line-height: var(--lh-snug);
}

.slide__body--visual-focus .timeline-step,
.slide__body--visual-strip .timeline-step {
  padding: var(--space-4);
  gap: var(--space-2);
}

.slide__body--visual-focus:has(> .pattern-grid--3),
.slide__body--visual-strip:has(> .pattern-grid--3) {
  grid-template-columns: minmax(0, 1fr) minmax(430px, 0.68fr);
  gap: var(--space-3);
}

.slide__body--visual-focus:has(> .pattern-grid--3) .pattern-grid,
.slide__body--visual-strip:has(> .pattern-grid--3) .pattern-grid {
  gap: var(--space-2);
}

.slide__body--visual-focus:has(> .pattern-grid--3) .tile,
.slide__body--visual-strip:has(> .pattern-grid--3) .tile {
  padding: var(--space-3);
  gap: var(--space-1);
}

.slide__body--visual-focus:has(> .pattern-grid--3) .tile__title,
.slide__body--visual-strip:has(> .pattern-grid--3) .tile__title {
  font-size: var(--text-body);
}

.slide__body--visual-focus:has(> .pattern-grid--3) .tile__body,
.slide__body--visual-strip:has(> .pattern-grid--3) .tile__body {
  font-size: var(--text-xs);
  line-height: var(--lh-snug);
}

.slide__body--visual-focus:has(> .pattern-grid--3) .tile__regimen,
.slide__body--visual-strip:has(> .pattern-grid--3) .tile__regimen {
  gap: var(--space-1);
  padding-top: var(--space-2);
  margin-top: var(--space-1);
}

.slide__body--visual-focus:has(> .pattern-grid--3) .tile__regimen li,
.slide__body--visual-strip:has(> .pattern-grid--3) .tile__regimen li {
  grid-template-columns: minmax(0, 0.45fr) minmax(0, 1fr);
  gap: var(--space-2);
  font-size: var(--text-xs);
}

.slide__body--visual-focus:has(> .pattern-grid--3) .tile__regimen-dose,
.slide__body--visual-strip:has(> .pattern-grid--3) .tile__regimen-dose {
  white-space: normal;
}

.slide__body--visual-focus:has(> .pattern-grid--3) .tile__duration,
.slide__body--visual-strip:has(> .pattern-grid--3) .tile__duration {
  padding-top: var(--space-2);
  font-size: var(--text-micro);
}

.pattern-split--with-visual {
  grid-template-columns: minmax(0, 1.04fr) minmax(320px, 0.9fr);
  gap: var(--space-8);
}

.pattern-split--with-visual .pattern-split__detail {
  display: grid;
  grid-template-rows: minmax(160px, 0.9fr) auto auto;
  gap: var(--space-3);
  min-height: 0;
}

.pattern-split--with-visual .pattern-split__metric {
  padding: var(--space-4);
}

.pattern-split--with-visual .pattern-split__metric-value {
  font-size: var(--text-h3);
}


/* ==========================================================================
   MOTION — sequential entrance for PRESENTING MODE only
   (2026-08-09, job 20260808-clinic-deck-motion)

   Design contract — read before editing:

   1. EVERYTHING lives inside `@media screen and (prefers-reduced-motion:
      no-preference)`. Print/PDF is therefore animation-free BY CONSTRUCTION,
      not by an override that a future rule could outrank. `@media print` does
      not match `screen`, and neither does Playwright's
      `page.emulate_media(media="print")` — which is exactly how
      shared/_validate_layout.py renders decks. Layout validation sees the
      static, settled layout.

   2. Motion only fires under `body.presenting .slide.is-active`. Plain
      scroll-through browsing of the deck page stays 100% static, so
      tools/slide_screens.py (per-slide screenshots, screen media, no
      presenting class), preview.png and _visual_diff are untouched. No
      existing deck needs an HTML or JS change — the effect is pure CSS and
      applies to every deck that already ships the shared stylesheet.

   3. THE GATE IS WRAPPED IN `:where()`, WHICH CONTRIBUTES ZERO SPECIFICITY.
      That is deliberate. The gate is five class-level selectors long; if it
      counted, every rule below would sit at (0,7,1) and the later, more
      specific-looking overrides (`.compare-col--avoid` and friends) would
      silently LOSE to the generic rule they are written to override. With
      `:where()` the specificity of each rule is decided by its target alone,
      so "later and equally specific wins" holds and the overrides work.
      Do not un-`:where()` the gate.

   4. An element must never animate inside an animating ancestor: the two
      transforms compound and the two opacities multiply, which reads as a
      double-fade wobble. Two shapes cause it and both are handled below —
      a wrapper `<div>` between the body and a pattern container (see the
      nested-container reset), and a chrome element nested in another
      (the cover slide does not separately animate `.slide__chapter`,
      because `.slide__header` already carries it in).

   5. The settled state must equal the static state EXACTLY. Two rules follow
      from that. First, fill-mode is `backwards`, not `both`: `backwards` holds
      the `from` state through the delay (so nothing flashes in early) and then
      lets the element fall back to its own resting style when the animation
      ends — `both` would pin it at the `to` state forever, leaving every
      animated element with an identity `transform` matrix that keeps
      establishing a containing block long after the motion is over. Second,
      never animate opacity to 1 on an element whose resting opacity is not 1:
      `.slide__bg-num` sits at 0.05 by design and is deliberately not animated.
      tests/test_deck_motion_contract.py pins both.

   6. Never animate `.slide` itself with `transform`: presenting mode already
      owns that channel (`transform: scale(var(--present-scale))`). Only
      descendants get transforms.

   7. No web fonts, no network assets — CSS keyframes only. The local font
      embedding contract is unchanged.

   Kill switches: `body.motion-off` (runtime), or `data-motion="off"` on a
   single `.slide` (authoring).
   ========================================================================== */

@media screen and (prefers-reduced-motion: no-preference) {

  :root {
    --motion-step: 80ms;                              /* stagger between items */
    --motion-dur: 460ms;                              /* content unit */
    --motion-dur-chrome: 380ms;                       /* header/title/footer */
    --motion-dur-hero: 620ms;                         /* cover slide */
    --motion-ease: cubic-bezier(0.22, 0.61, 0.36, 1); /* ease-out, no overshoot */
    --motion-shift: 16px;
    --motion-lead: calc(var(--motion-step) * 3);      /* body waits for the title */
  }

  @keyframes ccs-rise {
    from { opacity: 0; transform: translate3d(0, var(--motion-shift), 0); }
    to   { opacity: 1; transform: none; }
  }

  @keyframes ccs-drop {
    from { opacity: 0; transform: translate3d(0, calc(-1 * var(--motion-shift)), 0); }
    to   { opacity: 1; transform: none; }
  }

  @keyframes ccs-in-left {
    from { opacity: 0; transform: translate3d(calc(-1.5 * var(--motion-shift)), 0, 0); }
    to   { opacity: 1; transform: none; }
  }

  @keyframes ccs-in-right {
    from { opacity: 0; transform: translate3d(calc(1.5 * var(--motion-shift)), 0, 0); }
    to   { opacity: 1; transform: none; }
  }

  @keyframes ccs-pop {
    from { opacity: 0; transform: scale(0.965); }
    to   { opacity: 1; transform: none; }
  }

  @keyframes ccs-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  /* ---- Tier A: slide chrome --------------------------------------------
     `.slide__bg-num` is deliberately absent — its resting opacity is 0.05,
     and every keyframe here ends at opacity 1.                             */

  :where(body.presenting:not(.motion-off))
  :where(.slide.is-active:not([data-motion="off"])) .slide__header {
    animation: ccs-drop var(--motion-dur-chrome) var(--motion-ease) backwards;
  }

  :where(body.presenting:not(.motion-off))
  :where(.slide.is-active:not([data-motion="off"])) .slide__title {
    animation: ccs-rise var(--motion-dur-chrome) var(--motion-ease) backwards;
    animation-delay: var(--motion-step);
  }

  :where(body.presenting:not(.motion-off))
  :where(.slide.is-active:not([data-motion="off"])) .slide__subtitle {
    animation: ccs-rise var(--motion-dur-chrome) var(--motion-ease) backwards;
    animation-delay: calc(var(--motion-step) * 2);
  }

  :where(body.presenting:not(.motion-off))
  :where(.slide.is-active:not([data-motion="off"])) .slide__footer {
    animation: ccs-fade var(--motion-dur) var(--motion-ease) backwards;
    animation-delay: calc(var(--motion-step) * 4);
  }

  /* ---- Tier B: content units, staggered ---------------------------------
     Direct children of the body or of a pattern container animate. A pattern
     container itself is excluded so a grid and its tiles never both animate.
     Specificity: (0,2,0) — every override below matches it and wins on order. */

  :where(body.presenting:not(.motion-off))
  :where(.slide.is-active:not([data-motion="off"]))
  :is(.slide__body, .pattern-grid, .pattern-checklist, .pattern-timeline,
      .pattern-compare, .pattern-split, .pattern-hero-number, .closing-grid)
  > *:not(:is(.pattern-grid, .pattern-checklist, .pattern-timeline,
              .pattern-compare, .pattern-split, .pattern-hero-number,
              .closing-grid)) {
    animation: ccs-rise var(--motion-dur) var(--motion-ease) backwards;
    animation-delay: calc(var(--motion-lead) + var(--m-i, 0) * var(--motion-step));
  }

  /* Stagger index. Every descendant of the body gets its own --m-i from its
     own position, so the inherited value from a parent is always overridden. */
  :where(body.presenting .slide.is-active) .slide__body :nth-child(1)  { --m-i: 0; }
  :where(body.presenting .slide.is-active) .slide__body :nth-child(2)  { --m-i: 1; }
  :where(body.presenting .slide.is-active) .slide__body :nth-child(3)  { --m-i: 2; }
  :where(body.presenting .slide.is-active) .slide__body :nth-child(4)  { --m-i: 3; }
  :where(body.presenting .slide.is-active) .slide__body :nth-child(5)  { --m-i: 4; }
  :where(body.presenting .slide.is-active) .slide__body :nth-child(6)  { --m-i: 5; }
  :where(body.presenting .slide.is-active) .slide__body :nth-child(7)  { --m-i: 6; }
  :where(body.presenting .slide.is-active) .slide__body :nth-child(8)  { --m-i: 7; }
  /* 9th item onward shares one delay — a 10-tile slide must not take 1.4s. */
  :where(body.presenting .slide.is-active) .slide__body :nth-child(n+9) { --m-i: 8; }

  /* ---- Directional accents ---------------------------------------------
     Compare/split slides carry a left-vs-right meaning; the entrance should
     say the same thing the layout says. Each selector below is (0,2,0), the
     same as the Tier B rule, and comes later — that is the whole reason the
     gate is `:where()`-wrapped. Keep the parent in the selector; dropping it
     to a bare `.compare-col--avoid` drops to (0,1,0) and stops working.      */

  :where(body.presenting:not(.motion-off))
  :where(.slide.is-active:not([data-motion="off"])) .pattern-compare > .compare-col--avoid {
    animation-name: ccs-in-left;
  }

  :where(body.presenting:not(.motion-off))
  :where(.slide.is-active:not([data-motion="off"])) .pattern-compare > .compare-col--prefer {
    animation-name: ccs-in-right;
  }

  :where(body.presenting:not(.motion-off))
  :where(.slide.is-active:not([data-motion="off"])) .pattern-split > .pattern-split__primary,
  :where(body.presenting:not(.motion-off))
  :where(.slide.is-active:not([data-motion="off"])) .pattern-split > .split__left {
    animation-name: ccs-in-left;
  }

  :where(body.presenting:not(.motion-off))
  :where(.slide.is-active:not([data-motion="off"])) .pattern-split > .pattern-split__detail,
  :where(body.presenting:not(.motion-off))
  :where(.slide.is-active:not([data-motion="off"])) .pattern-split > .pattern-split__supporting,
  :where(body.presenting:not(.motion-off))
  :where(.slide.is-active:not([data-motion="off"])) .pattern-split > .split__right {
    animation-name: ccs-in-right;
  }

  /* The one number the slide exists for, and the red-flag strip, land with a
     scale-in instead of a slide so they read as arriving, not sliding past. */
  :where(body.presenting:not(.motion-off))
  :where(.slide.is-active:not([data-motion="off"])) .pattern-hero-number > .pattern-hero-number__numeric,
  :where(body.presenting:not(.motion-off))
  :where(.slide.is-active:not([data-motion="off"])) .slide__body > .alert-strip,
  :where(body.presenting:not(.motion-off))
  :where(.slide.is-active:not([data-motion="off"])) .slide__body > .ai-visual {
    animation-name: ccs-pop;
  }

  /* ---- Nested-container reset -------------------------------------------
     Some decks wrap a pattern container in a layout div
     (`.slide__body > .visual-column > .pattern-grid > .tile`). Tier B would
     animate the wrapper AND the tiles inside it — compounded transforms.
     The wrapper stands down and lets its tiles carry the motion. Declared
     last so it wins the (0,2,0) tie against every rule above.               */

  :where(body.presenting:not(.motion-off))
  :where(.slide.is-active:not([data-motion="off"]))
  :is(.slide__body, .pattern-grid, .pattern-checklist, .pattern-timeline,
      .pattern-compare, .pattern-split, .pattern-hero-number, .closing-grid)
  > *:has(:is(.pattern-grid, .pattern-checklist, .pattern-timeline,
              .pattern-compare, .pattern-split, .pattern-hero-number,
              .closing-grid)) {
    animation: none;
  }

  /* ---- Cover slide ------------------------------------------------------
     No body content on the cover; give the title block room to breathe.
     `.slide__chapter` is NOT animated separately — it lives inside
     `.slide__header`, which already carries it in.                          */

  :where(body.presenting:not(.motion-off))
  .slide--cover:where(.is-active:not([data-motion="off"])) .slide__title {
    animation: ccs-rise var(--motion-dur-hero) var(--motion-ease) backwards;
    animation-delay: calc(var(--motion-step) * 2);
  }

  :where(body.presenting:not(.motion-off))
  .slide--cover:where(.is-active:not([data-motion="off"])) .slide__subtitle {
    animation: ccs-rise var(--motion-dur-hero) var(--motion-ease) backwards;
    animation-delay: calc(var(--motion-step) * 4);
  }
}


/* ==========================================================================
   PRINT (PDF) — patient-share format
   Each slide renders as one A4-landscape page at native 16:9.
   ========================================================================== */

@media print {
  @page {
    size: 1280px 720px;
    margin: 0;
  }

  body {
    background: #fff;
  }

  .deck {
    padding: 0;
    gap: 0;
  }

  .slide {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    page-break-after: always;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .slide:last-child { page-break-after: auto; }

  .deck-nav { display: none !important; }

  /* Belt and braces. The MOTION section above can never reach print (it is
     gated on `screen`), but a deck-local <style> or a future rule might —
     and an element frozen at its keyframe `from` state prints blank. */
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}


/* ==========================================================================
   NAVIGATION (screen mode only — hidden in print)
   ========================================================================== */

.deck-nav {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  gap: var(--space-2);
  z-index: 100;
}

.deck-nav button {
  background: var(--color-navy);
  color: var(--color-canvas);
  border: none;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  box-shadow: var(--shadow-elevated);
  transition: transform 0.15s ease;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.deck-nav button:hover { transform: translateY(-2px); }


/* Mobile fit-to-width is handled via <meta name="viewport" content="width=1280">
   in each HTML head. Mobile browsers auto-zoom out, pinch-zoom remains active.
   No CSS zoom hack — kept simple and standards-compliant. */
