/* Minimalist editorial portal layout, command search, slim library & reading polish. */
.portal-home, .portal-page { --portal-soft: var(--wash); --portal-accent: var(--accent); }

/* 1. Floating ModelDial-inspired pill header & clean mobile dropdown */
.site-header {
  position: sticky; top: 0; z-index: 40;
  padding: 12px 0 6px;
  background: transparent;
  border-bottom: 0;
  pointer-events: none;
}
.site-header .header-inner {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  min-height: 58px; padding: 6px 10px 6px 20px;
  border-radius: var(--radius-pill, 999px);
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid var(--line-soft, var(--line));
  box-shadow: 0 2px 12px rgb(15 23 42 / .04);
  transition: box-shadow .2s, border-color .2s, background-color .2s;
}
.site-header.is-scrolled .header-inner {
  border-color: var(--line);
  box-shadow: var(--shadow-md);
}
.brand { display: flex; align-items: center; gap: 11px; font-size: 17.5px; font-weight: 680; letter-spacing: -.015em; white-space: nowrap; }
.brand small { display: block; font: 9px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .16em; color: var(--muted); font-weight: 500; margin-top: 2px; }
#site-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; white-space: nowrap; font-size: 14px; }
#site-nav a {
  padding: 7px 14px; border-radius: var(--radius-pill, 999px); color: var(--muted); font-weight: 500;
  transition: color .15s, background-color .15s, box-shadow .15s;
}
#site-nav a:hover { color: var(--ink); background: var(--control-hover); text-decoration: none; }
#site-nav a[aria-current="page"] {
  color: var(--ink); background: var(--frosted-bg); font-weight: 600;
  box-shadow: var(--frosted-shadow); text-decoration: none;
}

.portal-search-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 12px; border-radius: var(--radius-pill, 999px);
  border: 0; background: var(--surface); color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 12px; white-space: nowrap; flex-shrink: 0;
  transition: color .15s, background-color .15s, box-shadow .15s;
}
.portal-search-toggle:hover { color: var(--ink); background: var(--control-hover); box-shadow: inset 0 0 0 1px var(--line-strong); }
.portal-search-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; flex-shrink: 0; }
.portal-search-toggle .search-kbd {
  font: 11px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  padding: 2px 6px; border-radius: var(--radius-pill, 999px); border: 1px solid var(--line);
  background: var(--control-bg); color: var(--muted);
}

.site-header .theme-toggle {
  width: 38px; height: 38px; border-radius: var(--radius-pill, 999px);
  border: 0; background: transparent;
}
.site-header .theme-toggle:hover {
  background: var(--control-hover); border-color: transparent; color: var(--ink);
}

.menu-toggle {
  display: none; align-items: center; justify-content: center; flex-shrink: 0;
  width: 38px; height: 38px; padding: 8px; border-radius: var(--radius-pill, 999px);
  border: 0; background: transparent; color: var(--muted);
  transition: color .15s, background-color .15s;
}
.menu-toggle:hover { background: var(--control-hover); color: var(--ink); }

/* 2. Global Command Search Dialog (Cmd+K / Ctrl+K) */
.cmd-search-open { overflow: hidden; }
.cmd-search-dialog {
  width: min(620px, calc(100% - 28px));
  max-height: min(84dvh, 660px);
  margin: min(9vh, 72px) auto auto;
  padding: 0; border: 0; border-radius: 24px;
  background: var(--overlay); color: var(--ink); box-shadow: var(--float-shadow);
  overflow: hidden;
}
.cmd-search-dialog::backdrop { background: rgb(10 14 23 / .50); backdrop-filter: blur(6px); }
.cmd-search-panel { display: flex; flex-direction: column; max-height: min(84dvh, 660px); }
.cmd-search-head {
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
}
.cmd-search-icon { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.9; stroke-linecap: round; flex-shrink: 0; }
.cmd-search-input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink);
  font-size: 15px; line-height: 1.5; padding: 4px 0; outline: none;
}
.cmd-search-input:focus-visible { outline: none; }
.cmd-search-close {
  border: 0; background: var(--control-bg); color: var(--muted);
  border-radius: 999px; padding: 5px 10px; font: 11px/1.2 ui-monospace, SFMono-Regular, monospace;
  transition: color .14s, background-color .14s;
}
.cmd-search-close:hover { color: var(--ink); background: var(--control-hover); }
.cmd-search-tabs {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  background: var(--control-bg); overflow-x: auto; scrollbar-width: none;
}
.cmd-tab {
  position: relative;
  border: 0; background: transparent; color: var(--muted);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 500; line-height: 1.3; white-space: nowrap; flex-shrink: 0;
  transition: color .14s, background-color .14s, box-shadow .14s;
}
.cmd-tab:hover { color: var(--ink); background: var(--control-hover); }
.cmd-tab[aria-pressed="true"] {
  background: var(--pill-active-bg); color: var(--pill-active-fg);
  box-shadow: var(--pill-active-shadow); font-weight: 600;
}
.cmd-search-status { flex-shrink: 0; padding: 9px 16px 6px; font-size: 12px; color: var(--muted); }
.cmd-search-results { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 10px 10px; overscroll-behavior: contain; }
.cmd-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 10px; color: var(--ink);
  transition: background-color .12s;
}
.cmd-item.is-active, .cmd-item:hover { background: var(--accent-surface); color: var(--ink); }
.cmd-item-badge {
  flex-shrink: 0; padding: 3px 8px; border-radius: 6px;
  background: var(--wash); border: 1px solid var(--line);
  font-size: 11px; color: var(--accent); font-weight: 600;
}
.cmd-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cmd-item-meta { font-size: 11px; color: var(--accent); }
.cmd-item-body strong { font-size: 14px; font-weight: 600; line-height: 1.45; }
.cmd-item-body small {
  font-size: 12px; color: var(--muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.cmd-item mark { background: var(--accent-line); color: var(--ink); border-radius: 3px; padding: 0 2px; }
.cmd-item-arrow { color: var(--muted); font-size: 14px; flex-shrink: 0; }
.cmd-item.is-active .cmd-item-arrow { color: var(--accent); transform: translateX(2px); }
.cmd-empty { padding: 34px 16px; text-align: center; }
.cmd-empty p { font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.cmd-empty small { font-size: 13px; color: var(--muted); }
.cmd-search-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0;
  padding: 10px 16px; border-top: 1px solid var(--line); background: var(--wash); font-size: 12px;
}
.cmd-hints { color: var(--muted); display: flex; align-items: center; gap: 5px; }
.cmd-hints kbd {
  font: 11px/1 ui-monospace, SFMono-Regular, monospace;
  padding: 2px 5px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface);
}
.cmd-all-link { color: var(--accent); font-weight: 500; white-space: nowrap; }
.cmd-all-link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* 3. Slim Editorial Homepage (4 crisp sections, zero repetition) */
.home-hero-slim {
  padding-block: 54px 44px; border-bottom: 1px solid var(--line);
}
.home-hero-copy { max-width: 680px; }
.home-hero-slim h1 {
  font-size: clamp(32px, 4vw, 48px); font-weight: 700;
  letter-spacing: -.038em; line-height: 1.3; color: var(--ink); text-wrap: balance;
}
.home-hero-slim h1 span { color: var(--accent); }
.home-deck { font-size: 16px; color: var(--muted); line-height: 1.88; margin: 18px 0 26px; max-width: 560px; }
.home-hero-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.button { border-radius: var(--radius-pill, 999px); transition: background-color .16s, color .16s, box-shadow .16s, transform .16s; }
.home-hero-actions .button { border-radius: var(--radius-pill, 999px); min-height: 46px; padding: 10px 22px; font-weight: 560; gap: 10px; }
.home-hero-actions .secondary-search kbd {
  font: 11px/1 ui-monospace, SFMono-Regular, monospace;
  padding: 3px 7px; border-radius: var(--radius-pill, 999px); border: 1px solid var(--line);
  background: var(--surface); color: var(--muted);
}

.portal-section { padding-block: 42px; scroll-margin-top: 86px; }
.portal-section .section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 22px; }
.portal-section .section-heading h2 { font-size: 24px; font-weight: 680; letter-spacing: -.025em; }
.home-updates-section { padding-bottom: 54px; }

/* Three Domain Cards (clean, no tag clutter) */
.portal-domains { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.portal-domain {
  display: flex; flex-direction: column; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-md); padding: 22px 24px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.portal-domain:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--ink); }
.domain-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.portal-domain-symbol {
  font: 11px/1 ui-monospace, SFMono-Regular, monospace; font-weight: 650;
  color: var(--accent); background: var(--accent-surface); padding: 5px 9px; border-radius: 6px;
}
.domain-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.portal-domain h3 { font-size: 20px; font-weight: 650; margin-bottom: 8px; color: var(--ink); }
.portal-domain:hover h3 { color: var(--accent); }
.portal-domain p { color: var(--muted); font-size: 14px; line-height: 1.8; flex: 1; margin-bottom: 16px; }
.domain-cta { font-size: 13px; font-weight: 550; color: var(--accent); display: inline-flex; align-items: center; gap: 6px; }

/* Featured & Article Cards */
.portal-featured { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.article-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 22px 24px; display: flex; flex-direction: column; min-width: 0;
  box-shadow: var(--shadow-sm); transition: border-color .18s, transform .18s, box-shadow .18s;
}
.article-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--ink); }
.portal-entry .card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.portal-entry .meta-domain { color: var(--accent); font-weight: 600; }
.portal-entry .meta-kind {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--wash); border: 1px solid var(--line); color: var(--muted);
}
.entry-cover-frame {
  width: 100%; height: 138px; margin-bottom: 14px; border-radius: 9px; overflow: hidden;
  border: 1px solid var(--line); background: var(--wash);
}
.entry-cover-frame .entry-cover {
  display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 22%;
}
.portal-entry .entry-heading { margin-top: 2px; }
.portal-entry .entry-heading h3 { font-size: 18.5px; font-weight: 630; line-height: 1.5; color: var(--ink); margin: 0; }
.portal-entry p {
  margin: 10px 0 18px; font-size: 14px; color: var(--muted); line-height: 1.8;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.portal-entry .card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: auto; padding-top: 13px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted);
}
.article-card:is(:hover, :focus-visible) :is(h2, h3),
.course-choice-link:is(:hover, :focus-visible) h2 { color: var(--accent); }
.article-card:hover .card-arrow { color: var(--accent); transform: translateX(3px); }
.card-arrow { transition: transform .15s, color .15s; }

/* Updates & Integrated Practice Row */
.portal-updates { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; }
.portal-updates > a {
  display: grid; grid-template-columns: 176px 1fr 22px; gap: 20px; align-items: center;
  padding: 17px 22px; border-bottom: 1px solid var(--line); transition: background-color .15s;
}
.portal-updates > a:last-child { border-bottom: 0; }
.portal-updates > a:hover { background: var(--wash); color: var(--ink); }
.portal-updates > a:hover strong { color: var(--accent); }
.portal-updates .update-practice-row { background: var(--accent-surface); }
.portal-updates .update-practice-row:hover { background: var(--wash); }
.update-pill {
  display: inline-block; font-size: 11px; font-weight: 650; color: var(--accent);
  background: var(--surface); border: 1px solid var(--accent-line);
  border-radius: 999px; padding: 1px 8px; margin-right: 4px;
}
.portal-updates .update-meta { font-size: 12px; color: var(--muted); }
.portal-updates strong { font-size: 15.5px; font-weight: 560; line-height: 1.5; transition: color .15s; }
.portal-updates .update-arrow { color: var(--muted); transition: transform .15s, color .15s; }
.portal-updates > a:hover .update-arrow { color: var(--accent); transform: translateX(3px); }

/* Practice Case Detail Card (used on /projects/) */
.portal-case {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 36px 48px;
  padding: 34px 36px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--wash);
}
.portal-case-intro h2 { font-size: 26px; font-weight: 680; line-height: 1.45; margin-top: 16px; color: var(--ink); }
.portal-case-intro p { font-size: 15px; color: var(--muted); line-height: 1.88; margin: 16px 0 24px; }
.portal-case-intro .button { border-radius: 10px; }
.status-pill {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 600;
  color: var(--accent); background: var(--accent-surface);
  border: 1px solid var(--accent-line); border-radius: 999px; padding: 4px 12px;
}
.portal-case-flow {
  list-style: none; margin: 0; padding: 0; align-self: center;
  display: flex; flex-direction: column; gap: 12px;
}
.portal-case-flow li {
  display: grid; grid-template-columns: 36px 1fr; gap: 14px; align-items: start;
  padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
}
.flow-step {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-surface); border: 1px solid var(--accent-line);
  font: 12px/1 ui-monospace, SFMono-Regular, monospace; font-weight: 650; color: var(--accent);
}
.portal-case-flow strong { display: block; font-size: 15px; font-weight: 630; color: var(--ink); margin-bottom: 3px; }
.portal-case-flow li > div > span { display: block; font-size: 13px; color: var(--muted); line-height: 1.65; }

/* 4. Lightweight Topic Pages & Slim Library Filters (2 rows, 4 controls) */
.portal-topic-head { padding: 36px 0 20px; max-width: 780px; }
.portal-topic-head .breadcrumb { margin-bottom: 16px; }
.portal-topic-head h1 { font-size: clamp(30px, 4vw, 44px); font-weight: 700; letter-spacing: -.035em; line-height: 1.25; }
.portal-deck { font-size: 16px; line-height: 1.88; color: var(--muted); max-width: 650px; margin: 14px 0 0; }
.portal-tracks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.portal-tracks:has(> .portal-track:only-child) { grid-template-columns: 1fr; }
.portal-track {
  min-width: 0; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius-md); padding: 24px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: border-color .18s, transform .18s;
}
.portal-track-link:hover { border-color: var(--accent); transform: translateY(-2px); color: var(--ink); }
.portal-track h3 { font-size: 21px; font-weight: 650; line-height: 1.45; }
.portal-track > p:not(.eyebrow) { font-size: 14px; color: var(--muted); margin: 10px 0 18px; line-height: 1.8; max-width: 670px; }
.portal-track .course-actions { padding-top: 14px; justify-content: start; gap: 24px; font-size: 13px; font-weight: 550; }
.topic-more-row { margin-top: 26px; display: flex; justify-content: center; }
.topic-more-row .button { border-radius: 10px; }

.library-page .page-heading { padding-top: 28px; padding-bottom: 20px; }
.library-page .page-heading h1 { font-size: clamp(28px, 3.5vw, 38px); font-weight: 700; }
.library-page .page-heading .breadcrumb { margin-bottom: 14px; }
.library-page .page-heading > p:last-child { margin-top: 8px; font-size: 15px; }

/* ModelDial-inspired borderless tonal filter bar, tactile segmented tracks & custom pill dropdowns */
.library-filters-slim {
  padding: 0; border: 0; border-radius: 0;
  background: transparent; margin-bottom: 0;
}
.library-filters-slim .search-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.library-filters-slim .search-row label {
  position: relative; flex: 1 1 280px; min-width: 0; display: flex; align-items: center;
}
.library-filters-slim .search-row label::before {
  content: "";
  position: absolute; left: 16px; top: 50%; width: 16px; height: 16px;
  transform: translateY(-50%); pointer-events: none; opacity: .68;
  background-color: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m16 16 5 5'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m16 16 5 5'/%3E%3C/svg%3E") center/contain no-repeat;
}
.library-filters-slim .search-row input {
  width: 100%; min-width: 0; border: 0; border-radius: var(--radius-pill, 999px);
  background: var(--control-bg); color: var(--ink);
  padding: 0 18px 0 42px; min-height: 46px; font-size: 14.5px;
  box-shadow: var(--track-inset);
  transition: background-color .16s, box-shadow .16s;
}
.library-filters-slim .search-row input:hover {
  background: var(--control-hover);
}
.library-filters-slim .search-row input:focus {
  outline: none; background: var(--surface-elevated);
  box-shadow: 0 0 0 2px var(--accent);
}

/* Segmented domain track (ModelDial axis-tabs aesthetic) */
.library-filters-slim .filter-group {
  display: inline-flex; align-items: center; gap: 4px; flex-wrap: nowrap;
  padding: 4px; border-radius: var(--radius-pill, 999px);
  background: var(--control-bg); box-shadow: var(--track-inset);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.library-filters-slim .filter-group button {
  position: relative; overflow: hidden;
  border: 0; border-radius: var(--radius-pill, 999px);
  min-height: 38px; padding: 0 16px; font-size: 13.5px; font-weight: 500;
  white-space: nowrap; flex-shrink: 0;
  transition: color .15s, background-color .15s, box-shadow .15s;
}
.library-filters-slim .filter-group button[aria-pressed="true"] {
  font-weight: 600;
}
.library-filters-slim .filter-group button[aria-pressed="true"]::before,
.library-quick-tabs button[aria-pressed="true"]::before,
.button.primary::before,
.pill-select-trigger[data-active="true"]::before {
  content: "";
  position: absolute; inset: 1px 8px auto; height: 44%;
  border-radius: 999px; background: var(--pill-sheen);
  pointer-events: none;
}
.button.primary { position: relative; overflow: hidden; }

.library-filters-slim .filter-row-slim {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-top: 0; border-top: 0;
}
.library-filters-slim .select-group { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.library-filters-slim .select-group label { position: relative; margin: 0; }
.library-filters-slim .select-group select {
  border: 0; border-radius: var(--radius-pill, 999px);
  padding: 0 34px 0 16px; background: var(--control-bg); color: var(--ink);
  font-size: 13.5px; font-weight: 500; min-height: 44px;
  cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16'%3E%3Cpath d='M4.25 6.25 8 10l3.75-3.75' fill='none' stroke='%2359636e' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  transition: background-color .15s, box-shadow .15s;
}
.library-filters-slim .select-group select:hover { background-color: var(--control-hover); }

.library-quick-tabs {
  display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 4px;
  margin-left: auto; padding: 4px; border-radius: var(--radius-pill, 999px);
  background: var(--control-bg); box-shadow: var(--track-inset);
}
.library-quick-tabs button {
  position: relative; overflow: hidden;
  min-height: 36px; padding: 0 15px; border-radius: var(--radius-pill, 999px);
  border: 0; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: color .14s, background-color .14s, box-shadow .14s;
}
.library-quick-tabs button:hover { color: var(--ink); background: var(--control-hover); }
.library-quick-tabs button[aria-pressed="true"] {
  background: var(--pill-active-bg); color: var(--pill-active-fg);
  box-shadow: var(--pill-active-shadow); font-weight: 600;
}

/* Custom Tactile Pill Dropdown (ModelDial scope/ranking popover aesthetic) */
.pill-select {
  position: relative; display: inline-flex; align-items: center; max-width: 100%;
}
.pill-select-trigger {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 44px; padding: 0 16px; border: 0; border-radius: var(--radius-pill, 999px);
  background: var(--control-bg); color: var(--ink);
  font-size: 13.5px; font-weight: 500; line-height: 1.2; white-space: nowrap;
  cursor: pointer; max-width: 100%;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.pill-select-trigger:hover { background: var(--control-hover); }
.pill-select.is-open .pill-select-trigger {
  background: var(--surface-elevated);
  box-shadow: inset 0 0 0 2px var(--ink);
}
.pill-select-trigger[data-active="true"] {
  background: var(--pill-active-bg); color: var(--pill-active-fg);
  box-shadow: var(--pill-active-shadow);
}
.pill-select-trigger[data-active="true"]:hover { background: var(--pill-active-hover-bg); }
.pill-select.is-open .pill-select-trigger[data-active="true"] {
  box-shadow: var(--pill-active-shadow), 0 0 0 2px var(--accent);
}
.pill-select-prefix {
  font-size: 12.5px; color: var(--muted); font-weight: 450; flex-shrink: 0;
}
.pill-select-trigger[data-active="true"] .pill-select-prefix {
  color: inherit; opacity: .74;
}
.pill-select-value {
  font-weight: 600; overflow: hidden; text-overflow: ellipsis; max-width: 190px;
}
.pill-select-chevron {
  flex-shrink: 0; margin-left: 2px; opacity: .72;
  transition: transform .18s cubic-bezier(.22, 1, .36, 1), opacity .15s;
}
.pill-select.is-open .pill-select-chevron { transform: rotate(180deg); opacity: 1; }

.pill-select-menu {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 60;
  min-width: max(220px, 100%); max-width: min(320px, calc(100vw - 24px));
  max-height: 360px; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
  padding: 6px; border-radius: 20px;
  background: var(--overlay); color: var(--ink);
  box-shadow: var(--float-shadow);
  animation: pillMenuIn .14s cubic-bezier(.22, 1, .36, 1);
}
.pill-select-menu::-webkit-scrollbar { width: 6px; }
.pill-select-menu::-webkit-scrollbar-track { background: transparent; }
.pill-select-menu::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
.pill-select-menu.is-open-up { top: auto; bottom: calc(100% + 8px); }
@keyframes pillMenuIn {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.pill-select-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 38px; padding: 8px 12px;
  border: 0; border-radius: 12px; background: transparent; color: var(--ink);
  font-size: 13.5px; font-weight: 480; text-align: left; cursor: pointer;
  transition: background-color .12s, color .12s;
}
.pill-select-option:hover,
.pill-select-option:focus-visible {
  background: var(--control-hover); outline: none;
}
.pill-select-option.is-selected {
  background: var(--accent-surface); color: var(--accent); font-weight: 600;
}
.pill-select-option:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pill-select-check { opacity: 0; flex-shrink: 0; color: var(--accent); }
.pill-select-option.is-selected .pill-select-option:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pill-select-check { opacity: 1; }

/* Upgrade CS329Z Reading Room filters to match the same ModelDial tonal pill style */
.reading-filters {
  background: transparent; padding: 0; border: 0; border-radius: 0; margin: 22px 0;
}
.reading-filters .reading-search {
  display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; color: var(--muted);
}
.reading-filters input[type="search"] {
  border: 0; border-radius: var(--radius-pill, 999px);
  background: var(--control-bg); color: var(--ink);
  min-height: 46px; padding: 0 18px; font-size: 14.5px;
  box-shadow: var(--track-inset);
  transition: background-color .15s, box-shadow .15s;
}
.reading-filters input[type="search"]:hover { background: var(--control-hover); }
.reading-filters input[type="search"]:focus {
  outline: none; background: var(--surface-elevated);
  box-shadow: 0 0 0 2px var(--accent);
}
.reading-selects {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px;
}
.reading-selects button[data-reading-reset] {
  min-height: 44px; padding: 0 16px; border-radius: var(--radius-pill, 999px);
  background: var(--control-bg); color: var(--muted); font-size: 13px; font-weight: 500;
  transition: background-color .15s, color .15s;
}
.reading-selects button[data-reading-reset]:hover { background: var(--control-hover); color: var(--ink); }

@media (max-width: 760px) {
  .library-quick-tabs { margin-left: 0; width: 100%; justify-content: space-between; }
  .library-quick-tabs button { flex: 1; padding-inline: 8px; }
}
.library-results-heading .reset-button {
  min-height: 44px; padding: 0 12px; flex-shrink: 0; border: 0; border-radius: var(--radius-pill, 999px);
  background: transparent; color: var(--ink); font-size: 13px; font-weight: 500; cursor: pointer;
  text-decoration: none; transition: background-color .15s, color .15s;
}
.library-results-heading .reset-button:hover { background: var(--control-hover); color: var(--ink); }

.library-results-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; margin: 8px 0 10px;
}
.library-results-heading .library-status { margin: 0; scroll-margin-top: 96px; font-size: 13px; color: var(--muted); }
.library-pagination {
  display: flex; align-items: center; justify-content: center; gap: 20px;
  margin: 34px 0 12px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.library-pagination .button { border-radius: 10px; min-height: 42px; padding-inline: 18px; }
.library-pagination .button:disabled { opacity: .4; cursor: default; }

/* 5. Course Shelf Bento Cards */
.course-choice-link {
  display: flex; flex-direction: column; align-items: flex-start;
  width: 100%; height: 100%; padding: 24px 26px; border-radius: 14px;
}
.course-choice-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; flex-wrap: wrap;
}
.course-choice-top .eyebrow { margin: 0; }
.course-pill {
  font-size: 11px; color: var(--accent); background: var(--accent-surface);
  border: 1px solid var(--accent-line); border-radius: 999px; padding: 3px 10px; font-weight: 550;
}
.course-choice-link .text-link { margin-top: auto; padding-top: 14px; font-weight: 600; }
.course-picker article:has(.course-choice-link:hover) {
  border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md);
}
.course-shelf-foot { margin-top: 16px; }

/* About page: full-width balanced editorial profile, pillars & follow channels */
.about-hero {
  display: grid; grid-template-columns: 1.3fr .95fr; gap: 44px; align-items: start;
  padding: 36px 0 46px; border-bottom: 1px solid var(--line);
}
.about-hero-main .breadcrumb { margin-bottom: 18px; }
.about-hero-main .eyebrow { margin-bottom: 12px; }
.about-hero-main h1 { font-size: clamp(32px, 4vw, 46px); font-weight: 700; letter-spacing: -.035em; line-height: 1.24; color: var(--ink); }
.about-intro-lead { font-size: 17px; font-weight: 600; color: var(--ink); margin: 18px 0 14px; line-height: 1.7; }
.about-intro-body { font-size: 15px; line-height: 1.9; color: var(--muted); margin: 0 0 12px; max-width: 620px; }
.about-focus-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.about-focus-tags span {
  font-size: 12px; font-weight: 500; color: var(--accent);
  background: var(--accent-surface); border: 1px solid var(--accent-line);
  border-radius: 999px; padding: 4px 12px;
}

.about-profile-card {
  padding: 26px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.about-profile-top { display: flex; align-items: center; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.about-profile-top img { border-radius: 50%; flex-shrink: 0; border: 1px solid var(--line); }
.about-profile-top strong { display: block; font-size: 20px; font-weight: 680; color: var(--ink); line-height: 1.3; }
.about-profile-top span { display: block; font-size: 13px; color: var(--muted); margin-top: 3px; }
.about-profile-facts { margin: 18px 0 22px; display: flex; flex-direction: column; gap: 14px; }
.about-profile-facts dt { font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--accent); margin-bottom: 3px; }
.about-profile-facts dd { margin: 0; font-size: 13.5px; line-height: 1.7; color: var(--muted); }
.about-profile-cta { width: 100%; border-radius: 10px; justify-content: center; gap: 8px; font-weight: 550; }

.about-pillars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.about-pillar {
  padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.about-pillar h3 { font-size: 18.5px; font-weight: 650; margin: 14px 0 8px; color: var(--ink); }
.about-pillar p { font-size: 14px; line-height: 1.82; color: var(--muted); margin: 0; }

.about-follow-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: stretch; }
.about-wechat-card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  padding: 26px; border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.about-channel-tag {
  display: inline-block; font-size: 11px; font-weight: 650; color: var(--accent);
  background: var(--accent-surface); border: 1px solid var(--accent-line);
  border-radius: 999px; padding: 2px 10px; margin-bottom: 10px;
}
.about-wechat-copy h3 { font-size: 21px; font-weight: 650; margin: 0 0 8px; color: var(--ink); }
.about-wechat-copy p { font-size: 14px; line-height: 1.8; color: var(--muted); margin: 0; }
.about-wechat-qr {
  padding: 16px 18px; border-radius: 12px; border: 1px solid var(--line);
  background: #ffffff;
}
.about-wechat-qr img { display: block; width: 100%; height: auto; border-radius: 6px; }
.about-social-list { display: grid; grid-template-rows: 1fr 1fr; gap: 18px; }
.about-social-card {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.about-social-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--ink); }
.about-social-card strong { font-size: 17px; font-weight: 630; color: var(--ink); margin-bottom: 6px; }
.about-social-card:hover strong { color: var(--accent); }
.about-social-card p { font-size: 13.5px; line-height: 1.75; color: var(--muted); margin: 0 0 12px; }
.about-social-arrow { margin-top: auto; font-size: 13px; font-weight: 550; color: var(--accent); }

.about-pledge {
  margin-top: 8px; padding: 20px 24px; border-radius: var(--radius-md);
  border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--wash);
}
.about-pledge strong { display: block; font-size: 14px; font-weight: 650; color: var(--ink); margin-bottom: 6px; }
.about-pledge p { font-size: 13.5px; line-height: 1.82; color: var(--muted); margin: 0; }

.footer-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; }
.footer-meta p { margin: 0; color: var(--muted); }
.portal-page { padding-bottom: 52px; }

/* 6. Streamlined Reading Controls (inline in byline, quiet scrollspy, progress bar) */
.reading-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 95;
  pointer-events: none; background: transparent;
}
.reading-progress-fill {
  width: 100%; height: 100%; background: var(--accent);
  transform-origin: left center; transform: scaleX(0); will-change: transform;
}

.byline-tools {
  display: inline-flex; align-items: center; gap: 6px; margin-left: auto;
}
.inline-tool-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 7px; border: 1px solid transparent;
  background: transparent; color: var(--muted); font-size: 12px; line-height: 1.4;
  transition: color .14s, background-color .14s, border-color .14s;
}
.inline-tool-btn:hover,
.inline-tool-btn[aria-pressed="true"],
.inline-tool-btn.is-copied {
  color: var(--accent); background: var(--accent-surface); border-color: var(--accent-line);
}
.byline-tools [data-action-status], .byline-tools .reader-tool-status {
  font-size: 12px; color: var(--accent);
}

.reader-layout > .contents { top: 92px; }
.reader-layout > .contents nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.reader-layout > .contents a {
  padding: 7px 12px; border-left: 2px solid var(--line); border-radius: 0 7px 7px 0;
  color: var(--muted); transition: color .14s, background-color .14s, border-color .14s;
}
.reader-layout > .contents a:hover { color: var(--accent); background: var(--wash); border-left-color: var(--accent-line); }
.reader-layout > .contents a[aria-current="location"] {
  color: var(--accent); border-left-color: var(--accent); background: var(--accent-surface); font-weight: 600;
}
:root[data-reader-size="large"] .prose p,
:root[data-reader-size="large"] .prose li,
:root[data-reader-size="large"] .prose dd { font-size: 18px; line-height: 1.98; }

.article-mobile-toc {
  display: flex; align-items: center; gap: 12px;
  position: fixed; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  width: min(440px, calc(100% - 32px)); min-height: 48px; padding: 10px 16px;
  border: 1px solid var(--accent-line); border-radius: 14px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-md);
  font-family: inherit; z-index: 80; cursor: pointer; text-align: left;
}
.article-mobile-toc[hidden] { display: none; }
.article-mobile-toc .reader-mobile-label {
  font-size: 13px; font-weight: 600; color: var(--accent);
  white-space: nowrap; flex-shrink: 0;
}
.article-mobile-toc .reader-mobile-current {
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0;
}
.article-mobile-toc .reader-mobile-chevron {
  color: var(--accent); font-size: 18px; flex-shrink: 0;
}
.article-toc-sheet {
  width: 100%; max-height: 76dvh; margin: auto 0 0;
  border-radius: 18px 18px 0 0; border-width: 1px 0 0; overflow: auto;
  background: var(--surface); color: var(--ink); border-color: var(--line); padding: 0;
}
.article-toc-sheet::backdrop { background: rgb(10 14 23 / .50); backdrop-filter: blur(4px); }
.article-toc-sheet .reader-directory { padding: 0 20px max(24px, env(safe-area-inset-bottom)); }
.article-toc-sheet .reader-directory-head {
  position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); padding: 14px 0; margin: 0 0 8px; border-bottom: 1px solid var(--line);
}
.article-toc-sheet .reader-directory-head h2 { font-size: 15px; margin: 0; }
.article-toc-sheet .reader-directory-close {
  display: block; min-height: 38px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--wash); color: var(--accent); font-size: 13px;
}
.article-toc-sheet nav { display: flex; flex-direction: column; gap: 2px; }
.article-toc-sheet nav a { padding: 11px 12px; border-left: 2px solid var(--line); border-radius: 0 7px 7px 0; font-size: 14px; color: var(--muted); }
.article-toc-sheet nav a[aria-current="location"] { color: var(--accent); border-left-color: var(--accent); background: var(--accent-surface); font-weight: 600; }

/* Legacy course layouts adjustments */
.reading-layout .article-head { padding-top: 0; }
.reading-layout .article-head > .eyebrow { display: none; }
.reading-layout .article-head .lesson-label { margin-bottom: 10px; }
.reading-layout .article-head .deck { margin-bottom: 12px; }
.cs2680-side .study-disclosure { margin-bottom: 18px; }
.cs2680-side summary {
  cursor: pointer; min-height: 42px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 16px; border: 0; border-radius: var(--radius-pill, 999px);
  background: var(--control-bg); font-weight: 600; transition: background-color .15s;
}
.cs2680-side summary:hover { background: var(--control-hover); }
.cs2680-side summary::after { content: '＋'; color: var(--accent); }
.cs2680-side details[open] > summary::after { content: '−'; }
.cs2680-side summary::-webkit-details-marker { display: none; }
.cs2680-side nav { font-size: 13px; }
.cs2680-prose .course-origin-summary { font-size: 12px; line-height: 1.7; margin: 8px 0 14px; }

/* Unified pill rounding on CTA & pagination buttons */
.topic-more-row .button,
.library-pagination .button,
.about-profile-cta,
.portal-case-intro .button { border-radius: var(--radius-pill, 999px); }

/* Polished collapsible trays (reading course map & study disclosures) */
.reading-course-map {
  margin-top: 24px; border: 0; border-radius: var(--radius-lg, 24px);
  padding: 16px 22px; background: var(--control-bg);
}
.reading-course-map summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  list-style: none; cursor: pointer; color: var(--ink); font-weight: 600; line-height: 1.6;
}
.reading-course-map summary::-webkit-details-marker { display: none; }
.reading-course-map summary::after {
  content: '展开 ＋'; font-size: 12.5px; font-weight: 500;
  padding: 5px 12px; border-radius: 999px; background: var(--surface-elevated);
  color: var(--ink); box-shadow: inset 0 0 0 1px var(--line);
}
.reading-course-map[open] > summary::after { content: '收起 −'; }
.reading-course-map nav a {
  border-radius: 16px; background: var(--surface-elevated);
  border: 1px solid var(--line); transition: border-color .15s, transform .15s;
}
.reading-course-map nav a:hover { border-color: var(--accent); transform: translateY(-1px); }

/* 7. Responsive breakpoints */
@media (max-width: 1040px) {
  .portal-domains { grid-template-columns: 1fr 1fr; }
  .portal-domains > .portal-domain:last-child { grid-column: 1 / -1; }
  .portal-featured { grid-template-columns: 1fr 1fr; }
  .portal-featured > .article-card:last-child { grid-column: 1 / -1; }
  .portal-case { grid-template-columns: 1fr; gap: 26px; padding: 26px; }
  .about-hero { grid-template-columns: 1fr; gap: 28px; padding: 28px 0 36px; }
  .about-pillars { grid-template-columns: 1fr 1fr; }
  .about-pillars > .about-pillar:last-child { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .cs2680-side { display: flex; flex-wrap: wrap; gap: 10px; }
  .cs2680-side .study-disclosure { flex: 1 1 140px; margin: 0; }
  .cs2680-side .study-disclosure[open] { flex-basis: 100%; }
}

@media (max-width: 760px) {
  .site-header { padding: 8px 0 4px; }
  .site-header .header-inner { flex-wrap: nowrap; gap: 6px; min-height: 54px; padding: 5px 8px 5px 14px; }
  .brand { font-size: 16.5px; gap: 10px; }
  .portal-search-toggle {
    margin-left: auto; order: 2; width: 38px; height: 38px; padding: 0; justify-content: center;
    background: var(--control-bg); box-shadow: none;
  }
  .portal-search-toggle .search-kbd { display: none; }
  .theme-toggle {
    order: 3; width: 38px; height: 38px; padding: 0;
    background: var(--control-bg); border-color: transparent;
  }
  .nav-ready .menu-toggle {
    display: inline-flex; order: 4;
    background: var(--control-bg); border-color: transparent;
  }
  .site-header :is(.menu-toggle, .theme-toggle, .portal-search-toggle) { width: 44px; height: 44px; }
  .home-hero-actions .secondary-search kbd { display: none; }
  .nav-ready #site-nav {
    display: none; position: absolute; left: 16px; right: 16px; top: calc(100% + 8px); z-index: 45;
    background: var(--overlay); border: 0; border-radius: 20px;
    padding: 8px; box-shadow: var(--float-shadow); margin: 0; white-space: normal;
  }
  .nav-ready #site-nav.is-open { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
  .nav-ready #site-nav a { padding: 11px 16px; border-radius: 12px; font-size: 15px; }

  .home-hero-slim { padding-block: 32px 30px; }
  .home-hero-slim h1 { font-size: 30px; line-height: 1.35; }
  .home-deck { font-size: 15px; margin: 14px 0 22px; }
  .portal-section { padding-block: 30px; }
  .portal-section .section-heading { align-items: start; flex-direction: column; gap: 6px; margin-bottom: 16px; }
  .portal-section .section-heading h2 { font-size: 22px; }
  .portal-domains, .portal-featured, .portal-tracks, .portal-about-grid { grid-template-columns: 1fr; }
  .portal-domains > .portal-domain:last-child,
  .portal-featured > .article-card:last-child { grid-column: auto; }
  .portal-case { padding: 22px 20px; gap: 20px; }
  .portal-case-intro h2 { font-size: 22px; }
  .portal-updates > a { grid-template-columns: 1fr 20px; gap: 6px 12px; padding: 15px 16px; }
  .portal-updates .update-meta { grid-column: 1 / -1; }

  .portal-topic-head { padding: 24px 0 12px; }
  .portal-topic-head h1 { font-size: 32px; }

  .library-page .page-heading { padding: 20px 0 18px; margin: 0; }
  .library-page .page-heading h1 { font-size: 28px; }
  .library-filters-slim { padding: 0; }
  .library-filters-slim .search-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .library-filters-slim .search-row label { flex: none; }
  .library-filters-slim .search-row input { font-size: 16px; }
  .library-filters-slim .filter-group { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; gap: 4px; }
  .library-filters-slim .filter-group button { padding-inline: 4px; font-size: 12.5px; }
  .library-filters-slim .select-group { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); width: 100%; gap: 8px; }
  .library-filters-slim .select-group label,
  .library-filters-slim .select-group .pill-select,
  .library-filters-slim .select-group .pill-select-trigger,
  .library-filters-slim .select-group select { width: 100%; justify-content: space-between; }
  .pill-select-trigger { padding-inline: 12px; gap: 5px; }
  .pill-select-value { min-width: 0; }
  .pill-select-option { min-height: 44px; }
  .cmd-search-input, .reading-filters input[type="search"] { font-size: 16px; }
  .cmd-search-close { min-width: 44px; min-height: 44px; }
  .cmd-search-tabs { padding: 4px 12px; }
  .cmd-tab { min-height: 44px; }
  .library-pagination { gap: 12px; font-size: 12px; }
  .library-pagination .button { padding-inline: 14px; }

  .byline-tools { margin-left: 0; }
  .course-choice-link { padding: 20px; }
  .about-hero { padding: 22px 0 28px; }
  .about-hero-main h1 { font-size: 32px; }
  .about-profile-card { padding: 20px; }
  .about-pillars, .about-follow-grid { grid-template-columns: 1fr; gap: 16px; }
  .about-pillars > .about-pillar:last-child { grid-column: auto; }
  .about-social-list { grid-template-rows: auto; gap: 14px; }
  .about-wechat-card { padding: 20px; }
  .portal-about img { width: 68px; height: 68px; }
  .reader-page { padding-bottom: 24px; }
  body.article-toc-ready { padding-bottom: 86px; }
  body.article-toc-ready .reader-layout > .contents { display: none; }
  .cmd-hints { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pill-select-menu { animation: none; }
  .portal-domain, .article-card, .course-picker article, .portal-track { transition: none !important; transform: none !important; }
}

@media print {
  .portal-search-toggle, .article-mobile-toc, .article-toc-sheet, .reading-progress, .byline-tools,
  .media-lightbox, .code-copy-btn, .heading-anchor-btn, .quiz-batch-bar, .reader-toast { display: none !important; }
  .portal-domains, .portal-case { display: block; }
  .portal-domain, .portal-case { break-inside: avoid; }
}

/* 8. Phase 1 Reading Enhancements: Lightbox, Code Copy, Heading Anchors, Quiz Batch & Recent Searches */
.cmd-recent {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 6px 10px 10px; margin-bottom: 6px; border-bottom: 1px dashed var(--line);
}
.cmd-recent-label { font-size: 11px; color: var(--muted); margin-right: 4px; }
.cmd-recent-chip {
  border: 1px solid var(--line); background: var(--wash); color: var(--ink);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; line-height: 1.4;
  transition: border-color .14s, color .14s, background-color .14s;
}
.cmd-recent-chip:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-surface); }
.cmd-recent-clear {
  margin-left: auto; border: 0; background: transparent; color: var(--muted);
  font-size: 11px; padding: 2px 6px; text-decoration: underline; text-underline-offset: 3px;
}
.cmd-recent-clear:hover { color: var(--accent); }

/* Media Lightbox (<dialog>) */
.lightbox-open { overflow: hidden; }
a.has-lightbox { cursor: zoom-in; }
.media-lightbox {
  width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh;
  margin: 0; padding: 0; border: 0; background: rgb(10 14 23 / .88); color: #eef3f9;
}
.media-lightbox::backdrop { background: rgb(10 14 23 / .82); backdrop-filter: blur(6px); }
.lightbox-shell {
  display: flex; flex-direction: column; width: 100%; height: 100%;
  padding: 14px 18px 18px;
}
.lightbox-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-shrink: 0; padding-bottom: 10px;
}
.lightbox-counter { font: 13px/1 ui-monospace, SFMono-Regular, monospace; color: #cbd6e6; }
.lightbox-actions { display: flex; align-items: center; gap: 8px; }
.lightbox-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 34px; padding: 5px 12px; border-radius: 8px;
  border: 1px solid rgb(255 255 255 / .22); background: rgb(255 255 255 / .08);
  color: #f4f7fb; font-size: 12px; line-height: 1.3; text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.lightbox-btn:hover { background: rgb(255 255 255 / .18); border-color: rgb(255 255 255 / .4); color: #fff; }
.lightbox-stage {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  position: relative; gap: 10px;
}
.lightbox-viewport {
  flex: 1; min-width: 0; min-height: 0; height: 100%;
  display: flex; align-items: center; justify-content: center; overflow: auto;
  padding: 6px; cursor: zoom-out;
}
.lightbox-img {
  display: block; max-width: 100%; max-height: calc(100dvh - 130px);
  width: auto; height: auto; object-fit: contain;
  border-radius: 8px; background: #fff; box-shadow: 0 12px 42px rgb(0 0 0 / .45);
  cursor: zoom-in; transition: transform .18s;
}
.lightbox-viewport.is-zoomed { display: block; text-align: center; cursor: grab; }
.lightbox-viewport.is-zoomed .lightbox-img {
  max-width: none; max-height: none; width: min(1400px, 165vw); height: auto; cursor: zoom-out;
}
.lightbox-nav {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgb(255 255 255 / .22); background: rgb(20 28 42 / .72);
  color: #fff; font-size: 24px; line-height: 1; display: grid; place-items: center; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.lightbox-nav:hover { background: rgb(255 255 255 / .2); border-color: rgb(255 255 255 / .45); }
.lightbox-caption {
  flex-shrink: 0; margin: 10px auto 0; max-width: 720px; text-align: center;
  font-size: 13px; line-height: 1.6; color: #cbd6e6;
}

/* Code Block Copy Button */
pre.code-block-enhanced { position: relative; padding-top: 38px !important; }
.code-copy-btn {
  position: absolute; top: 8px; right: 10px; z-index: 2;
  padding: 3px 10px; min-height: 26px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font: 11px/1.3 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  cursor: pointer; transition: color .14s, border-color .14s, background-color .14s;
}
.code-copy-btn:hover,
.code-copy-btn.is-copied {
  color: var(--accent); border-color: var(--accent-line); background: var(--accent-surface);
}

/* Heading Anchor Share Button */
.has-anchor-link { position: relative; }
.heading-anchor-btn {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 8px; width: 24px; height: 24px; border-radius: 6px;
  border: 1px solid transparent; background: transparent; color: var(--muted);
  font: 14px/1 ui-monospace, SFMono-Regular, monospace; font-weight: 500;
  vertical-align: middle; opacity: 0; transition: opacity .14s, color .14s, background-color .14s;
}
.has-anchor-link:hover .heading-anchor-btn,
.has-anchor-link:focus-within .heading-anchor-btn,
.heading-anchor-btn:focus-visible { opacity: 1; }
.heading-anchor-btn:hover { color: var(--accent); background: var(--accent-surface); border-color: var(--accent-line); }

/* Quiz / Self-check Batch Toggle Bar */
.quiz-batch-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 18px 0 12px; padding: 8px 14px; border-radius: 9px;
  background: var(--wash); border: 1px solid var(--line); font-size: 12px; color: var(--muted);
}
.quiz-batch-btn {
  padding: 4px 12px; min-height: 28px; border-radius: 7px;
  border: 1px solid var(--accent-line); background: var(--surface); color: var(--accent);
  font-size: 12px; font-weight: 550; cursor: pointer;
  transition: background-color .14s, color .14s;
}
.quiz-batch-btn:hover { background: var(--accent-surface); }

/* Subtle Floating Toast */
.reader-toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 120;
  transform: translate(-50%, 10px); opacity: 0; pointer-events: none;
  padding: 8px 16px; border-radius: 999px;
  background: var(--ink); color: var(--paper); box-shadow: var(--shadow-md);
  font-size: 13px; line-height: 1.4; white-space: nowrap;
  transition: opacity .18s, transform .18s;
}
.reader-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .lightbox-shell { padding: 10px 12px 14px; }
  .lightbox-nav { position: absolute; bottom: 10px; z-index: 3; width: 38px; height: 38px; }
  .lightbox-prev { left: 10px; }
  .lightbox-next { right: 10px; }
  .heading-anchor-btn { opacity: .65; }
  .reader-toast { bottom: 76px; }
}

/* 9. Homepage Scenario Start Cards, Back-to-Top, Article Related & Table Scroll Cue */
.home-start-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
  margin-top: 30px;
}
.home-start-card {
  display: flex; flex-direction: column; min-width: 0;
  padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: border-color .18s, box-shadow .18s;
}
.home-start-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-md); }
.home-start-tag {
  display: inline-block; align-self: flex-start;
  font-size: 11px; font-weight: 600; color: var(--accent);
  background: var(--accent-surface); border: 1px solid var(--accent-line);
  border-radius: 999px; padding: 2px 10px; margin-bottom: 12px;
}
.home-start-card h2 { font-size: 18px; font-weight: 650; line-height: 1.45; margin: 0 0 8px; color: var(--ink); }
.home-start-card p { font-size: 13.5px; line-height: 1.78; color: var(--muted); margin: 0 0 16px; flex: 1; }
.home-start-links {
  display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line);
}
.home-start-primary { font-size: 13.5px; font-weight: 600; color: var(--accent); }
.home-start-primary:hover { text-decoration: underline; text-underline-offset: 4px; }
.home-start-sub { font-size: 12.5px; color: var(--muted); }
.home-start-sub:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
@media (max-width: 1040px) {
  .home-start-grid { grid-template-columns: 1fr 1fr; }
  .home-start-grid > .home-start-card:last-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .home-start-grid { grid-template-columns: 1fr; margin-top: 22px; gap: 12px; }
  .home-start-grid > .home-start-card:last-child { grid-column: auto; }
  .home-start-card { padding: 18px; }
}

.back-to-top {
  position: fixed; right: 24px; bottom: 26px; z-index: 75;
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 38px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--accent-line); background: var(--surface); color: var(--accent);
  box-shadow: var(--shadow-md); font-size: 12.5px; font-weight: 600; cursor: pointer;
  opacity: 0; transform: translateY(8px);
  transition: opacity .18s, transform .18s, background-color .14s;
}
.back-to-top[hidden] { display: none; }
.back-to-top.is-visible { opacity: 1; transform: translateY(0); }
.back-to-top:hover { background: var(--accent-surface); }
@media (max-width: 960px) {
  .back-to-top { right: 16px; bottom: 76px; }
}

.article-related {
  margin-top: 28px; padding: 20px 22px; border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--wash);
}
.article-related h2 { font-size: 17px; margin: 0 0 12px; color: var(--ink); }
.article-related a {
  display: block; padding: 9px 0; border-top: 1px solid var(--line);
  font-size: 14.5px; font-weight: 550; color: var(--accent);
}
.article-related a:first-of-type { border-top: 0; }
.article-related a:hover { text-decoration: underline; text-underline-offset: 4px; }

.course-step-note { border-style: dashed !important; opacity: .88; }

/* Subtle visual scroll affordance for wide tables on mobile & narrow viewports */
.table-scroll.is-scrollable,
.meeting-table.is-scrollable,
.evidence-table.is-scrollable {
  position: relative;
  background-image: linear-gradient(to left, rgb(104 22 116 / .12), transparent 24px);
  background-position: right center;
  background-repeat: no-repeat;
  background-size: 24px 100%;
  background-attachment: scroll;
}
.table-scroll.is-scrollable:not(.is-scrolled-end)::after,
.meeting-table.is-scrollable:not(.is-scrolled-end)::after,
.evidence-table.is-scrollable:not(.is-scrolled-end)::after {
  content: '← 左右滑动查看完整表格 →';
  display: block; position: sticky; left: 0;
  padding: 5px 10px; font-size: 11px; color: var(--muted);
  background: var(--wash); border-top: 1px solid var(--line); text-align: center;
}
@media print { .back-to-top { display: none !important; } }


/* 10. Editorial homepage: one concrete lead story + reader routes (2026-11 round) */
.home-hero-editorial {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 48px; align-items: center;
  padding-block: 48px 40px; border-bottom: 1px solid var(--line);
}
.home-hero-editorial h1 {
  font-size: clamp(30px, 3.4vw, 44px); font-weight: 700; letter-spacing: -.035em; line-height: 1.32;
  color: var(--ink); text-wrap: balance; margin: 0;
}
.home-hero-editorial h1 span { color: var(--accent); }
.home-hero-editorial .home-deck { margin: 16px 0 22px; }
.home-hero-editorial .home-hero-actions { gap: 18px; }
.home-hero-editorial .home-hero-actions .text-link { font-size: 14px; font-weight: 560; color: var(--accent); }
.home-lead {
  position: relative; min-width: 0; padding: 26px 28px 22px;
  border: 1px solid var(--accent-line); border-radius: var(--radius-md, 16px);
  background: var(--surface); box-shadow: var(--shadow-md);
}
.home-lead::before {
  content: ""; position: absolute; left: 28px; right: 28px; top: -1px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent);
}
.home-lead-kicker { display: flex; gap: 10px; align-items: center; margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }
.home-lead-kicker span {
  padding: 2px 10px; border-radius: 999px; background: var(--accent-surface); color: var(--accent); font-weight: 650; letter-spacing: .04em;
}
.home-lead-question { margin: 0 0 6px; font-size: 14px; line-height: 1.7; color: var(--muted); }
.home-lead h2 { margin: 0 0 10px; font-size: clamp(21px, 2vw, 25px); line-height: 1.42; font-weight: 700; letter-spacing: -.02em; }
.home-lead h2 a { color: var(--ink); text-decoration: none; }
.home-lead h2 a:hover { color: var(--accent); }
.home-lead-summary { margin: 0 0 12px; font-size: 14.5px; line-height: 1.8; color: var(--muted); }
.home-lead-points { margin: 0 0 18px; padding: 0; list-style: none; display: grid; gap: 6px; }
.home-lead-points li { position: relative; padding-left: 18px; font-size: 13.5px; line-height: 1.7; color: var(--ink); }
.home-lead-points li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.home-lead-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.home-lead-foot .button { min-height: 44px; padding: 10px 22px; font-weight: 600; gap: 8px; }
.home-lead-next { display: block; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--accent); font-weight: 560; }
.home-lead-next:hover, .home-route-cta:hover, .home-route-extra:hover { text-decoration: underline; text-underline-offset: 4px; }

.home-routes { padding-block: 30px 6px; }
.home-routes-title { font-size: 13px; font-weight: 650; letter-spacing: .06em; color: var(--muted); margin: 0 0 14px; }
.home-route-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.home-route { display: flex; gap: 14px; padding: 18px 20px 18px 0; min-width: 0; }
.home-route + .home-route { padding-left: 20px; border-left: 1px solid var(--line); }
.home-route-index { font: 600 13px/1.6 ui-monospace, SFMono-Regular, monospace; color: var(--accent); padding-top: 1px; }
.home-route-body { min-width: 0; }
.home-route-who { margin: 0 0 4px; font-size: 15px; font-weight: 650; color: var(--ink); line-height: 1.5; }
.home-route-need { margin: 0 0 10px; font-size: 13.5px; line-height: 1.7; color: var(--muted); }
.home-route-cta { display: inline-block; font-size: 13.5px; font-weight: 600; color: var(--accent); }
.home-route-extra { display: inline-block; margin-left: 12px; font-size: 13px; color: var(--muted); }
.home-route-extra:hover { color: var(--accent); }

@media (max-width: 960px) {
  .home-hero-editorial { grid-template-columns: 1fr; gap: 26px; }
  .home-route-list { grid-template-columns: 1fr; }
  .home-route, .home-route + .home-route { padding: 14px 0; border-left: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .home-hero-editorial { padding-block: 22px 26px; gap: 18px; }
  .home-hero-editorial h1 { font-size: 24px; line-height: 1.4; }
  .home-hero-editorial .home-deck { font-size: 14px; line-height: 1.75; margin: 10px 0 14px; }
  .home-hero-editorial .home-hero-actions .button { min-height: 40px; padding: 8px 16px; }
  .home-lead { padding: 20px 18px 16px; }
  .home-lead::before { left: 18px; right: 18px; }
  .home-lead h2 { font-size: 20px; }
  .home-lead-summary { font-size: 14px; }
  .home-route-extra { display: block; margin: 6px 0 0; }
}

/* 11. Article library: compact controls, comparable cards, visible active filters */
.library-results-heading { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.library-results-heading .reset-button:not([hidden]) {
  display: inline-flex; align-items: center; min-height: 32px; padding: 4px 14px; border-radius: 999px;
  border: 1px solid var(--accent-line); background: var(--accent-surface); color: var(--accent);
  font-size: 12.5px; font-weight: 600; text-decoration: none;
}
.library-active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.library-active-filters:empty { display: none; }
.library-active-filters li {
  font-size: 12px; line-height: 1.5; padding: 3px 10px; border-radius: 999px;
  background: var(--wash); border: 1px solid var(--line); color: var(--ink);
}
.library-page .article-card .card-meta > span:nth-child(3) {
  padding: 1px 8px; border-radius: 999px; background: var(--wash); border: 1px solid var(--line); color: var(--ink);
}
.library-page .article-card h2 { font-size: 19px; line-height: 1.5; margin: 10px 0 8px; }
.library-page .article-card p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 760px) {
  .library-page .page-heading { padding: 14px 0 10px !important; }
  .library-page .page-heading h1 { font-size: 24px !important; margin: 0; }
  .library-page .page-heading p { font-size: 13px; margin: 2px 0 0; }
  .library-filters-slim { margin-bottom: 10px; }
  .library-filters-slim .search-row { gap: 8px !important; }
  .library-filters-slim .search-row input { min-height: 44px; }
  .library-filters-slim .filter-row-slim { margin-top: 8px; gap: 8px; }
  .library-filters-slim .select-group .pill-select-trigger,
  .library-filters-slim .select-group select { min-height: 40px; }
  /* 快捷形态与“类型/系列”下拉重复，手机上让位给结果 */
  .library-quick-tabs { display: none !important; }
  .library-results-heading { margin: 4px 0 12px; }
  .library-page .article-grid { gap: 12px; }
  .library-page .article-card { padding: 16px 18px !important; }
  .library-page .article-card h2 { font-size: 17px !important; margin: 8px 0 6px; }
  .library-page .article-card p { font-size: 13.5px; line-height: 1.7; -webkit-line-clamp: 2; margin: 0 0 10px; }
  .library-page .article-card .card-foot { padding-top: 8px; }
}
