/* PhotoCat Lab — direction « laboratoire de nuit » : bleu nuit, lumière solaire, couleurs des catalyseurs */
@font-face {
    font-family: "Space Grotesk";
    src: url("../fonts/space-grotesk-500.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: "Space Grotesk";
    src: url("../fonts/space-grotesk-700.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}

:root {
    --bg: #070b16;
    --bg-2: #0c1222;
    --surface: rgba(255, 255, 255, 0.045);
    --surface-2: rgba(255, 255, 255, 0.075);
    --surface-solid: #111a2e;
    --ink: #eef2fa;
    --ink-2: #c3cbdc;
    --muted: #8a96ad;
    --line: rgba(255, 255, 255, 0.1);
    --sun: #ffb547;
    --sun-soft: rgba(255, 181, 71, 0.14);
    --accent: #ffb547;
    --accent-soft: rgba(255, 181, 71, 0.14);
    --zn: #2dd4bf;
    --mg: #fb923c;
    --tc: #f7e463;
    --warn: #ffcf70;
    --warn-soft: rgba(255, 196, 77, 0.12);
    --bad: #ff8f78;
    --bad-soft: rgba(255, 120, 95, 0.12);
    --ok: #5ee0a0;
    --ok-soft: rgba(80, 220, 150, 0.12);
    --radius: 18px;
    --display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
    --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
    margin: 0;
    background:
        radial-gradient(1200px 600px at 85% -10%, rgba(255, 181, 71, 0.10), transparent 60%),
        radial-gradient(900px 500px at -10% 20%, rgba(45, 212, 191, 0.07), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    color: var(--ink);
    font: 16px/1.6 var(--font);
}
a { color: var(--sun); }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.2rem, 5.2vw, 4.2rem); }
h2 { font-size: clamp(1.4rem, 2.6vw, 2.1rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
sub, sup { line-height: 0; }

.container { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* En-tête */
.site-header {
    position: sticky; top: 0; z-index: 20;
    background: rgba(7, 11, 22, 0.72);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.site-header .container { display: flex; align-items: center; gap: 20px; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand-mark {
    width: 32px; height: 32px; border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #fff3c4, var(--sun) 45%, #e0791b 100%);
    box-shadow: 0 0 18px rgba(255, 181, 71, 0.55);
    display: inline-block; font-size: 0;
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 8px 14px; border-radius: 999px; font-size: .95rem; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--sun-soft); color: var(--sun); font-weight: 600; }

/* Choix de la langue (ajouté par i18n.js) */
.lang-switch { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, 0.04); }
.lang-switch button {
    font: inherit; font-size: .8rem; font-weight: 700; letter-spacing: .06em;
    color: var(--muted); background: transparent; border: 0; border-radius: 999px;
    padding: 5px 10px; cursor: pointer;
}
.lang-switch button:hover { color: var(--ink); }
.lang-switch button[aria-pressed="true"] { background: var(--sun); color: #1b1305; }
.lang-switch button:focus-visible { outline: 2px solid var(--sun); outline-offset: 2px; }
@media (max-width: 720px) {
    .site-header .container { gap: 8px 12px; padding-top: 8px; padding-bottom: 8px; }
    .lang-switch { order: 1; margin-left: auto; }
    .nav { order: 2; width: 100%; margin-left: 0; }
}

main { padding: 40px 0 80px; }
.lead { font-size: 1.15rem; color: var(--ink-2); max-width: 760px; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: .76rem; font-weight: 700; color: var(--sun); margin-bottom: .8em; }

/* Panneaux « verre » */
.card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    backdrop-filter: blur(10px);
}
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.split { display: grid; gap: 20px; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
section.block { margin-top: 56px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head p { margin: 0; color: var(--muted); max-width: 720px; }

/* Onglets */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 28px 0 22px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; width: fit-content; max-width: 100%; }
.tabs button { border: 0; background: none; padding: 9px 16px; font: inherit; font-size: .95rem; color: var(--muted); cursor: pointer; border-radius: 999px; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--sun); color: #1b1305; font-weight: 700; }
.tab-panel[hidden] { display: none; }
@media (max-width: 640px) { .tabs { border-radius: 16px; } }

/* Formulaires */
label.field { display: grid; gap: 6px; font-size: .92rem; font-weight: 600; margin-bottom: 14px; color: var(--ink-2); }
label.field small { font-weight: 400; color: var(--muted); }
input[type="number"], input[type="text"], select, textarea {
    width: 100%; font: inherit; font-weight: 400; color: var(--ink); background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; min-height: 42px;
}
select option { background: var(--surface-solid); color: var(--ink); }
textarea { font-family: var(--mono); font-size: .88rem; line-height: 1.5; resize: vertical; min-height: 170px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(255, 181, 71, 0.5); outline-offset: 1px; border-color: var(--sun); }
input[type="range"] { width: 100%; accent-color: var(--sun); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox { display: flex; gap: 8px; align-items: center; font-size: .92rem; margin-bottom: 12px; color: var(--ink-2); }
.checkbox input { accent-color: var(--sun); }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px;
    border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
    font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: border-color .15s, background .15s;
}
.btn:hover { border-color: rgba(255, 255, 255, 0.3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--sun); border-color: var(--sun); color: #1b1305; }
.btn.primary:hover { background: #ffc566; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: .88rem; }
.btn.icon { width: 42px; padding: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Résultats */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.kpi .label { font-size: .78rem; color: var(--muted); }
.kpi .value { font-family: var(--display); font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .unit { font-family: var(--font); font-size: .8rem; color: var(--muted); font-weight: 400; margin-left: 3px; }
.chart-box { position: relative; height: 360px; }
@media (max-width: 600px) { .chart-box { height: 280px; } }

table.data { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
table.data tr.best td { background: var(--ok-soft); }
.table-wrap { overflow-x: auto; }

.note { border-radius: 14px; padding: 12px 14px; font-size: .92rem; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.note.warn { background: var(--warn-soft); border-color: rgba(255, 196, 77, 0.3); color: var(--warn); }
.note.bad { background: var(--bad-soft); border-color: rgba(255, 120, 95, 0.3); color: var(--bad); }
.note.ok { background: var(--ok-soft); border-color: rgba(80, 220, 150, 0.3); color: var(--ok); }
.badge { display: inline-block; font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); width: fit-content; }
.badge.zn { background: rgba(45, 212, 191, 0.15); color: var(--zn); }
.badge.mg { background: rgba(251, 146, 60, 0.15); color: var(--mg); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
ul.clean, ol.clean { padding-left: 20px; margin: 0; }
ul.clean li, ol.clean li { margin-bottom: 8px; color: var(--ink-2); }

/* ── Accueil : photoréacteur 3D ─────────────────────────────────────────── */
.hero3d { position: relative; margin-top: -40px; }
.stage-wrap { position: relative; }
.hero3d-intro { padding: 56px 0 24px; max-width: 820px; }
.hero3d-intro h1 span { color: var(--sun); }
.stage {
    position: relative; height: min(78vh, 720px); min-height: 480px;
    border: 1px solid var(--line); border-radius: 28px; overflow: hidden;
    background: radial-gradient(ellipse at 50% 0%, #1b2440 0%, #0a0f1d 55%, #060912 100%);
}
.stage canvas.three { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; cursor: grab; }
.stage canvas.three:active { cursor: grabbing; }
.hud {
    position: absolute; z-index: 2; background: rgba(8, 12, 24, 0.72); border: 1px solid var(--line);
    border-radius: 18px; padding: 16px; backdrop-filter: blur(12px);
}
.hud-controls { left: 16px; top: 16px; width: 300px; }
.hud-chart { right: 16px; bottom: 16px; width: min(420px, calc(100% - 32px)); }
.hud-chart .chart-box { height: 170px; }
.hud-time { right: 16px; top: 16px; text-align: right; }
.hud-time .clock { font-family: var(--display); font-size: 2.4rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.hud-time .clock small { font-size: 1rem; color: var(--muted); font-weight: 500; }
.hud-time .phase { font-size: .85rem; color: var(--sun); margin-top: 4px; }
.hud .kpis { grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0 0; }
.hud .kpi { padding: 8px 10px; }
.hud .kpi .value { font-size: 1.15rem; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; background: rgba(0, 0, 0, 0.3); border-radius: 999px; margin-bottom: 12px; }
.seg button { border: 0; border-radius: 999px; padding: 8px; font: inherit; font-size: .9rem; font-weight: 600; color: var(--muted); background: none; cursor: pointer; }
.seg button[aria-pressed="true"].zn { background: var(--zn); color: #04221e; }
.seg button[aria-pressed="true"].mg { background: var(--mg); color: #2a1102; }
.legend3d { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--muted); margin-top: 10px; }
.legend3d i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
@media (max-width: 900px) {
    .stage { height: 58vh; min-height: 360px; }
    .stage-wrap > .hud { position: static; width: auto; margin-top: 12px; }
    .hud-time { right: 12px; top: 12px; padding: 10px 12px; }
    .hud-time .clock { font-size: 1.6rem; }
}
.scene-label {
    position: absolute; z-index: 1; pointer-events: none; white-space: nowrap; transform: translate(-50%, -50%);
    font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
    background: rgba(6, 9, 18, 0.62); border: 1px solid rgba(255, 255, 255, 0.14); color: #fff;
    opacity: 0; transition: opacity .4s; text-shadow: 0 1px 2px #000;
}
.scene-label.sun { color: #ffd27a; border-color: rgba(255, 181, 71, 0.45); }
.scene-label.cat { color: #fff7c2; }
.scene-label.rad { color: #7ee8ff; border-color: rgba(126, 232, 255, 0.4); }
.scene-label.gas { color: #dff6ff; }
@media (max-width: 600px) { .scene-label { font-size: .68rem; padding: 2px 7px; } }
.viewer { position: relative; height: 440px; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); background: radial-gradient(ellipse at 50% 30%, #18213a, #070b16 75%); }
.viewer canvas { width: 100% !important; height: 100% !important; display: block; cursor: grab; }
.viewer .overlay { position: absolute; left: 14px; bottom: 12px; font-size: .82rem; color: var(--muted); pointer-events: none; }
.viewer .axis-label { position: absolute; font-size: .78rem; color: var(--ink-2); pointer-events: none; white-space: nowrap; transform: translate(-50%, -50%); text-shadow: 0 1px 3px #000; }

/* Cartes de modules */
.module-card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; transition: border-color .2s, transform .2s; }
.module-card:hover { border-color: rgba(255, 181, 71, 0.55); transform: translateY(-3px); }
.module-card .num { font-family: var(--display); color: var(--sun); font-size: .9rem; font-weight: 700; }
.module-card p { color: var(--muted); margin: 0; }
.module-card .go { margin-top: auto; color: var(--sun); font-weight: 600; font-size: .92rem; }
.paper { display: grid; gap: 6px; }
.paper .meta { color: var(--muted); font-size: .9rem; }
.steps { counter-reset: s; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps li { list-style: none; position: relative; padding: 18px 18px 18px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.steps li::before { counter-increment: s; content: "0" counter(s); display: block; font-family: var(--display); font-weight: 700; color: var(--sun); font-size: 1.6rem; margin-bottom: 6px; }
.steps strong { color: var(--ink); }

.site-footer { border-top: 1px solid var(--line); padding: 28px 0 44px; color: var(--muted); font-size: .88rem; }

/* Diagramme de bandes */
.band-svg { width: 100%; height: auto; max-height: 460px; }
.band-svg text { fill: var(--ink); font-family: var(--font); }

:focus-visible { outline: 2px solid var(--sun); outline-offset: 2px; }
