/* The Quiet Manager — calm, paper-like reading theme with dark mode. */
:root {
  color-scheme: light;
  --bg: #f6f3ee;
  --surface: #fffdf9;
  --surface-2: #efebe3;
  --ink: #1f2328;
  --ink-2: #4a4f57;
  --muted: #6b7079;
  --line: #ddd6ca;
  --accent: #1f6f6b;
  --accent-ink: #ffffff;
  --accent-soft: #dcecea;
  --tip: #2f6b3a;
  --tip-soft: #e3f0e2;
  --warn: #8a4b0f;
  --warn-soft: #f7e9d7;
  --research: #4b3f8f;
  --research-soft: #e8e5f6;
  --focus: #1f6f6b;
  --radius: 12px;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Charter, 'Bitstream Charter', Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #16181d;
  --surface: #1d2026;
  --surface-2: #252931;
  --ink: #e8e5df;
  --ink-2: #c3c0ba;
  --muted: #9a9890;
  --line: #343841;
  --accent: #6cc5bd;
  --accent-ink: #10201f;
  --accent-soft: #1f3534;
  --tip: #8fd19a;
  --tip-soft: #1e2f22;
  --warn: #f0b878;
  --warn-soft: #34281b;
  --research: #b9adf5;
  --research-soft: #29253f;
  --focus: #6cc5bd;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #16181d;
    --surface: #1d2026;
    --surface-2: #252931;
    --ink: #e8e5df;
    --ink-2: #c3c0ba;
    --muted: #9a9890;
    --line: #343841;
    --accent: #6cc5bd;
    --accent-ink: #10201f;
    --accent-soft: #1f3534;
    --tip: #8fd19a;
    --tip-soft: #1e2f22;
    --warn: #f0b878;
    --warn-soft: #34281b;
    --research: #b9adf5;
    --research-soft: #29253f;
    --focus: #6cc5bd;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1.0625rem/1.7 var(--sans);
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 12px; }

/* ---- header ---- */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 1.15rem; margin-right: auto; }
.brand svg { color: var(--accent); }
.site-nav ul { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }
.site-nav a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 0.93rem; }
.site-nav a:hover { background: var(--surface-2); color: var(--ink); }
.site-nav a[aria-current='page'] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.theme-btn, .menu-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 10px; min-height: 40px; min-width: 40px; display: grid; place-items: center; cursor: pointer; font: inherit; font-size: 0.93rem;
}
.theme-btn:hover, .menu-btn:hover { color: var(--ink); border-color: var(--muted); }
.menu-btn { display: none; padding: 0 12px; }

@media (max-width: 960px) {
  .menu-btn { display: grid; }
  .site-nav { display: none; position: absolute; top: 60px; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; }
  .site-nav a { padding: 10px 12px; font-size: 1rem; }
}

/* ---- page head ---- */
.page-head { padding: 56px 0 28px; max-width: 46rem; }
.kicker { margin: 0 0 8px; font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.25; color: var(--ink); text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem); margin: 0 0 16px; letter-spacing: -0.01em; }
.lead { font-size: clamp(1.1rem, 1rem + 0.4vw, 1.3rem); color: var(--ink-2); margin: 0; text-wrap: pretty; }
.page-index .page-head { padding-top: 72px; max-width: 52rem; }

/* ---- layout + toc ---- */
.layout { display: block; padding-bottom: 64px; }
.layout.has-toc { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 56px; align-items: start; }
.toc { position: sticky; top: 84px; font-size: 0.9rem; border-left: 2px solid var(--line); padding-left: 16px; max-height: calc(100vh - 110px); overflow: auto; }
.toc-title { margin: 0 0 8px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0 0 6px; }
.toc a { color: var(--ink-2); text-decoration: none; display: block; line-height: 1.4; padding: 2px 0; }
.toc a:hover, .toc a.active { color: var(--accent); }
.toc a.active { font-weight: 600; }
@media (max-width: 960px) {
  .layout.has-toc { display: block; }
  .toc { position: static; max-height: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 32px; background: var(--surface); }
}

/* ---- prose ---- */
.prose { max-width: 46rem; min-width: 0; }
.prose section { margin-bottom: 48px; }
.prose h2 { font-size: clamp(1.45rem, 1.2rem + 0.9vw, 1.8rem); margin: 0 0 14px; padding-top: 8px; }
.prose h3 { font-size: 1.2rem; margin: 28px 0 10px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 6px; }
.prose li::marker { color: var(--accent); }
.prose strong { color: var(--ink); }

/* boxes */
.box { border-radius: var(--radius); padding: 16px 20px; margin: 20px 0; border-left: 4px solid; }
.box > :last-child { margin-bottom: 0; }
.box-title { font-weight: 700; margin: 0 0 6px !important; font-size: 0.95rem; }
.box-note { background: var(--accent-soft); border-color: var(--accent); }
.box-note .box-title { color: var(--accent); }
.box-tip { background: var(--tip-soft); border-color: var(--tip); }
.box-tip .box-title { color: var(--tip); }
.box-warn { background: var(--warn-soft); border-color: var(--warn); }
.box-warn .box-title { color: var(--warn); }
.box-research { background: var(--research-soft); border-color: var(--research); }
.box-research .box-title { color: var(--research); }

/* say: phrase cards */
.say { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 20px; margin: 20px 0; }
.say-label { margin: 0 0 8px !important; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--muted); }
.say ul { list-style: none; padding: 0 !important; margin: 0 !important; }
.say li { font-family: var(--serif); font-size: 1.08rem; padding: 8px 0; border-top: 1px dashed var(--line); margin: 0; }
.say li:first-child { border-top: 0; }

/* tables */
.table-wrap { overflow-x: auto; margin: 20px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; line-height: 1.5; }
caption { caption-side: bottom; text-align: left; padding: 10px 14px; color: var(--muted); font-size: 0.85rem; }
th, td { text-align: left; vertical-align: top; padding: 11px 14px; border-bottom: 1px solid var(--line); }
thead th { background: var(--surface-2); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); }
tbody tr:last-child > * { border-bottom: 0; }
tbody th { font-weight: 600; }

/* templates */
.template { margin: 20px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.template figcaption { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 10px 8px 16px; background: var(--surface-2); font-weight: 600; font-size: 0.92rem; }
.template pre { margin: 0; padding: 16px; overflow-x: auto; font: 0.86rem/1.6 var(--mono); white-space: pre; tab-size: 2; }
.copy, .btn-quiet { font: inherit; font-size: 0.85rem; padding: 6px 12px; min-height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.copy:hover, .btn-quiet:hover { color: var(--accent); border-color: var(--accent); }

/* checklist */
.checklist { list-style: none; padding: 0 !important; }
.checklist li { margin: 0; }
.checklist label { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.checklist label:hover { background: var(--surface-2); }
.checklist input { width: 20px; height: 20px; margin-top: 4px; flex: none; accent-color: var(--accent); }
.checklist input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.check-actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; color: var(--ink-2); font-weight: 600; }

/* key takeaways */
.key { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px 28px 12px; }
.key h2 { padding-top: 0; }
.takeaways { counter-reset: k; list-style: none; padding: 0 !important; }
.takeaways li { counter-increment: k; position: relative; padding-left: 44px; margin-bottom: 14px; }
.takeaways li::before { content: counter(k); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 0.88rem; }

/* pager */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 40px; }
.pager a { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; text-decoration: none; color: var(--ink); background: var(--surface); font-weight: 600; font-family: var(--serif); font-size: 1.05rem; }
.pager a:hover { border-color: var(--accent); }
.pager a span { display: block; font: 600 0.75rem/1.4 var(--sans); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 2px; }
.pager .next { text-align: right; grid-column: 2; }
@media (max-width: 520px) { .pager { grid-template-columns: 1fr; } .pager .next { grid-column: 1; } }

/* home */
.page-index .prose { max-width: none; }
.page-index .prose section { max-width: none; }
.cards { list-style: none; padding: 0 !important; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.cards li { margin: 0; }
.card { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 20px 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-decoration: none; color: var(--ink); transition: border-color 0.15s, transform 0.15s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-n { font: 700 0.8rem var(--mono); color: var(--accent); }
.card-t { font: 700 1.25rem/1.3 var(--serif); }
.card-d { color: var(--ink-2); font-size: 0.97rem; line-height: 1.55; }
.ideas { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.ideas > div { background: var(--accent-soft); border-radius: 16px; padding: 20px 22px; }
.ideas h3 { margin: 0 0 8px; font-size: 1.15rem; }
.ideas p { margin: 0; color: var(--ink-2); }
.page-index #who { max-width: 46rem; }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: 0.9rem; }
.site-footer p { margin: 0 0 6px; max-width: 60rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

@media print {
  .site-header, .toc, .pager, .copy, .theme-btn, .check-actions, .skip { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .layout.has-toc { display: block; }
  a { color: inherit; }
  .box, .say, .template, .key, .table-wrap { break-inside: avoid; }
}
