/* Shared InfraLens layout and components. Loaded after design-system.css. */

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 13, 24, 0.94);
  backdrop-filter: blur(10px);
}

html[data-theme="light"] .topbar {
  background: rgba(238, 236, 227, 0.92);
}

.topbar-inner,
main,
.page-shell,
.footer-inner {
  width: min(1380px, calc(100% - 40px));
  margin-right: auto;
  margin-left: auto;
}

.topbar-inner {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 32px;
  align-items: center;
  padding: 18px 0;
}

.brand {
  min-width: 0;
}

.brand-home {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-home:hover {
  text-decoration: none;
}

.brand-home:hover {
  color: var(--accent);
}

.brand-logo {
  display: block;
  width: 48px;
  height: 48px;
  max-width: 100%;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

html[data-theme="light"] .brand-logo {
  filter: none;
}

.brand-wordmark {
  color: var(--ink);
  font-size: 26px;
  font-weight: 760;
  line-height: 1.15;
}

.brand-home:hover .brand-wordmark {
  color: var(--accent);
}

.brand h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 760;
  line-height: 1.15;
  letter-spacing: 0;
}

.brand p {
  max-width: 920px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.top-menu {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.top-actions {
  position: static;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.top-actions a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  color: var(--accent);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 680;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}

.top-actions a:hover,
.top-actions a.is-current,
.top-actions a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.theme-switcher {
  position: relative;
  min-height: 38px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 0;
  isolation: isolate;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  padding: 2px;
  overflow: hidden;
}

.theme-switcher {
  width: 80px;
}

.theme-switcher::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc(50% - 2px);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.22), rgba(94, 234, 212, 0.14));
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.18);
  transform: translateX(0);
  transition: transform 220ms ease, background-color 220ms ease, box-shadow 220ms ease;
}

html[data-theme="light"] .theme-switcher::before {
  background: linear-gradient(135deg, rgba(47, 111, 174, 0.18), rgba(15, 118, 110, 0.10));
  box-shadow: inset 0 0 0 1px rgba(47, 111, 174, 0.16);
}

.theme-switcher:has([data-theme-switch="light"].is-active)::before {
  transform: translateX(100%);
}

.theme-toggle {
  position: relative;
  z-index: 1;
  min-height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0 7px;
  font: inherit;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.2;
  cursor: pointer;
  transition: color 180ms ease;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .moon-disc {
  fill: currentColor;
  stroke: currentColor;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--accent);
  background: transparent;
}

.theme-toggle[aria-pressed="true"],
.theme-toggle.is-active {
  color: var(--accent);
  background: transparent;
}

.theme-divider {
  display: none;
}

.nav-links,
.track-links,
.compact-links,
.map-children,
.action-row,
.lab-nav,
.button-row,
.related-links,
.concept-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-links {
  justify-content: flex-end;
}

.nav-links a,
.text-button,
.track-links a,
.compact-links a,
.map-children a,
.related-links a,
.concept-tags span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  color: var(--accent);
  padding: 0 11px;
  font-size: 13px;
  font-weight: 680;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}

.nav-links a:hover,
.text-button:hover,
.track-links a:hover,
.compact-links a:hover,
.map-children a:hover,
.related-links a:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

main {
  padding: 22px 0 44px;
}

.dashboard-layout,
.handbook-layout {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.page-shell {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 22px 0 44px;
}

.concept-tags {
  margin-bottom: 16px;
}

.concept-tags span {
  min-height: 28px;
  border-color: var(--line);
  color: var(--muted);
  padding: 0 9px;
  font-size: 12px;
}

.principle-grid,
.systems-grid,
.concept-split,
.concept-footer,
.pytorch-examples {
  display: grid;
  gap: 14px;
}

.principle-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.systems-grid,
.concept-split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.principle-card,
.systems-grid section,
.visual-note,
.terminology-card,
.interview-level,
.pytorch-example-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-soft);
  padding: 14px;
}

.principle-card h3,
.systems-grid h3,
.visual-note h3,
.terminology-card h3,
.interview-level h4,
.concept-formula h4,
.pytorch-examples h3,
.pytorch-example-card h4 {
  margin-top: 0;
}

.concept-formula {
  display: grid;
  gap: 10px;
  margin: 16px 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--note-bg);
  padding: 14px;
}

.concept-formula code {
  display: block;
  width: 100%;
  padding: 8px 10px;
}

.concept-pair-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.concept-pair-list div {
  display: grid;
  grid-template-columns: minmax(120px, 0.28fr) minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.concept-pair-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.concept-pair-list dt {
  color: var(--accent);
  font-weight: 760;
}

.concept-pair-list dd {
  margin: 0;
  color: var(--muted);
}

.visual-note {
  border-color: rgba(94, 234, 212, 0.34);
  background: rgba(94, 234, 212, 0.08);
}

.visual-note p {
  margin-bottom: 0;
}

.interview-lens {
  margin-top: 18px;
}

.pytorch-examples {
  margin: 18px 0;
}

.expanded-knowledge,
.method-comparison {
  margin: 18px 0;
}

.expanded-knowledge {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--note-bg);
  padding: 14px;
}

.expanded-knowledge h3,
.method-comparison h3 {
  margin-top: 0;
}

.pytorch-example-card {
  border-color: rgba(251, 191, 36, 0.34);
  background: rgba(251, 191, 36, 0.08);
}

.pytorch-example-card code {
  display: block;
  width: 100%;
  padding: 8px 10px;
}

.interview-level {
  margin-top: 12px;
}

.concept-footer {
  margin-top: 18px;
}

.concept-index-group {
  margin-top: 18px;
}

.concept-index-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.concept-index-links a {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-soft);
  padding: 12px;
}

.concept-index-links a:hover {
  border-color: var(--line-strong);
  background: var(--accent-soft);
  text-decoration: none;
}

.concept-index-links span {
  color: var(--ink);
  font-weight: 760;
}

.concept-index-links small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.content,
.content-flow {
  display: grid;
  gap: 24px;
  min-width: 0;
}

.toc {
  position: sticky;
  top: 96px;
  z-index: 8;
  align-self: start;
  max-height: calc(100vh - 116px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 12px;
  box-shadow: var(--shadow-subtle);
}

.toc-card {
  display: contents;
}

.toc b,
.toc-card b {
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.toc p,
.toc-card p {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.toc nav,
.toc-card nav {
  display: grid;
  gap: 2px;
}

.toc a,
.toc-card a {
  min-height: 29px;
  display: flex;
  align-items: center;
  border-left: 3px solid transparent;
  border-radius: 4px;
  color: var(--muted);
  padding: 0 8px;
  font-size: 12.5px;
  font-weight: 620;
  line-height: 1.2;
}

.toc a:hover,
.toc-card a:hover {
  background: var(--paper-soft);
  color: var(--ink);
  text-decoration: none;
}

.toc a.is-active,
.toc-card a.is-active {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.panel,
.metric,
.map-card,
.path-card,
.track-header-card,
.concept-card,
.visual-card,
.ecosystem-card,
.recipe-card,
.detail-card,
.strategy-card,
.family-card,
.frontier-detail,
.frontier-tab,
.project-card,
.project-figure,
.workflow-step,
.ref-card,
.summary-box,
.network-note,
.lab-section,
.doc-block,
.callout,
.qa-block,
.qa-card,
.lab-item,
.meta-card,
.calc-card,
.check-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-subtle);
}

.panel {
  overflow: hidden;
}

.anchor-section,
.lab-section {
  scroll-margin-top: 104px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  background: var(--paper-soft);
  padding: 18px 20px 14px;
}

.panel-head h2,
.panel-head h3 {
  margin: 3px 0 6px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 740;
  line-height: 1.25;
  letter-spacing: 0;
}

.panel-head p {
  max-width: 920px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.anchor-title a {
  flex: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--muted);
  padding: 3px 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.anchor-title a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.doc-body,
.panel-body,
.lab-section {
  padding: 18px 20px 20px;
}

.doc-body > *:first-child,
.panel-body > *:first-child,
.lab-section > *:first-child {
  margin-top: 0;
}

.doc-body > *:last-child,
.panel-body > *:last-child,
.lab-section > *:last-child {
  margin-bottom: 0;
}

.doc-body h3,
.lab-section h3 {
  margin: 24px 0 8px;
  font-size: 17px;
  line-height: 1.3;
  font-weight: 720;
}

.doc-body p,
.lab-section p,
.panel-body p {
  margin: 0 0 14px;
  color: var(--ink);
  line-height: 1.72;
}

.section-kicker,
.kicker,
.track-label,
.track-eyebrow {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.lead-copy {
  max-width: 920px;
  margin: 0 0 16px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.6;
}

.infralens-hero {
  border: 0;
  background: var(--bg);
  box-shadow: none;
}

.home-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(320px, 0.72fr);
  gap: 34px;
  align-items: stretch;
  padding: 70px 0 52px;
}

.home-hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.home-hero-copy h2 {
  max-width: 820px;
  margin: 0 0 16px;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.02;
  font-weight: 780;
}

.home-hero-copy p {
  max-width: 760px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.65;
}

.infralens-hero .action-row {
  gap: 12px;
  margin-top: 12px;
}

.infralens-hero .text-button {
  min-height: 42px;
  border-color: rgba(125, 211, 252, 0.34);
  background: rgba(18, 27, 43, 0.68);
  padding: 0 14px;
}

html[data-theme="light"] .infralens-hero .text-button {
  border-color: var(--line-strong);
  background: rgba(245, 242, 233, 0.82);
}

.home-orientation {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(18, 27, 43, 0.86), rgba(12, 19, 32, 0.7));
  padding: 24px;
  box-shadow: var(--shadow-soft);
}

html[data-theme="light"] .home-orientation {
  background: linear-gradient(180deg, rgba(245, 242, 233, 0.92), rgba(235, 232, 224, 0.78));
}

.home-orientation h3 {
  margin: 0 0 18px;
  font-size: 20px;
  line-height: 1.25;
}

.home-steps {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.home-steps li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
}

.home-steps li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.home-steps li > span {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--accent);
  background: var(--paper);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 760;
}

.home-steps b {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  line-height: 1.35;
}

.home-steps p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.home-section {
  display: grid;
  gap: 18px;
  margin-top: 36px;
}

.home-section-head h2 {
  max-width: 880px;
  margin: 0 0 8px;
  font-size: 32px;
  line-height: 1.18;
}

.home-section-head p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.home-section .doc-body {
  padding: 0;
}

.home-question-grid,
.home-guide-grid,
.home-resource-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.home-guide-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.home-resource-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-question-card,
.home-guide-card,
.home-resource-card {
  min-height: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 27, 43, 0.5);
  padding: 18px;
  box-shadow: none;
}

html[data-theme="light"] .home-question-card,
html[data-theme="light"] .home-guide-card,
html[data-theme="light"] .home-resource-card {
  background: rgba(245, 242, 233, 0.72);
}

.home-question-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.home-card-label {
  align-self: flex-start;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--faint);
  background: var(--paper);
  padding: 2px 9px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.5;
  text-transform: uppercase;
}

.home-question-card h3,
.home-resource-card h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.28;
}

.home-question-card p,
.home-resource-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.62;
}

.home-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.home-link-row a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  color: var(--accent);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 680;
  line-height: 1.25;
}

.home-link-row a:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

.home-guide-card {
  display: grid;
  gap: 8px;
  align-content: start;
  color: var(--ink);
  text-decoration: none;
}

.home-guide-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.home-guide-card strong {
  color: var(--accent);
  font-size: 15px;
  line-height: 1.3;
}

.home-guide-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.home-resource-card {
  display: grid;
  gap: 12px;
  align-content: start;
}

.home-resource-card .text-button {
  justify-self: start;
  margin-top: 2px;
}

.home-copy-block p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.subsection-grid,
.two-column-note {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.system-map-grid,
.path-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.path-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.track-header-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.85fr);
  gap: 14px;
  align-items: stretch;
}

.map-card,
.path-card,
.track-header-card {
  padding: 16px;
  background: var(--paper);
}

.map-parent {
  border-color: rgba(125, 211, 252, 0.34);
  background: linear-gradient(180deg, rgba(125, 211, 252, 0.10), rgba(18, 27, 43, 0.96));
}

.map-card h3,
.path-card h3,
.track-header-card h3,
.doc-block h3,
.lab-item h3,
.calc-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0;
}

.map-card p,
.path-card p,
.track-header-card p,
.doc-block p,
.lab-item p,
.calc-card p,
.workflow-step p,
.summary-box p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.55;
}

.path-card ol {
  margin: 0;
  padding-left: 20px;
}

.path-card li {
  margin: 6px 0;
}

.doc-block,
.callout,
.concept-links,
.formula-block,
.definition-box,
.formula-box,
.assumption-list,
.term-list,
.use-labs,
.concept-note,
.line-explainer,
.interview-answer,
.handbook-link {
  background: var(--note-bg);
}

.doc-block,
.callout,
.concept-links,
.formula-block,
.definition-box,
.formula-box,
.assumption-list,
.term-list,
.use-labs,
.concept-note,
.line-explainer,
.interview-answer,
.handbook-link {
  border-color: var(--note-border);
}

.doc-block,
.callout,
.concept-links,
.formula-block,
.definition-box,
.formula-box,
.assumption-list,
.term-list {
  margin: 14px 0;
  padding: 13px 15px;
}

.use-labs,
.concept-note {
  border-left: 4px solid var(--accent);
}

.callout b,
.concept-links b,
.definition-box strong,
.formula-box strong,
.assumption-list strong,
.term-list strong {
  display: block;
  margin-bottom: 6px;
}

.callout p,
.concept-links p,
.formula-block p,
.definition-box p,
.formula-box p,
.assumption-list p,
.term-list p {
  margin: 0 0 8px;
}

.callout p:last-child,
.concept-links p:last-child,
.formula-block p:last-child,
.definition-box p:last-child,
.formula-box p:last-child,
.assumption-list p:last-child,
.term-list p:last-child {
  margin-bottom: 0;
}

.doc-body ul,
.doc-body ol,
.lab-section ul,
.lab-section ol,
.panel-body ul,
.panel-body ol,
.plain-list,
.reference-inline,
.reading-list {
  margin: 8px 0 0;
  padding-left: 22px;
}

.doc-body li,
.lab-section li,
.panel-body li,
.plain-list li,
.reference-inline li,
.reading-list li {
  margin: 7px 0;
}

.definition-list,
.api-list,
.check-list,
.drill-list,
.lab-list,
.reference-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.definition-list div,
.api-list div {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.definition-list dt,
.api-list dt {
  color: var(--ink);
  font-weight: 720;
}

.definition-list dd,
.api-list dd {
  margin: 0;
  color: var(--muted);
}

.meta-grid,
.calculator-grid,
.metrics-grid,
.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.meta-card,
.calc-card,
.check-item,
.lab-item {
  padding: 13px 15px;
}

.meta-card b,
.check-item b {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.meta-card span,
.check-item span,
.check-item {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.calc-card {
  display: grid;
  align-content: start;
  gap: 10px;
}

.calc-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.calc-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.calc-form input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--code-bg);
  color: var(--ink);
  padding: 7px 9px;
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}

.calc-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 174, 0.12);
}

.calc-result {
  display: grid;
  gap: 7px;
}

.calc-line {
  display: grid;
  grid-template-columns: minmax(98px, 0.58fr) minmax(0, 1.42fr);
  gap: 10px;
  align-items: start;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.calc-line b {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.35;
}

.calc-line span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.table-wrap,
.section-table {
  margin: 16px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.crosslink-table table,
.curriculum-table table {
  min-width: 980px;
}

.tradeoff-table table {
  min-width: 1260px;
}

.tradeoff-table th:first-child,
.tradeoff-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--paper);
  box-shadow: 1px 0 0 var(--line);
  font-weight: 720;
}

.tradeoff-table th:first-child {
  background: var(--paper-soft);
}

.flow-diagram {
  overflow: auto;
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
}

.mini-code,
.recipe-code,
.code-block {
  overflow: auto;
  margin: 16px 0;
  border: 1px solid #263244;
  border-radius: var(--radius);
  background: var(--code-dark);
  color: #d8e3f4;
  padding: 14px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.58;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.mini-code code,
.recipe-code code,
.code-block code {
  white-space: pre;
}

.code-preview {
  background: var(--paper);
}

.code-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.code-preview-title h2,
.code-preview-head h2,
.lab-section h2 {
  margin: 4px 0 10px;
  font-size: 22px;
  font-weight: 740;
  line-height: 1.25;
}

.code-preview-title p,
.code-preview-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.code-preview-actions {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.code-preview pre {
  max-height: 460px;
  overflow: auto;
}

.qa-block,
.qa-card {
  overflow: hidden;
  background: var(--paper);
}

.qa-block summary,
.qa-card summary {
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 13px 14px;
  font-weight: 760;
  line-height: 1.45;
}

.qa-block[open] summary,
.qa-card[open] summary {
  border-bottom: 1px solid var(--line);
  background: var(--paper-soft);
}

.qa-content {
  padding: 14px;
}

.question-number {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
}

.source-line,
.related-line {
  color: var(--muted);
  font-size: 13px;
}

.related-line {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.interview-answer p {
  max-width: 920px;
  color: var(--ink);
  font-size: 15.5px;
}

.misunderstanding-list li::marker {
  color: var(--orange);
}

.source-link,
.recipe-link,
.panel-tag,
.chip,
.eyebrow,
.frontier-kicker {
  border-radius: 999px;
  font-weight: 780;
}

.panel-tag {
  border-color: rgba(47, 111, 174, 0.40);
  background: var(--accent-soft);
  color: var(--accent);
}

.network-canvas {
  border-color: var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(125, 211, 252, 0.06) 0 1px, transparent 1px 100%),
    linear-gradient(0deg, rgba(94, 234, 212, 0.05) 0 1px, transparent 1px 100%),
    var(--bg-panel);
  background-size: 28px 28px;
}

.site-footer {
  border-top: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(125, 211, 252, 0.035), transparent 58%),
    var(--footer-bg);
  margin-top: 32px;
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(260px, auto) minmax(300px, 1fr);
  gap: 28px;
  align-items: center;
  padding: 30px 0;
}

.footer-brand-block {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: var(--footer-text);
  text-decoration: none;
}

.footer-brand:hover {
  text-decoration: none;
}

.footer-logo {
  width: 86px;
  height: 42px;
  display: block;
  object-fit: contain;
}

.footer-brand-name {
  color: var(--footer-text);
  font-size: 18px;
  font-weight: 780;
  line-height: 1.2;
}

.footer-description,
.footer-meta p {
  margin: 0;
  color: var(--footer-muted);
  font-size: 13px;
  line-height: 1.62;
}

.footer-description {
  max-width: 320px;
}

.footer-credit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 58px;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  padding: 0 28px;
}

.footer-credit div {
  display: grid;
  gap: 2px;
}

.footer-credit-label {
  color: var(--footer-muted);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.035em;
  line-height: 1.2;
  text-transform: uppercase;
}

.footer-credit strong {
  color: var(--footer-text);
  font-size: 16px;
  font-weight: 780;
  line-height: 1.25;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.footer-links a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.44);
  color: var(--footer-muted);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 720;
}

html[data-theme="light"] .footer-links a {
  background: rgba(245, 242, 233, 0.72);
}

.footer-links a:hover,
.footer-links a:focus-visible {
  border-color: rgba(125, 211, 252, 0.42);
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.footer-link-icon {
  width: 16px;
  height: 16px;
  flex: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.footer-link-icon-fill {
  fill: currentColor;
  stroke: none;
}

.footer-meta {
  display: grid;
  gap: 5px;
  justify-items: start;
  text-align: left;
}

.footer {
  display: none;
}

@media (max-width: 1180px) {
  .topbar-inner {
    grid-template-columns: 1fr;
  }

  .top-menu,
  .top-actions,
  .nav-links {
    justify-content: flex-start;
  }

  .path-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-layout,
  .handbook-layout,
  .page-shell {
    grid-template-columns: 1fr;
  }

  .toc {
    position: static;
    max-height: none;
  }

  .toc nav,
  .toc-card nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .calculator-grid {
    grid-template-columns: 1fr;
  }

  .home-hero-grid {
    grid-template-columns: 1fr;
  }

  .home-question-grid,
  .home-guide-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .topbar-inner,
  main,
  .page-shell,
  .footer-inner {
    width: min(100% - 24px, 1380px);
  }

  .subsection-grid,
  .two-column-note,
  .track-header-grid,
  .system-map-grid,
  .path-grid,
  .meta-grid,
  .principle-grid,
  .systems-grid,
  .concept-split,
  .concept-index-links,
  .concept-pair-list div,
  .definition-list div,
  .api-list div {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .code-preview-head {
    display: grid;
  }

  .code-preview-actions,
  .nav-links {
    justify-content: flex-start;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .footer-credit {
    justify-content: flex-start;
    border-right: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 16px 0;
  }

  .footer-links {
    justify-content: flex-start;
  }

  .home-hero-grid {
    padding-top: 42px;
  }

  .home-question-grid,
  .home-guide-grid,
  .home-resource-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  html {
    scroll-padding-top: 132px;
  }

  .topbar-inner,
  main,
  .page-shell,
  .footer-inner {
    width: min(100% - 20px, 1380px);
  }

  .topbar-inner {
    gap: 10px;
    padding: 10px 0;
  }

  .brand-home {
    min-height: 44px;
    gap: 8px;
  }

  .brand-logo {
    width: 40px;
    height: 40px;
  }

  .brand-wordmark {
    font-size: 22px;
  }

  .brand h1 {
    font-size: 22px;
  }

  .brand p {
    display: none;
  }

  .top-menu {
    justify-content: flex-start;
    gap: 8px;
  }

  .top-actions {
    gap: 8px;
  }

  .top-actions a,
  .text-button,
  .track-links a,
  .compact-links a,
  .map-children a,
  .related-links a {
    min-height: 42px;
    padding: 0 12px;
  }

  .theme-switcher {
    min-height: 46px;
    width: 92px;
  }

  .theme-toggle {
    min-height: 40px;
    padding: 0;
    font-size: 11.5px;
  }

  main {
    padding-top: 16px;
    padding-bottom: 32px;
  }

  .content,
  .content-flow {
    gap: 18px;
  }

  .panel-head {
    gap: 10px;
  }

  .panel-head,
  .doc-body,
  .lab-section {
    padding: 16px;
  }

  .home-hero-grid {
    gap: 18px;
    padding: 30px 0 26px;
  }

  .home-hero-copy h2 {
    margin-bottom: 12px;
    font-size: 34px;
    line-height: 1.08;
  }

  .home-hero-copy p,
  .home-section-head p,
  .home-copy-block p {
    font-size: 15px;
    line-height: 1.62;
  }

  .home-orientation {
    padding: 16px;
  }

  .home-orientation h3 {
    margin-bottom: 12px;
    font-size: 18px;
  }

  .home-steps {
    gap: 10px;
  }

  .home-steps li {
    padding-bottom: 10px;
  }

  .home-section {
    gap: 14px;
    margin-top: 28px;
  }

  .home-section-head h2 {
    font-size: 24px;
    line-height: 1.22;
  }

  .home-question-card,
  .home-guide-card,
  .home-resource-card {
    padding: 15px;
  }

  .home-link-row a {
    min-height: 40px;
    padding: 0 11px;
  }

  .flow-diagram,
  .mini-code,
  .recipe-code,
  .code-block,
  .code-preview pre {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .footer-credit {
    align-items: flex-start;
    gap: 12px;
  }

  .footer-logo {
    width: 42px;
    height: 42px;
  }

  .footer-brand-block,
  .footer-credit,
  .footer-links {
    width: 100%;
  }

  .footer-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .footer-links a {
    justify-content: center;
    min-height: 44px;
    padding: 0 10px;
  }

  .toc nav,
  .toc-card nav,
  .calc-form,
  .calc-line {
    grid-template-columns: 1fr;
  }
}
