/* ============================================================================
   IREX docs site — shared styles for documentation pages
   (User Guide, Release Notes, Changelog, and related help).

   Tokens and fonts: colors_and_type.css (canonical).
   List / table patterns: aligned with templates/document.css (web-scaled).
   ========================================================================== */

@import url("colors_and_type.css");

:root {
  /* Page / section title scale for the docs site (under marketing display) */
  --docs-title: clamp(1.75rem, 3.5vw, 2.25rem); /* → ~36px */
  --docs-h2:    var(--fs-h3);   /* 1.5rem / 24px */
  --docs-h3:    var(--fs-h4);   /* 1.25rem / 20px */
  --docs-lead:  var(--fs-lg);   /* 1.125rem / 18px */
  /*
    Reading column with left nav + right “On this page”.
    ~50rem — comfortable measure for dual-rail docs (prose, tables, figures share it).
  */
  --docs-measure: 50rem;
}

/* Keep sticky topbars from shifting when a page gains/loses a vertical scrollbar */
html {
  scrollbar-gutter: stable;
}

/* --------------------------------------------------------------------------
   Chrome shared by docs pages (title, eyebrow, lead)
   -------------------------------------------------------------------------- */
.irex-eyebrow {
  font-family: var(--font-head);
  font-weight: var(--w-semibold);
  font-size: var(--fs-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--space-3);
}

.irex-page-title {
  font-family: var(--font-head);
  font-weight: var(--w-bold);
  font-size: var(--docs-title);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--fg);
  margin: 0 0 var(--space-4);
}

.irex-lead {
  font-family: var(--font-body);
  font-size: var(--docs-lead);
  line-height: var(--lh-relaxed);
  color: var(--fg-muted);
  margin: 0 0 var(--space-7);
  max-width: 40rem;
}

/* --------------------------------------------------------------------------
   Article body — class="docs-prose" (alias: .guide-content for the user guide)
   -------------------------------------------------------------------------- */
.docs-prose,
.guide-content {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
  font-weight: var(--w-regular);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.docs-prose > :first-child,
.guide-content > :first-child { margin-top: 0; }

.docs-prose h1,
.docs-prose h2,
.docs-prose h3,
.docs-prose h4,
.guide-content h1,
.guide-content h2,
.guide-content h3,
.guide-content h4 {
  font-family: var(--font-head);
  color: var(--fg);
  line-height: var(--lh-snug);
  margin: var(--space-7) 0 var(--space-3);
}

.docs-prose h1, .guide-content h1 {
  font-weight: var(--w-bold);
  font-size: var(--docs-title);
  letter-spacing: var(--tracking-tight);
}

.docs-prose h2, .guide-content h2 {
  font-weight: var(--w-bold);
  font-size: var(--docs-h2);
}

.docs-prose h3, .guide-content h3 {
  font-weight: var(--w-semibold);
  font-size: var(--docs-h3);
}

.docs-prose h4, .guide-content h4 {
  font-weight: var(--w-semibold);
  font-size: var(--fs-base);
}

.docs-prose p,
.docs-prose li,
.docs-prose td,
.docs-prose th,
.docs-prose dd,
.docs-prose dt,
.guide-content p,
.guide-content li,
.guide-content td,
.guide-content th,
.guide-content dd,
.guide-content dt {
  color: var(--fg);
}

.docs-prose p,
.guide-content p {
  margin: 0 0 var(--space-4);
  max-width: var(--docs-measure);
}

.docs-prose p strong,
.docs-prose li strong,
.docs-prose b,
.guide-content p strong,
.guide-content li strong,
.guide-content b {
  color: var(--fg);
  font-weight: var(--w-semibold);
}

/* Links — same as .irex-link */
.docs-prose a,
.guide-content a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.docs-prose a:hover,
.guide-content a:hover {
  color: var(--link);
  border-bottom-color: currentColor;
  text-decoration: none;
}
.docs-prose a:active,
.guide-content a:active { color: var(--link-press); }

/* ---- Lists — same as prior release-notes / changelog (native markers) -- */
.docs-prose ul,
.guide-content ul,
.docs-prose ol,
.guide-content ol,
ol.cl-list {
  margin: 0 0 var(--space-5);
  max-width: var(--docs-measure);
  color: var(--fg);
}
.docs-prose ul,
.guide-content ul {
  list-style: disc;
  padding-left: 1.35rem;
}
.docs-prose ol,
.guide-content ol,
ol.cl-list {
  list-style: decimal;
  /* Outside markers need room for 2-digit numbers (10., 11.) — 1.35rem clips the leading 1 */
  padding-left: 2.25rem;
}
.docs-prose ul > li,
.guide-content ul > li,
.docs-prose ol > li,
.guide-content ol > li,
ol.cl-list > li {
  margin-bottom: var(--space-2);
  padding-left: 0.25rem;
  color: var(--fg);
}
.docs-prose ul > li::marker,
.guide-content ul > li::marker {
  color: var(--fg-subtle);
}
.docs-prose ol > li::marker,
.guide-content ol > li::marker,
ol.cl-list > li::marker {
  color: var(--fg);
}
.docs-prose ul ul,
.guide-content ul ul,
.docs-prose ol ol,
.guide-content ol ol {
  margin: var(--space-2) 0;
}

/* ---- Brand tables ---------------------------------------------------- */
.docs-prose table,
.guide-content table {
  border-collapse: collapse;
  width: 100%;
  max-width: var(--docs-measure);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  margin: var(--space-2) 0 var(--space-5);
}
.docs-prose th,
.docs-prose td,
.guide-content th,
.guide-content td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.7rem;
}
.docs-prose th,
.guide-content th {
  background: var(--irex-charcoal);
  color: var(--irex-white);
  font-family: var(--font-head);
  font-weight: var(--w-semibold);
  letter-spacing: 0.02em;
  border: none;
}
/* Legacy exports often wrap header cells as th > p > b/strong — prose color
   rules would paint those charcoal-on-charcoal. Keep header text white. */
.docs-prose th *,
.guide-content th * {
  color: inherit;
  font-family: inherit;
}
.docs-prose th a,
.guide-content th a {
  color: var(--irex-white);
  border-bottom-color: rgba(255, 255, 255, 0.45);
}
.docs-prose th a:hover,
.guide-content th a:hover {
  color: var(--irex-white);
  border-bottom-color: currentColor;
}
.docs-prose td,
.guide-content td {
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  background: transparent;
}
/* Nested prose in cells keeps body color; don't inherit a parent max-width trap */
.docs-prose th p,
.docs-prose td p,
.guide-content th p,
.guide-content td p {
  margin: 0;
  max-width: none;
  color: inherit;
}
.docs-prose tbody tr:nth-child(even) td,
.docs-prose tr:nth-child(even) td,
.guide-content tbody tr:nth-child(even) td,
.guide-content tr:nth-child(even) td {
  background: var(--neutral-50);
}
.docs-prose thead tr:first-child > th,
.docs-prose tr:first-child > th,
.guide-content thead tr:first-child > th,
.guide-content tr:first-child > th {
  background: var(--irex-charcoal);
  color: var(--irex-white);
}

/* ---- Callouts / legacy .important → brand callout ----------------- */
.docs-prose .important,
.docs-prose .callout,
.docs-prose p.important,
.docs-prose div.important,
.guide-content .important,
.guide-content .callout,
.guide-content p.important,
.guide-content div.important {
  background: var(--neutral-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin: var(--space-2) 0 var(--space-5);
  max-width: var(--docs-measure);
  color: var(--fg);
}
.docs-prose .important > :first-child,
.docs-prose .callout > :first-child,
.guide-content .important > :first-child,
.guide-content .callout > :first-child { margin-top: 0; }
.docs-prose .important > :last-child,
.docs-prose .callout > :last-child,
.guide-content .important > :last-child,
.guide-content .callout > :last-child { margin-bottom: 0; }
.docs-prose .important p,
.docs-prose .callout p,
.guide-content .important p,
.guide-content .callout p {
  color: var(--fg);
  max-width: none;
}

/* Neutralize common leftover inline layout from CMS exports */
.docs-prose [style*="margin-left"],
.docs-prose [style*="text-align: justify"],
.docs-prose [style*="text-align:justify"],
.guide-content [style*="margin-left"],
.guide-content [style*="text-align: justify"],
.guide-content [style*="text-align:justify"] {
  margin-left: 0 !important;
  text-align: left !important;
}

/* ---- Shared image lightbox (guide + release notes) -------------------- */
html.docs-lightbox-open,
html.guide-lightbox-open { overflow: hidden; }

.docs-lightbox,
.guide-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: rgba(38, 39, 40, 0.72);
  cursor: zoom-out;
}
.docs-lightbox[hidden],
.guide-lightbox[hidden] { display: none !important; }

.docs-lightbox-figure,
.guide-lightbox-figure {
  margin: 0;
  max-width: min(96vw, 1400px);
  max-height: 92vh;
  cursor: default;
}
.docs-lightbox-img,
.guide-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 92vh;
  width: auto;
  height: auto;
  margin: 0;
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  background: var(--irex-white);
}

.docs-lightbox-close,
.guide-lightbox-close {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 1001;
  width: 1.75rem;
  height: 1.75rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--irex-white);
  color: var(--irex-charcoal);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.docs-lightbox-close:hover,
.guide-lightbox-close:hover { color: var(--irex-red); }

/* ---- Docs site top nav + language --------------------------------------- */
/* ---- Docs site top nav — text links (sentence case labels) -------------- */
/* Labels: sentence case only — "User guide", "What's new", "Getting started".
   Proper nouns stay capped (IREX). No Title Case / CamelCase.
   Items must match the published docs portal — one flat strip, no dropdown of
   extras (camera-requirements is wiki-only and is not in the portal nav). */
.docs-topnav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-5);
  margin-left: auto;
  min-width: 0;
}
.docs-topnav-primary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-5);
  min-width: 0;
}
.docs-browse {
  display: none;
  position: relative;
}
.docs-topnav a {
  font-family: var(--font-head);
  font-weight: var(--w-semibold);
  font-size: 0.8125rem;
  color: var(--fg-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  letter-spacing: 0.01em;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.docs-topnav a:hover {
  color: var(--link);
  border-bottom-color: currentColor;
  text-decoration: none;
}
.docs-topnav a[aria-current="page"] {
  color: var(--fg);
  border-bottom-color: var(--accent);
}
.docs-topnav a:active { color: var(--link-press); }

.docs-lang,
.docs-browse {
  position: relative;
}
.docs-lang summary,
.docs-browse summary {
  list-style: none;
  cursor: pointer;
  font-family: var(--font-head);
  font-weight: var(--w-semibold);
  font-size: 0.8125rem;
  color: var(--fg-muted);
  padding: 0.15rem 0;
  user-select: none;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
}
.docs-lang summary::-webkit-details-marker,
.docs-browse summary::-webkit-details-marker { display: none; }
.docs-lang summary::after,
.docs-browse summary::after {
  content: "";
  display: inline-block;
  width: 0.35rem;
  height: 0.35rem;
  margin-left: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.12rem) rotate(45deg);
  vertical-align: middle;
}
.docs-lang[open] summary,
.docs-browse[open] summary { color: var(--fg); }
.docs-browse summary[aria-current="true"] {
  color: var(--fg);
  border-bottom-color: var(--accent);
}
.docs-lang[open] summary::after,
.docs-browse[open] summary::after {
  transform: translateY(0.05rem) rotate(225deg);
}
.docs-lang-menu,
.docs-browse-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: auto;
  right: 0;
  min-width: 15rem;
  max-width: min(20rem, calc(100vw - 1.5rem));
  margin: 0;
  padding: 0.4rem 0;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(38, 39, 40, 0.08));
  z-index: 100;
}
.docs-lang-menu {
  min-width: 9rem;
}
.docs-browse-menu {
  right: auto;
  left: 0;
}
.docs-lang-menu a,
.docs-browse-menu a {
  display: block;
  padding: 0.55rem 1rem;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg);
  border: 0;
  letter-spacing: 0;
}
.docs-lang-menu a:hover,
.docs-browse-menu a:hover {
  background: var(--teal-wash, rgba(39, 90, 109, 0.08));
  color: var(--link);
  border: 0;
}
.docs-lang-menu a[aria-current="true"],
.docs-browse-menu a[aria-current="page"] {
  color: var(--link);
  border: 0;
}

.docs-lang {
  margin-left: var(--space-3);
  flex-shrink: 0;
}
.docs-lang summary {
  min-width: 2.25rem;
  text-align: center;
}

/* Compact header — tablet & phone: the primary strip folds into one Docs menu */
@media (max-width: 960px) {
  .docs-topnav-primary { display: none; }
  .docs-browse { display: block; flex-shrink: 0; }
  .docs-topnav {
    flex-wrap: nowrap;
    gap: var(--space-3);
    margin-left: auto;
    align-items: center;
  }
  .docs-lang { margin-left: var(--space-2); }
}


/* Do not put overflow-x on the article: any overflow ≠ visible on
   .guide-content / .docs-prose clips list-style:outside markers, so
   double-digit numbers (10., 11.) lose their leading digit.
   Tables already use max-width: var(--docs-measure) above. */
.docs-prose,
.guide-content {
  max-width: 100%;
}

