/* Tonik — Notice utilisateur, screen layout. */

:root {
  --paper: #f6f1e7;
  --paper-card: #fbf8f1;
  --ink: #1a1612;
  --ink-muted: #5a524a;
  --ink-faint: #b5ab9c;
  --burgundy: #6b1f2e;
  --burgundy-deep: #4a131f;
  --gold: #b08740;
  --rule: rgba(107, 31, 46, 0.18);

  --font-display: 'Cormorant Garamond', 'Cormorant', 'Baskerville', 'Georgia', serif;
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --sidebar-w: 280px;
  --content-max: 720px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--burgundy); text-decoration: none; }
a:hover { color: var(--burgundy-deep); text-decoration: underline; }

/* ─── Topbar ─────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--topbar-h);
  background: var(--paper-card);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: saturate(120%);
}
.topbar-inner {
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.brand {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--burgundy);
  letter-spacing: 0.01em;
}
.brand em { font-style: italic; }
.brand-sub {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ─── Layout ─────────────────────────────────────────────────────── */
.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

/* ─── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 32px 0 32px 0;
}
.toc-nav .toc-title {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 14px 0;
}
.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: tocnum;
}
.toc-list li { margin: 0; }
.toc-list a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 12px 6px 10px;
  border-left: 2px solid transparent;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.4;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  text-decoration: none;
}
.toc-list a:hover {
  color: var(--ink);
  background: rgba(107, 31, 46, 0.04);
  text-decoration: none;
}
.toc-list a.active {
  color: var(--burgundy-deep);
  border-left-color: var(--burgundy);
  background: rgba(107, 31, 46, 0.06);
  font-weight: 500;
}
.toc-list .num {
  flex: 0 0 auto;
  width: 22px;
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-faint);
  font-size: 13px;
  text-align: right;
}
.toc-list a.active .num { color: var(--gold); }
.toc-list .label { flex: 1; }

/* ─── Content ────────────────────────────────────────────────────── */
.content {
  padding: 32px 0 96px 0;
  max-width: var(--content-max);
  min-width: 0;
}

/* Hero */
.hero {
  padding: 24px 0 36px 0;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 36px;
}
.hero-eyebrow {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-muted);
  font-size: 16px;
  margin: 0 0 8px 0;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--burgundy-deep);
  font-size: 56px;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 14px 0;
}
.hero-sub {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 21px;
  color: var(--ink-muted);
  margin: 0 0 16px 0;
}
.hero-meta {
  font-size: 13px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
}

/* Chapter sections */
section.chapter {
  padding: 56px 0 24px 0;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
section.chapter + section.chapter {
  border-top: 1px solid var(--rule);
}
section.chapter > .eyebrow {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14px;
  color: var(--gold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 6px 0;
}
section.chapter > h1 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--burgundy-deep);
  font-size: 38px;
  line-height: 1.15;
  letter-spacing: -0.005em;
  margin: 0 0 24px 0;
}
section.chapter h2 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.25;
  margin: 36px 0 12px 0;
}
section.chapter h3 {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--ink);
  font-size: 16px;
  letter-spacing: 0.02em;
  margin: 24px 0 8px 0;
}

/* Body typography */
p { margin: 0 0 14px 0; }
ul, ol { margin: 8px 0 18px 0; padding-left: 26px; }
li { margin: 4px 0; line-height: 1.55; }

strong { font-weight: 600; color: var(--ink); }
em { font-style: italic; }

code {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 13.5px;
  color: var(--burgundy-deep);
  background: rgba(107, 31, 46, 0.07);
  padding: 1px 5px;
  border-radius: 3px;
}

pre {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 13px;
  background: var(--paper-card);
  color: var(--burgundy-deep);
  border-left: 3px solid var(--burgundy);
  padding: 12px 14px;
  overflow-x: auto;
  margin: 16px 0;
}
pre code { background: none; padding: 0; }

blockquote {
  border-left: 3px solid var(--gold);
  margin: 16px 0;
  padding: 4px 14px;
  color: var(--ink-muted);
  font-style: italic;
}

/* Figures */
figure {
  margin: 24px 0;
  text-align: center;
}
figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: white;
}
figcaption {
  margin-top: 10px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-muted);
  text-align: center;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14.5px;
}
th, td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule);
}
th {
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  font-size: 12px;
  text-transform: uppercase;
}

/* Hide print-only quirks */
.cover { display: none; }
section.toc { display: none; }
.muted { color: var(--ink-muted); }

/* ─── Responsive (sub-900px: collapse sidebar) ───────────────────── */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0 20px;
  }
  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    border-bottom: 1px solid var(--rule);
    padding: 16px 0;
  }
  .toc-list a { font-size: 13.5px; padding: 4px 8px; }
  .hero h1 { font-size: 40px; }
  section.chapter > h1 { font-size: 28px; }
  section.chapter h2 { font-size: 20px; }
}
