/* Auth pages — sign-in / sign-up as « Le billet »: one train ticket in the NP look
   (np-skin.css gives the paper, grain, inks and fonts).
   Left: a riso stub with the 11 NP stations (pink for sign-in, green for sign-up).
   Right: the white ticket with the Frenchify logo, title, form and a barcode, split by a perforation.
   Markup comes from FrenchifyAuth.renderAuthForm (auth.js). */

body.auth-page {
  min-height: 100vh;
  overflow-x: hidden;
  --stub: var(--pink);
  --stub-i: var(--pink-i);
  background:
    radial-gradient(circle at 12% 16%, rgba(255,72,176,.10) 0 17%, transparent 17.5%),
    radial-gradient(circle at 90% 86%, rgba(0,120,191,.10) 0 15%, transparent 15.5%),
    var(--paper);
  background-attachment: fixed;
}
body.auth-page[data-auth-mode="signup"] {
  --stub: var(--green);
  --stub-i: var(--green-i);
  background:
    radial-gradient(circle at 12% 16%, rgba(0,166,81,.10) 0 17%, transparent 17.5%),
    radial-gradient(circle at 90% 86%, rgba(255,184,0,.13) 0 15%, transparent 15.5%),
    var(--paper);
  background-attachment: fixed;
}

body.auth-page .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 28px;
  box-sizing: border-box;
}

/* ---------- the ticket ---------- */
.auth-ticket {
  position: relative;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  width: min(960px, 100%);
  filter: drop-shadow(0 28px 32px rgba(31,29,43,.26));
  transform: rotate(-1deg);
}

/* the stub: halftone riso colour, two half-moon notches on the tear line */
.auth-stub {
  position: relative;
  padding: 34px 28px 30px;
  border-radius: 22px 0 0 22px;
  color: var(--white);
  background-color: var(--stub);
  background-image: radial-gradient(rgba(255,253,248,.2) 28%, transparent 31%);
  background-size: 10px 10px;
  -webkit-mask:
    radial-gradient(circle 16px at 100% 0, transparent 98%, #000) top / 100% 51% no-repeat,
    radial-gradient(circle 16px at 100% 100%, transparent 98%, #000) bottom / 100% 51% no-repeat;
          mask:
    radial-gradient(circle 16px at 100% 0, transparent 98%, #000) top / 100% 51% no-repeat,
    radial-gradient(circle 16px at 100% 100%, transparent 98%, #000) bottom / 100% 51% no-repeat;
}
.auth-stub-title {
  margin: 0;
  font: 800 30px/1 var(--head);
  font-stretch: 80%;
  letter-spacing: -.01em;
}
.auth-stub-title span {
  display: block;
  margin-top: 8px;
  font: 700 12px/1 var(--head);
  font-stretch: 100%;
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: .85;
}

.auth-route {
  position: relative;
  list-style: none;
  margin: 22px 0 0;
  padding: 0 0 0 4px;
}
.auth-route::before {  /* the line */
  content: "";
  position: absolute;
  left: 9px;
  top: 10px;
  bottom: 10px;
  width: 5px;
  border-radius: 3px;
  background: var(--white);
  opacity: .9;
}
.auth-route li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 26px;
  font: 600 14.5px/1 var(--hand);
}
.auth-route li i {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: inset 0 0 0 4px var(--ink);
  animation: auth-stop 11s linear infinite;
  animation-delay: calc(var(--n) * 1s);
}
.auth-route li b { width: 34px; font: 800 12px/1 var(--head); }
/* a light travels down the line, one station a second */
@keyframes auth-stop {
  0%, 8%   { transform: scale(1.3); box-shadow: inset 0 0 0 4px var(--sun), 0 0 0 2.5px var(--ink); }
  11%, 100% { transform: none; box-shadow: inset 0 0 0 4px var(--ink); }
}
@media (prefers-reduced-motion: reduce) {
  .auth-route li i { animation: none; }
}

/* the ticket body */
.auth-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 32px 46px 28px 52px;
  border-radius: 0 22px 22px 0;
  background: var(--white);
  -webkit-mask:
    radial-gradient(circle 16px at 0 0, transparent 98%, #000) top / 100% 51% no-repeat,
    radial-gradient(circle 16px at 0 100%, transparent 98%, #000) bottom / 100% 51% no-repeat;
          mask:
    radial-gradient(circle 16px at 0 0, transparent 98%, #000) top / 100% 51% no-repeat,
    radial-gradient(circle 16px at 0 100%, transparent 98%, #000) bottom / 100% 51% no-repeat;
}
.auth-card::before {  /* perforation */
  content: "";
  position: absolute;
  left: 0;
  top: 24px;
  bottom: 24px;
  border-left: 3px dashed var(--paper-3);
  pointer-events: none;
}

.auth-ticket-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.auth-logo-link { display: block; line-height: 0; text-decoration: none; }
/* logo.svg has a wide viewBox and no intrinsic size — must constrain */
.auth-logo { display: block; width: 156px; height: auto; }
.auth-ticket-no {
  font: 700 12.5px/1 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .14em;
  color: var(--muted);
}

.auth-card h1 {
  margin: 26px 0 0;
  font: 800 52px/1 var(--head);
  font-stretch: 78%;
  letter-spacing: -.01em;
  color: var(--ink);
}
.auth-sub {
  margin: 8px 0 0;
  font: 600 18px/1.35 var(--hand);
  color: var(--stub-i);
  transform: rotate(-1deg);
  transform-origin: left;
}
.auth-sub strong { font-weight: 700; color: var(--ink); }

/* ---------- form ---------- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 26px;
}

/* boxed fields with the label sitting on the top border */
.auth-field {
  position: relative;
  display: block;
  padding: 19px 14px 11px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--white);
  cursor: text;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.auth-field > span {
  position: absolute;
  top: -9px;
  left: 12px;
  padding: 0 6px;
  background: var(--white);
  font: 700 11px/1.4 var(--head);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
}
.auth-field input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0;
  border: 0;
  outline: 0;
  background: none;
  font: 500 16px/1.3 var(--head);
  color: var(--ink);
}
.auth-field input::placeholder { color: var(--muted); }
.auth-field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-t); }
.auth-field:focus-within > span { color: var(--blue-i); }
.auth-field:has(input[readonly]) { border-style: dashed; cursor: default; }
.auth-field input[readonly] { color: var(--ink-2); }

.auth-form select {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 13px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--white);
  font: 500 15.5px/1.3 var(--head);
  color: var(--ink);
}
.auth-form select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-t); }

.auth-error {
  margin: 0;
  padding: 9px 13px;
  border-radius: 10px;
  background: var(--pink-t);
  color: var(--pink-i);
  font: 600 14.5px/1.35 var(--head);
}
.auth-card > .auth-error { margin-top: 24px; }
.auth-error[hidden] { display: none !important; }

/* the punch button + three punched holes */
.auth-act { display: flex; align-items: center; gap: 18px; margin-top: 4px; }
.auth-legal { margin-top: 12px; font-size: 13px; }
.auth-legal a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.auth-form .btn,
.auth-form .btn-block {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: auto;
  margin: 0;
  padding: 15px 26px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  font: 800 18px/1 var(--head);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 14px 22px -14px rgba(31,29,43,.7);
  transition: transform .3s var(--bounce);
}
.auth-form .btn::after { content: "→"; font-weight: 800; color: var(--sun); }
.auth-form .btn:hover { transform: rotate(-1.5deg) scale(1.03); }
.auth-form .btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.auth-holes { display: flex; gap: 7px; }
.auth-holes i { width: 16px; height: 16px; border-radius: 50%; background: var(--paper); box-shadow: inset 0 2px 3px rgba(31,29,43,.35); }

/* switch line + barcode */
.auth-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-top: 22px;
}
.auth-switch {
  margin: 0;
  font: 500 14.5px/1.4 var(--head);
  color: var(--ink-2);
}
.auth-switch a { color: var(--blue-i); font-weight: 700; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.auth-barcode {
  flex-shrink: 0;
  width: 150px;
  height: 34px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 5px, var(--ink) 5px 6px, transparent 6px 9px, var(--ink) 9px 12px, transparent 12px 14px);
  opacity: .85;
}

/* ---------- sign-up: where to start ---------- */
.auth-start-path {
  position: relative;
  margin: 0;
  padding: 14px 16px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.auth-start-path::before { content: ""; position: absolute; inset: 6px; border: 2px dashed rgba(31,29,43,.14); border-radius: 9px; pointer-events: none; }
.auth-start-path legend { float: left; width: 100%; padding: 0; font: 700 16px/1.2 var(--hand); color: var(--green-i); }
.auth-start-path legend + * { clear: both; }
.auth-start-hint { margin: 0; font: 500 14px/1.4 var(--head); color: var(--ink-2); }
.auth-card > .auth-start-hint { margin-top: 10px; }
.auth-start-row { display: flex; flex-direction: column; gap: 5px; font: 700 14px/1.2 var(--head); color: var(--ink); }
.auth-start-or { margin: 0; text-align: center; font: 600 15px/1 var(--hand); color: var(--muted); }
/* the two choices side by side on wide screens: NP | or | level */
@media (min-width: 761px) {
  .auth-start-path {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: end;
    column-gap: 12px;
  }
  .auth-start-path legend,
  .auth-start-path .auth-start-hint { grid-column: 1 / -1; }
  .auth-start-or { padding-bottom: 14px; }
}

.auth-agree {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 2px 0;
  font: 500 14.5px/1.4 var(--head);
  color: var(--ink-2);
  cursor: pointer;
}
.auth-agree input[type="checkbox"] { margin-top: 3px; width: 17px; height: 17px; flex-shrink: 0; accent-color: var(--ink); }
.auth-agree a { color: var(--blue-i); font-weight: 700; text-decoration: underline; }

/* ---------- tablets and phones: the stub becomes a strip on top ---------- */
@media (max-width: 760px) {
  .auth-shell { align-items: flex-start; padding: 28px 16px 40px; }
  .auth-ticket { grid-template-columns: 1fr; transform: none; }
  .auth-stub {
    padding: 20px 24px 22px;
    border-radius: 22px 22px 0 0;
    -webkit-mask:
      radial-gradient(circle 16px at 0 100%, transparent 98%, #000) left / 51% 100% no-repeat,
      radial-gradient(circle 16px at 100% 100%, transparent 98%, #000) right / 51% 100% no-repeat;
            mask:
      radial-gradient(circle 16px at 0 100%, transparent 98%, #000) left / 51% 100% no-repeat,
      radial-gradient(circle 16px at 100% 100%, transparent 98%, #000) right / 51% 100% no-repeat;
  }
  .auth-stub-title { font-size: 24px; }
  .auth-stub-title span { display: inline; margin: 0 0 0 6px; }
  .auth-stub-title span::before { content: "· "; }
  /* the 11 stations as one row of dots */
  .auth-route { display: flex; justify-content: space-between; margin-top: 16px; padding: 0; }
  .auth-route::before { left: 6px; right: 6px; top: 50%; bottom: auto; width: auto; height: 5px; margin-top: -2.5px; }
  .auth-route li { height: auto; }
  .auth-route li b,
  .auth-route li span { display: none; }

  .auth-card {
    padding: 26px 22px 24px;
    border-radius: 0 0 22px 22px;
    -webkit-mask:
      radial-gradient(circle 16px at 0 0, transparent 98%, #000) left / 51% 100% no-repeat,
      radial-gradient(circle 16px at 100% 0, transparent 98%, #000) right / 51% 100% no-repeat;
            mask:
      radial-gradient(circle 16px at 0 0, transparent 98%, #000) left / 51% 100% no-repeat,
      radial-gradient(circle 16px at 100% 0, transparent 98%, #000) right / 51% 100% no-repeat;
  }
  .auth-card::before { left: 24px; right: 24px; top: 0; bottom: auto; border-left: 0; border-top: 3px dashed var(--paper-3); }
  .auth-logo { width: 132px; }
  .auth-card h1 { margin-top: 22px; font-size: 40px; }
  .auth-sub { font-size: 16.5px; }
  .auth-act { flex-wrap: wrap; }
  .auth-foot { flex-direction: column; align-items: flex-start; gap: 16px; }
  .auth-barcode { width: 120px; height: 28px; }
}
@media (max-width: 380px) {
  .auth-holes { display: none; }
  .auth-form .btn, .auth-form .btn-block { width: 100%; justify-content: center; }
}
