/* MedICS Documentation layout — layered on top of style.css */

.docs-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) 200px;
  gap: 2.5rem;
  align-items: start;
  padding-top: 2.25rem;
  padding-bottom: 3.5rem;
}
/* The three-column shell needs more room than the default content container. */
.docs-shell.container { width: min(1440px, 100% - 3rem); }

/* ---------- side columns ---------- */
/* Both side columns stick below the nav. They are deliberately flat — no card
   or border — so the three columns read as one page, as they do in the VS Code
   docs. The accent left-rule on an item is what marks the current entry. */
.docs-side,
.docs-toc {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.docs-side { font-size: 0.86rem; }
.docs-toc { font-size: 0.8rem; }

.docs-side__title,
.docs-toc__title {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 0.5rem;
}
/* Group label inside the global nav (Basics, Features, …). */
.docs-side__group {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-3);
  font-weight: 600;
  margin: 1.05rem 0 0.3rem;
}
.docs-side nav ul,
.docs-toc nav ul { list-style: none; padding: 0; margin: 0; }

/* A left rule per item reads as a continuous guide down the column and turns
   into the accent colour for the hovered / current entry. */
.docs-side nav a,
.docs-toc nav a {
  display: block;
  color: var(--muted);
  padding: 0.3rem 0.6rem;
  line-height: 1.4;
  border-left: 2px solid var(--border);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.docs-side nav a { font-size: 0.84rem; }
.docs-toc nav a.lvl-3 { padding-left: 1.15rem; }
.docs-toc nav a.lvl-4 { padding-left: 1.9rem; }
.docs-side nav a:hover,
.docs-toc nav a:hover {
  color: var(--text);
  border-left-color: var(--border-2);
  background: var(--hover-tint);
}
.docs-side nav a.is-current,
.docs-toc nav a.is-active {
  color: var(--text);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* ---------- main column ---------- */
.docs-main { min-width: 0; }
.docs-hero { padding: 0.25rem 0 1.4rem; border-bottom: 1px solid var(--border); margin-bottom: 1.6rem; }
.docs-hero .tag {
  color: var(--accent-3);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.docs-hero h1 { font-size: clamp(1.7rem, 3.4vw, 2.35rem); letter-spacing: -0.03em; margin: 0.45rem 0 0.6rem; }
.docs-hero p { color: var(--muted); max-width: 52rem; margin: 0; }

.docs-content { color: var(--muted); }
.docs-content h2 {
  font-size: 1.5rem;
  color: var(--text);
  letter-spacing: -0.02em;
  margin: 2.6rem 0 0.7rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
}
.docs-content h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.docs-content h3 { font-size: 1.16rem; color: var(--text); margin: 1.7rem 0 0.5rem; }
.docs-content h4 { font-size: 1rem; color: var(--text); margin: 1.25rem 0 0.4rem; }
.docs-content p { margin: 0.65rem 0 1rem; }
.docs-content strong { color: var(--text); }
.docs-content a { text-decoration: underline; text-underline-offset: 2px; }
.docs-content ul, .docs-content ol { padding-left: 1.35rem; margin: 0.6rem 0 1.1rem; }
.docs-content ul { list-style: disc; }
.docs-content ol { list-style: decimal; }
.docs-content li { margin: 0.3rem 0; }
.docs-content li > ul, .docs-content li > ol { margin: 0.3rem 0; }
.docs-content blockquote {
  border-left: 3px solid var(--accent);
  background: var(--surface);
  padding: 0.7rem 1rem;
  border-radius: 0 8px 8px 0;
  margin: 1rem 0;
  color: var(--muted);
}
.docs-content blockquote p { margin: 0.3rem 0; }
.docs-content blockquote strong { color: var(--accent-3); }
.docs-content hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* code + tables inside docs */
.docs-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 0.8rem 0 1.3rem;
}
.docs-content pre code {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: none;
  border: none;
  padding: 0;
  color: var(--code-text);
  line-height: 1.55;
}
.docs-content :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.08rem 0.35rem;
  color: var(--text);
  white-space: nowrap;
}
.docs-content table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 0.8rem 0 1.4rem; }
.docs-content th, .docs-content td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.docs-content th { color: var(--muted); font-weight: 600; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; }
.docs-content td { color: var(--muted); }
.docs-content td:first-child { color: var(--text); }
.docs-content img { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }
/* Toolbox screenshots are written straight into a paragraph instead of a
   figure, so centre them in the column rather than leaving them on the left. */
.docs-content p > img { display: block; margin-inline: auto; }

/* ---------- screenshots ---------- */
/* `margin: 0 auto` centres the width-constrained variants below; the unbounded
   ones fill the column, where the auto margins resolve to zero. */
.doc-screens { display: grid; gap: 1rem; margin: 0 auto 2rem; }
.doc-screens--grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
/* Two panel screenshots side by side, kept close to their native size. */
.doc-screens--pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  max-width: 520px;
}
/* A single narrow panel screenshot (a dock), kept close to its native size. */
.doc-screens--narrow { max-width: 250px; }
/* A single dialog screenshot: smaller than full width, still readable. */
.doc-screens--medium { max-width: 460px; }
/* A larger, detail-dense dialog: wider than --medium, still not full width. */
.doc-screens--wide { max-width: 720px; }
/* Two related panel screenshots that should still sit on a single row. */
.doc-screens--duo {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  max-width: 760px;
}
.doc-figure {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.doc-figure a { display: block; }
.doc-figure img { display: block; width: 100%; height: auto; border: none; border-radius: 0; }
.doc-figure figcaption {
  padding: 0.6rem 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.doc-figure figcaption strong { color: var(--text); }

/* ---------- numbered steps (Quick start) ---------- */
/* The number is an absolutely-positioned marker rather than a grid column: the
   card holds three children (::before, h4, p), which a two-column grid would
   wrap onto a second row with a mis-sized first track. Scoping every rule to
   .docs-content also outranks the generic `.docs-content h4`/`p` spacing. */
.docs-content .steps {
  counter-reset: step;
  display: grid;
  gap: 0.7rem;
  margin: 1rem 0 1.5rem;
}
.docs-content .step {
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem 0.85rem 3.2rem;
}
.docs-content .step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 1.1rem;
  top: 0.9rem;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--accent-3);
}
.docs-content .step h4 { margin: 0 0 0.25rem; font-size: 1rem; }
.docs-content .step p { margin: 0; font-size: 0.92rem; }

/* ---------- pager ---------- */
.docs-pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}
.docs-pager a { display: flex; flex-direction: column; gap: 0.15rem; max-width: 48%; }
.docs-pager a span { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; }
.docs-pager .next { text-align: right; margin-left: auto; }

/* ---------- page feedback (bottom of every docs page) ---------- */
/* Three columns, like the VS Code docs: a helpful vote, support links and an
   "Edit this page" link. Rendered by js/site.js on every page that has a
   .docs-main column, so the markup is defined once and cannot drift. */
.docs-feedback {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
  margin-top: 3rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
}
.docs-feedback__title {
  margin: 0 0 0.85rem;
  font-size: 0.98rem;
  color: var(--text);
}
.docs-feedback__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.docs-feedback__btn { min-width: 88px; justify-content: center; }
.docs-feedback__after { margin-top: 0.2rem; }
.docs-feedback__thanks { margin: 0; font-size: 0.86rem; color: var(--muted); }
.docs-feedback__comment { display: grid; gap: 0.5rem; margin-top: 0.65rem; }
.docs-feedback__comment-label { font-size: 0.82rem; color: var(--muted); }
.docs-feedback__note {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  font: inherit;
  font-size: 0.86rem;
  color: var(--text);
  background: var(--code-bg);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}
.docs-feedback__note:focus { outline: none; border-color: var(--accent); }
.docs-feedback__comment-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.docs-feedback__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}
.docs-feedback__links a {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  text-decoration: none;
}
.docs-feedback__links a:hover { color: var(--accent-3); }
.docs-feedback__links svg { width: 17px; height: 17px; flex: none; }
.docs-feedback__edit { display: inline-flex; }
@media (max-width: 980px) {
  .docs-feedback { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* ---------- tight panel strip (hub) ---------- */
.tight-lead { margin: 0 0 0.7rem; }

.panel-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 0.6rem;
  margin: 0 0 1.6rem;
}
.panel-tile {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  transition: border-color 0.18s, transform 0.18s;
}
.panel-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.panel-tile a { display: block; }
.panel-tile img {
  display: block;
  width: 100%;
  height: 118px;
  object-fit: contain;
  object-position: center;
  padding: 4px;
  background: var(--code-bg);
}
.panel-tile figcaption {
  padding: 0.4rem 0.6rem;
  font-size: 0.76rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  /* The thumbnail is centred inside the tile (object-position: center), so the
     label is centred too rather than hugging the left edge. */
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.panel-tile figcaption strong { color: var(--text); }

@media (max-width: 560px) {
  .panel-tile img { height: 104px; }
  /* A phone column is too narrow for two shots side by side. */
  .doc-screens--pair { grid-template-columns: minmax(0, 1fr); max-width: 320px; }
}

/* ---------- hub cards ---------- */
.doc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 0;
}
.doc-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  transition: border-color 0.18s, transform 0.18s;
}
.doc-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.doc-card h3 { margin: 0; font-size: 1rem; color: var(--text); }
.doc-card p { margin: 0; font-size: 0.87rem; color: var(--muted); }
.doc-card .doc-card__tag {
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent-3);
  font-weight: 600;
}

/* ---------- misc ---------- */
.docs-content .anchor-note { font-size: 0.85rem; color: var(--muted); }
/* Emphasis box for important notes (dimensions, behaviour caveats). */
.docs-content .callout {
  margin: 1rem 0 1.5rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-3);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.92rem;
}
.docs-content .callout strong { color: var(--text); }
.diagram {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--code-text-dim);
  margin: 1rem 0 1.5rem;
}

/* Drop the in-page TOC once three columns would crowd the article. */
@media (max-width: 1240px) {
  .docs-shell { grid-template-columns: 232px minmax(0, 1fr); }
  .docs-toc { display: none; }
}
/* Single column: the global nav moves above the article and stops sticking. */
@media (max-width: 980px) {
  .docs-shell { grid-template-columns: 1fr; gap: 1.5rem; }
  .docs-side { position: static; max-height: none; }
}
