/* The documentation, on top of ../styles.css: a contents rail on the left, the guide on the right, in the same
   gunmetal-and-amber printed look. Motion here is small and quiet: the contents marker slides to the section you're
   reading, and a section you jump to gets a brief amber rule. Nothing follows the pointer. */

.docs-page { max-width: var(--page); margin: 0 auto; padding: 0 16px; }

.docs-hero { padding: 56px 0 8px; display: grid; grid-template-columns: 1fr auto; gap: 24px 40px; align-items: end; }
.docs-hero h1 { font-size: clamp(36px, 5vw, 56px); margin: 18px 0 14px; }
.docs-hero .lead { max-width: 640px; }
.docs-hero-cta { display: grid; gap: 8px; justify-items: start; }
.docs-hero-cta .fine { margin: 0; }

/* "Your download has started": shown when someone arrives from a download button, or presses one here */
.dl-note {
  display: flex; gap: 16px; align-items: flex-start; margin: 28px 0 0; padding: 16px 20px;
  background: var(--accent-soft); border-left: 3px solid var(--accent);
}
.dl-note[hidden] { display: none; }
.dl-note svg { width: 22px; height: 22px; flex: none; margin-top: 2px; color: var(--accent); }
.dl-note p { margin: 0; color: var(--muted); }
.dl-note strong { color: var(--text); display: block; font-family: var(--display); font-size: 17px; margin-bottom: 2px; }
.dl-note a { color: var(--text); }
.dl-note .dl-close {
  margin-left: auto; flex: none; background: transparent; border: 0; color: var(--dim); cursor: pointer;
  font: 700 18px var(--mono); line-height: 1; padding: 2px 4px;
}
.dl-note .dl-close:hover { color: var(--text); }

/* Layout: contents rail and the guide */
.docs-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 48px; margin-top: 40px; align-items: start; }

.toc { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; padding: 0 4px 24px 0; scrollbar-width: thin; }
.toc-search { position: sticky; top: 0; z-index: 2; display: block; margin-bottom: 10px; padding-bottom: 8px; background: var(--bg); }
.toc-search input::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; cursor: pointer;
  background: linear-gradient(45deg, transparent 45%, var(--muted) 45% 55%, transparent 55%),
              linear-gradient(-45deg, transparent 45%, var(--muted) 45% 55%, transparent 55%);
}
.toc-search input {
  width: 100%; padding: 11px 12px 11px 36px; border: 1px solid var(--line-strong); background: var(--inset);
  color: var(--text); font: 500 14px var(--body); -webkit-appearance: none; appearance: none; border-radius: 0;
}
.toc-search input::placeholder { color: var(--dim); }
.toc-search input:focus { outline: none; border-color: var(--accent); }
.toc-search svg { position: absolute; left: 11px; top: calc(50% - 4px); width: 16px; height: 16px; transform: translateY(-50%); color: var(--dim); pointer-events: none; z-index: 1; }
.toc-count { display: block; margin: 0 0 12px; min-height: 16px; }
.toc-count:empty { display: none; }

.toc-group { margin: 0 0 18px; }
.toc-group[hidden] { display: none; }
.toc-group h2 {
  margin: 0 0 6px; font: 700 11px var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim);
}
.toc-group h2 b { color: var(--accent); margin-right: 8px; letter-spacing: 0.04em; }
.toc ul { list-style: none; margin: 0; padding: 0; position: relative; border-left: 1px solid var(--line); }
.toc li[hidden] { display: none; }
.toc a {
  display: block; padding: 5px 0 5px 14px; text-decoration: none; color: var(--muted); font-size: 14px; line-height: 1.4;
  transition: color 0.18s ease;
}
.toc a:hover { color: var(--text); }
.toc a[aria-current="true"] { color: var(--text); }
/* The marker that slides to the section being read (docs.js moves it) */
.toc-marker {
  position: absolute; left: -1px; top: 0; width: 2px; height: 0; background: var(--accent);
  transform: translateY(var(--y, 0)); opacity: 0;
  transition: transform 0.32s cubic-bezier(0.25, 0.8, 0.25, 1), height 0.32s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.2s ease;
}
.toc-marker.on { opacity: 1; }

.toc-toggle { display: none; }

/* The guide */
/* styles.css pads every <main>; the guide sits inside .docs-page, which already has the gutter */
.guide { min-width: 0; max-width: none; margin: 0; padding: 0; }
.guide > section { padding: 8px 0 40px; scroll-margin-top: 84px; }
.guide > section[hidden] { display: none; }
.guide .mark { margin-bottom: 14px; }
.guide h2 { font-size: clamp(26px, 3.2vw, 34px); position: relative; }
.guide h3 { font-size: 19px; margin: 30px 0 8px; scroll-margin-top: 84px; }
.guide h4 { font: 700 12px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); margin: 22px 0 6px; }
.guide p, .guide li, .guide dd { color: var(--muted); }
.guide p { margin: 0 0 14px; max-width: 72ch; }
.guide strong { color: var(--text); font-weight: 600; }
.guide a { color: var(--text); text-decoration-color: rgba(255, 194, 26, 0.5); text-underline-offset: 3px; }
.guide a:hover { text-decoration-color: var(--accent); }
.guide ul.plain { margin: 0 0 16px; padding-left: 18px; display: grid; gap: 6px; max-width: 72ch; }
.guide ul.plain li::marker { color: var(--accent); }
.guide .lead { margin-bottom: 18px; }

/* A section jumped to gets a short amber rule that fades, so you can see where you landed */
.guide > section h2::before {
  content: ""; position: absolute; left: -18px; top: 6px; bottom: 6px; width: 3px; background: var(--accent);
  opacity: 0; transform: scaleY(0.4); transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.guide > section.landed h2::before { opacity: 1; transform: none; }

/* A copy-link mark beside each section heading */
.anchor {
  margin-left: 10px; font: 700 14px var(--mono); color: var(--dim); text-decoration: none !important;
  opacity: 0; transition: opacity 0.18s ease, color 0.18s ease; vertical-align: middle;
}
.guide h2:hover .anchor, .guide h3:hover .anchor, .anchor:focus-visible { opacity: 1; }
.anchor:hover { color: var(--accent); }
.anchor.copied { color: var(--ok); opacity: 1; }

/* Numbered steps reuse .steps from styles.css; here they sit in the text column */
.guide .steps { margin: 6px 0 22px; max-width: 72ch; }

/* Notes in the margin of the manual: a tip, or a heads-up */
.callout {
  margin: 4px 0 20px; padding: 14px 18px; max-width: 72ch;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-strong);
}
.callout p { margin: 0; }
.callout p + p { margin-top: 8px; }
.callout b.tag { display: block; margin-bottom: 4px; font: 700 11px var(--mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); }
.callout.tip { border-left-color: var(--accent); }
.callout.tip b.tag { color: var(--accent); }
.callout.warn { border-left-color: var(--record); }
.callout.warn b.tag { color: var(--record); }

/* Where to find something in the app: Settings > Plan */
.path { font: 600 0.92em var(--body); color: var(--text); white-space: nowrap; }
.path i { font-style: normal; color: var(--accent); margin: 0 4px; font-family: var(--mono); }

/* Tables of keys and settings */
.guide .table-wrap { margin: 6px 0 22px; }
.guide table { min-width: 520px; }
.guide th, .guide td { padding: 11px 16px; font-size: 14px; vertical-align: top; }
.guide td { color: var(--muted); }
.guide td:first-child { color: var(--text); white-space: nowrap; }
.guide td.wrap { white-space: normal; }
.guide tbody tr:hover td { background: var(--surface-2); }

/* Screenshots */
.guide .figure { margin: 8px 0 24px; max-width: 820px; }

/* Troubleshooting and questions reuse details from styles.css */
.guide details { max-width: 76ch; scroll-margin-top: 84px; }
.guide details p, .guide details ul { margin-left: 28px; }
.guide details ul { padding-left: 18px; color: var(--muted); display: grid; gap: 4px; margin-top: 10px; }
.guide details[open] summary { color: var(--text); }
.guide summary { transition: color 0.18s ease; }
.guide summary:hover { color: var(--accent-hover); }

/* Nothing matched the search */
.no-match { padding: 24px 0; color: var(--muted); }
.no-match[hidden] { display: none; }

/* Previous and next at the end */
.docs-end {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; margin: 8px 0 0; padding-top: 22px;
  border-top: 1px solid var(--line);
}
.docs-end p { margin: 0; }

/* The nav's current page */
.nav nav a[aria-current="page"] { color: var(--accent); }

/* Small screens: the contents fold into a button above the guide */
@media (max-width: 900px) {
  .docs-hero { grid-template-columns: 1fr; padding-top: 36px; }
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 24px; }
  .toc { position: static; max-height: none; overflow: visible; padding: 0; }
  .toc-toggle {
    display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 13px 16px; cursor: pointer;
    background: var(--surface); border: 1px solid var(--line-strong); color: var(--text);
    font: 700 12px var(--mono); letter-spacing: 0.16em; text-transform: uppercase;
  }
  .toc-toggle::after { content: "+"; color: var(--accent); font-size: 16px; }
  .toc.open .toc-toggle::after { content: "−"; }
  .toc-body { display: none; padding: 16px 2px 8px; }
  .toc.open .toc-body { display: block; }
  .toc-search { position: static; margin-top: 0; }
  .guide > section h2::before { left: -12px; }
  .anchor { opacity: 1; }
  .guide td:first-child { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .toc-marker, .guide > section h2::before, .anchor, .toc a { transition: none; }
}

/* Five footer links fit a phone when they can wrap */
.footer nav { flex-wrap: wrap; gap: 10px 22px; }

/* The side panel is a tall, slim screenshot */
.guide .figure.narrow { max-width: 240px; }
