/* =========================================================
   SOMENTRAV — page de connexion
   Ported from the owner's approved example (login_example.zip).

   The layout is ordinary responsive flow — nothing is transform-scaled —
   and THE PAGE NEVER SCROLLS. Every vertical gap and the logo take a vh
   component in their clamp(), so on a short viewport the air shrinks
   before the content ever reaches the edge; below 620px of height the
   discipline pillars (context, not function) are dropped, as on phones.
   The vh clamps are budgeted for the shortest laptop (768px tall) WITH
   the pillars visible; verified by measuring the column at 800, 768,
   900, 1080 and 1440 of height.

   The only motion is on the photo itself: the workshop's lamps stutter on
   like real fluorescent tubes, then the cars' optics glow. Everything is
   keyframed from load; prefers-reduced-motion switches it all off.

   THEMES: the example ships a dark file and a light file; here they are one
   markup and two token sets. Base tokens are DARK (the agreed design);
   [data-theme] and prefers-color-scheme pick the set. The CTA stays the
   same blue in both themes on the owner's earlier rule — the light example
   had it orange, normalised here; one word restores it.
   ========================================================= */

:root{
  --blue:#1f6fe0;
  --blue-hi:#2f8dfb;
  --ember:#ff5a1f;
  --ease:cubic-bezier(.2,.7,.25,1);

  /* ---------- DARK — the agreed design (default) ---------- */
  --page:#04070f;          --bg:#03060d;
  --text:#eef4fb;          --muted:#98adc6;
  --lede:#b3c4d9;
  --photo:url("/img/automotive_workshop_blue_high_res.webp");
  --pf0:brightness(.44) saturate(.88) contrast(1.04);
  --pf1:brightness(.92) saturate(1.1) contrast(1.05);
  --scrim:
    radial-gradient(58% 64% at 50% 47%,rgba(3,6,13,.52) 0%,rgba(3,6,13,.30) 55%,transparent 78%),
    radial-gradient(130% 110% at 50% 45%,transparent 40%,rgba(3,6,13,.82) 100%),
    linear-gradient(180deg,rgba(3,6,13,.55) 0%,rgba(3,6,13,.12) 30%,rgba(3,6,13,.12) 62%,rgba(3,6,13,.66) 100%);
  --lamp1:214,240,255;     --lamp2:92,176,255;   --lamp3:40,120,235;
  --tail:255,40,52;
  --dots:rgba(150,190,240,.55);
  --logo:url("/img/somentrav-logo-dark-mode.png");
  --logo-sh:drop-shadow(0 10px 30px rgba(12,60,140,.45));
  --hex-bg:rgba(31,111,224,.14);
  --hex-grad:linear-gradient(160deg,rgba(110,180,255,.75),rgba(110,180,255,.12));
  --hex-ink:#4f9dfb;
  --legal:rgba(152,173,198,.6);
  --card-bg:linear-gradient(180deg,rgba(16,30,54,.72),rgba(7,14,28,.86));
  --card-line:rgba(120,175,255,.18);
  --card-sh:0 36px 80px -26px rgba(0,0,0,.85),inset 0 1px 0 rgba(160,205,255,.14);
  --field-line:rgba(120,170,235,.2);
  --field-bg:rgba(9,18,34,.55);
  --field-bg-f:rgba(13,27,50,.7);
  --field-line-f:rgba(47,141,251,.7);
  --label:#d3e2f5;
  --ph:rgba(152,173,198,.55);
  --peek-h:#8fd4ff;
  --check:#c3d4e8;
  --box-line:rgba(120,170,235,.45); --box-bg:rgba(9,18,34,.7);
  --status-ok:#8fd4ff;  --status-ko:#ff8f5f;
}

/* ---------- LIGHT ---------- */
@media (prefers-color-scheme:light){
  :root:not([data-theme=dark]){
    --page:#eef3f9;          --bg:#e9eef5;
    --text:#0d1c31;          --muted:#5a708c;
    --lede:#41556f;
    --photo:url("/img/automotive_workshop_high_res.webp");
    --pf0:brightness(.86) saturate(.9) contrast(1.02);
    --pf1:brightness(1.04) saturate(1.02) contrast(1.03);
    --scrim:
      radial-gradient(58% 64% at 50% 47%,rgba(240,245,251,.55) 0%,rgba(240,245,251,.32) 55%,transparent 78%),
      radial-gradient(130% 110% at 50% 45%,transparent 40%,rgba(230,238,248,.72) 100%),
      linear-gradient(180deg,rgba(240,245,251,.6) 0%,rgba(240,245,251,.16) 30%,rgba(240,245,251,.16) 62%,rgba(238,244,251,.7) 100%);
    --lamp1:255,253,244;     --lamp2:196,224,255;  --lamp3:150,200,255;
    --tail:255,46,40;
    --dots:rgba(30,80,150,.35);
    --logo:url("/img/somentrav-logo-light-mode.png");
    --logo-sh:drop-shadow(0 8px 22px rgba(12,60,140,.18));
    --hex-bg:rgba(31,111,224,.10);
    --hex-grad:linear-gradient(160deg,rgba(31,111,224,.65),rgba(31,111,224,.16));
    --hex-ink:#1f6fe0;
    --legal:rgba(70,95,125,.65);
    --card-bg:linear-gradient(180deg,rgba(255,255,255,.94),rgba(250,252,255,.9));
    --card-line:rgba(18,58,116,.10);
    --card-sh:0 30px 70px -28px rgba(13,40,80,.42),0 2px 6px -2px rgba(13,40,80,.12),inset 0 1px 0 rgba(255,255,255,.9);
    --field-line:rgba(18,58,116,.22);
    --field-bg:#fff;
    --field-bg-f:#fff;
    --field-line-f:rgba(31,111,224,.65);
    --label:#16304f;
    --ph:rgba(90,112,140,.6);
    --peek-h:var(--blue);
    --check:#33506f;
    --box-line:rgba(18,58,116,.22);   --box-bg:#fff;
    --status-ok:#0f5fc4;  --status-ko:#d13d02;
  }
}
:root[data-theme=light]{
  --page:#eef3f9;          --bg:#e9eef5;
  --text:#0d1c31;          --muted:#5a708c;
  --lede:#41556f;
  --photo:url("/img/automotive_workshop_high_res.webp");
  --pf0:brightness(.86) saturate(.9) contrast(1.02);
  --pf1:brightness(1.04) saturate(1.02) contrast(1.03);
  --scrim:
    radial-gradient(58% 64% at 50% 47%,rgba(240,245,251,.55) 0%,rgba(240,245,251,.32) 55%,transparent 78%),
    radial-gradient(130% 110% at 50% 45%,transparent 40%,rgba(230,238,248,.72) 100%),
    linear-gradient(180deg,rgba(240,245,251,.6) 0%,rgba(240,245,251,.16) 30%,rgba(240,245,251,.16) 62%,rgba(238,244,251,.7) 100%);
  --lamp1:255,253,244;     --lamp2:196,224,255;  --lamp3:150,200,255;
  --tail:255,46,40;
  --dots:rgba(30,80,150,.35);
  --logo:url("/img/somentrav-logo-light-mode.png");
  --logo-sh:drop-shadow(0 8px 22px rgba(12,60,140,.18));
  --hex-bg:rgba(31,111,224,.10);
  --hex-grad:linear-gradient(160deg,rgba(31,111,224,.65),rgba(31,111,224,.16));
  --hex-ink:#1f6fe0;
  --legal:rgba(70,95,125,.65);
  --card-bg:linear-gradient(180deg,rgba(255,255,255,.94),rgba(250,252,255,.9));
  --card-line:rgba(18,58,116,.10);
  --card-sh:0 30px 70px -28px rgba(13,40,80,.42),0 2px 6px -2px rgba(13,40,80,.12),inset 0 1px 0 rgba(255,255,255,.9);
  --field-line:rgba(18,58,116,.22);
  --field-bg:#fff;
  --field-bg-f:#fff;
  --field-line-f:rgba(31,111,224,.65);
  --label:#16304f;
  --ph:rgba(90,112,140,.6);
  --peek-h:var(--blue);
  --check:#33506f;
  --box-line:rgba(18,58,116,.22);   --box-bg:#fff;
  --status-ok:#0f5fc4;  --status-ko:#d13d02;
}

*{box-sizing:border-box}
html,body{height:100%;overflow:hidden}
body{
  margin:0;height:100dvh;background:var(--page);color:var(--text);
  font-family:"IBM Plex Sans","Inter",system-ui,-apple-system,"Segoe UI",sans-serif;
  -webkit-font-smoothing:antialiased;overscroll-behavior:none;
}

/* ---------- FOND : photo + lumières alignées sur la photo ---------- */
.bg{position:fixed;inset:0;overflow:hidden;z-index:0;background:var(--bg)}
.bg__frame{
  position:absolute;top:50%;left:50%;
  width:100%;height:56.25vw;min-height:100%;min-width:177.78vh;
  transform:translate(-50%,-50%);
}
.bg__photo{
  position:absolute;inset:0;
  background:var(--photo) center/cover no-repeat;
  filter:var(--pf0);
  animation:wake 2s .35s var(--ease) both;
}
@keyframes wake{ from{ filter:var(--pf0) } to{ filter:var(--pf1) } }

/* lampes de l'atelier */
.lamp{
  position:absolute;left:var(--x);top:var(--y);width:var(--w);height:var(--h);
  transform:translate(-50%,-50%) rotate(var(--r,0deg));
  background:radial-gradient(ellipse at center,
    rgba(var(--lamp1),var(--i,.9)) 0%,
    rgba(var(--lamp2),calc(var(--i,.9)*.5)) 38%,
    rgba(var(--lamp3),0) 72%);
  filter:blur(var(--b,16px));mix-blend-mode:screen;opacity:0;
  animation:ignite 1.15s var(--d,0s) both;
}
.lamp.tremble{
  animation:ignite 1.15s var(--d,0s) both,
            hum var(--hd,7s) calc(var(--d,0s) + 1.3s) infinite ease-in-out;
}
@keyframes ignite{
  0%{opacity:0} 6%{opacity:.85} 9%{opacity:.04}
  16%{opacity:.6} 20%{opacity:0} 27%{opacity:1} 31%{opacity:.12}
  38%{opacity:.92} 42%{opacity:.35} 55%{opacity:1} 100%{opacity:1}}
@keyframes hum{0%,100%{opacity:1}42%{opacity:.84}44%{opacity:.98}46%{opacity:.7}49%{opacity:1}76%{opacity:.91}}

/* optiques des voitures */
.optic{
  position:absolute;left:var(--x);top:var(--y);width:var(--w);height:var(--h);
  transform:translate(-50%,-50%);border-radius:999px;
  background:radial-gradient(ellipse at center,
    rgba(var(--tail),.95) 0%,
    rgba(var(--tail),.42) 34%,
    rgba(var(--tail),0) 72%);
  filter:blur(var(--b,6px));mix-blend-mode:screen;opacity:0;
  animation:opticOn .6s var(--d,1.7s) both,
            glow 4.8s calc(var(--d,1.7s) + .6s) infinite ease-in-out;
}
@keyframes opticOn{0%{opacity:0;filter:blur(20px)}60%{opacity:1}100%{opacity:1;filter:blur(var(--b,6px))}}
@keyframes glow{0%,100%{opacity:.76}50%{opacity:1}}

/* voile de lisibilité */
.scrim{ position:absolute;inset:0;pointer-events:none;background:var(--scrim) }

/* ---------- COMPOSITION CENTRÉE, EN FLUX ----------
   The column is centred while the viewport is taller than the content;
   min-height (never height) means a short viewport gets page scroll, and
   the content is never compressed to fit. */
.canvas{
  position:relative;z-index:2;
  height:100dvh;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  padding:clamp(10px,6vh - 30px,48px) clamp(16px,4vw,64px);
  text-align:center;
}
.canvas > *{flex:none;}

.logo{
  width:clamp(200px,15vw + 80px,340px);
  height:clamp(84px,24vh - 76px,205px);
  margin:0 auto clamp(6px,4vh - 20px,28px);
  background:var(--logo) center/contain no-repeat;
  filter:var(--logo-sh);
  animation:up .8s .1s var(--ease) both}
@keyframes up{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}

.pillars{
  display:flex;flex-wrap:wrap;justify-content:center;
  max-width:720px;
  gap:clamp(24px,3vh,40px) clamp(24px,3vw,45px);
  margin-top:clamp(14px,7vh - 30px,72px);
}
.pillar{width:clamp(170px,12vw,210px);text-align:center}
.hex{
  width:50px;height:56px;display:grid;place-items:center;margin:0 auto clamp(6px,2.5vh - 10px,16px);
  clip-path:polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);
  background:var(--hex-bg);position:relative;
}
.hex::before{
  content:"";position:absolute;inset:0;padding:1.4px;
  clip-path:polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);
  background:var(--hex-grad);
  -webkit-mask:linear-gradient(#000,#000) content-box,linear-gradient(#000,#000);
  mask:linear-gradient(#000,#000) content-box,linear-gradient(#000,#000);
  -webkit-mask-composite:xor;mask-composite:exclude;
}
.hex svg{width:22px;height:22px;stroke:var(--hex-ink);fill:none;stroke-width:1.7;position:relative}
.hex svg.bolt{stroke:none;fill:var(--hex-ink)}
.pillar h2{font-size:13.5px;font-weight:700;letter-spacing:.13em;text-transform:uppercase;margin:0 0 9px}
.pillar p{margin:0;font-size:12.5px;line-height:1.5;color:var(--muted)}

.legal{font-size:12px;color:var(--legal);margin:clamp(12px,3.5vh - 12px,32px) 0 0;letter-spacing:.02em}
.reveal{animation:up .8s var(--rd,.3s) var(--ease) both}

/* ---------- CARTE DE CONNEXION ---------- */
.card{
  width:min(100%,clamp(380px,24vw + 96px,560px));
  padding:clamp(15px,4.5vh - 14px,38px) clamp(22px,2.5vw,40px) clamp(13px,4vh - 12px,32px);
  border-radius:20px;text-align:left;
  background:var(--card-bg);
  -webkit-backdrop-filter:blur(20px) saturate(140%);
  backdrop-filter:blur(20px) saturate(140%);
  border:1px solid var(--card-line);
  box-shadow:var(--card-sh);
  animation:up .85s .35s var(--ease) both;
}
.card h2{font-size:clamp(22px,2vh + 8px,30px);font-weight:600;text-align:center;margin:0 0 6px;letter-spacing:-.01em}
.card .sub{margin:0 0 clamp(9px,3.5vh - 14px,26px);text-align:center;color:var(--muted);font-size:clamp(13px,.3vw + 9px,14.5px);line-height:1.5}

.field{margin-bottom:clamp(9px,3vh - 11px,20px);text-align:left}
.field__label{display:block;padding:0 2px 7px;font-size:13.5px;font-weight:500;color:var(--label)}
.field__row{
  display:flex;align-items:center;padding:0 16px;
  border:1px solid var(--field-line);border-radius:10px;
  background:var(--field-bg);
  transition:border-color .2s var(--ease),box-shadow .2s var(--ease),background .2s var(--ease);
}
.field__row:focus-within{
  border-color:var(--field-line-f);background:var(--field-bg-f);
  box-shadow:0 0 0 3px rgba(31,111,224,.15);
}
.field input{
  flex:1;min-width:0;border:0;background:transparent;outline:none;
  color:var(--text);font-family:inherit;font-size:15px;
  min-height:48px;
}
.field input::placeholder{color:var(--ph)}
.field input:-webkit-autofill{-webkit-text-fill-color:var(--text);transition:background-color 9999s}
.peek{border:0;background:transparent;padding:2px;margin-left:8px;cursor:pointer;color:var(--muted);display:grid;place-items:center;transition:color .2s}
.peek:hover{color:var(--peek-h)}
.peek svg{width:19px;height:19px;stroke:currentColor;fill:none;stroke-width:1.6}
.peek .off{display:none}
.peek.is-on .on{display:none}
.peek.is-on .off{display:block}

.row{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin:4px 0 clamp(10px,3.5vh - 13px,26px)}
.check{display:inline-flex;align-items:center;gap:9px;cursor:pointer;font-size:13.5px;color:var(--check);user-select:none;white-space:nowrap}
.check input{position:absolute;opacity:0;width:0;height:0}
.box{width:16px;height:16px;border-radius:4px;flex:none;border:1px solid var(--box-line);background:var(--box-bg);display:grid;place-items:center;transition:all .18s var(--ease)}
.box svg{width:10px;height:10px;stroke:#fff;fill:none;stroke-width:2.8;opacity:0;transition:opacity .18s}
.check input:checked + .box{background:var(--blue);border-color:var(--blue)}
.check input:checked + .box svg{opacity:1}
.check input:focus-visible + .box{outline:2px solid var(--blue-hi);outline-offset:2px}
/* there is no reset flow, so this is a sentence, never a link */
.hint{margin:1px 0 0;max-width:185px;text-align:right;font-size:12.5px;line-height:1.45;color:var(--muted)}

/* the CTA stays the same blue in both themes — the brand does not change
   with the theme (the light example's orange was normalised on that rule) */
.cta{
  position:relative;width:100%;height:52px;border:0;border-radius:10px;cursor:pointer;overflow:hidden;
  background:linear-gradient(100deg,#1656c4,#2a86f2 55%,#1d6fe0);color:#fff;
  font-family:inherit;font-size:14px;font-weight:600;letter-spacing:.16em;text-transform:uppercase;
  display:flex;align-items:center;justify-content:center;gap:10px;
  box-shadow:0 12px 30px -12px rgba(31,111,224,.9),inset 0 1px 0 rgba(255,255,255,.28);
  transition:transform .18s var(--ease),box-shadow .25s var(--ease);
}
.cta .arrow{position:absolute;right:20px;width:17px;height:17px;stroke:currentColor;fill:none;stroke-width:2;transition:transform .25s var(--ease)}
.cta:hover{transform:translateY(-1px);box-shadow:0 18px 40px -12px rgba(42,134,242,1),inset 0 1px 0 rgba(255,255,255,.32)}
.cta:hover .arrow{transform:translateX(4px)}
.cta:active{transform:none}

.status{margin:0 0 clamp(8px,2vh - 4px,14px);min-height:14px;text-align:center;font-size:12.5px;line-height:1.5;color:var(--muted);opacity:0;transition:opacity .25s}
.status.on{opacity:1}
.status.ok{color:var(--status-ok)}
.status.ko{color:var(--status-ko)}

/* ---------- day / night, above the plan, outside its scale ---------- */
.theme{
  position:fixed;z-index:5;
  top:calc(14px + env(safe-area-inset-top));
  right:calc(14px + env(safe-area-inset-right));
  width:48px;height:48px;display:grid;place-items:center;
  color:var(--muted);background:var(--card-bg);
  border:1px solid var(--card-line);border-radius:12px;cursor:pointer;
  -webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);
  transition:color .15s,transform .1s;
}
.theme:hover{color:var(--text)}
.theme:active{transform:translateY(1px)}
.theme svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:2}
.theme .sun{display:none}
:root[data-theme=dark] .theme .sun{display:block}
:root[data-theme=dark] .theme .moon{display:none}
@media (prefers-color-scheme:dark){
  :root:not([data-theme=light]) .theme .sun{display:block}
  :root:not([data-theme=light]) .theme .moon{display:none}
}

/* ---------- PORTRAIT ÉTROIT : la carte prend la largeur ---------- */
@media (max-width:640px){
  .pillars,.legal{display:none}
  .logo{width:min(62vw,230px)}
  .card{width:100%}
}
/* viewport court : le sous-titre tient sur une ligne, le logo se serre */
@media (max-height:820px){
  .card .sub br{display:none}
  .cta{height:48px}
  .logo{height:clamp(64px,34vh - 160px,205px)}
  .card h2{margin-bottom:4px}
  .hex{margin-bottom:4px}
  .pillar p{font-size:12px;line-height:1.35}
  .pillars{margin-top:12px}
  .legal{margin-top:8px}
  .canvas{padding-top:6px;padding-bottom:6px}
}
/* trop court pour le contexte : les piliers disparaissent, jamais de scroll */
@media (max-height:620px){
  .pillars,.legal{display:none}
}
:focus-visible{outline:2px solid var(--blue-hi);outline-offset:3px;border-radius:6px}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.001ms !important;animation-iteration-count:1 !important;transition-duration:.001ms !important}
  .lamp,.optic,.logo,.card,.reveal{opacity:1 !important;transform:none !important}
  .bg__photo{filter:var(--pf1) !important}
}
