/* ==========================================================================
   Spack Machine — site-wide theme primitives (ZeroY)
   Load after spack-ds-tokens.css. Machine-specific layouts stay in
   spack-ds-machine-zeroy.css. Reuse these classes on any page.
   ========================================================================== */

/* ---------- Text links ---------- */
.textlink {
  font-weight: 600;
  color: var(--red);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  margin-right: 20px;
}
.textlink:hover { color: var(--red-dark); }

/* ---------- Chapters ---------- */
.chapter { padding: 88px 0; background: var(--paper); color: var(--ink); }
/* Compact kept as a class hook for markup; vertical rhythm matches standard chapters. */
.chapter--compact { padding: 88px 0; }
.chapter--compact .chapter__head { margin-bottom: 48px; }
.chapter--tint { background: var(--tint); }
.chapter--dark { background: var(--graphite); color: #f2f2f4; }
.chapter--dark .chapter__intro,
.chapter--dark p { color: var(--grey-on-dark); }
.chapter--dark .eyebrow { color: var(--red); }
.chapter--dark :focus-visible { outline-color: #fff; }

.chapter__head {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 32px;
  align-items: start;
  margin-bottom: 48px;
  max-width: 980px;
}
.chapter__index {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(56px, 6vw, 84px);
  line-height: 0.9;
  color: var(--line-strong);
  margin: 0;
}
.chapter--dark .chapter__index { color: var(--graphite-3); }
.chapter__head h2 {
  font-family: var(--font-display);
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 800;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
  line-height: 1.12;
}
.chapter__intro { color: var(--muted); max-width: 62ch; margin: 0; }

.boundary-note {
  font-size: 14px;
  color: var(--muted);
  border-left: 3px solid var(--red);
  padding-left: 14px;
  margin-top: 32px;
  max-width: 75ch;
}
.chapter--dark .boundary-note { color: var(--grey-on-dark); }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.chips li {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--ink);
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line-strong);
  margin-bottom: 32px;
}
.tab {
  font: inherit;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: var(--muted);
  padding: 10px 18px 12px;
  cursor: pointer;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--red); }

/* ---------- Disclosure ---------- */
.disclosure {
  margin-top: 32px;
  border: 1px solid var(--line);
  background: var(--white);
}
.disclosure summary {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15.5px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
  position: relative;
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 14px;
  font-size: 20px;
  font-weight: 400;
  color: var(--red);
}
.disclosure[open] summary::after { content: "–"; }
.disclosure summary:hover { color: var(--red); }
.disclosure__note { font-size: 13.5px; color: var(--muted); padding: 0 20px; }
.disclosure__body { padding: 8px 20px 20px; }
.disclosure .table-scroll { margin: 8px 20px 20px; }
.disclosure .boundary-note { margin: 0 20px 20px; }

.disclosure--dark {
  background: var(--graphite-2);
  border-color: var(--graphite-3);
}
.disclosure--dark summary { color: #f2f2f4; }
.disclosure--dark summary:hover { color: #fff; }

/* ---------- Spec tables ---------- */
.table-scroll { overflow-x: auto; }

.spectable {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 640px;
}
.spectable caption {
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  padding-bottom: 10px;
}
.spectable th,
.spectable td {
  text-align: left;
  vertical-align: top;
  padding: 10px 14px;
  border: 1px solid var(--line);
}
.spectable thead th {
  font-family: var(--font-display);
  font-weight: 600;
  background: var(--tint);
}
.chapter--tint .spectable thead th { background: #e7e4db; }
.spectable tbody th { font-weight: 600; white-space: nowrap; }
.spectable td { font-variant-numeric: tabular-nums; }
.us {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.spectable td .us { margin-top: 2px; }

/* ---------- Responsive chapter rhythm ---------- */
@media (max-width: 900px) {
  .chapter { padding: 64px 0; }
  .chapter__head { grid-template-columns: 1fr; gap: 8px; }
  .chapter__index { font-size: 44px; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }
}
@media (max-width: 620px) {
  .wrap { padding-inline: 18px; }
}

/* ---------- Divi leftover shortcodes (spack-divi-*) ---------- */
.spack-divi-figure {
  margin: 1.5rem 0;
  max-width: 100%;
}
.spack-divi-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

.spack-divi-blurb {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 12px;
  padding: 16px 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-body);
}
.spack-divi-blurb:hover {
  border-color: var(--line-strong);
  color: var(--red);
}
.spack-divi-blurb:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}
.spack-divi-blurb__img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
}
.spack-divi-blurb__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-small);
  line-height: 1.4;
}

.spack-divi-cta {
  margin: 0 0 16px;
  padding: 20px 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
}
.spack-divi-cta__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-h3);
  color: var(--ink);
  margin: 0 0 12px;
}
.spack-divi-cta__body {
  color: var(--ink-2);
  margin: 0 0 16px;
}
.spack-divi-cta__body img {
  max-width: 160px;
  height: auto;
}
.spack-divi-cta__btn {
  margin-top: 4px;
}

.spack-divi-toggle {
  margin: 0 0 12px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: var(--radius-l);
}
.spack-divi-toggle__summary {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-small);
  color: var(--ink);
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  position: relative;
}
.spack-divi-toggle__summary::-webkit-details-marker { display: none; }
.spack-divi-toggle__summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 12px;
  font-size: 20px;
  font-weight: 400;
  color: var(--red);
}
.spack-divi-toggle[open] .spack-divi-toggle__summary::after { content: "–"; }
.spack-divi-toggle__summary:hover { color: var(--red); }
.spack-divi-toggle__body {
  padding: 0 18px 16px;
  color: var(--ink-2);
}

.spack-divi-btn {
  margin: 0 0 16px;
}

.spack-divi-video {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  margin: 1.5rem 0;
  background: var(--tint);
  border-radius: var(--radius-l);
  overflow: hidden;
}
.spack-divi-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.spack-divi-video-fallback {
  margin: 1rem 0;
}
.spack-divi-video-fallback a { color: var(--red); }

.spack-divi-tab {
  margin: 0 0 16px;
  padding: 16px 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
}
.spack-divi-tab__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-h3);
  color: var(--ink);
  margin: 0 0 12px;
}
.spack-divi-tab__body { color: var(--ink-2); }
.spack-divi-tab__body img {
  max-width: 100%;
  height: auto;
}

.spack-divi-gallery {
  margin: 1.5rem 0;
}
.spack-divi-gallery .gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
}
.spack-divi-gallery .gallery-item {
  margin: 0;
}
.spack-divi-gallery .gallery-icon img {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 620px) {
  .spack-divi-blurb,
  .spack-divi-cta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }
  .spack-divi-cta {
    padding: 16px;
  }
  .spack-divi-btn {
    display: block;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
  }
  .spack-divi-toggle__summary {
    padding-right: 40px;
  }
  .spack-divi-gallery .gallery,
  .spack-divi-gallery .gallery-item {
    display: block;
    width: 100% !important;
  }
}
