/* robintrabuc.com — direction artistique reprise de Vigie (« édition imprimée ») :
   ivoire chaud, noir chaud, accent terre cuite, filets discrets, grain argentique léger.
   Newsreader pour le texte, Hanken Grotesk pour les métadonnées et l'interface. */

/* Polices hébergées sur le serveur (pas d'appel à Google). Sous-ensemble latin. */
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/assets/fonts/newsreader-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/newsreader-italic-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/assets/fonts/hanken-grotesk-latin.woff2') format('woff2');
}

/* ---------- Thème clair (par défaut) ---------- */
:root {
  color-scheme: light dark;
  --paper: #faf9f5;
  --card: #f3f1ea;
  --ink: #141413;
  --ink-2: #3d3c38;
  --muted: #6b6a65;
  --line: rgba(20, 20, 19, 0.12);
  --accent: #a84e2c;
  --link: #8f4224;
  --ring: #c9643c;
  --veil: rgba(20, 20, 19, 0.05);
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.08 0 0 0 0 0.08 0 0 0 0 0.07 0.3 0 0 0 -0.12'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");

  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'Hanken Grotesk', ui-sans-serif, system-ui, -apple-system, sans-serif;
  accent-color: var(--accent);
}

/* ---------- Thème sombre : suit le système, sauf choix explicite (data-theme sur <html>) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #17110f;
    --card: #221b18;
    --ink: #f0eee6;
    --ink-2: #d3cfc4;
    --muted: #a8a49a;
    --line: rgba(240, 238, 230, 0.12);
    --accent: #e39a58;
    --link: #eaa77a;
    --ring: #e39a58;
    --veil: rgba(240, 238, 230, 0.06);
    --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.94 0 0 0 0 0.93 0 0 0 0 0.9 0.22 0 0 0 -0.09'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: #17110f;
  --card: #221b18;
  --ink: #f0eee6;
  --ink-2: #d3cfc4;
  --muted: #a8a49a;
  --line: rgba(240, 238, 230, 0.12);
  --accent: #e39a58;
  --link: #eaa77a;
  --ring: #e39a58;
  --veil: rgba(240, 238, 230, 0.06);
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.94 0 0 0 0 0.93 0 0 0 0 0.9 0.22 0 0 0 -0.09'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  color-scheme: dark;
}
:root[data-theme='light'] { color-scheme: light; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper) var(--grain);
  background-size: 200px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 0.9375rem; /* 15 px */
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
  border-radius: 2px;
}
a { color: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }

.skip {
  position: absolute; left: 1rem; top: -3rem;
  font: 500 0.875rem var(--sans);
  background: var(--ink); color: var(--paper);
  padding: 0.5rem 0.75rem; border-radius: 8px; text-decoration: none;
}
.skip:focus { top: 1rem; }

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 2.75rem) clamp(1.25rem, 5vw, 2rem) 3rem;
}

/* ---------- En-tête sur une ligne (comme la barre de Vigie) : nom à gauche, onglets + icône à droite ---------- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.name {
  margin: 0;
  font-size: clamp(1.25rem, 4vw, 1.4375rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.1;
}
.name a { text-decoration: none; }
.bar-right { display: flex; align-items: center; gap: 1.25rem; }

.tabs { display: flex; gap: 1.25rem; margin: 0; padding: 0; list-style: none; }
.tabs a {
  font-size: 0.9375rem;
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 0.15rem;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current='page'] { color: var(--ink); border-bottom-color: var(--ink); }

@media (max-width: 34rem) {
  .bar { flex-wrap: wrap; }
  .bar-right { width: 100%; justify-content: space-between; }
}


/* Bouton de thème : icône seule ; un clic bascule clair ↔ sombre.
   Soleil quand la page est claire, croissant de lune quand elle est sombre. */
.icon-button {
  appearance: none;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.icon-button:hover { background: var(--veil); color: var(--ink); }
.icon-button svg { width: 1rem; height: 1rem; }
.icon-button .i-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .icon-button .i-light { display: none; }
  :root:not([data-theme='light']) .icon-button .i-dark { display: block; }
}
:root[data-theme='dark'] .icon-button .i-light { display: none; }
:root[data-theme='dark'] .icon-button .i-dark { display: block; }

/* ---------- Contenu ---------- */
main { padding-top: 2.5rem; }

.intro {
  margin: 0 0 3rem;
  max-width: 34rem;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
}
.intro a { color: var(--link); text-underline-offset: 0.18em; }

/* Légende en capitales espacées */
.meta {
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Rubrique : capitales espacées prolongées d'un filet (édition imprimée) */
.rubric {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin: 0;
}
.rubric::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.rubric + * { margin-top: 0.5rem; }

/* ---------- Sommaire numéroté (apps, contact) ---------- */
.toc { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc-row {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr) auto 2.75rem 1rem;
  gap: 1rem;
  align-items: baseline;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.toc-row::before {
  counter-increment: toc;
  content: counter(toc, decimal-leading-zero);
  font: 500 0.7rem var(--sans);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  transition: color 0.2s ease;
}
.toc-name { font-size: 1.0625rem; color: var(--ink); transition: color 0.2s ease; }
.toc-domain, .toc-year { font: 500 0.65rem var(--sans); letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); }
.toc-year { font-variant-numeric: tabular-nums; text-align: right; }
.toc-arrow {
  font-family: var(--sans);
  color: var(--accent);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
a.toc-row:hover::before, a.toc-row:hover .toc-name,
a.toc-row:focus-visible::before, a.toc-row:focus-visible .toc-name { color: var(--accent); }
a.toc-row:hover .toc-arrow, a.toc-row:focus-visible .toc-arrow { opacity: 1; transform: none; }
@media (max-width: 34rem) {
  .toc-row { grid-template-columns: 1.75rem minmax(0, 1fr) auto; gap: 0.75rem; }
  .toc-domain, .toc-arrow { display: none; }
}

.more {
  display: inline-block;
  margin-top: 1.25rem;
  font: 500 0.8125rem var(--sans);
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}
.more:hover { color: var(--accent); }

.footer {
  margin-top: 4.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}


@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
