/* Long-form document pages (User Guide, Access Register): a contents rail beside one reading
   column; tables scroll inside their own boxes. Everything is scoped under .doc so the site's
   own header, main and footer rules aren't affected. */
.doc {
  --doc-line: var(--border);
  --doc-accent: var(--mem-blue-text);
  --doc-accent-soft: var(--mem-blue-soft);
  --doc-ok: var(--success-text);
  --doc-ok-soft: var(--success-bg);
  --doc-warn: var(--warning-text);
  --doc-warn-soft: var(--warning-bg);
  --doc-risk: var(--danger-text);
  --doc-risk-soft: var(--danger-bg);
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 40px;
  font-size: 15px;
  line-height: 1.6;
}

.doc nav.toc { position: sticky; top: 20px; align-self: start; font-size: 13.5px; }
.doc nav.toc p { text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; font-size: 12px; font-weight: 700; }
.doc nav.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.doc nav.toc a { color: var(--text); text-decoration: none; display: block; padding: 3px 0 3px 10px; border-left: 2px solid var(--doc-line); }
.doc nav.toc a:hover, .doc nav.toc a:focus-visible { border-left-color: var(--mem-blue); color: var(--doc-accent); outline: none; }

.doc-body { min-width: 0; }
.doc-head { border-bottom: 3px solid var(--mem-navy); padding-bottom: 14px; }
.doc .eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: 12px; font-weight: 700; color: var(--doc-accent); margin: 0; }
.doc h2 { font-size: 24px; line-height: 1.2; margin: 40px 0 6px; text-wrap: balance; scroll-margin-top: 16px; }
.doc h3 { font-size: 17px; margin: 24px 0 6px; }
.doc p, .doc li { max-width: 72ch; }
.doc .lede { color: var(--muted); margin: 6px 0 0; }
.doc .meta { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.doc .meta b { color: var(--text); }
.doc code, .doc .mono { font-family: Consolas, "Courier New", monospace; font-size: .88em; }
.doc code { background: var(--doc-accent-soft); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.doc a { color: var(--doc-accent); }

.doc .table-box { overflow-x: auto; border: 1px solid var(--doc-line); border-radius: 10px; background: var(--card); margin: 12px 0; }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--doc-line); }
.doc th { background: var(--bg); white-space: nowrap; font-size: 13.5px; }
.doc tr:last-child td { border-bottom: 0; }
.doc td.c, .doc th.c { text-align: center; }
.doc .matrix td:first-child { font-weight: 700; white-space: nowrap; }
/* The access matrix fits the column on desktop: headings and pills wrap instead of scrolling */
.doc .matrix th { white-space: normal; vertical-align: bottom; }
.doc .matrix th, .doc .matrix td { padding: 8px 8px; }
.doc .matrix .pill { white-space: normal; text-align: center; line-height: 1.35; padding: 2px 8px; }

.doc .pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; white-space: nowrap; }
.doc .yes { background: var(--doc-ok-soft); color: var(--doc-ok); }
.doc .part { background: var(--doc-warn-soft); color: var(--doc-warn); }
.doc .no { background: var(--bg); color: var(--muted); border: 1px solid var(--doc-line); }
.doc .legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted); }

.doc .findings { display: grid; gap: 10px; margin: 12px 0; padding: 0; list-style: none; }
.doc .findings li { max-width: none; background: var(--card); border: 1px solid var(--doc-line); border-left: 4px solid var(--doc-warn); border-radius: 8px; padding: 10px 14px; }
.doc .findings li.high { border-left-color: var(--doc-risk); }
.doc .findings li.low { border-left-color: var(--mem-blue); }
.doc .findings b { display: block; }
.doc .sev { text-transform: uppercase; letter-spacing: .08em; font-size: 11.5px; font-weight: 700; color: var(--muted); }

.doc dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 8px 0; font-size: 14px; }
.doc dl.facts dt { color: var(--muted); }
.doc dl.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .doc dl.facts { grid-template-columns: minmax(0, 1fr); } .doc dl.facts dd { margin-bottom: 6px; } }

.doc .app { background: var(--card); border: 1px solid var(--doc-line); border-radius: 10px; padding: 4px 18px 14px; margin: 14px 0; }
.doc .app h3 { margin-top: 14px; }
.doc section.guide { scroll-margin-top: 16px; padding-top: 36px; }
.doc section.guide h2 { margin-top: 0; }

.doc .who { display: inline-block; font-size: 12.5px; font-weight: 700; background: var(--doc-accent-soft); color: var(--doc-accent); padding: 2px 10px; border-radius: 99px; margin: 4px 0 8px; }
.doc ol.steps { counter-reset: s; list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.doc ol.steps > li { counter-increment: s; position: relative; padding-left: 38px; }
.doc ol.steps > li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 26px; height: 26px; border-radius: 50%; background: var(--mem-navy); color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.doc ul { padding-left: 20px; }
.doc ul li { margin: 3px 0; }
.doc .ui { font-weight: 700; white-space: nowrap; }
.doc .callout { border-radius: 10px; padding: 10px 14px; margin: 12px 0; font-size: 14.5px; max-width: 72ch; }
.doc .callout.tip { background: var(--doc-ok-soft); border-left: 4px solid var(--doc-ok); }
.doc .callout.warn { background: var(--doc-warn-soft); border-left: 4px solid var(--doc-warn); }
.doc .callout b { display: block; }
.doc .apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 14px 0; }
.doc .apps a { display: block; background: var(--card); border: 1px solid var(--doc-line); border-radius: 10px; padding: 12px 14px; color: var(--text); text-decoration: none; }
.doc .apps a:hover, .doc .apps a:focus-visible { border-color: var(--mem-blue); outline: none; }
.doc .apps b { display: block; font-size: 16px; }
.doc .apps span { color: var(--muted); font-size: 13.5px; }
.doc details { background: var(--card); border: 1px solid var(--doc-line); border-radius: 10px; padding: 10px 14px; margin: 8px 0; }
.doc summary { cursor: pointer; font-weight: 700; }
.doc details p { margin: 8px 0 2px; }
.doc .doc-foot { margin-top: 44px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--doc-line); padding-top: 14px; }

/* Phones: contents as one row of chips to swipe, and tables as one card per row with each
   value labelled by its column heading (labels added by shared/docs.js). */
@media (max-width: 900px) {
  .doc { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .doc nav.toc { position: static; }
  .doc nav.toc ol { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
  .doc nav.toc a { white-space: nowrap; border: 1px solid var(--doc-line); border-radius: 99px; padding: 3px 12px; background: var(--card); }
}

@media (max-width: 640px) {
  .doc { font-size: 14.5px; }
  .doc h2 { font-size: 21px; margin-top: 32px; }
  .doc .table-box { overflow-x: visible; border: 0; background: transparent; }
  .doc table.stackable thead { display: none; }
  .doc table.stackable, .doc table.stackable tbody, .doc table.stackable tr, .doc table.stackable td { display: block; width: 100%; }
  .doc table.stackable tr { background: var(--card); border: 1px solid var(--doc-line); border-radius: 10px; padding: 6px 12px; margin-bottom: 10px; }
  .doc table.stackable td { border: 0; padding: 5px 0; text-align: left; }
  .doc table.stackable td[data-label]:not([data-label=""]) { display: grid; grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); gap: 10px; align-items: start; }
  .doc table.stackable .cell-value { min-width: 0; }
  .doc table.stackable td[data-label]:not([data-label=""])::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; font-weight: 700; }
  /* The first cell names the row: show it as the card's title */
  .doc table.stackable td:first-child { display: block !important; font-weight: 700; font-size: 15px; border-bottom: 1px solid var(--doc-line); padding-bottom: 7px; margin-bottom: 3px; }
  .doc table.stackable td:first-child::before { display: none; }
  .doc table.stackable td.c { text-align: left; }
  .doc .pill { white-space: normal; }
  .doc .app { padding: 2px 14px 12px; }
  .doc .callout, .doc details { font-size: 14px; }
}
