/* SPDX-FileCopyrightText: 2026 CNRS */
/* SPDX-License-Identifier: CECILL-B */

/* Look of fair3r.fr: grey strip, white masthead, blue accent, green secondary. */
:root {
  --accent: #1da2f1;
  --accent-strong: #11689f;
  --secondary: #03ca76;
  --bg: #f7f9fb;
  --surface: #fff;
  --surface-alt: #f4f6f8;
  --border: #e0e0e0;
  --text: #1f2933;
  --muted: #666;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.06);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --heading: Chivo, "Arial Black", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 90px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 "Helvetica Neue", Helvetica, Arial, sans-serif;
}
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 24px; }

/* Header */
.topstrip { background: var(--surface-alt); border-bottom: 1px solid var(--border); font-size: 12px; }
.topstrip .wrap { display: flex; justify-content: space-between; padding-top: 5px; padding-bottom: 5px; color: var(--muted); }
.masthead { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.bar { display: flex; align-items: center; gap: 28px; min-height: 76px; }
.brand { display: flex; align-items: center; gap: 14px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { height: 56px; width: auto; }
.brand span {
  font: 700 17px var(--heading);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
}
.topnav { display: flex; gap: 4px; margin-left: auto; }
.topnav a {
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 10px 14px;
  border-radius: 6px;
}
.topnav a:hover { background: var(--bg); text-decoration: none; }
.search { position: relative; width: 250px; }
.search input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  background: var(--surface);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
#results {
  position: absolute;
  top: 100%;
  right: 0;
  width: 420px;
  max-width: 90vw;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  max-height: 70vh;
  overflow: auto;
}
#results a { display: block; padding: 10px 14px; border-bottom: 1px solid var(--surface-alt); color: var(--text); }
#results a:hover, #results a.on { background: var(--surface-alt); text-decoration: none; }
#results small { display: block; color: var(--muted); }
#results b { color: var(--accent-strong); }
#results .none { padding: 12px 14px; color: var(--muted); }
.menu { display: none; border: 1px solid var(--border); background: var(--surface); border-radius: 4px; font-size: 20px; padding: 4px 10px; cursor: pointer; }

/* Layout */
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr) 210px; gap: 36px; padding-top: 28px; padding-bottom: 60px; }
.sidebar, .toc { position: sticky; top: 100px; align-self: start; max-height: calc(100vh - 120px); overflow: auto; font-size: 14px; }
.sidebar h4, .toc h4 {
  margin: 22px 0 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}
.sidebar h4:first-of-type, .toc h4 { margin-top: 0; }
.sidebar ul, .toc ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a, .toc li a { display: block; padding: 4px 10px; color: var(--text); border-left: 2px solid transparent; border-radius: 0 4px 4px 0; }
.sidebar li a:hover, .toc li a:hover { background: var(--surface-alt); text-decoration: none; }
.sidebar a.active { border-left-color: var(--accent); background: var(--surface-alt); font-weight: 600; }
.nav-home { display: block; padding: 4px 10px; color: var(--text); font-weight: 600; border-left: 2px solid transparent; }
.nav-home.active { border-left-color: var(--accent); background: var(--surface-alt); }
.toc li.l3 a { padding-left: 22px; }
.toc li a { color: var(--muted); font-size: 13px; }
.toc li a.on { color: var(--accent-strong); border-left-color: var(--accent); }

/* Content */
.content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 34px 44px 40px; min-width: 0; }
.eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-strong); display: flex; align-items: center; gap: 12px; }
.eyebrow::before { content: ""; width: 26px; height: 2px; background: var(--accent); }
.content h1 { margin: 0 0 18px; font: 900 38px/1.1 var(--heading); }
.content h2 { margin: 38px 0 12px; font: 800 24px/1.2 var(--heading); padding-top: 18px; border-top: 1px solid var(--surface-alt); }
.content h3 { margin: 28px 0 8px; font: 700 18px/1.3 var(--heading); }
.content h4 { margin: 20px 0 6px; font-size: 15px; }
.content p, .content li { max-width: 78ch; }
.content img { max-width: 100%; }
.content hr { border: 0; border-top: 1px solid var(--border); margin: 26px 0; }
code { font: 0.88em var(--mono); background: var(--surface-alt); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; }
pre { position: relative; background: #0f1b2a; color: #e6edf3; border-radius: var(--radius); padding: 16px 18px; overflow: auto; line-height: 1.5; }
pre code { background: none; border: 0; padding: 0; color: inherit; font-size: 13px; }
.copy { position: absolute; top: 8px; right: 8px; font: 11px var(--mono); background: #1f3147; color: #cfe3f5; border: 0; border-radius: 4px; padding: 3px 8px; cursor: pointer; opacity: 0; transition: opacity 0.15s; }
pre:hover .copy { opacity: 1; }
table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 14px; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; vertical-align: top; }
th { background: var(--surface-alt); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
blockquote { margin: 16px 0; padding: 8px 18px; border-left: 4px solid var(--accent); background: var(--surface-alt); border-radius: 0 var(--radius) var(--radius) 0; }
.muted { color: var(--muted); }
.edit { margin-top: 40px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--surface-alt); padding-top: 14px; }

/* Home */
.hero { padding: 6px 0 28px; }
.hero h1 { font-size: 56px; }
.hero h1 span { color: var(--accent); }
.lead { font-size: 18px; max-width: 60ch; }
.figures { display: flex; flex-wrap: wrap; gap: 34px; margin-top: 26px; }
.figures div { display: flex; flex-direction: column; }
.figures strong { font: 900 38px/1 var(--heading); color: var(--accent); }
.figures span { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin: 10px 0 8px; }
.card { display: block; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; color: var(--text); background: var(--surface); box-shadow: var(--shadow); border-top: 3px solid var(--accent); }
.card:nth-child(3n+2) { border-top-color: var(--secondary); }
.card:hover { text-decoration: none; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); }
.card h3 { margin: 0 0 4px; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }

/* Generated reference pages */
.chip { display: inline-block; padding: 1px 9px; border-radius: 999px; border: 1px solid; font: 700 11px/1.7 "Helvetica Neue", Arial, sans-serif; white-space: nowrap; }
a.chip:hover { text-decoration: none; filter: brightness(0.95); }
.source { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px 12px; margin: 14px 0; background: var(--surface); }
.source header { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.source h3 { margin: 0; font-size: 17px; }
.source .key { margin-left: auto; color: var(--muted); }
.source dl { display: grid; grid-template-columns: 90px 1fr; gap: 6px 14px; margin: 12px 0 6px; font-size: 14px; }
.source dt { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; padding-top: 2px; }
.source dd { margin: 0; overflow-wrap: anywhere; }
.source details { margin: 6px 0 2px; }
.source summary { cursor: pointer; color: var(--accent-strong); font-size: 13px; }
.source:target { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29, 162, 241, 0.2); }
.notice { background: #fff4e5; border: 1px solid #f0c987; border-radius: 6px; padding: 6px 12px; margin: 10px 0 0; font-size: 14px; max-width: none; }
.fields td:first-child { min-width: 190px; }
.req { color: #d9534f; }
tr:target td { background: rgba(29, 162, 241, 0.1); }

/* Footer */
.footer { border-top: 3px solid var(--accent); background: var(--surface); color: var(--muted); font-size: 13px; padding: 18px 0; }
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 230px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; padding-top: 16px; }
  .sidebar { display: none; position: static; max-height: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
  .sidebar.open { display: block; }
  .menu { display: block; margin-left: auto; }
  .topnav { display: none; }
  .bar { gap: 12px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .search { order: 3; width: 100%; }
  .content { padding: 22px 18px 28px; }
  .content h1 { font-size: 30px; }
  .hero h1 { font-size: 38px; }
  .source dl { grid-template-columns: 1fr; }
}

/* Diagram viewer: tabs, zoom, full screen */
.dgm { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin: 18px 0; display: flex; flex-direction: column; }
.dgm-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface-alt); border-radius: var(--radius) var(--radius) 0 0; }
.dgm-title { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.dgm-tools { display: flex; gap: 4px; }
.dgm-bar button { font: 600 13px "Helvetica Neue", Arial, sans-serif; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 6px; padding: 5px 12px; cursor: pointer; }
.dgm-bar button:hover { border-color: var(--accent); color: var(--accent-strong); }
.dgm-views { position: relative; flex: 1; }
.dgm-view { position: relative; height: 560px; overflow: hidden; cursor: grab; touch-action: none; background-image: radial-gradient(#e4e9ee 1px, transparent 1px); background-size: 18px 18px; }
.dgm-view[hidden] { display: none; }
.dgm-view.grab { cursor: grabbing; }
.dgm-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.dgm-stage svg { display: block; max-width: none; }
.dgm-view .dgm-src { display: none; }
.dgm:fullscreen { background: var(--surface); border-radius: 0; margin: 0; }
.dgm:fullscreen .dgm-views, .dgm:fullscreen .dgm-view { height: calc(100vh - 53px); }
kbd { font: 0.85em var(--mono); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--surface-alt); }
.dgm-edge { stroke: #c4ced9; stroke-width: 1.3; transition: stroke 0.15s, opacity 0.15s; }
.dgm-edge.hot { stroke: var(--accent); stroke-width: 2; }
.dgm-edge.dim { opacity: 0.12; }
.dgm-node { cursor: default; transition: opacity 0.15s; }
.dgm-node.dim { opacity: 0.25; }
.dgm-rails path { stroke: #9aa5b1; stroke-width: 1.2; stroke-dasharray: 4 3; fill: none; }
.dgm-view { height: 640px; }

/* Home: a discreet pill, top right of the hero; the miniature of the diagram shows on hover */
.hero { position: relative; }
.hero-map {
  position: absolute; top: 0; right: 0; padding: 5px 12px; cursor: pointer; font: inherit;
  background: var(--surface); color: var(--muted); border: 1px solid var(--border); border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; transition: color 0.15s, border-color 0.15s;
}
.hero-map:hover, .hero-map:focus-visible { color: var(--accent-strong); border-color: var(--accent); }
.hero-map:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hero-map-thumb {
  position: absolute; top: calc(100% + 10px); right: 0; width: 300px; padding: 10px 12px; pointer-events: none;
  background: var(--surface) radial-gradient(#e4e9ee 1px, transparent 1px) 0 0 / 14px 14px;
  border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(17, 104, 159, 0.2); opacity: 0; transform: translateY(-4px); transition: opacity 0.15s, transform 0.15s; z-index: 5;
}
.hero-map:hover .hero-map-thumb, .hero-map:focus-visible .hero-map-thumb { opacity: 1; transform: none; }
.hero-map-thumb svg { display: block; width: 100%; height: auto; }
a.fig { display: flex; flex-direction: column; color: inherit; padding: 6px 10px; margin: -6px -10px; border-radius: var(--radius); transition: background 0.15s; }
a.fig:hover { background: var(--surface-alt); text-decoration: none; }
a.fig:hover span { color: var(--accent-strong); }
a.fig span::after { content: " →"; opacity: 0; transition: opacity 0.15s; }
a.fig:hover span::after { opacity: 1; }
td.sec-name { border-left: 4px solid var(--accent-row, var(--border)); }
.dgm-modal { border: 0; padding: 0; border-radius: 12px; width: min(1100px, 94vw); height: min(88vh, 900px); box-shadow: 0 20px 60px rgba(15, 27, 42, 0.45); overflow: hidden; background: var(--surface); }
.dgm-modal[open] { display: flex; }
.dgm-modal::backdrop { background: rgba(31, 41, 51, 0.55); backdrop-filter: blur(3px); }
.dgm-modal .dgm { flex: 1; width: 100%; margin: 0; border: 0; border-radius: 0; }
.dgm-modal .dgm-bar { border-radius: 0; }
.dgm-modal .dgm-views, .dgm-modal .dgm-view { height: 100%; }
.dgm-modal .dgm-views { min-height: 0; }
.dgm-link { align-self: center; font-size: 13px; font-weight: 600; padding: 0 10px; white-space: nowrap; }
@media (max-width: 800px) {
  .hero-map-thumb { display: none; }
}

/* Diagram: unfolding sections, field rows, URLs */
.dgm-section { cursor: pointer; }
.dgm-row { cursor: default; }
.dgm-row:hover rect { fill: #f1f7fc; }
.dgm-source { cursor: pointer; }
.dgm-source.pinned rect { filter: drop-shadow(0 1px 3px rgba(17, 104, 159, 0.4)); }
.dgm-url { cursor: pointer; }
.dgm-url:hover { fill: var(--accent-strong); text-decoration: underline; }
.dgm-rails .dep { stroke: #9aa5b1; stroke-width: 1.2; stroke-dasharray: none; fill: none; }
.dgm-sep { width: 1px; background: var(--border); margin: 3px 4px; }
.dgm-bar button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.dgm-tools { flex-wrap: wrap; }
.dgm-bar button { font-size: 12px; padding: 4px 10px; }
.dgm-tools { gap: 4px; }
