/* =========================================
   Turn2Engineering – Resource Page Layout
   Shared Resource Article CSS Template
   WordPress / Astra compatible
   Mediavine-ready, compact above-the-fold,
   MathJax v4 CHTML-friendly, WCAG-conscious
   ========================================= */

*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --t2e-blue: #0056b3;
  --t2e-blue-2: #0b3a75;
  --t2e-blue-3: #163f74;
  --t2e-blue-soft: #e7f1ff;
  --t2e-green: #0a6b2b;
  --t2e-green-soft: #e9f7ee;
  --t2e-amber: #a16207;
  --t2e-red: #b42318;

  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --surface: #f8fafc;
  --surface-2: #eef4fb;
  --surface-3: #ffffff;

  --h1: clamp(26px, 4vw, 34px);
  --h2: clamp(21px, 3.4vw, 28px);
  --h3: clamp(18px, 2.6vw, 22px);
  --body: clamp(14px, 2vw, 16.5px);
  --small: clamp(12px, 1.8vw, 14px);

  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius: 14px;
  --radius-sm: 10px;

  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.10);
  --shadow-subtle: 0 6px 18px rgba(15, 23, 42, 0.07);
  --shadow-image: 0 14px 30px rgba(15, 23, 42, 0.10);

  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.22);

  --content-max: 940px;
  --shell-max: 1320px;
  --sidebar-width: clamp(260px, 23vw, 300px);
  --sticky-offset: 88px;
}

html,
body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif,
               "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !important;
  background: linear-gradient(180deg, #f8fafc 0%, #f3f6fa 100%) !important;
  color: var(--ink) !important;
  line-height: 1.7 !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
  -webkit-font-smoothing: antialiased;
}

/* =========================
   Astra / Fluid Container Hardening
   Mirrors the proven equations.css container strategy.
   This stylesheet is only loaded on Resource Pages, so
   these resets intentionally do not depend on a body class.
   ========================= */

.site-content,
.content-area,
.entry-content,
.site-main,
.ast-container,
.ast-container-fluid,
.site-content > .ast-container,
.site-content > .ast-container-fluid,
.ast-plain-container,
.ast-plain-container.ast-container,
.ast-plain-container.ast-container-fluid,
.ast-article-single,
.ast-separate-container .ast-article-single,
#primary {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.site-content > .ast-container,
.site-content > .ast-container-fluid {
  display: block !important;
}

.entry-content,
.site-main,
.content-area,
#primary,
.article-shell,
.article-layout,
.article-main,
.article-sidebar {
  min-width: 0 !important;
}

.article-shell {
  width: 100%;
}

body.resource-page * {
  -webkit-tap-highlight-color: transparent;
}

.article-shell {
  width: 100%;
  max-width: var(--shell-max);
  margin: 10px auto 34px;
  padding: 0 14px 24px;
}

.card {
  position: relative;
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.30);
  padding: clamp(16px, 2vw, 21px) clamp(14px, 2vw, 21px) clamp(13px, 1.8vw, 17px);
  margin-bottom: 12px;
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.055);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.article-shell h1,
.article-shell h2,
.article-shell h3,
.article-shell h4,
.article-shell h5,
.article-shell h6 {
  color: #183b63 !important;
  font-weight: 800 !important;
  letter-spacing: -0.015em;
  margin: 0 0 11px 0 !important;
  line-height: 1.18 !important;
  scroll-margin-top: 120px !important;
}

.article-shell h1 {
  font-size: var(--h1) !important;
}

.article-shell h2 {
  font-size: var(--h2) !important;
}

.article-shell h3 {
  font-size: var(--h3) !important;
}

.article-shell p,
.article-shell li,
.article-shell td,
.article-shell th {
  font-size: var(--body) !important;
  line-height: 1.72 !important;
  color: var(--ink-soft) !important;
  margin: 0 0 12px 0 !important;
}

.article-shell p {
  max-width: 72ch;
}

.article-shell a {
  color: var(--t2e-blue) !important;
  text-decoration: underline !important;
  text-underline-offset: 2px;
}

.article-shell a:hover {
  color: var(--t2e-blue-2) !important;
}

.article-shell a:focus-visible,
.card-toggle:focus-visible,
.faq-question:focus-visible,
.mobile-toc summary:focus-visible,
.related-card-link:focus-visible {
  outline: 2px solid #2563eb !important;
  outline-offset: 2px !important;
  box-shadow: var(--focus-ring) !important;
  border-radius: 10px;
}

.heading-anchor {
  display: none !important;
}

/* =========================
   Hero / Above-the-fold
   ========================= */

.article-hero {
  margin-bottom: 14px;
}

.breadcrumbs {
  padding-top: 10px;
  padding-bottom: 10px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(148, 163, 184, 0.42);
  background: linear-gradient(180deg, #fbfdff 0%, #f5f7fa 100%);
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.05);
}

.breadcrumbs-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: var(--small);
  color: #6b7280;
}

.breadcrumbs-inner span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.breadcrumbs-inner a {
  color: #35597e !important;
  text-decoration: none !important;
}

.breadcrumbs-inner a:hover,
.breadcrumbs-inner a:focus-visible {
  color: #183b63 !important;
  text-decoration: underline !important;
}

.breadcrumbs-inner .crumb-current {
  color: #111827;
  font-weight: 600;
}

.title-meta {
  margin-top: 8px;
  background: linear-gradient(135deg, #f4f8ff 0%, #ffffff 58%, #f8fbff 100%);
  border-radius: var(--radius-xl);
  border-color: #c7d7ea;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.085);
}

.page-title {
  margin-top: 2px !important;
  margin-bottom: 8px !important;
  max-width: 22ch;
}

.page-subtitle {
  margin: 0 0 10px 0 !important;
  font-size: var(--body) !important;
  color: var(--muted) !important;
  max-width: 78ch;
}

.meta-line {
  font-size: var(--small);
  color: #64748b;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.meta-pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #bfdbfe;
}

.key-takeaways {
  margin-top: 9px;
  background: linear-gradient(135deg, #fff8e8 0%, #fffdf8 62%, #ffffff 100%);
  border-color: #f0bd48;
  border-left: 5px solid #d99a12;
}

.kt-heading {
  font-size: 15px !important;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #92400e !important;
  font-weight: 800 !important;
  margin: 0 0 6px 0 !important;
  line-height: 1.3 !important;
}

.kt-list {
  list-style: disc;
  padding-left: 18px;
  margin: 6px 0 0 0;
}

.kt-list li {
  margin-bottom: 8px;
}

.kt-list li strong {
  color: #92400e;
}

/* =========================
   Main Layout
   ========================= */

.article-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.article-main {
  min-width: 0;
  width: 100%;
  max-width: var(--content-max);
}

.article-sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 1025px) {
  .article-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    gap: clamp(22px, 2.4vw, 32px);
    align-items: flex-start;
  }

  .article-sidebar {
    width: 100%;
    order: 1;
    align-self: start;
    position: sticky;
    top: var(--sticky-offset);
  }

  .article-main {
    order: 2;
  }
}

/* =========================
   Sidebar / TOC
   ========================= */

.card-toggle {
  background: none !important;
  border: none !important;
  padding: 0 0 8px;
  margin: 0 0 6px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--ink-soft) !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.card-toggle-label {
  font-size: var(--small);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #35597e !important;
}

.card-toggle-icon {
  font-size: 12px;
  transition: transform .16s ease;
  color: #56799c;
}

.card[data-open="true"] .card-toggle-icon {
  transform: rotate(180deg);
}

.card-collapsible-body {
  display: block;
}

.card[data-open="false"] .card-collapsible-body {
  display: none;
}

.toc-title {
  font-weight: 800;
  font-size: var(--small);
  color: #35597e !important;
  margin-bottom: 4px !important;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toc-list li a {
  display: block;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid #dce6f2;
  background: #ffffff !important;
  color: #1f2937 !important;
  text-decoration: none !important;
  font-size: var(--small);
}

.toc-list li a:hover {
  background: #eef4ff !important;
  border-color: #bcd3f3;
  color: #183b63 !important;
}

.toc-list li a.is-active {
  border-color: #8db4df !important;
  box-shadow: inset 4px 0 0 #2563eb;
  background: #eef5ff !important;
  color: #183b63 !important;
}

.author-box {
  background: linear-gradient(180deg, #f9fbff 0%, #ffffff 100%);
}

.author-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e5edff, #c7d2fe);
}

.author-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.author-name {
  font-weight: 700;
  font-size: var(--small);
  color: #111827;
}

.author-role {
  font-size: var(--small);
  color: #6b7280;
}

.author-bio {
  font-size: var(--small) !important;
}

.trust-box {
  background: #f9fafb;
}

.trust-text {
  font-size: var(--small) !important;
  margin-bottom: 4px !important;
}

.trust-note {
  font-size: var(--small) !important;
  color: #6b7280;
  font-style: italic;
}

.promo-box {
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
  border-color: #bfdbfe;
}

.promo-heading {
  font-weight: 700;
  font-size: var(--small);
  margin-bottom: 4px;
}

.promo-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.promo-links li {
  margin: 3px 0;
}

.promo-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--small) !important;
  text-decoration: none !important;
  color: #183b63 !important;
  padding: 4px 8px;
  border-radius: 10px;
  background: transparent !important;
}

/* =========================
   Intro / Content Cards
   ========================= */

.intro {
  background: linear-gradient(135deg, #f5f9ff 0%, #ffffff 72%);
  border-color: #dbe6f2;
  border-left: 4px solid #7aa7db;
}

.section-summary {
  margin: 0 0 6px 0;
  padding: 7px 10px;
  border-radius: 12px;
  border: 1px solid #d7e6ff;
  background: linear-gradient(180deg, #f5f9ff 0%, #ffffff 100%);
  color: #29496d !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
  max-width: 72ch;
}

.section-summary strong {
  color: #183b63 !important;
}

.intro-audience {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px 0 !important;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid #dbe3ef;
  background: #ffffff;
  color: #35597e !important;
  font-size: 12px !important;
  line-height: 1.3 !important;
  max-width: fit-content;
}

.intro-audience strong {
  color: #183b63 !important;
}

.topic-disclaimer {
  margin: 0 0 8px 0 !important;
  font-size: 12px !important;
  line-height: 1.4 !important;
  color: #7c4a03 !important;
  max-width: 72ch;
}

.core-content {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
}

.core-content .core-section {
  margin-bottom: 14px;
}

.core-content ul,
.core-content ol {
  padding-left: 22px;
  margin: 12px 0 18px;
}

/* =========================
   Diagram / Image System
   ========================= */

.diagram-card {
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.96) 0%, #ffffff 100%);
  border-color: #d8e7ff;
}

.diagram-figure {
  margin: 0;
  max-width: 100%;
}

.diagram-media {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.09);
}

.diagram-media::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(0, 86, 179, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 86, 179, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.55;
}

.diagram-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
  background: #ffffff;
}

.diagram-media--plain {
  background: #ffffff;
}

.diagram-media--plain::before {
  display: none;
}

.diagram-media--wide {
  aspect-ratio: 21 / 9;
}

.diagram-media--square {
  aspect-ratio: 1 / 1;
}

.diagram-media--natural {
  aspect-ratio: auto;
  min-height: 0;
}

.diagram-media--natural .diagram-img {
  height: auto;
  object-fit: contain;
}

.core-section .diagram-figure {
  margin: 16px 0 14px;
}

.core-section .diagram-media {
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
  background: #f8fafc;
}

.diagram-card > .diagram-figure .diagram-media {
  margin-top: 4px;
}

.diagram-caption {
  max-width: 74ch;
  font-size: var(--small) !important;
  color: var(--muted) !important;
  line-height: 1.55 !important;
  margin: 9px 0 0 0 !important;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.diagram-note {
  max-width: 72ch;
  margin-top: 10px !important;
}

/* =========================
   Logic / Utility Modules
   ========================= */

.logic-tree-placeholder {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed #9dbcf0;
  background: #f8fbff;
}

.logic-tree-title {
  font-size: var(--small);
  font-weight: 800;
  color: #183b63;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}

/* =========================
   MathJax / Equations
   ========================= */

html.mathjax-loading .equation-block,
html.mathjax-loading mjx-container {
  visibility: hidden;
}

html.mathjax-ready .equation-block,
html.mathjax-ready mjx-container {
  visibility: visible;
}

.equation-block {
  position: relative;
  margin: 18px 0;
  padding: 30px 18px 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, #eef4ff 0%, #ffffff 100%);
  border: 1px solid #d1ddff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  text-align: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 72px;
}

.equation-block::before {
  content: "Key equation";
  position: absolute;
  top: 8px;
  left: 14px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e0ebff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

mjx-container[display="true"] {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding-bottom: 2px;
}

/* =========================
   Tables
   ========================= */

.table-scroll-wrapper {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 12px 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid #e5e7eb;
  background: #ffffff;
  box-shadow:
    0 3px 10px rgba(15, 23, 42, 0.045),
    inset -12px 0 14px -16px rgba(15, 23, 42, 0.30),
    inset 12px 0 14px -16px rgba(15, 23, 42, 0.20);
}

.core-content table,
.article-main table {
  border-collapse: collapse;
  width: 100%;
  margin: 0;
  font-size: var(--body);
  min-width: 640px;
}

.core-content th,
.core-content td,
.article-main th,
.article-main td {
  border: 1px solid #e5e7eb;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.core-content th,
.article-main th {
  background: #eaf1f8;
  font-weight: 700;
  color: #183b63;
  border-bottom-color: #cbd8e6;
}

/* =========================
   Variables / Callouts
   ========================= */

.variables-box {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #dbe3ef;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.variables-box-title {
  font-size: var(--small);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.variables-box-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.variables-box-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: flex-start;
  gap: 6px 12px;
  padding: 4px 0;
  border-bottom: 1px dashed #e2e8f0;
}

.variables-box-list li:last-child {
  border-bottom: none;
}

.variables-box-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 12px;
  border-radius: 999px;
  background: #e0ebff;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}

.callout {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  border-left-width: 5px;
}

.callout-label {
  font-size: var(--small);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  margin-bottom: 6px;
}

.callout--tip {
  border-color: #b7ebcb;
  border-left-color: #16a34a;
  background: #eefcf3;
}

.callout--warning {
  border-color: #fdc9c5;
  border-left-color: #dc2626;
  background: #fff4f2;
}

.callout--check {
  border-color: #bfdbfe;
  border-left-color: #2563eb;
  background: #eff6ff;
}

.callout--field {
  border-color: #b8d7ff;
  border-left-color: #0f5ea8;
  background: #f3f8ff;
}

.visual-module {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.standards-module {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  padding: 14px 14px 10px;
}

/* =========================
   Mobile TOC
   ========================= */

.mobile-toc-wrapper {
  display: block;
  margin: 0 0 14px 0;
}

.mobile-toc {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
}

.mobile-toc summary {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
  color: #35597e !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  background: #ffffff !important;
}

.mobile-toc summary::-webkit-details-marker,
.mobile-toc summary::marker {
  display: none;
}

.mobile-toc summary::after {
  content: "▾";
  font-size: 14px;
  transition: transform 0.2s;
}

.mobile-toc[open] summary::after {
  transform: rotate(180deg);
}

.mobile-toc-list {
  padding: 0 16px 16px;
  margin: 0;
  list-style: none;
}

.mobile-toc-list li a {
  display: block;
  padding: 8px 0;
  color: var(--ink-soft) !important;
  text-decoration: none !important;
  border-bottom: 1px solid #f1f5f9;
  font-size: var(--body);
}

/* =========================
   FAQ
   ========================= */

.faq-module {
  background: linear-gradient(180deg, #f7f9fc 0%, #ffffff 100%);
  border: 1px solid #dce4ed;
  padding-top: 14px;
}

.faq-item {
  margin-bottom: 10px;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 10px;
}

.faq-item.is-open {
  border-color: #d1d5db;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.07);
}

.faq-question {
  width: 100%;
  text-align: left;
  background: none !important;
  border: none !important;
  padding: 10px 0 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font: inherit;
  cursor: pointer;
}

.faq-question-text {
  font-weight: 600;
  color: #111827 !important;
  font-size: var(--body);
}

.faq-icon {
  flex-shrink: 0;
  font-size: 13px;
  line-height: 1;
  color: #64748b;
  transition: transform .16s ease, color .16s ease;
}

.faq-item.is-open .faq-icon {
  transform: rotate(180deg);
  color: #0f172a;
}

.faq-answer {
  padding: 6px 0 10px 0;
  border-top: 1px solid #e5e7eb;
  margin-top: 4px;
}

/* =========================
   Conclusion / Related
   ========================= */

.conclusion-cta {
  background: #f9fafb;
  border-color: #e2e8f0;
}

.conclusion-links {
  list-style: none;
  padding-left: 0;
  margin: 8px 0 0 0;
}

.conclusion-links li {
  margin-bottom: 10px;
}

.conclusion-link-desc {
  font-size: var(--small) !important;
  color: var(--muted) !important;
  margin-top: 2px !important;
}

.related-resources {
  background: #ffffff;
  border-color: #e5e7eb;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.related-card {
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  text-align: left;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.065);
}

.related-card-link {
  display: block;
  height: 100%;
  padding: 10px 12px 10px;
  text-decoration: none !important;
  color: inherit !important;
}

.related-card-link:hover,
.related-card-link:focus-visible {
  background: #f8fbff !important;
}

.related-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 6px;
}

.related-card-title {
  font-size: var(--small);
  color: #1f2937;
  margin-bottom: 3px;
  font-weight: 700;
}

.related-card-meta {
  font-size: var(--small);
  color: #6b7280;
}

.muted {
  color: #6b7280 !important;
  font-size: var(--small) !important;
}

/* =========================
   Motion Preference
   ========================= */

@media (prefers-reduced-motion: reduce) {
  html,
  body {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* =========================
   Responsive Refinements
   ========================= */

@media (max-width: 1024px) {
  .article-main,
  .article-sidebar {
    max-width: 100%;
  }
}

/* Astra tablet/mobile breakpoint hard reset.
   The outer WordPress/Astra wrappers contribute ZERO side gutter.
   The article shell alone controls the remaining 6px edge spacing. */
@media (max-width: 921px) {
  html,
  body {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .site-content,
  .content-area,
  .entry-content,
  .site-main,
  .ast-container,
  .ast-container-fluid,
  .site-content > .ast-container,
  .site-content > .ast-container-fluid,
  .ast-plain-container,
  .ast-plain-container.ast-container,
  .ast-plain-container.ast-container-fluid,
  .ast-article-single,
  .ast-separate-container .ast-article-single,
  #primary {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-inline: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-inline: 0 !important;
  }

  .article-shell {
    width: 100% !important;
    max-width: 100% !important;
    margin: 6px auto 18px;
    padding: 0 6px 14px;
  }

  .article-layout,
  .article-main,
  .article-sidebar,
  .article-hero,
  .core-content,
  .core-section,
  .card,
  .diagram-card,
  .faq-module,
  .conclusion-cta {
    min-width: 0;
    max-width: 100%;
  }

  .article-hero {
    margin-bottom: 8px;
  }

  .card {
    padding: 13px 11px 10px;
    border-radius: 12px;
    margin-bottom: 7px;
  }

  .breadcrumbs {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .title-meta,
  .key-takeaways {
    margin-top: 6px;
  }

  .meta-line {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }

  .related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .intro-audience {
    display: inline-flex;
    max-width: 100%;
  }

  .diagram-media {
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  }

  .core-section .diagram-figure {
    margin: 14px 0 12px;
  }

  .core-content .core-section {
    margin-bottom: 9px;
  }

  .core-content ul,
  .core-content ol {
    padding-left: 20px;
    margin: 8px 0 12px;
  }

  .mobile-toc-wrapper {
    margin-bottom: 8px;
  }

  .mobile-toc summary {
    padding: 10px 12px;
  }

  .mobile-toc-list {
    padding: 0 12px 12px;
  }
}

/* Phone layout: essentially full-width.
   4px outer gutter matches the equations.css behavior that is already working. */
@media (max-width: 640px) {
  .article-shell {
    width: 100% !important;
    max-width: 100% !important;
    margin: 4px auto 14px;
    padding: 0 4px 10px !important;
  }

  .card {
    padding: 10px 8px 8px;
    border-radius: 10px;
    margin-bottom: 6px;
  }

  .breadcrumbs {
    padding-left: 8px;
    padding-right: 8px;
  }

  .title-meta {
    padding-top: 11px;
  }

  .page-title {
    font-size: clamp(22px, 7vw, 26px) !important;
    line-height: 1.15 !important;
    max-width: none;
  }

  .article-shell h2 {
    font-size: clamp(19px, 5.7vw, 23px) !important;
  }

  .article-shell h3 {
    font-size: clamp(17px, 5vw, 20px) !important;
  }

  .article-shell p,
  .article-shell li,
  .article-shell td,
  .article-shell th {
    line-height: 1.62 !important;
  }

  .article-shell p {
    max-width: 100%;
  }

  .key-takeaways {
    padding-left: 9px;
    padding-right: 9px;
    border-left-width: 4px;
  }

  .kt-list {
    padding-left: 17px;
  }

  .kt-list li {
    margin-bottom: 7px !important;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .breadcrumbs-inner {
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .breadcrumbs-inner span {
    flex-shrink: 0;
  }

  .breadcrumbs-inner::-webkit-scrollbar {
    display: none;
  }

  .section-summary,
  .topic-disclaimer {
    max-width: 100%;
  }

  .diagram-card {
    padding-left: 8px;
    padding-right: 8px;
  }

  .diagram-card h2 {
    padding-left: 1px;
    padding-right: 1px;
  }

  .diagram-media {
    aspect-ratio: 16 / 9;
    border-radius: 10px;
  }

  .diagram-caption,
  .diagram-note {
    padding-left: 1px;
    padding-right: 1px;
  }

  .variables-box-list li {
    grid-template-columns: 1fr;
  }

  .variables-box-symbol {
    width: fit-content;
    max-width: 100%;
  }

  .table-scroll-wrapper {
    margin: 8px 0 12px;
    border-radius: 8px;
    overscroll-behavior-inline: contain;
  }

  .core-content table,
  .article-main table {
    min-width: 560px;
  }

  .core-content th,
  .core-content td,
  .article-main th,
  .article-main td {
    padding: 7px 8px;
  }

  .equation-block {
    margin: 10px 0;
    padding: 36px 8px 10px;
    min-height: 72px;
  }

  .callout {
    border-left-width: 4px;
  }

  .card-toggle,
  .faq-question,
  .mobile-toc summary {
    min-height: 44px;
  }
}

/* Narrow phones: 2px shell gutter, matching the successful equations page strategy. */
@media (max-width: 390px) {
  .article-shell {
    padding-left: 2px !important;
    padding-right: 2px !important;
  }

  .card {
    padding-left: 7px;
    padding-right: 7px;
  }

  .breadcrumbs {
    padding-left: 7px;
    padding-right: 7px;
  }

  .mobile-toc summary {
    padding-left: 10px;
    padding-right: 10px;
  }

  .mobile-toc-list {
    padding-left: 10px;
    padding-right: 10px;
  }

  .equation-block {
    padding-left: 6px;
    padding-right: 6px;
  }

  .callout,
  .variables-box {
    padding-left: 8px;
    padding-right: 8px;
  }
}

@media (min-width: 1025px) {
  .mobile-toc-wrapper {
    display: none;
  }

  .author-avatar {
    display: none;
  }

  .author-header {
    align-items: flex-start;
  }
}

/* =========================
   Print
   ========================= */

@media print {
  .article-sidebar,
  .mobile-toc-wrapper {
    display: none !important;
  }

  .article-shell,
  .article-main {
    max-width: 100% !important;
    width: 100% !important;
  }

  .card {
    box-shadow: none !important;
    break-inside: avoid;
  }

  .article-shell a {
    color: #000 !important;
    text-decoration: underline !important;
  }
}

/* ==========================================================
   Turn2Engineering – Shared Resource UX Enhancements
   Existing HTML/JS selectors preserved.
   ========================================================== */

/* JS-hidden accordion/collapsible content must always stay hidden. */
.article-shell [hidden] {
  display: none !important;
}

/* Stronger visual rhythm for long-form resource sections. */
.core-content .core-section > h2:first-child,
.faq-module > h2:first-child,
.standards-module > h2:first-child,
.conclusion-cta > h2:first-child {
  padding-bottom: 9px;
  margin-bottom: 14px !important;
  border-bottom: 1px solid #e7edf4;
}

.article-main h3 {
  margin-top: 20px !important;
  color: #244b73 !important;
}

.core-content li + li {
  margin-top: 4px !important;
}

/* -------------------------
   Tables
   ------------------------- */

.table-scroll-wrapper.is-scrollable {
  scrollbar-gutter: stable;
  overscroll-behavior-inline: contain;
}

.table-scroll-wrapper:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
}

.core-content table caption,
.article-main table caption {
  caption-side: top;
  text-align: left;
  padding: 0 0 8px;
  color: var(--muted);
  font-size: var(--small);
  font-weight: 600;
  line-height: 1.5;
}

.core-content tbody tr:nth-child(even) td,
.article-main tbody tr:nth-child(even) td {
  background: #fbfdff;
}

.core-content tbody td:first-child,
.article-main tbody td:first-child {
  color: #1f3f61 !important;
  font-weight: 600;
}

.core-content td,
.core-content th,
.article-main td,
.article-main th {
  overflow-wrap: break-word;
  word-break: normal;
}

@media (hover: hover) and (pointer: fine) {
  .core-content tbody tr:hover td,
  .article-main tbody tr:hover td {
    background: #f2f7fc;
  }

  .core-content table .is-col-highlight,
  .article-main table .is-col-highlight {
    background: #eaf4ff !important;
  }

  .core-content th.is-col-highlight,
  .article-main th.is-col-highlight {
    background: #dcecff !important;
  }
}

/* -------------------------
   TOC / Sidebar
   ------------------------- */

.mobile-toc-list li a.is-active {
  color: #183b63 !important;
  font-weight: 700;
  background: #eef5ff !important;
  box-shadow: inset 4px 0 0 #2563eb;
  padding-left: 10px;
  padding-right: 8px;
  border-radius: 8px;
}

@media (min-width: 1025px) {
  .toc-box .card-collapsible-body {
    max-height: calc(100vh - var(--sticky-offset) - 150px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  body.admin-bar .article-sidebar {
    top: calc(var(--sticky-offset) + 32px);
  }
}

/* -------------------------
   Media / technical content
   ------------------------- */

.article-main img,
.article-main svg,
.article-main video,
.article-main canvas,
.article-main iframe {
  max-width: 100%;
}

.article-main img,
.article-main video {
  height: auto;
}

.article-main pre {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.article-main code {
  overflow-wrap: break-word;
}

.article-main pre code {
  overflow-wrap: normal;
  word-break: normal;
}

.article-main a {
  overflow-wrap: break-word;
}

/* -------------------------
   Interactive affordances
   ------------------------- */

.card-toggle,
.faq-question,
.mobile-toc summary {
  min-height: 44px;
}

.callout p:last-child,
.variables-box p:last-child,
.standards-module p:last-child,
.faq-answer p:last-child {
  margin-bottom: 0 !important;
}

@media (hover: hover) and (pointer: fine) {
  .faq-question:hover .faq-question-text {
    color: #183b63 !important;
  }

  .promo-links a:hover {
    background: #eef4ff !important;
  }

  .related-card {
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  }

  .related-card:hover {
    transform: translateY(-2px);
    border-color: #bfcfe0;
    box-shadow: 0 9px 22px rgba(15, 23, 42, 0.095);
  }
}

/* -------------------------
   Mobile
   ------------------------- */

/* Mobile width and gutter behavior is intentionally centralized in the
   main responsive section above to prevent conflicting padding rules. */



/* =========================
   Full-Width Mobile Safety
   Prevent nested Astra/WordPress blocks from reintroducing gutters.
   ========================= */

@media (max-width: 921px) {
  .entry-content > *,
  .site-main > article,
  .ast-article-single > .entry-content {
    max-width: 100% !important;
  }

  .article-shell,
  .article-layout,
  .article-main,
  .article-sidebar,
  .article-hero,
  .core-content {
    width: 100%;
  }
}

/* -------------------------
   High contrast
   ------------------------- */

@media (forced-colors: active) {
  .card,
  .table-scroll-wrapper,
  .faq-item.is-open,
  .mobile-toc,
  .callout,
  .variables-box,
  .standards-module,
  .related-card {
    border: 1px solid CanvasText;
  }

  .toc-list li a.is-active,
  .mobile-toc-list li a.is-active {
    outline: 2px solid Highlight;
    box-shadow: none;
  }
}

/* -------------------------
   Print
   ------------------------- */

@media print {
  html,
  body {
    overflow: visible !important;
    background: #ffffff !important;
  }

  .article-hero,
  .article-layout,
  .article-main,
  .core-content {
    display: block !important;
  }

  .article-sidebar,
  .mobile-toc-wrapper,
  .heading-anchor {
    display: none !important;
  }

  .article-shell {
    margin: 0 !important;
    padding: 0 !important;
  }

  .table-scroll-wrapper {
    overflow: visible !important;
    border-color: #d1d5db !important;
    box-shadow: none !important;
  }

  .core-content table,
  .article-main table {
    min-width: 0 !important;
    width: 100% !important;
    font-size: 10pt !important;
  }

  .core-content th,
  .core-content td,
  .article-main th,
  .article-main td {
    padding: 5px 6px !important;
    line-height: 1.35 !important;
  }

  .equation-block,
  .diagram-media,
  .related-card {
    box-shadow: none !important;
  }

  .faq-answer,
  .card-collapsible-body {
    display: block !important;
  }

  .faq-item,
  .callout,
  .variables-box,
  .diagram-figure {
    break-inside: avoid;
  }

  .related-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}