/*
 * Entry of the platform, in the same frame as the website's sign-in pages (one
 * SPS style, 30 Nov 2026): the platform's own calm background, the account
 * chooser in the middle on an opaque card with one hairline. No photograph,
 * nothing moving behind the card. Also used behind the splash, the lock screen
 * and the public pages.
 */
.auth {
  --auth-pad: clamp(1rem, 0.6rem + 2.4vw, 3rem);
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  min-height: 100svh;
}

/* ---------- Backdrop: the platform's own background ---------- */
.auth-backdrop { position: fixed; z-index: -1; inset: 0; background: var(--bg); }

/* ---------- Top, body, foot ---------- */
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: clamp(0.9rem, 0.7rem + 1vw, 1.6rem) var(--auth-pad) 0; }
.auth-brand { display: inline-flex; }
.auth-logo img, .auth-brand img { width: 176px; height: auto; }
.auth-top-actions { display: flex; align-items: center; gap: 0.5rem; }
.auth-back, .auth-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; height: 2.4rem; border: 0; border-radius: 999px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--sep);
  color: var(--label); font: inherit; font-size: var(--t-callout); font-weight: 580; text-decoration: none; cursor: pointer;
  transition: background var(--m-150) var(--ease-out);
}
.auth-back { padding: 0 1rem; }
.auth-icon-btn { width: 2.4rem; }
.auth-icon-btn .i { width: 16px; height: 16px; }
.auth-back:hover, .auth-icon-btn:hover { background: var(--surface-2); }
html[data-theme="dark"] .auth-back, html[data-theme="dark"] .auth-icon-btn { background: rgba(245, 250, 248, 0.06); box-shadow: inset 0 0 0 1px rgba(245, 250, 248, 0.1); }
html[data-theme="dark"] .auth-back:hover, html[data-theme="dark"] .auth-icon-btn:hover { background: rgba(245, 250, 248, 0.12); }

.auth-body { display: grid; place-items: center; padding: clamp(1.25rem, 0.8rem + 3vh, 3rem) var(--auth-pad); }
.auth-card {
  display: grid; gap: 0.95rem; width: min(100%, 31rem); padding: clamp(1.5rem, 1.1rem + 2vw, 2.5rem);
  border-radius: var(--r-xl); background: var(--surface);
  box-shadow: 0 0 0 1px var(--sep), 0 24px 48px -30px rgba(6, 33, 41, 0.28);
}
html[data-theme="dark"] .auth-card { box-shadow: 0 0 0 1px var(--sep-2), 0 24px 48px -28px rgba(0, 0, 0, 0.6); }

.auth-session { display: inline-flex; align-items: center; gap: 0.5rem; justify-self: start; padding: 0.3rem 0.75rem 0.3rem 0.35rem; border-radius: 999px; background: var(--accent-soft); font-size: var(--t-foot); font-weight: 600; color: var(--accent-text); }
/* An icon tile (frame.css): white in the mint capsule, the check in viridian ink. */
.auth-session .i { width: 22px; height: 22px; padding: 4px; border-radius: 7px; background: var(--surface); color: var(--accent-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-text) 22%, transparent); }
.auth-session small { font-weight: 500; color: var(--label-3); }
.auth-session small::before { content: "·"; margin-right: 0.5rem; color: var(--label-4); }
.auth-title { font-size: clamp(1.5rem, 1.3rem + 0.7vw, 1.85rem); font-weight: 620; line-height: 1.15; letter-spacing: -0.022em; text-wrap: balance; }
.auth-lead { margin-top: -0.55rem; color: var(--label-2); font-size: var(--t-callout); line-height: 1.55; }
.auth-group h2 { margin: 0.15rem 0 0.45rem; font-size: var(--t-foot); font-weight: 600; color: var(--label-3); }
.auth-paths { display: grid; gap: 0.45rem; }
.auth-path {
  display: flex; align-items: center; gap: 0.8rem; width: 100%; padding: 0.6rem 0.9rem; border: 0; border-radius: var(--r-l);
  background: var(--surface); box-shadow: 0 0 0 1px var(--sep), 0 1px 2px rgba(6, 33, 41, 0.05);
  color: var(--label); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
  transition: box-shadow var(--m-150) var(--ease-out), transform var(--m-150) var(--ease-out);
}
.auth-path:hover { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--signal) 75%, transparent), 0 8px 20px -12px rgba(6, 33, 41, 0.3); }
.auth-path:active { transform: scale(0.99); }
html[data-theme="dark"] .auth-path { background: rgba(3, 21, 26, 0.55); }
.profile-text { display: grid; min-width: 0; line-height: 1.35; }
.profile-text b { font-weight: 620; font-size: var(--t-body); }
.profile-text span { font-size: var(--t-foot); color: var(--label-2); }
.profile-text small { font-size: var(--t-cap); color: var(--label-3); }
.profile-go { margin-left: auto; flex: none; width: 15px; height: 15px; color: var(--label-4); transition: transform var(--m-150) var(--ease-out), color var(--m-150) var(--ease-out); }
.auth-path:hover .profile-go { transform: translateX(2px); color: var(--accent-text); }
.auth-alt { display: flex; flex-wrap: wrap; gap: 0.6rem 1.5rem; padding-top: 0.2rem; }
.auth .link { display: inline-flex; align-items: center; gap: 0.35rem; border: 0; padding: 0; background: none; color: var(--accent-text); font: inherit; font-size: var(--t-callout); font-weight: 580; text-decoration: none; cursor: pointer; }
.auth .link:hover { text-decoration: underline; text-underline-offset: 3px; }
.auth .link .i { width: 14px; height: 14px; }
.auth-note { display: grid; gap: 0.45rem; padding-top: 0.9rem; border-top: 1px solid var(--sep); }
.auth-note p { color: var(--label-3); font-size: var(--t-foot); line-height: 1.5; }
.auth-note .link { justify-self: start; color: var(--label-2); font-size: var(--t-foot); }
/* Online sign-in and "Créer mon accès" (views/login.js): the app's own fields, one column. */
.auth-form { display: grid; gap: 0.8rem; }
.auth-form .field { margin: 0; }
.auth-code { font-variant-numeric: tabular-nums; letter-spacing: 0.08em; text-transform: uppercase; }
.auth-submit { width: 100%; justify-content: center; margin-top: 0.2rem; }
.auth-error { display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.65rem 0.8rem; border-radius: var(--r-m); background: var(--red-soft); color: var(--label); font-size: var(--t-foot); line-height: 1.45; }
.auth-error .i { flex: none; width: 16px; height: 16px; margin-top: 1px; color: var(--red); }
/* A step that went through ("code sent"): the same note in the good tone. */
.auth-info { display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.65rem 0.8rem; border-radius: var(--r-m); background: var(--accent-soft); color: var(--label); font-size: var(--t-foot); line-height: 1.45; }
.auth-info .i { flex: none; width: 16px; height: 16px; margin-top: 1px; color: var(--accent-text); }

.auth-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem 1.5rem; padding: 0 var(--auth-pad) clamp(0.9rem, 0.7rem + 1vw, 1.5rem); color: var(--label-2); font-size: var(--t-foot); }
.auth-foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem 1.1rem; }
.auth-foot a { color: inherit; text-decoration: none; }
.auth-foot a:hover { color: var(--label); }

/* ---------- Opening after an account is chosen (ui/login-reveal.js): follows the theme ---------- */
.login-reveal { --reveal-ink: var(--label); --reveal-live: var(--accent-text); --reveal-fill: var(--signal); --reveal-logo: var(--signal); --reveal-bg: var(--bg); position: fixed; inset: 0; z-index: 200; background-color: var(--bg); cursor: pointer; transition: background-color 480ms var(--ease-out); }
.login-reveal svg { position: absolute; inset: 0; display: block; }
.login-reveal svg, .login-reveal-text { transition: opacity 200ms var(--ease-out); }
.login-reveal.is-leaving { background-color: transparent; pointer-events: none; }
.login-reveal.is-leaving svg, .login-reveal.is-leaving .login-reveal-text { opacity: 0; }
.login-reveal-text { position: absolute; inset-inline: 0; bottom: clamp(2rem, 9vh, 4.5rem); display: grid; justify-items: center; padding-inline: 1.25rem; text-align: center; pointer-events: none; }
.login-reveal-text > * { grid-area: 1 / 1; opacity: 0; }
.login-reveal-step { font-size: var(--t-callout); font-weight: 500; color: var(--label-3); }
.login-reveal-sentence { font-size: var(--t-title); font-weight: 500; color: var(--label); }
.login-reveal-node { font-size: var(--t-cap); font-weight: 580; }
.login-reveal-fly { position: fixed; z-index: 201; pointer-events: none; transform-origin: 0 0; color: var(--signal); }
.login-reveal-fly svg { display: block; width: 100%; height: 100%; }
/* The short opening (every sign-in after the first on a device): the mark
 * draws itself in the middle, then takes the same flight to the sidebar. */
.login-reveal .login-reveal-mark { inset: 50% auto auto 50%; width: 6rem; height: auto; aspect-ratio: 104 / 114.385; translate: -50% -50%; overflow: visible; }
.login-reveal-mark-line { fill: none; stroke: var(--reveal-logo); stroke-width: 1.6; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: reveal-draw 300ms cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.login-reveal-mark-fill { fill: var(--reveal-logo); opacity: 0; transform-box: fill-box; transform-origin: center; animation: reveal-fill 220ms var(--ease-out) 200ms forwards; }
@keyframes reveal-draw { to { stroke-dashoffset: 0; } }
@keyframes reveal-fill { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
/* The story can be skipped: said once a click is accepted. */
.login-reveal-skip { position: absolute; top: clamp(1rem, 4vh, 2rem); right: clamp(1rem, 4vw, 2.5rem); font-size: var(--t-foot); color: var(--label-3); pointer-events: none; opacity: 0; animation: reveal-hint var(--m-300) var(--ease-out) 900ms forwards; }
@keyframes reveal-hint { to { opacity: 1; } }
.login-reveal.is-leaving .login-reveal-skip { animation: none; opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .login-reveal-mark-line { animation: none; stroke-dashoffset: 0; }
  .login-reveal-mark-fill { animation: none; opacity: 1; }
}
html.reduce-motion .login-reveal-mark-line { animation: none; stroke-dashoffset: 0; }
html.reduce-motion .login-reveal-mark-fill { animation: none; opacity: 1; }

/* ---------- Splash: the same calm background behind the mark ---------- */
.splash .auth-backdrop { z-index: 0; }
.splash > svg, .splash > .splash-bar { position: relative; z-index: 1; }
.splash { background: var(--bg); }
.splash .splash-bar { background: rgba(6, 33, 41, 0.12); }
html[data-theme="dark"] .splash .splash-bar { background: rgba(245, 250, 248, 0.14); }

@media screen and (max-width: 560px) {
  .auth-logo img, .auth-brand img { width: 140px; }
  .auth-session small { display: none; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .auth-card { animation: auth-card-in 1000ms var(--ease-out) 160ms both; }
  .auth-backdrop.is-instant ~ .auth-body .auth-card { animation: auth-card-swap 320ms var(--ease-out) both; }
  .auth-paths li { animation: auth-row-in 520ms var(--ease-out) both; animation-delay: calc(380ms + var(--i, 0) * 50ms); }
  .auth-backdrop.is-instant ~ .auth-body .auth-paths li { animation: none; }
  @keyframes auth-card-in { from { opacity: 0; transform: translateY(18px) scale(0.985); } }
  @keyframes auth-card-swap { from { opacity: 0; transform: translateY(6px); } }
  @keyframes auth-row-in { from { opacity: 0; transform: translateY(6px); } }
}

/* Public pages (attestation, supplier, survey) sit on the same backdrop. */
.public { position: relative; isolation: isolate; background: transparent; }
.public .public-window { box-shadow: 0 0 0 1px var(--sep), 0 24px 48px -30px rgba(6, 33, 41, 0.28); border-radius: var(--r-xl); }
html[data-theme="dark"] .public .public-window { box-shadow: 0 0 0 1px var(--sep-2), 0 24px 48px -28px rgba(0, 0, 0, 0.6); }

/* ---------- Lock screen ---------- */
.lockscreen { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 1.5rem; animation: lock-in 280ms var(--ease-out) both; }
.lockscreen .auth-backdrop { z-index: 0; }
.lockscreen.is-leaving { animation: lock-out 240ms var(--ease-in) both; }
@keyframes lock-in { from { opacity: 0; } }
@keyframes lock-out { to { opacity: 0; } }
.lock-card { position: relative; z-index: 1; display: grid; justify-items: center; gap: 0.7rem; width: min(100%, 24rem); padding: 2rem 1.75rem 1.5rem; border-radius: var(--r-xl); text-align: center; background: var(--surface); box-shadow: 0 0 0 1px var(--sep), 0 24px 48px -30px rgba(6, 33, 41, 0.28); animation: auth-card-in 520ms var(--ease-out) both; }
html[data-theme="dark"] .lock-card { box-shadow: 0 0 0 1px var(--sep-2), 0 24px 48px -28px rgba(0, 0, 0, 0.6); }
.lock-mark { width: 22px; height: 22px; color: var(--label-3); margin-bottom: 0.4rem; }
.lock-card h1 { font-size: var(--t-title); font-weight: 650; }
.lock-card p { color: var(--label-2); font-size: var(--t-callout); line-height: 1.5; }
.lock-card .btn-primary { width: 100%; height: 2.8rem; border-radius: var(--r-m); margin-top: 0.4rem; }
.lock-card small { color: var(--label-3); font-size: var(--t-cap); line-height: 1.45; margin-top: 0.3rem; }
body.is-locked { overflow: hidden; }
body.is-locked #app { filter: blur(0); }

/* Attestation seal: QR of the page + live data fingerprint */
.public-seal { display: flex; gap: 14px; align-items: center; margin: 18px 0 6px; padding: 12px 14px; border-radius: var(--r-m); border: 1px solid var(--sep); background: var(--surface-2); }
.public-seal .qr { flex: none; width: 84px; height: 84px; border-radius: var(--r-xs); background: #fff; padding: 4px; }
.public-seal > div { display: grid; gap: 4px; min-width: 0; }
.public-seal b { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.public-seal small { font-size: 12px; color: var(--label-2); overflow-wrap: anywhere; }
.public-seal .mono { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.public-seal .c-good { color: var(--good); } .public-seal .c-danger { color: var(--red); }

/* Contributor page */
.contrib-form { display: grid; gap: 1rem; }
.contrib-line { border: 0; margin: 0; padding: 0.9rem 0 1rem; border-top: 1px solid var(--sep-2); display: grid; gap: 0.6rem; }
.contrib-line legend { display: grid; gap: 0.15rem; padding: 0; margin-bottom: 0.4rem; }
.contrib-line legend b { font-size: 15px; }
.contrib-line legend small { color: var(--label-2); font-size: 12px; }
.contrib-months { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.5rem; }
.contrib-months label { display: grid; gap: 0.2rem; font-size: 12px; color: var(--label-2); }
@media screen and (max-width: 640px) { .contrib-months { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Public pages on paper: a plain A4 document, no floating card, no buttons. */
