/* Technical guides — article layout aligned with the news cards
   (same accent, radius, and border as .news / .blog-post) */

:root {
  --tg-surface: #fafbfc;
  --tg-card: #ffffff;
  --tg-border: #e5e7eb;
  --tg-border-soft: #f0f1f3;
  --tg-text: #1f2937;
  --tg-text-muted: #4b5563;
  --tg-text-subtle: #6b7280;
  --tg-accent: #1d4ed8;
  --tg-accent-hover: #1e40af;
  --tg-accent-soft: #eff6ff;
  --tg-accent-border: #bfdbfe;
  --tg-radius: 0.75rem;
  --tg-radius-sm: 8px;
  --tg-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  --tg-table-border: #e0e0e0;
  --tg-table-canvas: #f4f5f7;
  --tg-table-head: #e8eaee;
  --tg-table-rowhead: #eceef1;
  --tg-table-stripe: #e6e8ec;
  --tg-table-shadow: 0 1px 3px rgba(15, 23, 42, 0.07);
  --tg-table-hover: #e0e3e8;
  --tg-max-prose: 65ch;
  --tg-font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tg-focus: 3px solid var(--color-primary, #007bff);
}

main.article-full {
  background: var(--tg-surface);
  min-height: 60vh;
  padding: clamp(1.25rem, 4vw, 2.5rem) 0;
}

.article-container {
  display: flex;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 1.5rem);
  gap: clamp(1.5rem, 3vw, 2.5rem);
  align-items: flex-start;
  font-family: var(--tg-font);
}

/* Sidebar */
.article-nav {
  flex: 0 0 220px;
  background: var(--tg-card);
  padding: 1.1rem 1rem;
  border-radius: var(--tg-radius);
  border: 1px solid var(--tg-border);
  box-shadow: var(--tg-shadow);
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.article-nav summary {
  margin: 0 0 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tg-text-subtle);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--tg-border-soft);
  list-style: none;
  cursor: pointer;
}

.article-nav summary::-webkit-details-marker {
  display: none;
}

.article-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.article-nav li {
  margin-bottom: 2px;
}

.article-nav a {
  color: var(--tg-text-muted);
  text-decoration: none;
  min-height: 44px;
  padding: 0.55rem 0.6rem;
  border-radius: var(--tg-radius-sm);
  font-size: 0.875rem;
  line-height: 1.35;
  transition: background 0.15s ease, color 0.15s ease;
  display: flex;
  align-items: center;
}

.article-nav a:hover {
  background: var(--tg-accent-soft);
  color: var(--tg-accent);
}

.article-nav a:focus-visible {
  background: var(--tg-accent-soft);
  color: var(--tg-accent);
  outline: var(--tg-focus);
  outline-offset: 2px;
}

.article-nav a.is-active {
  background: var(--tg-accent-soft);
  color: var(--tg-accent);
  box-shadow: inset 3px 0 0 var(--tg-accent);
  font-weight: 600;
}

@media (min-width: 901px) {
  .article-nav summary {
    pointer-events: none;
    cursor: default;
  }

  .article-nav details > ul {
    display: block;
  }

  .article-nav a {
    min-height: 0;
    padding: 0.4rem 0.6rem;
  }
}

.article-content-wrapper {
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

/* Header sits on the same card surface as the sections */
.article-header {
  margin-bottom: 1.5rem;
  padding: 1.35rem 1.35rem 1.15rem;
  background: var(--tg-card);
  border: 1px solid var(--tg-border);
  border-radius: var(--tg-radius);
  box-shadow: var(--tg-shadow);
}

.article-header h1 {
  color: var(--tg-text);
  margin: 0 0 0.85rem;
  font-size: clamp(1.45rem, 2.5vw, 1.85rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  max-width: min(100%, 42rem);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
  color: var(--tg-text-subtle);
  font-size: 0.875rem;
}

.article-meta .author {
  font-weight: 500;
  color: var(--tg-text-muted);
}

.article-meta .date::before {
  content: "·";
  margin-right: 0.65rem;
  color: var(--tg-text-subtle);
}

.article-content {
  line-height: 1.7;
  color: var(--tg-text);
  font-size: 1.0625rem;
  letter-spacing: 0.01em;
}

.article-content p,
.article-content ul,
.article-content ol,
.article-content h2,
.article-content h3,
.article-content h4 {
  max-width: var(--tg-max-prose);
}

.article-content p {
  margin: 0 0 1.1em;
  color: var(--tg-text);
}

.article-content p + p {
  margin-top: 0;
}

.article-content a {
  color: var(--tg-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

.article-content a:hover {
  color: var(--tg-accent-hover);
}

.article-content a:focus-visible {
  outline: var(--tg-focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.article-content > section,
.article-content section {
  margin-bottom: 1.5rem;
  padding: 1.35rem 1.35rem 1.2rem;
  background: var(--tg-card);
  border: 1px solid var(--tg-border);
  border-radius: var(--tg-radius);
  box-shadow: var(--tg-shadow);
}

.article-content > section:last-child,
.article-content section:last-of-type {
  margin-bottom: 0;
}

.article-content section[id],
.article-content h2 {
  scroll-margin-top: 1.25rem;
}

.article-content h2 {
  color: var(--tg-text);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.9rem;
  padding: 0 0 0.5rem;
  border-bottom: 1px solid var(--tg-border-soft);
  letter-spacing: -0.01em;
}

.article-content h3 {
  color: var(--tg-text);
  margin: 1.25rem 0 0.6rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
}

.article-content h3:first-child {
  margin-top: 0;
}

.article-content h4 {
  color: var(--tg-text-muted);
  margin: 1.15rem 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
}

.article-content h4:first-child {
  margin-top: 0;
}

.article-content section h2 + p,
.article-content h2 + p {
  font-size: 1.04em;
  color: var(--tg-text);
}

.article-content .faq h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1rem 0 0.4rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--tg-border-soft);
}

.article-content .faq h2 + h3 {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.article-content ul,
.article-content ol {
  margin: 0.65rem 0 1rem;
  padding-left: 1.25rem;
}

.article-content li {
  margin-bottom: 0.45rem;
  line-height: 1.7;
  color: var(--tg-text);
}

.article-content li::marker {
  color: var(--tg-text-subtle);
}

.article-content li ul,
.article-content li ol {
  margin-top: 0.35rem;
  margin-bottom: 0.2rem;
}

.article-content ul.feature-list {
  list-style: none;
  padding: 0;
  margin: 0.35rem 0 0;
  max-width: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.article-content ul.feature-list li {
  margin: 0;
  padding: 0.7rem 0.8rem;
  background: var(--tg-surface);
  border: 1px solid var(--tg-border-soft);
  border-radius: var(--tg-radius-sm);
}

@media (min-width: 700px) {
  .article-content ul.feature-list {
    grid-template-columns: 1fr 1fr;
  }
}

/* Quick facts */
.quick-facts {
  margin: 0 0 1.5rem;
  padding: 1.1rem 1.2rem;
  background: linear-gradient(135deg, var(--tg-accent-soft) 0%, #f8fafc 100%);
  border: 1px solid var(--tg-accent-border);
  border-radius: var(--tg-radius);
  box-shadow: var(--tg-shadow);
}

.quick-facts h3 {
  margin: 0 0 0.85rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tg-text-muted);
  border: none;
  max-width: none;
}

.quick-facts ul {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr));
  gap: 0.75rem 1.25rem;
}

.quick-facts li {
  padding: 0;
  margin: 0;
  border: none;
  font-size: 0.95rem;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.quick-facts strong {
  color: var(--tg-text-muted);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Callouts */
.callout {
  margin: 1.1rem 0;
  padding: 0.9rem 1.1rem;
  border-radius: var(--tg-radius-sm);
  border: 1px solid var(--tg-border);
  font-size: 0.95rem;
  line-height: 1.7;
}

.callout p {
  margin: 0;
  max-width: var(--tg-max-prose);
}

.callout p + p {
  margin-top: 0.5rem;
}

.callout strong {
  color: var(--tg-text);
}

.callout.info {
  background: #f0f7ff;
  border-color: #c5dcfa;
  color: var(--tg-text);
}

.callout.success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: var(--tg-text);
}

.callout.warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: var(--tg-text);
}

/* Properties table block */
.properties-table {
  margin: 1.25rem 0;
  padding: 1.1rem 1.2rem;
  background: var(--tg-card);
  border: 1px solid var(--tg-border);
  border-radius: var(--tg-radius);
  box-shadow: var(--tg-shadow);
  border-left: 3px solid var(--tg-accent);
}

.properties-table h3 {
  color: var(--tg-text);
  margin: 0 0 0.9rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
}

.properties-table ul {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: none;
}

.properties-table li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--tg-border-soft);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0;
  line-height: 1.5;
}

.properties-table li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.properties-table strong {
  min-width: 160px;
  flex-shrink: 0;
  color: var(--tg-text-muted);
  font-weight: 600;
  font-size: 0.9em;
}

/* Data tables fill the section card; the scroll wrapper handles narrow screens */
.table-scroll {
  margin: 1rem 0 1.25rem;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--tg-table-border);
  border-radius: var(--tg-radius-sm);
  background: var(--tg-table-canvas);
}

.article-content > section .table-scroll,
.article-content section .table-scroll {
  box-shadow: none;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.25rem;
  font-size: 0.9rem;
  border: 1px solid var(--tg-table-border);
  border-radius: var(--tg-radius-sm);
  overflow: hidden;
  background: var(--tg-table-canvas);
  font-variant-numeric: tabular-nums;
  box-shadow: var(--tg-table-shadow);
}

.table-scroll .data-table {
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.data-table--wide {
  min-width: 40rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.9rem;
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
  color: var(--tg-text);
  border: 1px solid var(--tg-table-border);
}

.data-table thead th {
  background: var(--tg-table-head);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tg-text-muted);
}

.data-table tbody th[scope="row"] {
  text-transform: none;
  font-size: 0.9rem;
  letter-spacing: 0;
  color: var(--tg-text);
  background: var(--tg-table-rowhead);
  font-weight: 600;
}

.data-table tbody tr:nth-child(even) td {
  background: var(--tg-table-stripe);
}

.data-table tbody tr:nth-child(even) th[scope="row"] {
  background: var(--tg-table-rowhead);
}

.data-table tbody tr:hover td,
.data-table tbody tr:hover th[scope="row"] {
  background: var(--tg-table-hover);
}

.data-table--figures td {
  text-align: right;
}

.data-table--figures thead th:first-child,
.data-table--figures tbody th[scope="row"] {
  text-align: left;
}

.data-table--compact {
  font-size: 0.86rem;
}

.data-table--compact th,
.data-table--compact td {
  padding: 0.5rem 0.65rem;
}

.data-table--compact th {
  font-size: 0.72rem;
}

.article-content .data-table caption {
  caption-side: top;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tg-text-muted);
  margin-bottom: 0.5rem;
}

.article-content table:not([class]) {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.25rem;
  font-size: 0.88rem;
  border: 1px solid var(--tg-table-border);
  background: var(--tg-table-canvas);
  font-variant-numeric: tabular-nums;
}

.article-content table:not([class]) th,
.article-content table:not([class]) td {
  padding: 0.5rem 0.7rem;
  text-align: left;
  vertical-align: top;
  line-height: 1.45;
  color: var(--tg-text);
  border: 1px solid var(--tg-table-border);
}

.article-content table:not([class]) thead th,
.article-content table:not([class]) tr:first-child th {
  background: var(--tg-table-head);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--tg-text-muted);
}

.article-content table:not([class]) tbody th {
  background: var(--tg-table-rowhead);
}

.article-content table:not([class]) tbody tr:nth-child(even) td {
  background: var(--tg-table-stripe);
}

.article-content table:not([class]) tbody tr:nth-child(even) th {
  background: var(--tg-table-rowhead);
}

.article-content table:not([class]) tbody tr:hover td,
.article-content table:not([class]) tbody tr:hover th {
  background: var(--tg-table-hover);
}

.references {
  list-style: none;
  padding: 0.85rem 0 0;
  margin: 0.35rem 0 0;
  border-top: 1px solid var(--tg-border);
  max-width: none;
}

.references li {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--tg-text-muted);
  margin-bottom: 0.35rem;
}

mcreference {
  font-size: 0.75em;
  color: var(--tg-accent);
  text-decoration: none;
  vertical-align: super;
  margin-left: 2px;
  font-weight: 500;
}

mcreference:hover {
  text-decoration: underline;
}

.article-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--tg-border);
}

.back-to-guides {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--tg-accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.35rem 0.45rem;
  border-radius: var(--tg-radius-sm);
  transition: color 0.15s ease;
}

.back-to-guides:hover {
  color: var(--tg-accent-hover);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.back-to-guides:focus-visible {
  color: var(--tg-accent-hover);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  outline: var(--tg-focus);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .article-container {
    flex-direction: column;
  }

  .article-nav {
    flex: none;
    width: 100%;
    max-width: 100%;
    position: static;
    max-height: none;
    order: 0;
  }

  .article-nav details:not([open]) > ul {
    display: none;
  }

  .article-nav summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    margin: 0;
    padding: 0.35rem 0.15rem;
    border-bottom: none;
  }

  .article-nav summary::after {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    margin-right: 0.35rem;
    border-right: 2px solid var(--tg-text-subtle);
    border-bottom: 2px solid var(--tg-text-subtle);
    transform: rotate(45deg);
    flex-shrink: 0;
  }

  .article-nav details[open] summary {
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--tg-border-soft);
  }

  .article-nav details[open] summary::after {
    transform: rotate(-135deg);
    margin-top: 0.25rem;
  }

  .article-content-wrapper {
    order: 1;
  }

  .article-content {
    font-size: 1rem;
  }
}

@media (max-width: 768px) {
  main.article-full {
    padding: 1rem 0 2rem;
  }

  .article-header,
  .article-content > section,
  .article-content section {
    padding: 1.1rem 1rem;
  }

  .article-header h1 {
    font-size: 1.35rem;
  }

  .article-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .article-meta .date::before {
    content: none;
  }

  .properties-table li {
    flex-direction: column;
  }

  .properties-table strong {
    min-width: auto;
    margin-bottom: 0.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .article-nav a,
  .article-nav summary::after,
  .back-to-guides {
    transition: none;
  }
}
