/* 4d manual — shared stylesheet.
   Linked by 4d-manual.html and every scripts-*.html category page,
   so the whole manual set shares one look. */
  :root {
    --bg: #f7f7f8;
    --fg: #1d1d20;
    --muted: #5a5a62;
    --accent: #2858c4;
    --border: #d8d8de;
    --panel: #ffffff;
    --code-bg: #eef0f4;
    --hover: #ebeef5;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; }
  body {
    font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI",
          "Helvetica Neue", Arial, sans-serif;
    color: var(--fg);
    background: var(--bg);
  }
  header {
    background: #2858c4;
    color: #fff;
    padding: 18px 24px;
    border-bottom: 1px solid #1c428f;
    display: flex;
    align-items: center;
    gap: 16px;
  }
  header img.logo { height: 46px; width: auto; }
  header .titles { flex: 1; }
  header h1 { margin: 0; font-size: 22px; font-weight: 600; }
  header .subtitle { margin-top: 4px; font-size: 13px; color: #cdd8f5; }
  header .subtitle a { color: #cfe0ff; text-decoration: none; }
  header .subtitle a:hover { text-decoration: underline; }
  header .version {
    font: 12px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: rgba(255,255,255,0.15);
    padding: 4px 10px; border-radius: 20px; white-space: nowrap;
  }

  main {
    max-width: 920px;
    margin: 0 auto;
    padding: 24px;
  }

  nav.toc {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 18px;
    margin-bottom: 24px;
  }
  nav.toc h2 {
    margin: 0 0 8px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
  }
  nav.toc ul { list-style: none; padding: 0; margin: 0;
               display: grid; grid-template-columns: repeat(2, 1fr);
               gap: 4px 16px; }
  nav.toc a { color: var(--accent); text-decoration: none; }
  nav.toc a:hover { text-decoration: underline; }

  details {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin: 0 0 12px 0;
    padding: 0 18px;
    transition: background 0.1s;
  }
  details[open] { background: var(--panel); }
  details summary {
    padding: 12px 0;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    user-select: none;
  }
  details summary::-webkit-details-marker { display: none; }
  details summary::before {
    content: "▶";
    display: inline-block;
    margin-right: 10px;
    font-size: 11px;
    color: var(--muted);
    transform: translateY(-2px);
    transition: transform 0.15s;
  }
  details[open] summary::before { transform: rotate(90deg) translateX(-2px); }
  details > *:not(summary) { padding-bottom: 14px; }
  details summary:hover { color: var(--accent); }

  /* Nested details (e.g. individual exercises) sit inside an outer
     details block; render them with a subtle alternate background and
     a thinner left border so the hierarchy is visible. */
  details details {
    background: var(--bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    margin: 8px 0;
    padding: 0 14px;
  }
  details details summary { padding: 10px 0; font-weight: 500; }

  h2.section { margin-top: 32px; font-size: 14px; text-transform: uppercase;
               letter-spacing: 0.06em; color: var(--muted);
               border-bottom: 1px solid var(--border); padding-bottom: 6px; }
  h3 { margin-top: 0; }
  h4 { margin: 1.1em 0 0.3em 0; font-size: 15px; }
  p { margin: 0.6em 0; }
  ul, ol { padding-left: 22px; }
  li { margin: 3px 0; }
  code, kbd {
    background: var(--code-bg);
    padding: 1px 6px;
    border-radius: 3px;
    font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  }
  kbd { border: 1px solid var(--border); }
  pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 14px;
    overflow-x: auto;
    font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  }
  pre code { background: none; padding: 0; }
  table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
    font-size: 14px;
  }
  th, td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
    vertical-align: top;
  }
  th { background: var(--code-bg); font-weight: 600; }
  td code { white-space: nowrap; }

  .subpages {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 8px;
  }
  .subpages a {
    display: block;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--fg);
    transition: background 0.1s, border-color 0.1s;
  }
  .subpages a:hover { background: var(--hover); border-color: var(--accent); }
  .subpages a strong { color: var(--accent); display: block; margin-bottom: 4px; }
  .subpages a span { font-size: 13px; color: var(--muted); }
  .subpages-label {
    margin: 20px 0 0 0;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
  }

  .note {
    background: #fff8e6;
    border-left: 3px solid #d4a000;
    padding: 8px 12px;
    margin: 10px 0 0 0;
    font-size: 14px;
  }
  .tip {
    background: #eaf3ff;
    border-left: 3px solid var(--accent);
    padding: 8px 12px;
    margin: 10px 0 0 0;
    font-size: 14px;
  }

  /* Numbered workflow steps */
  ol.steps { counter-reset: step; list-style: none; padding-left: 0; }
  ol.steps > li {
    position: relative; padding: 2px 0 10px 40px; margin: 0;
  }
  ol.steps > li::before {
    counter-increment: step; content: counter(step);
    position: absolute; left: 0; top: 0;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--accent); color: #fff;
    font-size: 13px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
  }
  ol.steps > li strong { display: block; }

  .badge {
    display: inline-block; font-size: 11px; font-weight: 600;
    padding: 1px 8px; border-radius: 20px; vertical-align: middle;
    margin-left: 6px;
  }
  .badge.core { background: #dff3e4; color: #1c6b34; }
  .badge.exp  { background: #fde8e8; color: #a12626; }
  .badge.alt  { background: #eee7fb; color: #5a37a8; }

  footer {
    color: var(--muted);
    font-size: 13px;
    margin-top: 40px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
  }

  @media (max-width: 600px) {
    nav.toc ul, .subpages { grid-template-columns: 1fr; }
    header { flex-wrap: wrap; }
  }

/* Labelled screenshots: a screenshot with numbered circle overlays.
   Used by ptychoscopy.html and the ScanInspect section of scripts-preparation.html. */
.shot { position: relative; margin: 12px 0; border: 1px solid var(--border);
        border-radius: 6px; overflow: hidden; background: var(--panel); }
.shot img { display: block; width: 100%; height: auto; }
.shot .num { position: absolute; transform: translate(-50%, -50%);
             width: 26px; height: 26px; border-radius: 50%;
             background: var(--accent); color: #fff;
             font: 700 13px/26px sans-serif; text-align: center;
             box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0,0,0,.45); }
.shot .missing { padding: 24px; text-align: center; color: var(--muted); font-size: 14px; }
table.legend td:first-child { white-space: nowrap; font-weight: 600; text-align: center; width: 2.2em; }
