/* Interactive reading (reading.js). All classes prefixed rd-. Uses site tokens with fallbacks. */
.rd-root {
  --rd-accent: var(--accent, #0A66D8);
  --rd-accent-fg: var(--accent-fg, #0A5BC2);
  --rd-soft: var(--accent-soft, #EAF2FD);
  --rd-fg: var(--fg, #1D1D1F);
  --rd-muted: var(--muted, #6E6E73);
  --rd-surface: var(--surface, #FFFFFF);
  --rd-surface-2: var(--surface-2, #F5F5F7);
  --rd-line: var(--line, #E3E3E8);
  --rd-good: var(--good, #1F8A3B);
  --rd-good-soft: var(--good-soft, #EAF6ED);
  --rd-bad: var(--bad, #C8102E);
  --rd-bad-soft: var(--bad-soft, #FDECEE);
  --rd-ease: cubic-bezier(.2, .8, .2, 1);
  --rd-shadow: 0 0 0 1px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.05), 0 10px 24px rgba(0,0,0,.05);
  container-type: inline-size;
  min-width: 0;
  overflow-wrap: anywhere;
}
.rd-root *, .rd-root *::before, .rd-root *::after { box-sizing: border-box; }
.rd-root [hidden] { display: none !important; }
.rd-root img, .rd-root video, .rd-root iframe { max-width: 100%; }
.rd-root table { max-width: 100%; }
.rd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rd-ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Buttons ---------- */
.rd-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border-radius: 980px; border: 0;
  font: inherit; font-size: .95rem; font-weight: 500; letter-spacing: -.01em; line-height: 1.2;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color .2s, color .2s, transform .15s var(--rd-ease), box-shadow .2s, opacity .2s;
}
.rd-btn:active:not(:disabled) { transform: scale(.97); }
.rd-btn:focus-visible { outline: 3px solid var(--rd-accent); outline-offset: 3px; }
.rd-btn-primary { background: var(--rd-accent); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--rd-accent) 28%, transparent); }
.rd-btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--rd-accent) 88%, #000); }
.rd-btn-primary:disabled { background: color-mix(in srgb, var(--rd-fg) 10%, transparent); color: var(--rd-muted); box-shadow: none; cursor: not-allowed; }
.rd-btn-soft { background: var(--rd-soft); color: var(--rd-accent-fg); }
.rd-btn-soft:hover { background: color-mix(in srgb, var(--rd-accent) 16%, var(--rd-surface)); }
.rd-btn-icon { width: 44px; padding: 0; background: color-mix(in srgb, var(--rd-fg) 7%, transparent); color: var(--rd-fg); }
.rd-btn-icon .rd-ic { width: 14px; height: 14px; fill: currentColor; }
.rd-btn-icon:hover { background: color-mix(in srgb, var(--rd-fg) 12%, transparent); }

/* ---------- Title + header ---------- */
.rd-title > * + * { margin-top: 6px; }
.rd-head {
  margin-top: 18px; padding: 14px 16px 16px; border-radius: 18px;
  background: var(--rd-surface-2);
}
.rd-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.rd-status { margin: 0; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.rd-status-n { font-size: .78rem; font-weight: 600; color: var(--rd-accent-fg); letter-spacing: 0; }
.rd-status-t { font-size: .98rem; font-weight: 600; color: var(--rd-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-listen { display: flex; gap: 8px; flex: none; }
.rd-listen-btn { min-height: 40px; padding: 8px 16px 8px 14px; }
.rd-listen-btn[aria-pressed="true"] { background: var(--rd-accent); color: #fff; }
.rd-listen-btn .rd-ic { width: 18px; height: 18px; }
.rd-listen-btn[aria-pressed="true"] .rd-ic { fill: currentColor; stroke-width: 1.5; }
.rd-stop-btn { width: 40px; min-height: 40px; }

/* Rail */
.rd-rail { margin-top: 14px; }
.rd-rail-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 0; }
.rd-root .rd-rail-list li { margin: 0; max-width: none; }
.rd-rail-i { position: relative; flex: 1 1 0; min-width: 0; }
.rd-rail-i + .rd-rail-i::before, .rd-rail-i + .rd-rail-i::after {
  content: ""; position: absolute; top: 15px; height: 2px; border-radius: 2px;
  left: calc(-50% + 20px); right: calc(50% + 20px);
  background: color-mix(in srgb, var(--rd-fg) 12%, transparent);
}
.rd-rail-i + .rd-rail-i::after { background: var(--rd-accent); transform: scaleX(0); transform-origin: left; transition: transform .6s var(--rd-ease); }
.rd-rail-i.rd-reached + .rd-rail-i.rd-reached::after { transform: scaleX(1); }
.rd-rail-btn {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 0 4px 2px; border: 0; background: none; font: inherit; color: var(--rd-muted);
  cursor: pointer; border-radius: 10px; -webkit-tap-highlight-color: transparent;
}
.rd-rail-btn:disabled { cursor: default; }
.rd-rail-btn:focus-visible { outline: 3px solid var(--rd-accent); outline-offset: 2px; }
.rd-dot {
  position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: .82rem; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--rd-surface); color: var(--rd-muted);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--rd-fg) 14%, transparent);
  transition: background-color .3s, color .3s, box-shadow .3s, transform .3s var(--rd-ease);
}
.rd-dot-ck { position: absolute; width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .45s .1s var(--rd-ease); }
.rd-reached .rd-dot { color: var(--rd-accent-fg); box-shadow: inset 0 0 0 1.5px var(--rd-accent); }
.rd-rail-btn[aria-current="step"] .rd-dot { background: var(--rd-accent); color: #fff; box-shadow: 0 0 0 5px color-mix(in srgb, var(--rd-accent) 18%, transparent); }
.rd-done .rd-dot { background: var(--rd-accent); color: transparent; box-shadow: none; }
.rd-done .rd-rail-btn[aria-current="step"] .rd-dot { box-shadow: 0 0 0 5px color-mix(in srgb, var(--rd-accent) 18%, transparent); }
.rd-done .rd-dot-ck { stroke-dashoffset: 0; }
.rd-dot-n { transition: opacity .2s; }
.rd-done .rd-dot-n { opacity: 0; }
.rd-reached .rd-rail-btn:not(:disabled):hover .rd-dot { transform: scale(1.08); }
.rd-rail-t {
  display: block; max-width: 100%; font-size: .76rem; line-height: 1.25; font-weight: 500; text-align: center;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.rd-reached .rd-rail-t { color: var(--rd-fg); }
.rd-rail-btn[aria-current="step"] .rd-rail-t { color: var(--rd-accent-fg); font-weight: 600; }
@container (max-width: 560px) {
  .rd-rail-t { display: none; }
  .rd-dot { width: 28px; height: 28px; font-size: .78rem; }
  .rd-rail-i + .rd-rail-i::before, .rd-rail-i + .rd-rail-i::after { top: 13px; left: calc(-50% + 17px); right: calc(50% + 17px); }
}

/* ---------- Chapters ---------- */
.rd-ch { position: relative; margin-top: 26px; scroll-margin-top: 84px; outline: none; }
.rd-root > .rd-ch + .rd-ch { margin-top: 30px; padding-top: 26px; border-top: 1px solid color-mix(in srgb, var(--rd-line) 80%, transparent); }
.rd-ch::before {
  content: ""; position: absolute; left: calc(-1 * clamp(10px, 2vw, 20px)); top: 2px; bottom: 2px; width: 3px; border-radius: 3px;
  background: transparent; transition: background-color .4s;
}
.rd-root > .rd-ch + .rd-ch::before { top: 28px; }
.rd-ch.rd-current::before { background: var(--rd-accent); }
.rd-ch-body > * + * { margin-top: 14px; }
.rd-ch-body > h3:first-child, .rd-ch-body > .rd-kicker + h3 { margin-top: 2px; }
.rd-kicker { margin: 0; font-size: .78rem; font-weight: 600; color: var(--rd-muted); letter-spacing: 0; }
.rd-current .rd-kicker { color: var(--rd-accent-fg); }
.rd-ch-body h3 { font-size: 1.2rem; }
.rd-ch-body h3 + * { margin-top: 10px; }

.rd-enter .rd-ch-body > * { animation: rd-rise .6s var(--rd-ease) both; animation-delay: var(--rd-d, 0ms); }
@keyframes rd-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.rd-foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px 16px; margin-top: 22px; }
.rd-gate { margin: 0; flex: 1 1 200px; font-size: .86rem; color: var(--rd-muted); }
.rd-gate:empty { display: none; }
.rd-next { min-width: 150px; }
.rd-next .rd-ic { stroke-width: 2.2; }
.rd-next:not(:disabled) .rd-ic { animation: rd-nudge 1.8s var(--rd-ease) .8s 2; }
@keyframes rd-nudge { 0%, 100% { transform: none; } 50% { transform: translateY(3px); } }
.rd-done-tag { margin: 0; display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; font-weight: 500; color: var(--rd-muted); }
.rd-done-tag .rd-ic { width: 16px; height: 16px; color: var(--rd-good); stroke-width: 2.4; }
.rd-finished .rd-ch:last-of-type .rd-done-tag { color: var(--rd-good); font-weight: 600; font-size: .92rem; padding: 8px 14px; border-radius: 980px; background: var(--rd-good-soft); }
.rd-done-tag:focus { outline: none; }

/* ---------- Explore cards (ul) ---------- */
.rd-explore { margin-top: 14px; }
.rd-ex-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 10px; }
.rd-ex-hint { font-size: .84rem; color: var(--rd-muted); font-weight: 500; }
.rd-count { font-size: .82rem; font-weight: 600; color: var(--rd-accent-fg); font-variant-numeric: tabular-nums; }
.rd-ex-head .rd-count { margin-left: auto; }
.rd-meter { flex: 1 0 100%; height: 3px; border-radius: 4px; background: color-mix(in srgb, var(--rd-fg) 8%, transparent); overflow: hidden; }
.rd-meter > span { display: block; height: 100%; width: 0; background: var(--rd-accent); border-radius: inherit; transition: width .5s var(--rd-ease); }
.rd-all .rd-count { color: var(--rd-good); }
.rd-all .rd-meter > span { background: var(--rd-good); }

.rd-root ul.rd-ex-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 10px; }
.rd-root ul.rd-ex-list.rd-ex-single { grid-template-columns: 1fr; }
.rd-root .rd-ex-list > li { margin: 0; max-width: none; }
.rd-ex-item { display: flex; }
.rd-ex-card {
  width: 100%; display: flex; align-items: flex-start; gap: 12px; text-align: left;
  padding: 14px 16px; border-radius: 14px; border: 0; cursor: pointer;
  font: inherit; font-size: .97rem; line-height: 1.45; color: var(--rd-fg);
  background: var(--rd-surface); box-shadow: var(--rd-shadow);
  transition: transform .25s var(--rd-ease), box-shadow .25s, background-color .3s;
  -webkit-tap-highlight-color: transparent;
}
.rd-ex-card:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(0,0,0,.05), 0 6px 18px rgba(0,0,0,.08); }
.rd-ex-card:active { transform: scale(.985); }
.rd-ex-card:focus-visible { outline: 3px solid var(--rd-accent); outline-offset: 2px; }
.rd-ex-card[aria-pressed="true"] { background: color-mix(in srgb, var(--rd-accent) 5%, var(--rd-surface)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--rd-accent) 22%, transparent); transform: none; }
.rd-ex-txt { min-width: 0; flex: 1; padding-top: 1px; }
.rd-ex-mark { flex: none; width: 24px; height: 24px; margin-top: 0; }
.rd-ex-mark svg { width: 24px; height: 24px; display: block; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.rd-ex-mark circle { stroke: color-mix(in srgb, var(--rd-fg) 22%, transparent); stroke-width: 1.6; fill: transparent; transition: fill .35s var(--rd-ease), stroke .35s; }
.rd-ex-mark path { stroke: #fff; stroke-width: 2.4; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .4s .12s var(--rd-ease); }
.rd-on .rd-ex-mark circle { fill: var(--rd-accent); stroke: var(--rd-accent); }
.rd-on .rd-ex-mark path { stroke-dashoffset: 0; }
.rd-on .rd-ex-mark svg { animation: rd-pop .45s var(--rd-ease); }
@keyframes rd-pop { 0% { transform: scale(.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* ---------- Stepper (ol) ---------- */
.rd-stepper { margin-top: 14px; }
.rd-root ol.rd-steps { list-style: none; margin: 0; padding: 0; }
.rd-root .rd-steps > li { margin: 0; max-width: none; }
.rd-step { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 14px; padding-bottom: 16px; }
.rd-step:last-child { padding-bottom: 0; }
.rd-step-rail { position: relative; display: flex; flex-direction: column; align-items: center; }
.rd-step-n {
  position: relative; z-index: 1; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: .9rem; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--rd-accent); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--rd-accent) 30%, transparent);
}
.rd-step-line { position: absolute; top: 38px; left: 16px; width: 2px; height: calc(100% - 24px); overflow: visible; }
.rd-step-line path { fill: none; stroke: var(--rd-accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .6s var(--rd-ease); }
.rd-linked .rd-step-line path { stroke-dashoffset: 0; }
.rd-step-body {
  padding: 12px 16px; border-radius: 14px; background: var(--rd-surface-2); line-height: 1.5; outline: none; min-width: 0;
}
.rd-step-body > * + * { margin-top: 8px; }
.rd-pop .rd-step-n { animation: rd-pop .45s .35s var(--rd-ease) both; }
.rd-pop .rd-step-body { animation: rd-rise .5s .3s var(--rd-ease) both; }
.rd-step-ctl { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-top: 14px; padding-left: 48px; }
.rd-step-ctl .rd-count { color: var(--rd-muted); }
.rd-stepper.rd-all .rd-step-ctl .rd-count { color: var(--rd-good); }

/* ---------- Do / Avoid flip cards ---------- */
.rd-root .doavoid.rd-flips { gap: 12px; }
.rd-root .doavoid .rd-flip { padding: 0; background: transparent; border-radius: 16px; perspective: 1000px; display: flex; }
.rd-flip-btn {
  width: 100%; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer;
  border-radius: 16px; -webkit-tap-highlight-color: transparent; display: block;
}
.rd-flip-btn:focus-visible { outline: 3px solid var(--rd-accent); outline-offset: 3px; }
.rd-flip-in { display: grid; min-height: 132px; height: 100%; transform-style: preserve-3d; transition: transform .6s var(--rd-ease); }
.rd-face {
  grid-area: 1 / 1; display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; border-radius: 16px;
  -webkit-backface-visibility: hidden; backface-visibility: hidden; min-width: 0;
}
.rd-front { align-items: flex-start; justify-content: space-between; background: var(--rd-surface); box-shadow: var(--rd-shadow); transition: box-shadow .25s, transform .25s var(--rd-ease); }
.rd-flip-btn:hover .rd-front { box-shadow: 0 0 0 1px rgba(0,0,0,.05), 0 8px 22px rgba(0,0,0,.09); }
.rd-back { transform: rotateY(180deg); justify-content: center; }
.rd-flipped .rd-flip-in { transform: rotateY(180deg); }
.rd-root .doavoid .rd-face b { display: block; margin: 0; font-size: 1.05rem; font-weight: 600; letter-spacing: -.01em; text-transform: none; }
.rd-root .doavoid .rd-back b { font-size: .8rem; }
.rd-flip-ic { width: 30px; height: 30px; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rd-hint { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 500; color: var(--rd-muted); }
.rd-hint .rd-ic { width: 14px; height: 14px; }
.rd-back-txt { font-size: .97rem; line-height: 1.45; color: var(--rd-fg); }
.rd-flip.do .rd-flip-ic, .rd-flip.do .rd-face b { color: var(--rd-good); stroke: var(--rd-good); }
.rd-flip.avoid .rd-flip-ic, .rd-flip.avoid .rd-face b { color: var(--rd-bad); stroke: var(--rd-bad); }
.rd-flip.do .rd-front { background: linear-gradient(160deg, color-mix(in srgb, var(--rd-good-soft) 70%, var(--rd-surface)), var(--rd-surface) 70%); }
.rd-flip.avoid .rd-front { background: linear-gradient(160deg, color-mix(in srgb, var(--rd-bad-soft) 70%, var(--rd-surface)), var(--rd-surface) 70%); }
.rd-flip.do .rd-back { background: var(--rd-good-soft); }
.rd-flip.avoid .rd-back { background: var(--rd-bad-soft); }
.rd-flip-btn:active .rd-flip-in { transform: scale(.98); }
.rd-flipped .rd-flip-btn:active .rd-flip-in { transform: rotateY(180deg) scale(.98); }

/* ---------- Key point callouts ---------- */
.rd-root .callout.rd-key { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 14px; align-items: start; padding: 16px 18px; border-radius: 16px; position: relative; overflow: hidden; }
.rd-key::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--rd-accent); transform: scaleY(0); transform-origin: top; transition: transform .7s .1s var(--rd-ease); }
.rd-key.rd-in::after { transform: scaleY(1); }
.rd-key-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--rd-surface); color: var(--rd-accent); box-shadow: 0 2px 8px color-mix(in srgb, var(--rd-accent) 18%, transparent); transform: scale(.6); opacity: 0; transition: transform .5s var(--rd-ease), opacity .4s; }
.rd-key-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rd-key-ic path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .9s .25s var(--rd-ease); }
.rd-key-ic path:nth-child(2) { transition-delay: .7s; }
.rd-key-ic path:nth-child(3), .rd-key-ic path:nth-child(4) { transition-delay: .9s; transition-duration: .4s; }
.rd-key.rd-in .rd-key-ic { transform: none; opacity: 1; }
.rd-key.rd-in .rd-key-ic path { stroke-dashoffset: 0; }
.rd-key-body { min-width: 0; padding-top: 6px; line-height: 1.5; }
.rd-key-body strong:first-child { color: var(--rd-accent-fg); }
.rd-key-body { opacity: .4; transition: opacity .6s .15s; }
.rd-key.rd-in .rd-key-body { opacity: 1; }

/* ---------- Speech highlight ---------- */
.rd-speaking { background-color: color-mix(in srgb, var(--rd-accent) 12%, transparent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--rd-accent) 12%, transparent); border-radius: 8px; transition: background-color .25s, box-shadow .25s; }
.rd-ex-item.rd-speaking, .rd-step.rd-speaking { background: none; box-shadow: none; }
.rd-ex-item.rd-speaking .rd-ex-card { box-shadow: 0 0 0 2px var(--rd-accent); }
.rd-step.rd-speaking .rd-step-body { box-shadow: 0 0 0 2px var(--rd-accent); }
.rd-flip.rd-speaking { background: transparent; box-shadow: 0 0 0 3px var(--rd-accent); border-radius: 16px; }
.callout.rd-speaking { box-shadow: 0 0 0 2px var(--rd-accent); }

/* ---------- Phone ---------- */
@container (max-width: 480px) {
  .rd-head { padding: 12px 12px 14px; border-radius: 16px; }
  .rd-listen-btn { padding: 8px 14px 8px 12px; }
  .rd-foot { justify-content: stretch; }
  .rd-next { flex: 1 1 100%; }
  .rd-step { grid-template-columns: 30px minmax(0, 1fr); gap: 12px; }
  .rd-step-n { width: 30px; height: 30px; font-size: .84rem; }
  .rd-step-line { top: 34px; left: 14px; height: calc(100% - 20px); }
  .rd-step-ctl { padding-left: 0; }
  .rd-root .callout.rd-key { grid-template-columns: 1fr; gap: 10px; }
  .rd-key-body { padding-top: 0; }
  .rd-flip-in { min-height: 112px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .rd-root *, .rd-root *::before, .rd-root *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .rd-flip-in { transform-style: flat; }
  .rd-flipped .rd-flip-in { transform: none; }
  .rd-back { transform: none; opacity: 0; }
  .rd-flipped .rd-back { opacity: 1; }
  .rd-flipped .rd-front { opacity: 0; }
}
