/*
 * Photo Doc user manual — standalone stylesheet.
 *
 * The manual is a self-contained static page so it can be shown both in the
 * app's manual window and on the website without changes. It therefore does
 * not share the app's stylesheet; colours are defined as tokens here, with a
 * dark variant that follows the operating system setting.
 */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #1d2330;
  --text-muted: #5b6475;
  --border: #e1e5eb;
  --accent: #5b54e8;
  --accent-soft: #ecebff;
  --tip-bg: #eaf6ef;
  --tip-border: #9fd3b2;
  --warn-bg: #fff6e5;
  --warn-border: #f0c776;
  --kbd-bg: #ffffff;
  --kbd-border: #c9ced8;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 16px rgba(16, 24, 40, 0.06);
  --sidebar-width: 270px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161b;
    --surface: #1c1f26;
    --surface-2: #242832;
    --text: #e7e9ee;
    --text-muted: #a2a9b7;
    --border: #2f3440;
    --accent: #9b96ff;
    --accent-soft: #2a2950;
    --tip-bg: #16291f;
    --tip-border: #2f6b48;
    --warn-bg: #2d2513;
    --warn-border: #7a5d1f;
    --kbd-bg: #262a33;
    --kbd-border: #454b58;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 16px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15.5px;
  line-height: 1.6;
}

a { color: var(--accent); }

/* ---------- Layout: sticky table of contents + scrolling content ---------- */

.manual-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.manual-toc {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 16px 32px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.manual-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 18px;
}
.manual-brand img { width: 34px; height: 34px; border-radius: 8px; }
.manual-brand strong { display: block; font-size: 16px; line-height: 1.2; }
.manual-brand span { font-size: 12.5px; color: var(--text-muted); }

.manual-search {
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.manual-toc ol { list-style: none; margin: 0; padding: 0; }
.manual-toc > nav > ol > li { margin-bottom: 6px; }
.manual-toc a {
  display: block;
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.manual-toc a:hover { background: var(--surface-2); }
.manual-toc a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.manual-toc ol ol a { padding-left: 24px; font-size: 13px; color: var(--text-muted); }
.manual-toc ol ol a.active { color: var(--accent); }
.manual-toc li.search-hidden { display: none; }

.manual-content {
  padding: 40px 48px 120px;
  max-width: 960px;
}

/* ---------- Typography ---------- */

h1 { font-size: 30px; line-height: 1.2; margin: 0 0 8px; }
h2 {
  font-size: 24px;
  margin: 64px 0 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
h2 .chapter-number { color: var(--accent); margin-right: 8px; }
h3 { font-size: 18px; margin: 34px 0 8px; }
h4 { font-size: 15.5px; margin: 22px 0 6px; }
.lead { font-size: 17px; color: var(--text-muted); margin-top: 0; }
p, ul, ol { margin: 0 0 12px; }
li { margin-bottom: 4px; }
code {
  font-family: Consolas, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  overflow-wrap: anywhere;
}
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  font-family: inherit;
  font-size: 0.85em;
  text-align: center;
  background: var(--kbd-bg);
  border: 1px solid var(--kbd-border);
  border-bottom-width: 2px;
  border-radius: 5px;
}

/* ---------- Building blocks ---------- */

.figure {
  margin: 18px 0 24px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.figure img,
.figure video { display: block; width: 100%; height: auto; border-radius: 6px; }
.figure figcaption { margin-top: 10px; font-size: 13.5px; color: var(--text-muted); }
.figure-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.figure-row .figure { margin: 0; }

.callout {
  margin: 16px 0;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.callout strong:first-child { display: block; margin-bottom: 2px; }
.callout.tip { background: var(--tip-bg); border-color: var(--tip-border); }
.callout.warn { background: var(--warn-bg); border-color: var(--warn-border); }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }

.steps { counter-reset: step; list-style: none; padding-left: 0; }
.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 40px;
  margin-bottom: 10px;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.table-wrap { overflow-x: auto; margin: 12px 0 20px; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; }
td:first-child { white-space: nowrap; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 14px 0 20px; }
.card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.card h4 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  vertical-align: -2px;
  margin-right: 6px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.source-list li { overflow-wrap: anywhere; }

.manual-footer { margin-top: 80px; font-size: 13px; color: var(--text-muted); }

.no-results { display: none; margin-top: 8px; font-size: 13px; color: var(--text-muted); padding: 0 10px; }
.no-results.visible { display: block; }

/* ---------- Narrow windows / phones ---------- */

@media (max-width: 860px) {
  .manual-layout { grid-template-columns: 1fr; }
  .manual-toc {
    position: static;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .manual-content { padding: 24px 16px 80px; }
  h2 { margin-top: 48px; }
}

@media print {
  .manual-toc { display: none; }
  .manual-layout { display: block; }
  .figure { box-shadow: none; break-inside: avoid; }
}
