/* ==========================================================================
   My Exports — Topic page layout & design system (all topic pages)

   Every topic page shares this shell: sticky top bar, module sidebar, topic
   hero, article surface and Previous / Next pager. Page-specific
   component styles live in assets/css/topics/<module>/<topic>.css and are
   wrapped in the `legacy` cascade layer, so anything declared here (unlayered)
   wins without !important. The `tp-reset` layer is only used for the few
   !important resets that must beat !important rules inside `legacy`.
   ========================================================================== */

@layer tp-reset, legacy;

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  --tp-font-body: 'Plus Jakarta Sans', 'Noto Sans Telugu', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif,
    'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
  --tp-font-display: 'Playfair Display', Georgia, 'Noto Serif Telugu', 'Noto Sans Telugu', serif;
  --tp-font-te: 'Noto Sans Telugu', 'Plus Jakarta Sans', system-ui, sans-serif;

  --tp-ink: #0d1b18;
  --tp-ink-2: #2b3a36;
  --tp-muted: #5a6a66;
  --tp-subtle: #7d8c88;
  --tp-line: #e2eae7;
  --tp-line-strong: #cbd9d4;
  --tp-bg: #f3f7f5;
  --tp-surface: #ffffff;
  --tp-surface-2: #f8fbfa;

  --tp-brand: #0b7f5c;
  --tp-brand-ink: #08696d;
  --tp-brand-deep: #05302b;
  --tp-brand-bright: #2cc3a6;
  --tp-brand-soft: #e6f7f1;
  --tp-gold: #f5a623;
  --tp-success: #12a585;

  /* Phase accent (overridden by .tp-phase-N on <body>). */
  --tp-accent: #0b7f5c;
  --tp-accent-bright: #2cc3a6;
  --tp-accent-soft: #e6f8f2;

  --tp-radius-sm: 10px;
  --tp-radius: 16px;
  --tp-radius-lg: 24px;
  --tp-radius-xl: 28px;
  --tp-shadow-sm: 0 1px 2px rgba(13, 40, 34, 0.06);
  --tp-shadow: 0 1px 2px rgba(13, 40, 34, 0.04), 0 18px 40px -26px rgba(13, 60, 50, 0.35);
  --tp-shadow-lg: 0 30px 60px -32px rgba(13, 60, 50, 0.45);
  --tp-ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  --tp-topbar-h: 64px;
  --tp-gutter: clamp(16px, 3.2vw, 32px);
  --tp-container: 1360px;
  --tp-sidebar-w: 300px;

  /* Content type scale: topic styles multiply their px font sizes by this. */
  --tp-type-scale: 1.18;
}

.tp-phase-1 { --tp-accent: #b45d05; --tp-accent-bright: #f5a623; --tp-accent-soft: #fff4dc; }
.tp-phase-2 { --tp-accent: #0b7f5c; --tp-accent-bright: #2cc3a6; --tp-accent-soft: #e3f7f0; }
.tp-phase-3 { --tp-accent: #1d4fd7; --tp-accent-bright: #3384ef; --tp-accent-soft: #e7f0fe; }
.tp-phase-4 { --tp-accent: #6d2fd0; --tp-accent-bright: #a86afc; --tp-accent-soft: #f2ecfe; }

@media (min-width: 768px) { :root { --tp-type-scale: 1.28; } }
@media (min-width: 1200px) { :root { --tp-type-scale: 1.34; --tp-topbar-h: 72px; } }

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--tp-topbar-h) + 16px);
  background: var(--tp-bg);
}

body.tp-body {
  display: block;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  width: auto;
  height: auto;
  overflow-x: clip;
  font-family: var(--tp-font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--tp-ink);
  background:
    radial-gradient(1200px 520px at 85% -120px, var(--tp-accent-soft) 0%, transparent 70%),
    radial-gradient(900px 480px at -10% 0%, #e9f6f1 0%, transparent 65%),
    var(--tp-bg);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  justify-content: initial;
  align-items: initial;
}

.tp-body :where(img, svg) { max-width: 100%; }
.tp-body :focus-visible { outline: 3px solid var(--tp-brand-bright); outline-offset: 3px; border-radius: 6px; }

.tp-container {
  width: 100%;
  max-width: var(--tp-container);
  margin-inline: auto;
  padding-inline: var(--tp-gutter);
}

.tp-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.tp-skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--tp-brand-deep);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s var(--tp-ease);
}
.tp-skip-link:focus { transform: none; }

/* --------------------------------------------------------------------------
   3. Top bar
   -------------------------------------------------------------------------- */
.tp-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--tp-topbar-h);
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid rgba(203, 217, 212, 0.7);
}

.tp-topbar__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
}

.tp-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  color: inherit;
  text-decoration: none;
  border-radius: 14px;
}
.tp-brand__logo {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--tp-line);
  box-shadow: var(--tp-shadow-sm);
  overflow: hidden;
}
.tp-brand__logo img { width: 32px; height: 32px; object-fit: contain; }
.tp-brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.tp-brand__title {
  font-family: var(--tp-font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--tp-ink);
}
.tp-brand__title em { font-style: italic; color: var(--tp-brand); }
.tp-brand__tag {
  margin-top: 3px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tp-subtle);
}

.tp-topbar__divider {
  width: 1px;
  height: 28px;
  background: var(--tp-line-strong);
  flex-shrink: 0;
}

.tp-crumbs { min-width: 0; flex: 1 1 auto; }
.tp-crumbs ol {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--tp-muted);
}
.tp-crumbs li { display: inline-flex; align-items: center; gap: 4px; min-width: 0; white-space: nowrap; }
.tp-crumbs li:last-child { overflow: hidden; }
.tp-crumbs li + li::before {
  content: '';
  width: 6px;
  height: 6px;
  margin: 0 6px 0 2px;
  border-top: 1.6px solid var(--tp-subtle);
  border-right: 1.6px solid var(--tp-subtle);
  transform: rotate(45deg);
  flex-shrink: 0;
}
.tp-crumbs a {
  color: inherit;
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 8px;
  transition: color 0.15s, background-color 0.15s;
}
.tp-crumbs a:hover { color: var(--tp-ink); background: rgba(13, 27, 24, 0.05); }
.tp-crumbs [aria-current='page'] {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--tp-ink);
  padding: 4px 6px;
}

.tp-topbar__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }

.tp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 700 14px/1 var(--tp-font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s var(--tp-ease);
}
.tp-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.tp-btn:active { transform: scale(0.97); }
.tp-btn--ghost { background: #fff; color: var(--tp-ink-2); border-color: var(--tp-line-strong); }
.tp-btn--ghost:hover { border-color: var(--tp-brand); color: var(--tp-brand); }
.tp-btn--primary { background: var(--tp-brand); color: #fff; box-shadow: 0 10px 22px -12px rgba(11, 127, 92, 0.8); }
.tp-btn--primary:hover { background: #0a6f51; }
.tp-btn--icon { width: 40px; padding: 0; }

.tp-toc-toggle { display: none; }

.tp-readbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: transparent;
  overflow: hidden;
  pointer-events: none;
}
.tp-readbar span {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(var(--tp-read, 0));
  background: linear-gradient(90deg, var(--tp-accent-bright), var(--tp-brand-bright));
}

/* --------------------------------------------------------------------------
   4. Page layout
   -------------------------------------------------------------------------- */
.tp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  padding-top: clamp(16px, 3vw, 32px);
  padding-bottom: 56px;
  align-items: start;
}
.tp-main { min-width: 0; display: flex; flex-direction: column; gap: clamp(18px, 2.4vw, 28px); }
.tp-main:focus { outline: none; }

@media (min-width: 1100px) {
  .tp-layout { grid-template-columns: var(--tp-sidebar-w) minmax(0, 1fr); gap: 40px; }
}
@media (min-width: 1400px) {
  .tp-layout { gap: 56px; }
}

/* --------------------------------------------------------------------------
   5. Sidebar (program navigator)
   -------------------------------------------------------------------------- */
.tp-sidebar {
  position: sticky;
  top: calc(var(--tp-topbar-h) + 24px);
  max-height: calc(100vh - var(--tp-topbar-h) - 48px);
  max-height: calc(100dvh - var(--tp-topbar-h) - 48px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.tp-sidebar__head { display: none; }

.tp-progress-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--tp-radius-lg);
  background: linear-gradient(135deg, var(--tp-brand-deep) 0%, #0a4d43 100%);
  color: #fff;
  box-shadow: var(--tp-shadow);
  flex-shrink: 0;
}
.tp-ring { position: relative; width: 56px; height: 56px; flex-shrink: 0; }
.tp-ring svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.tp-ring circle { fill: none; stroke-width: 6; }
.tp-ring .tp-ring__track { stroke: rgba(255, 255, 255, 0.16); }
.tp-ring .tp-ring__value {
  stroke: var(--tp-brand-bright);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s var(--tp-ease);
}
.tp-ring__label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
}
.tp-progress-card__title { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.tp-progress-card__meta { margin: 2px 0 0; font-size: 12.5px; color: rgba(255, 255, 255, 0.75); }

.tp-toc {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  border-radius: var(--tp-radius-lg);
  background: var(--tp-surface);
  border: 1px solid var(--tp-line);
  box-shadow: var(--tp-shadow-sm);
  scrollbar-width: thin;
  scrollbar-color: var(--tp-line-strong) transparent;
}
.tp-toc__phase {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 10px 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tp-subtle);
}
.tp-toc__phase:first-child { margin-top: 6px; }
.tp-toc__phase::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--phase-accent, var(--tp-accent-bright));
}

.tp-toc__module { border-radius: 14px; }
.tp-toc__module + .tp-toc__module { margin-top: 2px; }
.tp-toc__module[open] { background: var(--tp-surface-2); }
.tp-toc__summary {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto 14px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s;
}
.tp-toc__summary::-webkit-details-marker { display: none; }
.tp-toc__summary:hover { background: rgba(13, 27, 24, 0.045); }
.tp-toc__num {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--tp-surface-2);
  border: 1px solid var(--tp-line);
  font-size: 12.5px;
  font-weight: 800;
  color: var(--tp-ink-2);
  font-variant-numeric: tabular-nums;
}
.tp-toc__module.is-current .tp-toc__num { background: var(--tp-accent); border-color: var(--tp-accent); color: #fff; }
.tp-toc__module.is-complete .tp-toc__num { background: var(--tp-brand-soft); border-color: #bfe8da; color: var(--tp-brand); }
.tp-toc__title { min-width: 0; font-size: 14px; font-weight: 700; line-height: 1.3; color: var(--tp-ink); }
.tp-toc__count { font-size: 11.5px; font-weight: 700; color: var(--tp-subtle); font-variant-numeric: tabular-nums; }
.tp-toc__chev {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--tp-subtle);
  border-bottom: 2px solid var(--tp-subtle);
  transform: rotate(-45deg);
  transition: transform 0.2s var(--tp-ease);
  justify-self: center;
}
.tp-toc__module[open] > .tp-toc__summary .tp-toc__chev { transform: rotate(45deg); }

.tp-toc__topics { margin: 0; padding: 2px 6px 10px 22px; list-style: none; position: relative; }
.tp-toc__topics::before {
  content: '';
  position: absolute;
  left: 26px;
  top: 4px;
  bottom: 14px;
  width: 2px;
  border-radius: 2px;
  background: var(--tp-line);
}
.tp-toc__link {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 10px 7px 0;
  border-radius: 10px;
  color: var(--tp-ink-2);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.tp-toc__link:hover { color: var(--tp-ink); background: rgba(13, 27, 24, 0.04); }
.tp-toc__dot {
  position: relative;
  z-index: 1;
  justify-self: center;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--tp-surface);
  border: 2px solid var(--tp-line-strong);
}
.tp-toc__id { font-size: 11.5px; font-weight: 700; color: var(--tp-subtle); font-variant-numeric: tabular-nums; }
.tp-toc__name { min-width: 0; }
.tp-toc__link.is-done .tp-toc__dot { background: var(--tp-success); border-color: var(--tp-success); }
.tp-toc__link[aria-current='page'] {
  background: var(--tp-accent-soft);
  color: var(--tp-accent);
  font-weight: 800;
}
.tp-toc__link[aria-current='page'] .tp-toc__dot {
  background: var(--tp-accent-bright);
  border-color: var(--tp-surface);
  box-shadow: 0 0 0 3px var(--tp-accent-bright);
}
.tp-toc__link[aria-current='page'] .tp-toc__id { color: var(--tp-accent); }

.tp-sidebar__cta { flex-shrink: 0; }
.tp-sidebar__cta .tp-btn { width: 100%; }

/* --------------------------------------------------------------------------
   6. Topic hero
   -------------------------------------------------------------------------- */
.tp-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(22px, 4vw, 44px);
  border-radius: var(--tp-radius-xl);
  background:
    radial-gradient(110% 130% at 100% 0%, var(--tp-accent-soft) 0%, rgba(255, 255, 255, 0) 58%),
    var(--tp-surface);
  border: 1px solid var(--tp-line);
  box-shadow: var(--tp-shadow);
}
.tp-hero::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--tp-accent-bright), var(--tp-brand-bright) 70%, #9be7d6);
}
.tp-hero__watermark {
  position: absolute;
  right: clamp(-12px, -1vw, 0px);
  bottom: -0.22em;
  z-index: -1;
  font-family: var(--tp-font-display);
  font-size: clamp(120px, 17vw, 230px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: transparent;
  -webkit-text-stroke: 2px color-mix(in srgb, var(--tp-accent-bright) 26%, transparent);
  user-select: none;
  pointer-events: none;
}

.tp-hero__eyebrow { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: clamp(14px, 2vw, 20px); }
.tp-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--tp-line);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--tp-ink-2);
  text-decoration: none;
  white-space: nowrap;
}
.tp-chip--accent { background: var(--tp-accent-soft); border-color: transparent; color: var(--tp-accent); }
.tp-chip--accent::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tp-accent-bright);
}
a.tp-chip:hover { border-color: var(--tp-accent-bright); }

.tp-hero__title {
  margin: 0;
  max-width: 22ch;
  font-family: var(--tp-font-display);
  font-size: clamp(30px, 4.4vw, 52px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--tp-ink);
  text-wrap: balance;
}
.tp-hero__subtitle {
  margin: 10px 0 0;
  font-family: var(--tp-font-te);
  font-size: clamp(17px, 2.1vw, 22px);
  font-weight: 600;
  line-height: 1.5;
  color: var(--tp-accent);
}

.tp-hero__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin-top: clamp(20px, 3vw, 32px);
  padding-top: clamp(16px, 2.4vw, 22px);
  border-top: 1px dashed var(--tp-line-strong);
}
.tp-steps { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tp-steps__label { margin: 0; font-size: 13px; font-weight: 700; color: var(--tp-muted); }
.tp-steps__label strong { color: var(--tp-ink); }
.tp-steps__list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tp-steps__item {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 10px;
  background: var(--tp-surface);
  border: 1px solid var(--tp-line-strong);
  font-size: 12.5px;
  font-weight: 800;
  color: var(--tp-muted);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s, transform 0.15s var(--tp-ease);
}
a.tp-steps__item:hover { border-color: var(--tp-accent-bright); color: var(--tp-accent); transform: translateY(-1px); }
.tp-steps__item.is-done { background: var(--tp-brand-soft); border-color: #bfe8da; color: var(--tp-brand); }
.tp-steps__item[aria-current='page'] {
  background: var(--tp-accent);
  border-color: var(--tp-accent);
  color: #fff;
  box-shadow: 0 8px 18px -10px var(--tp-accent);
}

.tp-complete {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 20px 0 14px;
  border-radius: 999px;
  border: 1.5px solid var(--tp-line-strong);
  background: var(--tp-surface);
  color: var(--tp-ink-2);
  font: 700 14.5px/1 var(--tp-font-body);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.2s var(--tp-ease);
}
.tp-complete:hover { border-color: var(--tp-brand); color: var(--tp-brand); }
.tp-complete:active { transform: scale(0.97); }
.tp-complete__icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid currentColor;
  transition: background-color 0.2s, border-color 0.2s;
}
.tp-complete__icon svg { width: 14px; height: 14px; opacity: 0; transform: scale(0.6); transition: opacity 0.2s, transform 0.2s var(--tp-ease); }
.tp-complete[aria-pressed='true'] {
  background: var(--tp-brand);
  border-color: var(--tp-brand);
  color: #fff;
  box-shadow: 0 12px 24px -14px rgba(11, 127, 92, 0.9);
}
.tp-complete[aria-pressed='true'] .tp-complete__icon { background: #fff; border-color: #fff; color: var(--tp-brand); }
.tp-complete[aria-pressed='true'] .tp-complete__icon svg { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   7. Article surface — hosts the topic's own content
   -------------------------------------------------------------------------- */
.tp-article {
  --tp-article-pad: clamp(6px, 1.6vw, 18px);
  position: relative;
  padding-block: var(--tp-article-pad);
  padding-inline: clamp(0px, 1.4vw, 16px);
  border-radius: var(--tp-radius-xl);
  background: var(--tp-surface-2);
  border: 1px solid var(--tp-line);
  box-shadow: var(--tp-shadow-sm);
  font-family: var(--tp-font-body);
  color: var(--tp-ink);
  overflow-wrap: break-word;
}

/* Topic content follows the shell's type family; monospace stays intact
   because page styles keep explicit monospace declarations. */
.tp-article :where(button, input, select, textarea) { font-family: inherit; }
.tp-article :where(table) { max-width: 100%; }
.tp-article :where(img, svg, canvas, video) { max-width: 100%; }
.tp-article :where(a) { color: inherit; }

@layer tp-reset {
  /* The topic markup was authored inside a fixed-size phone frame. Turn the
     frame and its inner scroll viewport into plain, fluid page content. */
  .tp-article .ph,
  .tp-article .web-app-wrapper,
  .tp-article .phone-frame,
  .tp-article .phone-scroll {
    position: relative !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    overflow: visible !important;
  }
  .tp-article :where(.scroll-content, .app-scroll, .main-content, .screen-scroll, .content-scroll,
    .scroll-area, .mobile-scroll, .screen-content, .web-flow) {
    position: relative !important;
    inset: auto !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    flex: none !important;
  }
  /* Content reads top to bottom in a single column at every width. */
  .tp-article .web-flow {
    column-count: auto !important;
    columns: auto !important;
  }
  .tp-article .ph > .body {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

/* --------------------------------------------------------------------------
   8. Pager
   -------------------------------------------------------------------------- */
.tp-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.tp-pager__card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 112px;
  padding: 20px 22px;
  border-radius: var(--tp-radius-lg);
  background: var(--tp-surface);
  border: 1px solid var(--tp-line);
  box-shadow: var(--tp-shadow-sm);
  color: var(--tp-ink);
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.25s var(--tp-ease);
}
.tp-pager__card:hover {
  border-color: color-mix(in srgb, var(--tp-accent-bright) 60%, var(--tp-line));
  box-shadow: var(--tp-shadow-lg);
  transform: translateY(-2px);
}
.tp-pager__card--next {
  grid-column: 2;
  align-items: flex-end;
  text-align: right;
  background:
    radial-gradient(120% 140% at 100% 0%, var(--tp-accent-soft) 0%, rgba(255, 255, 255, 0) 65%),
    var(--tp-surface);
}
.tp-pager__dir {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tp-accent);
}
.tp-pager__dir svg { width: 18px; height: 18px; transition: transform 0.25s var(--tp-ease); }
.tp-pager__card--prev:hover .tp-pager__dir svg { transform: translateX(-3px); }
.tp-pager__card--next:hover .tp-pager__dir svg { transform: translateX(3px); }
.tp-pager__title {
  font-size: clamp(17px, 1.8vw, 20px);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.tp-pager__meta { font-size: 13px; font-weight: 600; color: var(--tp-muted); }

.tp-backlink {
  display: flex;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   9. Floating helpers
   -------------------------------------------------------------------------- */
.tp-totop {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 40;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--tp-line);
  background: var(--tp-surface);
  color: var(--tp-ink);
  box-shadow: var(--tp-shadow-lg);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s var(--tp-ease), visibility 0.25s;
}
.tp-totop svg { width: 20px; height: 20px; }
.tp-totop.is-visible { opacity: 1; visibility: visible; transform: none; }
.tp-totop:hover { color: var(--tp-brand); border-color: var(--tp-brand); }

.tp-toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--tp-brand-deep);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--tp-shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 16px);
  transition: opacity 0.25s, transform 0.3s var(--tp-ease), visibility 0.25s;
}
.tp-toast.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

.tp-scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(5, 25, 22, 0.42);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

/* --------------------------------------------------------------------------
   10. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1099.98px) {
  .tp-toc-toggle { display: inline-flex; }

  /* Sidebar becomes an off-canvas drawer. */
  .tp-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    width: min(360px, 88vw);
    max-height: none;
    padding: 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    background: var(--tp-bg);
    box-shadow: var(--tp-shadow-lg);
    transform: translateX(-104%);
    visibility: hidden;
    transition: transform 0.3s var(--tp-ease), visibility 0.3s;
  }
  .tp-sidebar__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
  }
  .tp-sidebar__title { margin: 0; font-size: 16px; font-weight: 800; }

  .tp-drawer-open { overflow: hidden; }
  .tp-drawer-open .tp-sidebar { transform: none; visibility: visible; }
  .tp-drawer-open .tp-scrim { opacity: 1; visibility: visible; }
}

@media (max-width: 899.98px) {
  .tp-topbar__divider, .tp-crumbs { display: none; }
}

@media (max-width: 639.98px) {
  :root { --tp-topbar-h: 60px; }
  .tp-brand__logo { width: 36px; height: 36px; border-radius: 10px; }
  .tp-brand__logo img { width: 28px; height: 28px; }
  .tp-brand__title { font-size: 18px; }
  .tp-brand__tag { font-size: 9.5px; letter-spacing: 0.1em; }
  .tp-btn__label { display: none; }
  .tp-topbar__actions .tp-btn { width: 40px; padding: 0; }

  .tp-layout { gap: 20px; padding-top: 14px; padding-bottom: 32px; }
  .tp-hero { border-radius: var(--tp-radius-lg); }
  .tp-hero__watermark { font-size: 120px; bottom: -0.18em; }
  .tp-hero__footer { flex-direction: column; align-items: stretch; }
  .tp-complete { justify-content: center; }

  /* Let the topic content use the full screen width; the content keeps its
     own 14–16px inner gutters. */
  .tp-article {
    margin-inline: calc(-1 * var(--tp-gutter));
    padding-inline: 0;
    border-radius: 0;
    border-inline: 0;
    box-shadow: none;
  }

  .tp-pager { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .tp-pager__card { min-height: 0; padding: 16px 18px; }
  .tp-pager__card--next { grid-column: auto; grid-row: 1; }
}

@media (max-width: 379.98px) {
  .tp-brand__tag { display: none; }
  .tp-chip { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tp-body *, .tp-body *::before, .tp-body *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .tp-topbar, .tp-sidebar, .tp-scrim, .tp-pager, .tp-backlink, .tp-totop, .tp-toast, .tp-complete { display: none !important; }
  .tp-layout { display: block; padding: 0; }
  .tp-hero, .tp-article { box-shadow: none; border: 0; background: #fff; }
  body.tp-body { background: #fff; }
}
