/* =========================================================
   jpoussin.fr — vitrine
   Direction « document » : papier presque blanc, titres en serif,
   filets plutôt que cartes, un seul accent vert bouteille.
   ========================================================= */

:root {
  --ink:        #17211d;
  --ink-2:      #3f4a45;
  --ink-3:      #626c68;
  --paper:      #fbfbf8;
  --surface:    #f3f4ef;
  --rule:       #d9ddd8;
  --rule-soft:  var(--rule);
  --accent:     #1f5443;
  --accent-ink: #ffffff;
  --accent-wash:rgba(31, 84, 67, .09);
  --live:       #2e7d5b;
  --work:       #a2701c;
  --error:      #b3261e;

  --serif: "Spectral", Georgia, serif;
  --sans:  "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --maxw: 1080px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --sec-y: clamp(2.5rem, 6vw, 4rem);
  --r: 3px;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:        #e6ebe7;
    --ink-2:      #b9c2bc;
    --ink-3:      #8a948e;
    --paper:      #121815;
    --surface:    #19201c;
    --rule:       #2c3631;
    --accent:     #7fc4a8;
    --accent-ink: #0d1411;
    --accent-wash:rgba(127, 196, 168, .12);
    --live:       #5fc49b;
    --work:       #d6a34a;
    --error:      #ff8a80;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  padding-inline: var(--gutter);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 400; margin: 0; }
h2 { font-size: clamp(1.5rem, 2.6vw, 1.75rem); line-height: 1.2; letter-spacing: -.005em; }
h3 { font-size: 1.19rem; font-weight: 500; line-height: 1.3; }
h4 { font-size: 1.06rem; font-weight: 500; line-height: 1.35; }
p  { margin: 0; }
ul, ol, dl, dd { margin: 0; padding: 0; }
li { list-style: none; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--accent-wash); padding: .08em .3em; border-radius: var(--r); }
a { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 50%; top: -3rem; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: .6rem 1rem;
  border-radius: 0 0 var(--r) var(--r); z-index: 60; text-decoration: none;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.rail, main, .foot { max-width: var(--maxw); margin-inline: auto; }

/* ── Boutons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-size: .9rem; font-weight: 500;
  padding: .7rem 1.15rem; border-radius: var(--r); border: 1px solid transparent;
  background: none; color: inherit; cursor: pointer; text-decoration: none;
  transition: background-color .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
}
.btn-sm { padding: .35rem .75rem; font-size: .82rem; }
.btn-solid { background: var(--accent); color: var(--accent-ink); }
.btn-solid:hover { background: var(--ink); color: var(--paper); }
.btn-line { border-color: var(--ink); }
.btn-line:hover { border-color: var(--accent); color: var(--accent); }

.icon-btn {
  border: 1px solid var(--rule); background: none; color: var(--ink);
  width: 2rem; height: 2rem; border-radius: var(--r); cursor: pointer; line-height: 1;
  font-size: .8rem;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── En-tête ─────────────────────────────────────────────── */
.rail {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1.5rem;
  padding-block: .8rem;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
  font-size: .82rem;
}
.mark { font-weight: 600; text-decoration: none; margin-right: auto; }

.rail-nav { display: flex; gap: 1.5rem; }
.rail-nav a {
  color: var(--ink-3); text-decoration: none;
  padding-bottom: 2px; border-bottom: 1px solid transparent;
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.rail-nav a:hover { color: var(--ink); }
.rail-nav a.is-active { color: var(--accent); border-color: var(--accent); }

/* ── Haut de page ────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
  padding-block: clamp(2.5rem, 6vw, 3.5rem) clamp(2.5rem, 6vw, 4rem);
}
.hero-title {
  font-size: clamp(1.9rem, 4.4vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.hero-lede {
  font-family: var(--serif); font-size: 1.19rem; line-height: 1.55;
  color: var(--ink-2); margin-top: 1.1rem; max-width: 46ch;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin-top: 1.6rem; font-size: .9rem; font-weight: 500; }
.hero-actions a,
.links a {
  color: var(--accent); text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 4px;
}
.hero-actions a:hover,
.links a:hover { color: var(--ink); }

/* parcours : la taille et le contraste montent jusqu'à l'étape actuelle */
.path-label { font-size: .8rem; color: var(--ink-3); margin-bottom: .9rem; max-width: 34ch; }
.path { padding-left: 1.4rem; }
/* un segment par étape, de sa pastille à la suivante : tient même si un intitulé passe à la ligne */
.path li:not(:last-child)::after {
  content: ""; position: absolute; left: calc(-1.4rem + 4px);
  top: calc(.45em + 10px); bottom: -.45em;
  width: 1px; background: var(--ink-3);
}
.path li {
  position: relative; font-family: var(--serif); line-height: 1.25;
  padding-bottom: .9rem; font-size: 1rem; color: var(--ink-3);
}
.path li::before {
  content: ""; position: absolute; left: -1.4rem; top: .45em;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--ink-3);
}
.path li:nth-child(2) { font-size: 1.125rem; }
.path li:nth-child(3) { font-size: 1.25rem; color: var(--ink-2); }
.path li[aria-current] { font-size: 1.56rem; font-weight: 500; color: var(--ink); padding-bottom: 0; }
.path li[aria-current]::before { background: var(--accent); border-color: var(--accent); top: .4em; }
.path small {
  display: block; margin-top: .2rem;
  font-family: var(--sans); font-size: .8rem; font-weight: 400; color: var(--accent);
}

/* ── Sections ────────────────────────────────────────────── */
.sec {
  display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 0 2rem;
  padding-block: var(--sec-y);
  border-top: 1px solid var(--ink);
}
.sec-label { font-size: .8rem; color: var(--ink-3); padding-top: .55rem; }
.sec-intro { color: var(--ink-2); max-width: 60ch; margin-top: .5rem; }

.points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; margin-block: 1.6rem 1.9rem; }
.points-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.points li { border-top: 1px solid var(--rule); padding-top: .75rem; }
.points h3 { margin-bottom: .3rem; }
.points p { font-size: .9rem; color: var(--ink-2); }

/* ── Blocs repliables ────────────────────────────────────── */
.fold { border-top: 1px solid var(--rule); }
.fold:last-of-type { border-bottom: 1px solid var(--rule); }
.fold > summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: baseline; gap: 1rem;
  padding-block: .85rem; font-weight: 500; font-size: .93rem;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after {
  content: "+"; flex: none; width: .9rem; text-align: center;
  color: var(--accent); font-size: 1.15rem; line-height: 1; font-weight: 400;
}
.fold[open] > summary::after { content: "–"; }
.fold > summary:hover { color: var(--accent); }
.fold-hint { margin-left: auto; font-weight: 400; font-size: .82rem; color: var(--ink-3); text-align: right; }
.fold-body { padding-block: .5rem 2rem; }
.fold-title { margin-block: 2.2rem .9rem; }

/* ── Schéma ──────────────────────────────────────────────── */
.diagram-wrap { margin: 0; max-width: 35rem; }
.diagram { width: 100%; height: auto; display: block; overflow: visible; }
.diagram-wrap figcaption { margin-top: .7rem; font-size: .8rem; color: var(--ink-3); line-height: 1.5; }

.diagram .wire { fill: none; stroke: var(--rule); stroke-width: 1.4; }
.diagram .flow path { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; opacity: 0; }

.diagram .node rect { fill: var(--paper); stroke: var(--ink-3); stroke-width: 1; }
.diagram .node .lbl { font-family: var(--sans); font-size: 13px; fill: var(--ink); text-anchor: middle; }
.diagram .node .lbl-sm { font-size: 10px; fill: var(--ink-3); }
.diagram .net-label { font-family: var(--sans); font-size: 9.5px; fill: var(--ink-3); }

.diagram .node-edge rect { fill: var(--accent-wash); stroke: var(--accent); }
.diagram .node-guard rect,
.diagram .node-base rect { fill: none; stroke-dasharray: 4 4; }
.diagram .node-proxy rect { fill: var(--surface); stroke: var(--ink); }

.diagram .node-svc { cursor: pointer; }
.diagram .node-svc rect { transition: stroke .2s var(--ease), fill .2s var(--ease); }
.diagram .node-svc:hover rect,
.diagram .node-svc:focus-visible rect { stroke: var(--accent); fill: var(--accent-wash); }
.diagram .node-svc:focus { outline: none; }

/* Sans script, tout est visible. Le script « arme » le schéma (is-armed),
   joue la séquence à la première ouverture du bloc (is-live), puis la fige (is-settled). */
.diagram.is-armed .node { opacity: 0; }
.diagram.is-armed .wire { stroke-dasharray: 1; stroke-dashoffset: 1; }

.diagram.is-live:not(.is-settled) .node {
  animation: node-in .45s var(--ease) forwards;
  animation-delay: calc(var(--i) * 85ms + 120ms);
}
.diagram.is-live:not(.is-settled) .wire {
  animation: wire-draw .5s var(--ease) forwards;
  animation-delay: calc(var(--i) * 85ms);
}
.diagram.is-live .flow path {
  opacity: 1;
  stroke-dasharray: 7 93;
  animation: packet 2.6s linear infinite;
  animation-delay: 1.25s;
}

@keyframes node-in {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: none; }
}
@keyframes wire-draw { to { stroke-dashoffset: 0; } }
@keyframes packet {
  from { stroke-dashoffset: 100; }
  to   { stroke-dashoffset: 0; }
}

/* ── Contenu des blocs ───────────────────────────────────── */
.layers { counter-reset: layer; border-top: 1px solid var(--rule); }
.layers > li {
  counter-increment: layer;
  display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: 0 .5rem;
  padding-block: .9rem; border-bottom: 1px solid var(--rule);
}
.layers > li::before { content: counter(layer); font-family: var(--serif); font-size: 1.06rem; line-height: 1.35; color: var(--ink-3); grid-row: span 2; }
.layers p { font-size: .9rem; color: var(--ink-2); max-width: 70ch; margin-top: .2rem; }

.inventory { border-top: 1px solid var(--rule); }
.inv-row {
  display: grid; grid-template-columns: 10rem minmax(0, 1.2fr) minmax(0, 1fr);
  gap: .2rem 1.5rem; padding: .7rem .5rem .7rem 0;
  border-bottom: 1px solid var(--rule); font-size: .9rem;
  transition: background-color .3s var(--ease);
}
.inv-name { font-weight: 500; display: flex; align-items: center; gap: .5rem; }
.inv-what { color: var(--ink-2); }
.inv-note { color: var(--ink-3); font-size: .85rem; }
.inv-row.is-target { background: var(--accent-wash); }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot-live { background: var(--live); }
.dot-work { background: var(--work); }
.legend { margin-top: .8rem; font-size: .8rem; color: var(--ink-3); }
.legend .dot { margin-right: .3rem; }
.legend .dot-work { margin-left: 1rem; }

.fixes { border-top: 1px solid var(--rule); }
.fix { padding-block: 1.1rem; border-bottom: 1px solid var(--rule); }
.fix h3 { font-size: 1.06rem; margin-bottom: .6rem; }
.fix dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem 1.5rem; }
.fix dt { font-size: .78rem; color: var(--ink-3); }
.fix dd { font-size: .9rem; color: var(--ink-2); }

.roadmap { border-top: 1px solid var(--rule); }
.roadmap li {
  display: grid; grid-template-columns: 6rem minmax(0, 1fr);
  gap: .1rem 1.5rem; padding-block: 1rem; border-bottom: 1px solid var(--rule);
}
.roadmap h3, .roadmap p { grid-column: 2; }
.roadmap h3 { font-size: 1.06rem; }
.roadmap p { color: var(--ink-2); font-size: .9rem; max-width: 66ch; }
.chip { grid-row: 1 / span 2; font-size: .8rem; color: var(--ink-3); padding-top: .2rem; }
.chip-next { color: var(--accent); font-weight: 500; }

/* ── Contact ─────────────────────────────────────────────── */
.closing { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.5rem, 4vw, 2.5rem); margin-top: 1.2rem; align-items: start; }
.closing .sec-intro { margin-top: 0; }
.links { border-top: 1px solid var(--ink); }
.links li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding-block: .7rem; border-bottom: 1px solid var(--rule); font-size: .9rem; }
.links span { font-size: .8rem; color: var(--ink-3); flex: none; }

/* ── Pied de page ────────────────────────────────────────── */
.foot {
  padding-block: 1.75rem 2.5rem;
  border-top: 1px solid var(--ink);
  font-size: .8rem; color: var(--ink-3);
  display: flex; flex-wrap: wrap; gap: .4rem 2rem; justify-content: space-between;
}

/* ── Portail privé (panneau latéral) ─────────────────────── */
.portal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 16, 13, .45);
  opacity: 0; transition: opacity .3s var(--ease);
}
.portal-backdrop.is-open { opacity: 1; }

.portal {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 51;
  width: min(430px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--ink);
  padding: 1.25rem clamp(1.1rem, 3vw, 1.75rem) 2rem;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform .35s var(--ease);
}
.portal.is-open { transform: none; }

.portal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.portal-head h2 { font-size: 1.3rem; }

.login-panel > p { color: var(--ink-2); font-size: .95rem; }
.login-form { display: flex; flex-direction: column; gap: .6rem; margin-top: 1.1rem; }
#password-input {
  font: inherit; padding: .7rem .85rem; border: 1px solid var(--ink-3);
  border-radius: var(--r); background: var(--paper); color: var(--ink);
}
#password-input:focus-visible { outline-offset: 1px; }
.error-text { color: var(--error); font-size: .88rem; margin-top: .7rem; min-height: 1.2em; }

.dashboard-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.panel-grid { display: grid; gap: 1rem; }
.panel { border: 1px solid var(--rule); border-radius: var(--r); padding: 1.1rem; background: var(--paper); }
.panel-title { font-size: .8rem; color: var(--ink-3); }
.weather-value { font-family: var(--serif); font-size: 2.6rem; line-height: 1.1; margin: .35rem 0 .6rem; }
.weather-value .unit { font-size: 1.1rem; color: var(--ink-3); margin-left: .15rem; }
.weather-link, .recipe-list a { font-size: .88rem; color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.weather-link:hover, .recipe-list a:hover { color: var(--ink); }
.recipe-list { margin-top: .7rem; display: grid; gap: .55rem; }
.recipe-list li { font-size: .95rem; }
.is-loading { color: var(--ink-3); }

/* ── Adaptations ─────────────────────────────────────────── */
@media (max-width: 760px) {
  .rail-nav { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .sec { grid-template-columns: minmax(0, 1fr); gap: .6rem; }
  .sec-label { padding-top: 0; }
  .points, .points-2 { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .fold > summary { flex-wrap: wrap; gap: .1rem 1rem; }
  .fold-hint { order: 3; flex-basis: 100%; margin-left: 0; text-align: left; }
  .fold > summary::after { margin-left: auto; }
  .inv-row { grid-template-columns: minmax(0, 1fr); padding-right: 0; }
  .fix dl { grid-template-columns: minmax(0, 1fr); gap: .6rem; }
  .roadmap li { grid-template-columns: minmax(0, 1fr); }
  .roadmap h3, .roadmap p { grid-column: 1; }
  .chip { grid-row: auto; padding-top: 0; }
  .closing { grid-template-columns: minmax(0, 1fr); }
  .foot { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .diagram.is-armed .node { opacity: 1; }
  .diagram.is-armed .wire { stroke-dashoffset: 0; }
  .diagram.is-live:not(.is-settled) .node,
  .diagram.is-live:not(.is-settled) .wire,
  .diagram.is-live .flow path { animation: none; }
  .diagram.is-live .flow path { opacity: .55; stroke-dasharray: 3 6; }
  .portal, .portal-backdrop, .skip-link { transition: none; }
}
