/* ============================================================
   lacroix.tv — système de design
   "le téléphone est devenu un protocole"
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --ink: #111111;
  --paper: #F2EDE4;
  --bg: #FAFAF7;
  --rule: #1A1A1A;
  --signal: #FF5B2E;
  --mute: #6B6357;
  --code-bg: #14110E;
  --code-fg: #F2EDE4;

  --serif: 'Fraunces', 'GT Sectra', Georgia, 'Times New Roman', serif;
  --sans: 'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --rule-w: 2px;
  --grid-max: 1280px;
  --grid-gap: 24px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Reset minimal ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }

/* ---------- Base ---------- */
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--signal); color: var(--bg); }

/* ---------- Typographie ---------- */
.display {
  font-family: var(--serif);
  font-weight: 400;
  font-style: normal;
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 0, "WONK" 0, "opsz" 144;
  letter-spacing: -0.02em;
  line-height: 0.95;
}

h1.display { font-size: clamp(56px, 9vw, 144px); }
h2.display { font-size: clamp(40px, 5.5vw, 88px); margin: 0 0 .2em; }
h3 { font-family: var(--sans); font-weight: 600; font-size: 20px; letter-spacing: -0.01em; margin: 0 0 8px; }

p { margin: 0 0 1em; max-width: 64ch; }
small, .small { font-size: 13px; }

.serif-italic {
  font-family: var(--serif);
  font-style: italic;
  font-variation-settings: "SOFT" 50, "WONK" 1, "opsz" 144;
}

/* Eyebrow numérotation type RFC */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::before {
  content: '';
  display: inline-block;
  width: 28px;
  height: 1px;
  background: var(--ink);
}

/* ---------- Navigation ---------- */
.nav {
  border-bottom: var(--rule-w) solid var(--rule);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav-inner {
  max-width: var(--grid-max);
  margin: 0 auto;
  padding: 16px 32px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 32px;
}
.brand {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.02em;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  line-height: 1;
}
.brand-dot {
  width: 7px; height: 7px;
  background: var(--signal);
  display: inline-block;
  margin-bottom: 2px;
  flex: 0 0 7px;
}
.brand i {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-variation-settings: "SOFT" 50, "WONK" 1, "opsz" 144;
}
.brand .first {
  font-family: var(--serif);
  font-style: normal;
  font-weight: 400;
  font-variation-settings: "opsz" 144;
  letter-spacing: -0.02em;
}

/* Wordmark plus grand pour le footer */
.brand-lg {
  font-size: 36px;
}
.brand-lg .brand-dot {
  width: 10px; height: 10px;
  flex: 0 0 10px;
  margin-bottom: 4px;
}
.nav-links {
  display: flex;
  gap: 28px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nav-links a {
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: border-color .15s ease;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] {
  border-bottom-color: var(--signal);
}
.nav-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
  letter-spacing: 0.04em;
}

/* ---------- Grille principale ---------- */
main { padding: 0; }
.wrap {
  max-width: var(--grid-max);
  margin: 0 auto;
  padding: 0 32px;
}

.grid {
  display: grid;
  grid-template-columns: [marg-l] minmax(40px, 1fr) [main-l] minmax(0, 9fr) [marg-r] minmax(60px, 3fr) [end];
  gap: var(--grid-gap);
  max-width: var(--grid-max);
  margin: 0 auto;
  padding: 0 32px;
}
.grid > .num { grid-column: marg-l / main-l; }
.grid > .body { grid-column: main-l / marg-r; }
.grid > .aside { grid-column: marg-r / end; }
.grid > .wide { grid-column: main-l / end; }
.grid > .full { grid-column: marg-l / end; }

/* Marginalia type édition critique */
.aside {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  line-height: 1.45;
  color: var(--mute);
  padding-top: 6px;
  border-top: 1px solid var(--ink);
  font-variation-settings: "SOFT" 50, "WONK" 1, "opsz" 14;
}
.aside .ref {
  font-family: var(--mono);
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  display: block;
  margin-bottom: 6px;
}

.num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  letter-spacing: 0.05em;
  padding-top: 8px;
}

/* ---------- Sections ---------- */
section { padding: 96px 0; border-bottom: var(--rule-w) solid var(--rule); }
section:last-of-type { border-bottom: none; }
section.tight { padding: 64px 0; }
section.hero { padding: 120px 0 96px; }

/* ---------- Hero ---------- */
.hero h1 { margin: 0 0 32px; }
.hero-lede {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.35;
  max-width: 38ch;
  color: var(--ink);
  font-variation-settings: "SOFT" 50, "WONK" 1, "opsz" 24;
}
.hero-thesis {
  font-size: 18px;
  max-width: 56ch;
  margin-top: 32px;
}

/* ---------- Trace SIP (signature) ---------- */
.trace {
  background: var(--code-bg);
  color: var(--code-fg);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  padding: 48px 32px;
  margin: 64px 0;
  position: relative;
  overflow: hidden;
}
.trace-header {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(242, 237, 228, 0.5);
  border-bottom: 1px solid rgba(242, 237, 228, 0.15);
  padding-bottom: 16px;
  margin-bottom: 24px;
}
.trace-dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--signal);
  border-radius: 50%;
  margin-right: 8px;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255,91,46,.7); }
  50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(255,91,46,0); }
}
.trace-line {
  display: grid;
  grid-template-columns: 56px 1fr 200px;
  gap: 16px;
  padding: 6px 0;
  opacity: 0;
  transform: translateX(-8px);
  animation: slidein .5s ease forwards;
}
.trace-line .t-from { color: rgba(242, 237, 228, 0.55); }
.trace-line .t-msg { color: var(--code-fg); }
.trace-line .t-msg .verb { color: var(--signal); font-weight: 500; }
.trace-line .t-msg .code { color: #8ED1A3; }
.trace-line .t-note {
  color: rgba(242, 237, 228, 0.4);
  font-style: italic;
  font-family: var(--serif);
  font-size: 12px;
}
.trace-line:nth-child(2) { animation-delay: .2s; }
.trace-line:nth-child(3) { animation-delay: .6s; }
.trace-line:nth-child(4) { animation-delay: 1.1s; }
.trace-line:nth-child(5) { animation-delay: 1.5s; }
.trace-line:nth-child(6) { animation-delay: 1.9s; }
.trace-line:nth-child(7) { animation-delay: 2.3s; }
@keyframes slidein {
  to { opacity: 1; transform: translateX(0); }
}

/* ---------- Entry tiles ---------- */
.entries {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: var(--rule-w) solid var(--rule);
  border-bottom: var(--rule-w) solid var(--rule);
}
.entry {
  padding: 48px 32px;
  border-right: var(--rule-w) solid var(--rule);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: background .2s ease;
  position: relative;
}
.entry:last-child { border-right: none; }
.entry:hover { background: var(--paper); }
.entry:hover .entry-arrow { transform: translateX(6px); }
.entry-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--mute);
  text-transform: uppercase;
  margin-bottom: 32px;
}
.entry-title {
  font-family: var(--serif);
  font-size: 36px;
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}
.entry-title i {
  font-style: italic;
  font-variation-settings: "SOFT" 50, "WONK" 1;
}
.entry-desc { font-size: 15px; color: var(--mute); max-width: 32ch; }
.entry-arrow {
  position: absolute;
  bottom: 32px;
  right: 32px;
  font-family: var(--mono);
  font-size: 18px;
  transition: transform .2s ease;
}

/* ---------- Code blocks ---------- */
pre, code { font-family: var(--mono); }
pre.code {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 32px;
  font-size: 13px;
  line-height: 1.65;
  overflow-x: auto;
  margin: 24px 0;
  white-space: pre;
}
pre.code .verb { color: var(--signal); }
pre.code .head { color: #8AB4E8; }
pre.code .val { color: var(--code-fg); }
pre.code .comment { color: rgba(242, 237, 228, 0.45); font-style: italic; }
pre.code .ok { color: #8ED1A3; }

code.inline {
  background: var(--paper);
  padding: 1px 6px;
  font-size: 0.9em;
  border: 1px solid rgba(17,17,17,.08);
}

/* ---------- Tables ---------- */
table.spec {
  width: 100%;
  border-collapse: collapse;
  margin: 32px 0;
  font-size: 14px;
}
table.spec th, table.spec td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ink);
  vertical-align: top;
}
table.spec thead th {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  border-bottom: var(--rule-w) solid var(--rule);
  background: var(--paper);
}
table.spec tbody th {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 400;
  width: 30%;
  color: var(--ink);
}
table.spec tbody td { font-family: var(--mono); font-size: 13px; }
table.spec tbody td .note {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--mute);
  display: block;
  margin-top: 4px;
}

/* ---------- Status codes ---------- */
.status-list { list-style: none; padding: 0; margin: 24px 0; }
.status-list li {
  display: grid;
  grid-template-columns: 80px 1fr 2fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(17,17,17,.12);
  font-family: var(--mono);
  font-size: 14px;
  align-items: baseline;
}
.status-list .code-num {
  font-weight: 600;
  letter-spacing: 0.05em;
}
.status-list .code-name { color: var(--ink); }
.status-list .code-desc {
  font-family: var(--serif);
  font-style: italic;
  color: var(--mute);
  font-size: 14px;
}
.status-1xx .code-num { color: var(--mute); }
.status-2xx .code-num { color: #2F8C56; }
.status-3xx .code-num { color: #B07A1C; }
.status-4xx .code-num { color: var(--signal); }
.status-5xx .code-num { color: #A53A18; }
.status-6xx .code-num { color: #6E1212; }

/* ---------- Diagrams ---------- */
.diagram {
  background: var(--paper);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  padding: 32px;
  border: var(--rule-w) solid var(--rule);
  margin: 32px 0;
  white-space: pre;
  overflow-x: auto;
}

/* ---------- Cards / steps ---------- */
.steps {
  border-top: var(--rule-w) solid var(--rule);
  margin-top: 48px;
}
.step {
  display: grid;
  grid-template-columns: 80px 1fr 280px;
  gap: 32px;
  padding: 40px 0;
  border-bottom: 1px solid rgba(17,17,17,.15);
}
.step-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--mute);
  padding-top: 6px;
}
.step-title {
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}
.step-body { font-size: 15px; }
.step-aside {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--mute);
  padding-top: 6px;
  border-top: 1px solid var(--ink);
}

/* ---------- Glossaire ---------- */
.gloss { columns: 1; padding: 32px 0; }
@media (min-width: 900px) { .gloss { columns: 2; column-gap: 64px; } }
.gloss dt {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-top: 24px;
  break-after: avoid;
}
.gloss dt::before { content: '— '; color: var(--signal); }
.gloss dd {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  break-inside: avoid;
}
.gloss dd em {
  font-family: var(--serif);
  font-style: italic;
  color: var(--mute);
  font-size: 13px;
}

/* ---------- ippi card ---------- */
.ippi-card {
  background: var(--paper);
  border: var(--rule-w) solid var(--rule);
  padding: 48px;
  margin: 48px 0;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 48px;
  align-items: center;
}
.ippi-card .ippi-logo {
  width: 140px;
  height: auto;
}
.ippi-card h3 {
  font-family: var(--serif);
  font-size: 28px;
  margin: 0 0 8px;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.ippi-card p { margin: 0 0 12px; font-size: 15px; }
.ippi-card a.cta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 2px solid var(--signal);
  padding-bottom: 2px;
}

/* ---------- Quote ---------- */
.pull {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  padding: 48px 0;
  max-width: 28ch;
  font-variation-settings: "SOFT" 50, "WONK" 1, "opsz" 32;
}
.pull-attr {
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--mute);
  display: block;
  margin-top: 16px;
}

/* ---------- Footer ---------- */
footer {
  border-top: var(--rule-w) solid var(--rule);
  padding: 64px 32px 32px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mute);
  letter-spacing: 0.02em;
}
footer .footer-inner {
  max-width: var(--grid-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
}
footer h4 {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 16px;
}
footer ul { list-style: none; padding: 0; margin: 0; }
footer li { margin-bottom: 8px; }
footer a { text-decoration: none; border-bottom: 1px solid transparent; }
footer a:hover { border-bottom-color: var(--signal); }
footer .colophon {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  line-height: 1.5;
  color: var(--mute);
  max-width: 36ch;
}
footer .footer-bot {
  max-width: var(--grid-max);
  margin: 48px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgba(17,17,17,.15);
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* ---------- Sub-nav (sous-pages d'une section) ---------- */
.subnav {
  border-bottom: 1px solid rgba(17,17,17,.15);
  background: var(--bg);
  position: sticky;
  top: 57px;
  z-index: 49;
}
.subnav-inner {
  max-width: var(--grid-max);
  margin: 0 auto;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex-wrap: wrap;
}
.subnav-label {
  color: var(--mute);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.subnav-label::after {
  content: '';
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--ink);
}
.subnav-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.subnav-links a {
  text-decoration: none;
  color: var(--mute);
  padding: 2px 0;
  border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.subnav-links a:hover { color: var(--ink); }
.subnav-links a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--signal);
}

/* ---------- Hub des sous-sections ---------- */
.hub {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: var(--rule-w) solid var(--rule);
  border-bottom: var(--rule-w) solid var(--rule);
  margin-top: 64px;
}
.hub-card {
  padding: 48px 40px;
  border-right: var(--rule-w) solid var(--rule);
  border-bottom: var(--rule-w) solid var(--rule);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: background .2s ease;
  position: relative;
}
.hub-card:nth-child(2n) { border-right: none; }
.hub-card:nth-last-child(-n+2) { border-bottom: none; }
.hub-card:hover { background: var(--paper); }
.hub-card:hover .entry-arrow { transform: translateX(6px); }
.hub-card .entry-num { margin-bottom: 24px; }
.hub-card .entry-title { font-size: 32px; }
.hub-card .entry-desc { margin-top: 12px; }
@media (max-width: 800px) {
  .hub { grid-template-columns: 1fr; }
  .hub-card { border-right: none; border-bottom: var(--rule-w) solid var(--rule); }
  .hub-card:nth-last-child(-n+2) { border-bottom: var(--rule-w) solid var(--rule); }
  .hub-card:last-child { border-bottom: none; }
}

/* ---------- Page header ---------- */
.page-header {
  padding: 96px 0 64px;
  border-bottom: var(--rule-w) solid var(--rule);
}
.page-header h1 {
  font-family: var(--serif);
  font-size: clamp(48px, 7vw, 96px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 16px 0 24px;
  max-width: 14ch;
}
.page-header h1 i {
  font-style: italic;
  font-variation-settings: "SOFT" 50, "WONK" 1;
}
.page-header .lede {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  line-height: 1.35;
  max-width: 50ch;
  color: var(--mute);
  font-variation-settings: "SOFT" 50, "WONK" 0, "opsz" 22;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
    padding: 0 24px;
  }
  .grid > .num,
  .grid > .body,
  .grid > .aside,
  .grid > .wide,
  .grid > .full { grid-column: 1; }
  .grid > .aside {
    border-top: 1px solid var(--ink);
    padding-top: 12px;
    margin-top: 8px;
  }
  .entries { grid-template-columns: 1fr; }
  .entry { border-right: none; border-bottom: var(--rule-w) solid var(--rule); }
  .entry:last-child { border-bottom: none; }
  .step { grid-template-columns: 60px 1fr; }
  .step-aside { grid-column: 1 / -1; padding-top: 12px; border-top: 1px solid rgba(17,17,17,.2); }
  .ippi-card { grid-template-columns: 1fr; padding: 32px; }
  .ippi-card .ippi-logo { width: 100px; }
  footer .footer-inner { grid-template-columns: 1fr 1fr; }
  .nav-inner { grid-template-columns: auto 1fr; padding: 16px 24px; }
  .nav-links { display: none; }
  .nav-meta { display: none; }
  .wrap { padding: 0 24px; }
  section { padding: 64px 0; }
  .trace-line { grid-template-columns: 50px 1fr; }
  .trace-line .t-note { grid-column: 1 / -1; padding-left: 50px; }
  .status-list li { grid-template-columns: 60px 1fr; }
  .status-list .code-desc { grid-column: 1 / -1; padding-left: 60px; }
  table.spec tbody th, table.spec tbody td { display: block; width: 100%; padding: 8px 12px; }
  table.spec tbody th { border-bottom: none; padding-bottom: 0; }
}
