/* ============================================================================
   MobileSigner platform documentation
   Tokens deliberately mirror the eFile workstation so the two read as one product.
   ============================================================================ */

:root {
  color-scheme: light;

  --ink: #18221d;
  --ink-2: #38443d;
  --muted: #6b7671;
  --line: #e2e6e4;
  --line-strong: #cdd4d1;
  --surface: #ffffff;
  --wash: #f7f8f8;

  --green: #0d6b4f;
  --green-dark: #084c39;
  --green-soft: #e4f4ec;

  --red: #8b2020;
  --red-soft: #fdeaea;
  --amber: #7a5200;
  --amber-soft: #fdf3dd;
  --slate: #4a5568;
  --slate-soft: #eef0f2;
  --blue: #1d4e89;
  --blue-soft: #e8f0f9;

  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
  --radius: 8px;
  --sidebar-w: 264px;
  --toc-w: 208px;
  --topbar-h: 56px;

  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --sans: 'DM Sans', system-ui, sans-serif;
  --display: Manrope, 'DM Sans', sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--wash); scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

a { color: var(--green-dark); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--green); }

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 3px;
}

.srOnly {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skipLink {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  padding: 10px 16px; background: var(--green-dark); color: #fff;
  font-weight: 600; border-radius: 0 0 var(--radius) 0;
}
.skipLink:focus { left: 0; color: #fff; }

/* ============================================================================
   Shell
   ============================================================================ */

.docsShell { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px 24px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.productMark {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 14px;
  text-decoration: none; color: inherit;
}
/* The logo carries its own badge and colour, so no background here — one asset
   renders identically in the docs sidebar, the workstation sidebar and favicons. */
.productMarkIcon {
  width: 28px; height: 28px; flex: none;
  border-radius: 7px;
  display: block;
}
.productMarkText { display: flex; flex-direction: column; line-height: 1.25; }
.productMarkText strong { font-family: var(--display); font-size: 14px; letter-spacing: -.01em; }
.productMarkText small { color: var(--muted); font-size: 11.5px; }

.searchWrap { position: relative; padding: 0 4px 14px; }
.searchWrap input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--wash);
  font-size: 13px;
}
.searchWrap input::placeholder { color: var(--muted); }
.searchWrap input:focus { background: var(--surface); }

.searchResults {
  position: absolute; left: 4px; right: 4px; top: calc(100% - 8px);
  z-index: 40;
  max-height: 340px; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .1);
}
.searchHit {
  display: block; padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
.searchHit:last-child { border-bottom: 0; }
.searchHit:hover, .searchHit.isActive { background: var(--green-soft); }
.searchHitTitle { display: block; font-weight: 600; font-size: 13px; }
.searchHitMeta { display: block; color: var(--muted); font-size: 11.5px; }
.searchEmpty { padding: 12px; color: var(--muted); font-size: 12.5px; }

.sidebarNav { display: flex; flex-direction: column; gap: 18px; }
.navGroup { display: flex; flex-direction: column; gap: 1px; }
.navGroupLabel {
  padding: 0 8px 6px;
  color: var(--muted);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
}
.navItem {
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--ink-2);
  font-size: 13.5px;
  text-decoration: none;
}
.navItem:hover { background: var(--wash); color: var(--ink); }
.navItemActive {
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--green-dark);
}

.docsMain { flex: 1; min-width: 0; margin-left: var(--sidebar-w); }

.topBar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  /* Full-bleed background, but inline padding that tracks the centred
     .docsBody column so the bar contents line up with the article. */
  padding-block: 0;
  padding-inline: max(24px, calc((100% - 1180px) / 2 + 40px));
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.navToggle {
  display: none;
  padding: 5px 10px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface);
  font-size: 12.5px;
}
.topBarTitle { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topBarOrg { font-weight: 600; white-space: nowrap; }
.topBarSep { color: var(--line-strong); }
.topBarContext { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topBarBadge {
  margin-left: auto;
  padding: 3px 9px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--wash);
  color: var(--muted);
  font-size: 11px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  white-space: nowrap;
}

.docsBody {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--toc-w);
  gap: 40px;
  padding: 36px 40px 96px;
  max-width: 1180px;
  /* Centre the column in the space left of the sidebar, so ultra-wide
     viewports do not leave the whole page hugging the left edge. */
  margin-inline: auto;
}

/* ============================================================================
   Page furniture
   ============================================================================ */

.doc { min-width: 0; }

.docKicker {
  margin: 0 0 6px;
  color: var(--green-dark);
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
}
.docTitle {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 30px; font-weight: 700; line-height: 1.15;
  letter-spacing: -.02em;
}
.docLede {
  margin: 0 0 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 15.5px; line-height: 1.55;
}

.tocRail {
  position: sticky; top: calc(var(--topbar-h) + 36px);
  align-self: start;
  max-height: calc(100vh - var(--topbar-h) - 72px);
  overflow-y: auto;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}
.tocLabel {
  display: block; padding-bottom: 8px;
  color: var(--muted);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
}
.toc { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.tocItem a {
  color: var(--muted);
  font-size: 12.5px; line-height: 1.4;
  text-decoration: none;
}
.tocItem a:hover { color: var(--ink); }
.tocLevel3 { padding-left: 12px; }
.tocItem.isCurrent a { color: var(--green-dark); font-weight: 600; }

.pageNav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 48px; padding-top: 24px;
  border-top: 1px solid var(--line);
}
.pageNavLink {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none; color: inherit;
}
.pageNavLink:hover { border-color: var(--green); }
.pageNavNext { text-align: right; }
.pageNavHint { color: var(--muted); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.pageNavTitle { font-weight: 600; color: var(--green-dark); }

/* ============================================================================
   Prose
   ============================================================================ */

.prose { font-size: 14.5px; line-height: 1.68; color: var(--ink-2); }
.prose > :first-child { margin-top: 0; }

.prose h2 {
  margin: 40px 0 12px;
  padding-top: 8px;
  font-family: var(--display);
  font-size: 20px; font-weight: 700; letter-spacing: -.015em;
  color: var(--ink);
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.prose h3 {
  margin: 28px 0 8px;
  font-size: 15.5px; font-weight: 700;
  color: var(--ink);
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.prose h4 {
  margin: 20px 0 6px;
  font-size: 14px; font-weight: 700;
  color: var(--ink);
}

.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin-bottom: 5px; }
.prose li > ul, .prose li > ol { margin: 5px 0 0; }

.prose strong { color: var(--ink); font-weight: 600; }

.prose hr { margin: 32px 0; border: 0; border-top: 1px solid var(--line); }

.prose blockquote {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-left: 3px solid var(--amber);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--amber-soft);
  color: #5c3f00;
}
.prose blockquote > :last-child { margin-bottom: 0; }

.prose code {
  padding: 1.5px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: .875em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  word-break: break-word;
}

.prose pre {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #10201a;
  overflow-x: auto;
  box-shadow: var(--shadow);
}
.prose pre code {
  padding: 0; border: 0; background: none;
  color: #d6e5de;
  font-size: 12.5px; line-height: 1.65;
}

.prose table {
  width: 100%;
  margin: 0 0 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  font-size: 13px;
  overflow: hidden;
}
.prose thead th {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--wash);
  color: var(--muted);
  font-size: 11px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.prose tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover { background: var(--wash); }
.prose td code { white-space: nowrap; }

.tableScroll { overflow-x: auto; margin: 0 0 20px; }
.tableScroll table { margin: 0; }

/* Badge-ish inline tokens produced by the Markdown, e.g. `**GET**` in an API table */
.prose .method {
  display: inline-block;
  min-width: 52px;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px; font-weight: 700;
  letter-spacing: .03em;
  text-align: center;
}
.prose .method-get { background: var(--blue-soft); color: var(--blue); }
.prose .method-post { background: var(--green-soft); color: var(--green-dark); }

/* ==============================================================================
   Interactive diagrams
   ============================================================================== */

.diagram {
  margin: 22px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.diagramTabs {
  display: flex; flex-wrap: wrap; gap: 2px;
  padding: 6px 8px 0;
  border-bottom: 1px solid var(--line);
  background: var(--wash);
}
.diagramTab {
  padding: 7px 12px;
  border: 1px solid transparent; border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: none;
  color: var(--muted);
  font-size: 12.5px; font-weight: 600;
}
.diagramTab:hover { color: var(--ink); background: rgba(0, 0, 0, .03); }
.diagramTab.isActive {
  background: var(--surface);
  border-color: var(--line);
  color: var(--green-dark);
  margin-bottom: -1px;
  padding-bottom: 8px;
}

.diagramViewport {
  position: relative;
  overflow: hidden;
  padding: 18px 14px;
  min-height: 180px;
  /* Cap the height so a tall topology cannot push the surrounding prose off
     the screen. The script fits the diagram to whatever height this yields. */
  max-height: 70vh;
  /* Centre the canvas so transform-origin: center matches the visual centre;
     without this a canvas taller than the viewport scales about the wrong point. */
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 0) 0 0 / 18px 18px;
  cursor: grab;
  touch-action: pan-y;
}
.diagram.isDragging .diagramViewport { cursor: grabbing; }
.diagramViewport:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }

.diagramCanvas {
  /* Fill the viewport width. As a flex item it would otherwise shrink to the
     SVG's intrinsic width, which collapses a width="100%" Mermaid diagram. */
  width: 100%;
  flex: 0 0 auto;
  transform-origin: center center;
  transition: transform .1s ease-out;
  will-change: transform;
}
.diagram.isDragging .diagramCanvas { transition: none; }

.diagramPane { display: flex; justify-content: center; }
.diagramPane[hidden] { display: none; }
.diagramPane svg { max-width: 100%; height: auto; }

.diagramToolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 10px 7px 14px;
  border-top: 1px solid var(--line);
  background: var(--wash);
}
.diagramHint { color: var(--muted); font-size: 11.5px; }
.diagramTools { display: flex; gap: 4px; }
.diagramTool {
  min-width: 28px; height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px; font-weight: 600;
  line-height: 1;
}
.diagramTool:hover { border-color: var(--green); color: var(--green-dark); }
.diagramTool[aria-pressed="true"] {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-dark);
}

/* Full view lifts the diagram over the page rather than opening a dialog,
   so the reader keeps their scroll position on exit. */
.diagram.isFull {
  position: fixed; inset: 16px; z-index: 60;
  margin: 0;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .22);
}
.diagram.isFull .diagramViewport { flex: 1; max-height: none; }

/* Hover focus: dim everything not adjacent to the hovered node. */
.diagramPane svg g.node,
.diagramPane svg g.edgePaths > path,
.diagramPane svg .edgeLabel { transition: opacity .12s ease-out; }
.diagramPane svg .isDim { opacity: .28; }
.diagramPane svg g.clickable { cursor: pointer; }
.diagramPane svg g.node a { text-decoration: none; }

/* A block that failed to render stays readable as source. */
.prose pre.diagramFailed { border-left: 3px solid var(--amber); }

@media (prefers-reduced-motion: reduce) {
  .diagramCanvas,
  .diagramPane svg g.node,
  .diagramPane svg g.edgePaths > path,
  .diagramPane svg .edgeLabel { transition: none; }
}

/* ============================================================================
   Responsive
   ============================================================================ */

@media (max-width: 1100px) {
  .docsBody { grid-template-columns: minmax(0, 1fr); }
  .tocRail { display: none; }
}

@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .18s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, .18);
  }
  .sidebar.isOpen { transform: translateX(0); }
  .docsMain { margin-left: 0; }
  .navToggle { display: inline-block; }
  .docsBody { padding: 24px 20px 72px; }
  .topBar { padding-inline: 20px; }
  .docTitle { font-size: 25px; }
  .pageNav { grid-template-columns: 1fr; }
  .topBarContext, .topBarBadge { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sidebar { transition: none; }
}

@media print {
  .sidebar, .topBar, .tocRail, .pageNav, .skipLink { display: none; }
  .docsMain { margin-left: 0; }
  .docsBody { display: block; padding: 0; max-width: none; }
  .prose pre { background: var(--wash); }
  .prose pre code { color: var(--ink); }
}
