/* The guides, platform pages and glossary (src/content/guides.ts, figures.ts).
   Every color is a token from site.css, so light and dark both follow the
   theme; ratios for the tokens are noted there. Reading size is 17px with a
   70 character measure: long articles are read, not scanned. */

/* ---------------- article layout ---------------- */

.guide-page {
  padding-block: 40px 80px;
}

.guide-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 232px;
  gap: 64px;
  align-items: start;
  max-width: 1040px;
}

.guide-layout-single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 760px;
}

.guide-article {
  min-width: 0;
  max-width: 720px;
}

.guide-article .section-eyebrow {
  margin-top: 18px;
}

.guide-article .section-eyebrow a {
  color: inherit;
}

.guide-title {
  margin-top: 10px;
  font-family: var(--serif);
  font-size: 44px;
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.guide-lead {
  margin-top: 16px;
  font-size: 18.5px;
  line-height: 1.55;
  color: var(--text-dim);
}

.guide-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 18px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--text-faint);
}

.guide-byline a {
  color: var(--text-dim);
}

/* ---------------- the words ---------------- */

.guide-body {
  max-width: 70ch;
  margin-top: 30px;
  font-size: 17px;
  line-height: 1.7;
}

.guide-body > * + * {
  margin-top: 1.05em;
}

.guide-body h2 {
  margin-top: 2.2em;
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: -0.015em;
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.guide-body h3 {
  margin-top: 1.7em;
  font-size: 18.5px;
  line-height: 1.35;
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.guide-body h2 + *,
.guide-body h3 + * {
  margin-top: 0.6em;
}

.guide-body a:not([class]) {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.guide-body a:not([class]):hover {
  text-decoration-color: currentColor;
}

.guide-body ul,
.guide-body ol {
  padding-left: 1.3em;
}

.guide-body li + li {
  margin-top: 0.45em;
}

.guide-body strong {
  font-weight: 650;
}

.guide-body code {
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

.guide-body .table-wrap {
  margin-block: 1.6em;
}

.guide-body .doc-table {
  font-size: 14.5px;
  line-height: 1.5;
}

.guide-body .doc-note {
  margin-block: 1.6em;
}

.guide-body .doc-note p {
  font-size: 15.5px;
  line-height: 1.6;
}

/* ---------------- figures ---------------- */

.fig {
  margin: 2em 0;
  padding: 22px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.fig figcaption {
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-dim);
}

.fig-tag {
  margin-bottom: 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.fig-flow {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.fig-step {
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 12px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.fig-step-label {
  font-weight: 650;
  font-size: 14.5px;
  line-height: 1.3;
}

.fig-step-sub {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-dim);
}

.fig-found {
  background: var(--brand-band);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.fig-found .fig-step-label {
  color: var(--accent);
}

.fig-lost .fig-step-label {
  color: var(--lost);
}

.fig-arrow {
  align-self: center;
  flex: 0 0 auto;
  font-size: 16px;
  color: var(--text-faint);
}

.fig-lane + .fig-lane {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line-strong);
}

.fig-lane-name {
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* A tagged link, split into its labeled parts. */
.fig-anatomy {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 4px;
}

.fig-part {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.fig-part code {
  padding: 4px 6px;
  font-size: 13px;
  background: var(--accent-soft);
  border: 0;
  border-radius: 6px;
  overflow-wrap: anywhere;
}

.fig-part-plain code {
  background: var(--bg-raised);
  border: 1px solid var(--line);
}

.fig-part-label {
  font-size: 12px;
  color: var(--text-dim);
}

/* Credit by model: one row per model, one bar per touch. */
.fig-credit-grid {
  display: grid;
  gap: 8px;
}

.fig-credit-row {
  display: grid;
  grid-template-columns: 150px repeat(var(--cols), minmax(0, 1fr));
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.fig-credit-head {
  align-items: end;
  font-size: 12px;
  line-height: 1.3;
  color: var(--text-dim);
}

.fig-credit-model {
  font-weight: 600;
  line-height: 1.3;
}

.fig-credit-cell {
  display: grid;
  gap: 3px;
}

.fig-bar {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent) var(--w), var(--line) var(--w));
}

.fig-credit-val {
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

/* ---------------- table of contents ---------------- */

.guide-side {
  position: sticky;
  top: calc(var(--header-h) + 28px);
  display: grid;
  gap: 28px;
  max-height: calc(100dvh - var(--header-h) - 56px);
  overflow-y: auto;
  padding-top: 64px;
}

.guide-side-title {
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.guide-toc ol,
.guide-toc-mobile ol {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  line-height: 1.4;
}

.guide-toc a {
  display: block;
  padding: 5px 0 5px 12px;
  color: var(--text-dim);
  border-left: 2px solid var(--line);
}

.guide-toc a:hover {
  color: var(--text);
  border-left-color: var(--accent);
  text-decoration: none;
}

.guide-toc-mobile {
  display: none;
  margin-top: 18px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.guide-toc-mobile summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
}

.guide-toc-mobile ol {
  padding: 0 16px 12px;
}

.guide-toc-mobile a {
  display: flex;
  align-items: center;
  min-height: 40px;
  color: var(--text-dim);
}

/* ---------------- after the words ---------------- */

.guide-cta {
  margin-top: 48px;
  padding: 20px 22px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.guide-cta-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.guide-cta-line {
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.55;
}

.guide-cta-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin-top: 10px;
  font-size: 14.5px;
  font-weight: 600;
}

.guide-cta-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
}

.guide-related {
  margin-top: 48px;
}

.guide-related-title {
  margin-bottom: 14px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.guide-help {
  margin-top: 32px;
  font-size: 13.5px;
  color: var(--text-faint);
}

/* ---------------- cards and hubs ---------------- */

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.guide-grid-featured {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 36px;
}

@media (max-width: 900px) {
  .guide-grid-featured {
    grid-template-columns: minmax(0, 1fr);
  }
}

.guide-card {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 18px 20px;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.guide-card:hover {
  border-color: var(--line-strong);
  text-decoration: none;
  transform: translateY(-1px);
}

.guide-card-title {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.guide-card-line {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-dim);
}

.guide-card-meta {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.guides-hero .crumbs {
  margin-bottom: 18px;
}

.guides-topic-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.guides-topic-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.guides-topic-title a {
  color: var(--text);
}

.guides-topic-line {
  font-size: 14.5px;
  color: var(--text-dim);
}

.guides-more {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.guides-more-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.guides-more-card:hover {
  border-color: var(--line-strong);
  text-decoration: none;
}

.guides-more-title {
  display: block;
  font-weight: 650;
}

.guides-more-line {
  display: block;
  font-size: 14px;
  color: var(--text-dim);
}

.guides-standards {
  max-width: 760px;
}

.guides-standards-list {
  display: grid;
  gap: 12px;
  margin-top: 22px;
  padding-left: 1.2em;
  font-size: 15.5px;
  line-height: 1.6;
}

.guides-hub-foot {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px;
}

.guides-hub-foot .guides-topic-title {
  margin-bottom: 14px;
  font-size: 22px;
}

/* Term chips: plain words, never logos. */
.guide-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-terms a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  font-size: 13.5px;
  color: var(--text-dim);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.guide-terms a:hover {
  color: var(--text);
  border-color: var(--line-strong);
  text-decoration: none;
}

/* ---------------- glossary ---------------- */

.glossary-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 28px;
}

.glossary-jump a {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  min-height: 40px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-dim);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.glossary-jump a:hover {
  color: var(--accent);
  border-color: var(--line-strong);
  text-decoration: none;
}

.glossary-letter {
  margin-top: 40px;
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.glossary-letter-title {
  padding-bottom: 8px;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  border-bottom: 1px solid var(--line);
}

.glossary-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 40px;
  margin: 0;
}

.glossary-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.glossary-item dt a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  font-weight: 650;
  font-size: 16px;
}

.glossary-item dd {
  margin: 4px 0 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-dim);
}

.glossary-also {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-faint);
}

.glossary-short {
  margin-top: 20px;
  padding: 18px 20px;
  font-size: 18px;
  line-height: 1.55;
  background: var(--brand-band);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}

.glossary-related {
  margin-top: 40px;
}

/* ---------------- smaller screens ---------------- */

@media (max-width: 1000px) {
  .guide-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .guide-side {
    display: none;
  }
  .guide-toc-mobile {
    display: block;
  }
}

@media (max-width: 720px) {
  .guide-page {
    padding-block: 24px 64px;
  }
  .guide-title {
    font-size: 32px;
  }
  .guide-lead {
    font-size: 16.5px;
  }
  .guide-body {
    font-size: 16.5px;
  }
  .guide-body h2 {
    font-size: 24px;
  }
  .fig {
    padding: 16px;
  }
  .fig-flow {
    flex-direction: column;
  }
  .fig-arrow {
    transform: rotate(90deg);
    line-height: 1;
  }
  .fig-credit-row {
    grid-template-columns: 92px repeat(var(--cols), minmax(0, 1fr));
    gap: 6px;
    font-size: 12px;
  }
  .fig-credit-head {
    font-size: 10.5px;
  }
  .guides-more,
  .guides-hub-foot,
  .glossary-list {
    grid-template-columns: minmax(0, 1fr);
  }
  .glossary-short {
    font-size: 16.5px;
  }
}

/* Navigation inside a guide reads as a list, not as body links: no underlines. */
main .guide-toc li a,
main .guide-toc-mobile li a,
main .guide-terms li a,
main .guide-card,
main .guides-more-card,
main .glossary-jump a,
main .guides-topic-title a {
  text-decoration: none;
}

/* On a phone the byline wraps; a dot would start a line, so the gap alone separates. */
@media (max-width: 720px) {
  .guide-byline [aria-hidden='true'] {
    display: none;
  }
  .guide-byline {
    column-gap: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .guide-card {
    transition: none;
  }
  .guide-card:hover {
    transform: none;
  }
}
