/* Page, HUD hors écran, châssis de l'écran et interface du poste.
   Les démos d'injects (qui imitent chacune leur média) sont dans injects.css.
   Dans #screen tout est en em : scene.js règle font-size selon la taille de la dalle. */
:root {
  color-scheme: dark;
  --ink: #04060a;
  --coal: #0b0e13;
  --graph: #141920;
  --graph-2: #1c222b;
  --line: rgba(150, 170, 205, .14);
  --line-2: rgba(150, 170, 205, .28);
  --text: #e6e9ee;
  --dim: #909aa9;
  --faint: #5f6876;
  --blue: #4b84ff;
  --blue-soft: rgba(75, 132, 255, .14);
  --red: #f0483e;
  --red-soft: rgba(240, 72, 62, .14);
  --term: #45e08a;
  --brass: #c9a86c;
  --ui: "Hanken Grotesk", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --display: "Bodoni Moda", Didot, "Bodoni 72", Georgia, serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden; background: #020308; color: var(--text);
  font-family: var(--ui); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
body.dragging #gl { cursor: grabbing; }
body.no-gl { background: radial-gradient(120% 90% at 30% 20%, #0c1428 0%, #020308 70%); }
body.no-gl #gl { display: none; }

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.hud > * { pointer-events: auto; }
.power {
  position: absolute; left: clamp(20px, 6vw, 96px); bottom: clamp(28px, 9vh, 96px); max-width: 31rem;
  transition: opacity .7s ease, transform .7s ease;
}
.power::before {
  content: ""; position: absolute; inset: -6rem -8rem -8rem -10rem; z-index: -1; pointer-events: none;
  background: radial-gradient(60% 60% at 35% 60%, rgba(2, 3, 8, .82), transparent 75%);
}
.power h1 {
  margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(1.75rem, 1.1rem + 2vw, 2.9rem);
  line-height: 1.08; letter-spacing: -.01em; text-wrap: balance;
}
.power p { margin: 1rem 0 1.6rem; color: #b4bcc9; font-size: 1.02rem; line-height: 1.5; max-width: 27rem; }
.power-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.4rem; }
.btn-on {
  border: 1px solid rgba(255, 255, 255, .85); background: #f1f3f6; color: #05070b; font-weight: 600;
  padding: .8rem 1.5rem; border-radius: 2px; font-size: 1rem; transition: background .2s, transform .2s;
}
.btn-on:hover { background: #fff; transform: translateY(-1px); }
.btn-quiet { background: none; border: 0; color: #aab3c0; padding: .5rem 0; text-decoration: underline; text-underline-offset: .25em; text-decoration-color: rgba(170, 179, 192, .4); }
.btn-quiet:hover { color: #fff; }
body.powered .power { opacity: 0; transform: translateY(12px); pointer-events: none; }

.hint {
  position: absolute; left: 50%; bottom: clamp(14px, 3.5vh, 36px); transform: translateX(-50%); margin: 0;
  padding: .55rem 1rem; font-size: .84rem; color: #c5ccd7; background: rgba(4, 6, 10, .72); border: 1px solid var(--line);
  border-radius: 99px; backdrop-filter: blur(6px); white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
  pointer-events: none; transition: opacity .4s;
}
body.docked .hint { opacity: 0; }
.skip {
  position: absolute; right: clamp(16px, 3vw, 40px); bottom: clamp(14px, 3.5vh, 36px);
  background: rgba(4, 6, 10, .6); border: 1px solid var(--line-2); color: #c5ccd7; padding: .5rem .95rem; border-radius: 99px; font-size: .84rem;
}
.skip:hover { color: #fff; border-color: rgba(255, 255, 255, .5); }
.portal {
  position: absolute; top: 14px; right: 16px; color: #007AFF; text-decoration: none; font-size: .9rem;
  background: rgba(4, 6, 10, .6); padding: .35rem .7rem; border-radius: 99px; border: 1px solid var(--line);
}
.noscript { position: fixed; inset: auto 0 0 0; margin: 0; padding: 1rem; text-align: center; background: #0b0e13; }

/* ---------- Châssis de l'écran ---------- */
#stage { position: fixed; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
#screen {
  position: absolute; left: 0; top: 0; width: 1280px; height: 800px; font-size: 16px;
  transform-origin: 0 0; pointer-events: auto; overflow: hidden; border-radius: .55em;
  background: var(--ink); container: scr / size;
  box-shadow: 0 0 5em rgba(70, 120, 255, .16), 0 0 1.2em rgba(70, 120, 255, .12);
  backface-visibility: hidden;
}
body:not(.docked) #screen { cursor: zoom-in; }
body:not(.docked) #screen * { pointer-events: none; }
body.takeover #screen {
  position: fixed; inset: 0; width: 100vw; height: 100dvh; font-size: 15px; border-radius: 0; box-shadow: none;
  animation: takeover-in .35s ease both;
}
@keyframes takeover-in { from { opacity: 0; transform: scale(.96); } }

/* Dalle allumée : reflet qui glisse avec l'angle de vue, trame très fine, coins assombris */
.glass {
  position: absolute; inset: 0; pointer-events: none; z-index: 60; border-radius: inherit;
  background:
    linear-gradient(104deg, transparent calc(var(--glare, 22%) - 26%), rgba(255, 255, 255, .05) var(--glare, 22%), transparent calc(var(--glare, 22%) + 26%)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .022) 0 1px, transparent 1px 3px);
  box-shadow: inset 0 0 5em rgba(0, 0, 0, .4);
  transition: opacity .5s;
}
body.dock-settled .glass { opacity: .4; }
body.takeover .glass { display: none; }

/* ---------- Système ---------- */
.os { position: absolute; inset: 0; font-size: 1em; line-height: 1.45; }
.os[data-state="off"] > * { display: none; }
.bios, .login, .desk { position: absolute; inset: 0; display: none; }
.os[data-state="bios"] .bios { display: block; }
.os[data-state="login"] .login { display: flex; }
.os[data-state="desk"] .desk { display: grid; }
.os[data-state="bios"] { animation: crt-on .5s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes crt-on {
  0% { transform: scaleY(.004) scaleX(.4); filter: brightness(8); }
  45% { transform: scaleY(.004) scaleX(1); filter: brightness(8); }
  100% { transform: none; filter: none; }
}

.bios { padding: 2.2em 2.6em; font-family: var(--mono); font-size: .86em; color: #b9c2cf; white-space: pre-wrap; line-height: 1.75; }
.bios .ok { color: var(--term); }
.bios .l0 { color: #fff; font-weight: 500; margin-bottom: 1.2em; display: block; }
.bios .cursor { display: inline-block; width: .55em; height: 1.05em; background: var(--term); vertical-align: -.15em; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.login { flex-direction: column; align-items: center; justify-content: center; gap: .9em; background: radial-gradient(70% 60% at 50% 40%, #0d1424 0%, var(--ink) 75%); }
.login-ring { width: 5.2em; height: 5.2em; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; }
.login-ring span { font-family: var(--display); font-size: 1.9em; color: var(--text); }
.login-user { font-family: var(--mono); font-size: .86em; color: var(--dim); }
.login-pass { height: 2.3em; min-width: 13em; border: 1px solid var(--line-2); border-radius: 2px; display: flex; align-items: center; justify-content: center; gap: .32em; background: rgba(255, 255, 255, .02); }
.login-pass i { width: .42em; height: .42em; border-radius: 50%; background: var(--text); }
.login-pass.ok { border-color: var(--term); }
.login-greet { margin-top: 1.4em; font-size: .92em; color: var(--dim); letter-spacing: .02em; opacity: 0; transition: opacity .6s; }
.login-greet.on { opacity: 1; }

/* ---------- Bureau : barre et vue ---------- */
.desk { grid-template-rows: auto minmax(0, 1fr); background: var(--ink); animation: desk-in .5s ease both; }
@keyframes desk-in { from { opacity: 0; } }
.bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1em;
  height: 3em; padding: 0 1em 0 1.1em; background: var(--coal); border-bottom: 1px solid var(--line);
}
.bar-brand { display: flex; align-items: center; gap: .6em; min-width: 0; white-space: nowrap; }
.mark { width: .8em; height: .8em; background: linear-gradient(135deg, var(--blue) 0 50%, var(--red) 50% 100%); flex: none; }
.bar-name { font-weight: 650; letter-spacing: .01em; }
.bar-scn { color: var(--dim); font-size: .86em; overflow: hidden; text-overflow: ellipsis; }
.bar-nav { display: flex; gap: .15em; height: 100%; }
.bar-nav button {
  background: none; border: 0; padding: 0 .95em; height: 100%; color: var(--dim); font-size: .92em; font-weight: 500;
  position: relative; transition: color .15s;
}
.bar-nav button:hover { color: var(--text); }
.bar-nav button[aria-current="page"] { color: #fff; }
.bar-nav button[aria-current="page"]::after { content: ""; position: absolute; left: .95em; right: .95em; bottom: -1px; height: 2px; background: var(--blue); }
.bar-right { display: flex; align-items: center; justify-content: flex-end; gap: .35em; }
.xclock { font-family: var(--mono); font-size: .8em; color: var(--text); display: inline-flex; align-items: center; gap: .55em; margin-right: .6em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.live { width: .5em; height: .5em; border-radius: 50%; background: var(--red); box-shadow: 0 0 .6em var(--red); animation: live 1.6s ease-in-out infinite; }
@keyframes live { 50% { opacity: .35; } }
.ico { width: 2.1em; height: 2.1em; display: grid; place-items: center; background: none; border: 1px solid transparent; border-radius: 3px; color: var(--dim); }
.ico:hover { color: #fff; border-color: var(--line-2); }
.ico svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#btnSound[aria-pressed="true"] .mute, #btnSound[aria-pressed="false"] .waves { display: none; }

.views { position: relative; min-height: 0; overflow: hidden; }
.view { position: absolute; inset: 0; overflow: auto; padding: 2em 2.4em 2.2em; display: none; scrollbar-width: thin; scrollbar-color: var(--graph-2) transparent; }
.view.on { display: block; animation: view-in .28s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(.35em); } }
.view h2 { font-family: var(--display); font-weight: 400; font-size: 2.7em; line-height: 1.06; letter-spacing: -.012em; margin: 0; text-wrap: balance; }
.view h3 { font-size: 1em; font-weight: 600; margin: 0 0 .8em; }
.lead { font-size: 1.08em; line-height: 1.55; color: #cfd5de; max-width: 62ch; margin: 1.1em 0 0; }
:where(.os) p { margin: 0; }
.btn {
  display: inline-flex; align-items: center; gap: .6em; background: var(--blue); color: #fff; border: 0; border-radius: 2px;
  padding: .7em 1.2em; font-weight: 600; font-size: .95em; transition: background .15s, transform .15s;
}
.btn:hover { background: #6397ff; transform: translateY(-1px); }
.link { background: none; border: 0; padding: 0; color: var(--blue); text-decoration: underline; text-underline-offset: .22em; text-decoration-color: rgba(75, 132, 255, .45); }
.link:hover { color: #86adff; }

/* Contact */
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 3.4em; align-items: start; }
.contact .kv { margin-top: 1.6em; }
.kv { display: grid; grid-template-columns: 7em 1fr; gap: .2em 1em; font-size: .93em; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; color: #cfd5de; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 1em 1.1em; border: 1px solid var(--line); background: var(--coal); padding: 1.6em; border-radius: 3px; }
.form label { display: grid; gap: .35em; font-size: .84em; color: var(--dim); }
.form .wide { grid-column: 1 / -1; }
.form input, .form select, .form textarea {
  background: var(--ink); border: 1px solid var(--line-2); border-radius: 2px; padding: .62em .7em; font-size: 1.12em; color: var(--text); width: 100%;
}
.form textarea { min-height: 5.6em; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.form .btn { justify-self: start; }
.form-note { font-size: .8em; color: var(--faint); }
.form-sent { color: var(--term); font-size: .9em; }

/* Décrochage bref de l'image au lancement d'un inject */
.os.glitch .desk { animation: glitch .42s steps(2, end); }
@keyframes glitch {
  0% { clip-path: inset(12% 0 58% 0); transform: translateX(-.5em); filter: hue-rotate(40deg) saturate(2); }
  25% { clip-path: inset(62% 0 8% 0); transform: translateX(.6em); }
  50% { clip-path: inset(30% 0 36% 0); transform: translateX(-.3em); filter: none; }
  75% { clip-path: inset(4% 0 80% 0); transform: translateX(.4em); }
  100% { clip-path: none; transform: none; }
}

/* ---------- Écran étroit (mode plein écran sur mobile) ---------- */
@container scr (max-width: 760px) {
  .bar { grid-template-columns: 1fr auto; height: auto; padding: .55em .8em 0; row-gap: .2em; }
  .bar-scn { display: none; }
  .bar-nav { grid-column: 1 / -1; grid-row: 2; overflow-x: auto; height: 2.5em; margin: 0 -.8em; padding: 0 .3em; scrollbar-width: none; }
  .bar-nav button { padding: 0 .75em; flex: none; }
  .bar-nav button[aria-current="page"]::after { left: .75em; right: .75em; }
  .view { padding: 1.4em 1.1em 2em; }
  .view h2 { font-size: 2.05em; }
  .contact, .form { grid-template-columns: minmax(0, 1fr); }
  .contact { gap: 1.8em; }
  .kv { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .hint { white-space: normal; text-align: center; border-radius: 12px; width: calc(100vw - 32px); }
  .skip { bottom: auto; top: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
