/* FastGRID: a cross between euler-x-engin (cool drafting white, tight grotesk, drafting grid,
   black bands, one copper signal) and Nohm (dark operator bar, dark map blocks, numbered tabs). */
:root {
  /* Light: drafting paper */
  --paper: #f2f3f4;
  --paper-2: #e6e8eb;
  --grid: #dfe2e6;
  --ink: #0c0d10;
  --ink-2: #4d535d;
  --muted: #80868f;
  --rule: #d6d9de;
  --card: #ffffff;
  /* Dark bands (header, maps, footer) */
  --night: #060607;
  --night-2: #131417;
  --night-line: #26282d;
  --on-night: #f3f3f1;
  --on-night-2: #9b9fa8;
  /* One signal colour, plus data colours */
  --accent: #ff6a2b;          /* copper */
  --accent-ink: #d24a0f;      /* copper dark enough for text on paper */
  --solar: #f2a516;
  --wind: #3d7fd9;
  --steel: #3d7fd9;
  --metal: #ff6a2b;
  --plastics: #2fa37a;
  --shadow: 0 1px 0 rgba(12, 13, 16, 0.06), 0 12px 32px -18px rgba(12, 13, 16, 0.28);
  --radius: 8px;
  --sans: "Hanken Grotesk", "Helvetica Neue", Arial, system-ui, sans-serif;
  --display: var(--sans);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --max: 1320px;
  --gutter: clamp(16px, 3.4vw, 44px);
  /* Older names still used by page styles */
  --serif: var(--display);
  --navy: var(--night);
  --navy-2: var(--night-2);
  --on-navy: var(--on-night);
  --on-navy-muted: var(--on-night-2);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0a0b0d; --paper-2: #15171b; --grid: #1a1c20; --ink: #f3f3f1; --ink-2: #b9bdc5;
    --muted: #868b94; --rule: #26282d; --card: #121316; --accent-ink: #ff8a55;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0a0b0d; --paper-2: #15171b; --grid: #1a1c20; --ink: #f3f3f1; --ink-2: #b9bdc5;
  --muted: #868b94; --rule: #26282d; --card: #121316; --accent-ink: #ff8a55;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.4); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } html { scroll-behavior: auto; } }

/* Bilingual content: <span lang="fr">…</span><span lang="en">…</span> */
html[data-lang="fr"] body [lang="en"],
html[data-lang="en"] body [lang="fr"] { display: none !important; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ── Header: dark operator bar ────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 1000;
  background: color-mix(in srgb, var(--night) 94%, transparent);
  backdrop-filter: blur(12px);
  color: var(--on-night);
  border-bottom: 1px solid var(--night-line);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { font-family: var(--display); font-weight: 600; letter-spacing: -0.03em; font-size: 20px; text-decoration: none; display: flex; align-items: center; gap: 10px; color: var(--on-night); }
.brand-mark { width: 24px; height: 24px; display: inline-flex; }
.brand-mark svg { width: 100%; height: 100%; }

/* Logos (assets/logos.js) */
.logo { display: inline-flex; width: 22px; height: 22px; color: var(--accent); flex: none; }
.logo svg { width: 100%; height: 100%; }
.logo.sm { width: 17px; height: 17px; margin-right: 9px; vertical-align: -3px; }
.logo.tile { width: 64px; height: 64px; padding: 14px; border-radius: var(--radius); background: var(--night); color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--night-line); margin-bottom: 18px; }
.logo.tile.muted-tile { color: var(--on-night-2); }
.logo.inline { width: .92em; height: .92em; margin-right: .32em; vertical-align: -.1em; }
.h2 .logo.inline, .index .title .logo.inline { width: .74em; height: .74em; margin-right: .24em; vertical-align: -.02em; }
.eyebrow .logo.inline { width: 1.5em; height: 1.5em; margin-right: .5em; vertical-align: -.45em; }

.nav { display: flex; gap: 22px; margin: 0 auto; align-items: center; }
.nav > a, .nav-drop > button {
  text-decoration: none; color: var(--on-night-2); background: none; border: 0;
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; padding: 6px 0; position: relative; white-space: nowrap;
}
.nav > a:hover, .nav-drop > button:hover, .nav > a[aria-current="page"] { color: var(--on-night); }
.nav > a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: var(--accent); }
.nav-drop { position: relative; }
.nav-drop > button::after { content: "⌃"; display: inline-block; transform: rotate(180deg); margin-left: 6px; font-size: 11px; color: var(--on-night-2); transition: transform .2s; }
.nav-drop.open > button { color: var(--on-night); }
.nav-drop.open > button::after { transform: none; }
.drop-panel {
  position: absolute; top: calc(100% + 16px); left: 50%; transform: translateX(-50%);
  width: 290px; background: var(--night-2); color: var(--on-night); border: 1px solid var(--night-line); border-radius: var(--radius);
  box-shadow: 0 24px 48px -20px rgba(0,0,0,.6); padding: 16px 18px 8px; display: none;
}
.nav-drop.open .drop-panel { display: block; }
.drop-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 12px; border-bottom: 1px solid var(--night-line); margin-bottom: 6px; }
.drop-head a { font-weight: 600; text-decoration: none; }
.drop-head span { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--on-night-2); }
.drop-panel .item { display: grid; grid-template-columns: 136px 1fr; padding: 10px 0; text-decoration: none; }
.drop-panel .item b { font-weight: 500; display: flex; align-items: center; }
.drop-panel .item span { color: var(--on-night-2); }
.drop-panel .item:hover b { color: var(--accent); }
.tools { display: flex; gap: 12px; align-items: center; }
.account-link { text-decoration: none; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--on-night); border: 1px solid var(--night-line); border-radius: 4px; padding: 6px 11px; white-space: nowrap; }
.account-link:hover, .account-link[aria-current="page"] { border-color: var(--accent); color: var(--accent); }
.lang-toggle { display: flex; gap: 2px; }
.lang-toggle button { border: 1px solid transparent; background: none; font: 500 12px var(--mono); padding: 4px 8px; color: var(--on-night-2); cursor: pointer; border-radius: 4px; }
.lang-toggle button[aria-pressed="true"] { border-color: var(--on-night); color: var(--on-night); }
.menu-btn { display: none; border: 1px solid var(--night-line); background: none; border-radius: 4px; padding: 6px 10px; font: inherit; color: var(--on-night); }

@media (max-width: 1320px) {
  .menu-btn { display: block; margin-left: auto; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: flex-start;
         gap: 4px; padding: 12px var(--gutter) 20px; background: var(--night); border-bottom: 1px solid var(--night-line); }
  .site-header.menu-open .nav { display: flex; }
  .drop-panel { position: static; transform: none; width: 100%; box-shadow: none; margin-top: 8px; }
  .site-header .tools { margin-left: 0; }
}

/* ── Type ─────────────────────────────────────────────── */
.eyebrow { font-family: var(--mono); font-size: 12.5px; font-weight: 500; letter-spacing: .02em; color: var(--muted); display: flex; align-items: center; gap: 14px; }
.eyebrow::before { content: ""; width: 56px; height: 1px; background: currentColor; opacity: .55; flex: none; }
.display {
  font-family: var(--display); font-size: clamp(48px, 8.4vw, 132px); line-height: .9; letter-spacing: -0.055em;
  font-weight: 500; margin: 22px 0 0; text-wrap: balance;
}
.h2 { font-family: var(--display); font-size: clamp(34px, 4.6vw, 68px); line-height: .95; letter-spacing: -0.045em; font-weight: 500; margin: 0; text-wrap: balance; }
.h3 { font-family: var(--display); font-size: 24px; letter-spacing: -0.03em; font-weight: 600; margin: 0 0 8px; }
.lead { font-size: clamp(17px, 1.45vw, 20px); line-height: 1.5; color: var(--ink-2); max-width: 36em; }
.muted { color: var(--muted); }

/* ── Hero on the drafting grid ────────────────────────── */
.hero { position: relative; padding-top: clamp(56px, 9vw, 128px); padding-bottom: clamp(40px, 5vw, 72px); }
.hero::before {
  content: ""; position: absolute; inset: 0 var(--gutter); pointer-events: none; z-index: 0;
  background: linear-gradient(to right, var(--grid) 1px, transparent 1px) 0 0 / 20% 100%;
  border-right: 1px solid var(--grid);
}
.hero > * { position: relative; z-index: 1; }
.hero-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 48px; align-items: end; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; gap: 24px; } }

/* ── Numbered index rows (home) ───────────────────────── */
.index { border-top: 1px solid var(--ink); margin: 0; padding: 0; list-style: none; }
.index a {
  display: grid; grid-template-columns: 80px minmax(0, 1.2fr) minmax(0, 1fr) 40px; align-items: center;
  padding: 30px 0; border-bottom: 1px solid var(--rule); text-decoration: none; transition: padding .3s cubic-bezier(.2,.7,.1,1);
}
.index a:hover { padding-left: 14px; }
.index .num { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.index .title { font-family: var(--display); font-size: clamp(34px, 4.4vw, 60px); font-weight: 500; letter-spacing: -0.05em; line-height: .95; }
.index .desc { font-size: 15px; color: var(--ink-2); }
.index .arrow { justify-self: end; font-size: 20px; transition: transform .25s; }
.index a:hover .arrow { transform: translate(3px, -3px); color: var(--accent); }
@media (max-width: 720px) {
  .index a { grid-template-columns: 40px 1fr 24px; row-gap: 6px; padding: 24px 0; }
  .index .desc { grid-column: 2; grid-row: 2; }
}

/* ── Tabs (Nohm-style numbered scale picker) ──────────── */
.tabs { display: grid; grid-template-columns: repeat(var(--tabs, 4), 1fr); border-top: 1px solid var(--ink); margin-top: 44px; }
.tabs button {
  text-align: left; background: none; border: 0; border-bottom: 2px solid transparent; font: inherit;
  padding: 16px 0; color: var(--muted); cursor: pointer; font-size: 15px; font-weight: 500; display: flex; gap: 12px; align-items: baseline;
}
.tabs button small { font-family: var(--mono); font-size: 11px; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs button[aria-selected="true"] small { color: var(--accent-ink); }
@media (max-width: 720px) { .tabs { grid-template-columns: repeat(2, 1fr); } }

/* ── Dark feature block (map / visuals) ───────────────── */
.feature {
  background: var(--night); color: var(--on-night); border-radius: 10px; overflow: hidden; border: 1px solid var(--night-line);
  display: grid; grid-template-columns: minmax(280px, 1fr) 2fr; min-height: 580px;
}
.feature-text { padding: 34px 30px; display: flex; flex-direction: column; gap: 18px; }
.feature-text .eyebrow { color: var(--on-night-2); }
.feature-text h2 { font-family: var(--display); font-size: clamp(30px, 3.2vw, 46px); line-height: .98; letter-spacing: -0.045em; margin: 0; font-weight: 500; color: var(--on-night); }
.feature-text p { color: var(--on-night-2); margin: 0; }
.feature-text [data-panel] > * + * { margin-top: 16px; }
.feature-visual { position: relative; background: var(--night-2); min-height: 440px; }
.feature-caption { grid-column: 1 / -1; border-top: 1px solid var(--night-line); padding: 14px 22px; font: 12px/1.55 var(--mono); color: var(--on-night-2); }
@media (max-width: 900px) { .feature { grid-template-columns: 1fr; } .feature-visual { min-height: 440px; } }

/* ── Sections, cards, grids ───────────────────────────── */
.section { padding-top: clamp(56px, 8vw, 112px); padding-bottom: clamp(56px, 8vw, 112px); }
.section + .section { border-top: 1px solid var(--rule); }
.band { background: var(--night); color: var(--on-night); }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .cols-3, .cols-2 { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 26px; }
.card .num { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.tag { display: inline-block; font-family: var(--mono); font-size: 11.5px; font-weight: 500; border-radius: 4px; border: 1px solid var(--rule); padding: 3px 9px; background: var(--paper-2); color: var(--ink-2); margin: 0 6px 6px 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.steel { background: var(--steel); } .dot.metal { background: var(--metal); } .dot.plastics { background: var(--plastics); }
ul.clean { list-style: none; padding: 0; margin: 0; }
ul.clean li { padding: 10px 0; border-bottom: 1px solid var(--rule); }
ul.clean li:last-child { border-bottom: 0; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none; background: var(--ink); color: var(--paper);
  padding: 13px 20px; border-radius: 4px; font-weight: 600; font-size: 13px; letter-spacing: .05em; text-transform: uppercase;
  border: 1px solid var(--ink); cursor: pointer; transition: background .2s, border-color .2s, color .2s;
}
.btn::after { content: "→"; font-weight: 400; letter-spacing: 0; }
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--night); }
.btn.ghost { background: none; color: var(--ink); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-ink); background: none; }
button.btn::after { content: none; }
table.compare { width: 100%; border-collapse: collapse; font-size: 15px; }
table.compare th, table.compare td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.compare th { font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.table-scroll { overflow-x: auto; }

/* Rows of numbered detail (about, sectors) */
.row { display: grid; grid-template-columns: 80px minmax(0, 1fr) minmax(0, 1.3fr); gap: 24px; padding: 40px 0; border-bottom: 1px solid var(--rule); }
.row:first-child { border-top: 1px solid var(--ink); }
.row .num { font-family: var(--mono); font-size: 13px; color: var(--muted); padding-top: 10px; }
.row .h2, .row .h3 { letter-spacing: -0.045em; }
@media (max-width: 860px) { .row { grid-template-columns: 1fr; gap: 12px; } }

/* Assistant console sample */
.console { background: var(--night); color: var(--on-night); border-radius: var(--radius); padding: 18px 20px; font-family: var(--mono); font-size: 13px; line-height: 1.65; }
.console .who { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--on-night-2); margin-bottom: 6px; display: block; }
.console .alert { border-left: 3px solid var(--accent); padding-left: 12px; }

/* ── Map widgets ──────────────────────────────────────── */
#map { position: absolute; inset: 0; background: #1a1c20; }
#map .leaflet-tile-pane { filter: grayscale(1) invert(1) brightness(.78) contrast(.9); }
.map-panel {
  position: absolute; top: 14px; right: 14px; z-index: 500; width: min(300px, calc(100% - 28px));
  background: rgba(19, 20, 23, .94); color: #f3f3f1; border-radius: var(--radius); border: 1px solid #26282d;
  backdrop-filter: blur(8px); box-shadow: 0 18px 40px -20px rgba(0,0,0,.7);
  padding: 14px 16px; font-size: 13px; max-height: calc(100% - 28px); overflow: auto;
}
.map-panel h4 { margin: 0 0 6px; font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.map-panel .k { color: #9b9fa8; font: 500 11px var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.map-panel .big { font-family: var(--display); font-size: 38px; font-weight: 500; letter-spacing: -0.05em; }
.map-panel a { color: #ff8a55; }
.mix-bar { display: grid; grid-template-columns: 90px 1fr 54px; align-items: center; gap: 8px; margin: 5px 0; font-size: 12px; }
.mix-bar i { display: block; height: 6px; border-radius: 3px; background: var(--wind); }
.map-legend { position: absolute; left: 14px; bottom: 14px; z-index: 500; background: rgba(19,20,23,.94); color: #f3f3f1;
  border: 1px solid #26282d; border-radius: 6px; padding: 6px 14px; font-size: 12px; }
.leaflet-container { font-family: var(--sans); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #131417; color: #f3f3f1; border-radius: 6px; }
.leaflet-popup-content { font-size: 13px; line-height: 1.5; }
.leaflet-popup-content h4 { margin: 0 0 4px; font-size: 15px; }
.leaflet-container a.leaflet-popup-close-button { color: #9b9fa8; }
.leaflet-tooltip { background: #131417; color: #f3f3f1; border: 1px solid #26282d; border-radius: 6px; box-shadow: none; font-family: var(--sans); }
.leaflet-tooltip-top::before { border-top-color: #131417; }
.leaflet-bar a { background: #131417; color: #f3f3f1; border-bottom-color: #26282d; }
.leaflet-bar a:hover { background: #26282d; color: #fff; }
.leaflet-bar { border: 1px solid #26282d !important; }
.leaflet-control-attribution { background: rgba(6,6,7,.7) !important; color: #9b9fa8; }
.leaflet-control-attribution a { color: #c9ccd2; }

/* ── Footer: dark band ────────────────────────────────── */
.site-footer { background: var(--night); color: var(--on-night-2); padding: 48px 0 64px; font-size: 14px; margin-top: 0; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
.site-footer a { text-decoration: none; margin-right: 18px; color: var(--on-night); }
.site-footer a:hover { color: var(--accent); }
