/* assets/styles.css — Design tokens + layout + a11y-friendly states */

:root{
  /* UA theming opt-in */
  color-scheme: light dark;

  /* Typography */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
               "Apple Color Emoji","Segoe UI Emoji";
  --fs-title: clamp(1.25rem, 1.05rem + 0.7vw, 1.6rem);
  --fs-body: clamp(0.98rem, 0.94rem + 0.2vw, 1.05rem);
  --lh: 1.45;

  /* Spacing scale */
  --s-1: 6px;
  --s-2: 10px;
  --s-3: 14px;
  --s-4: 18px;
  --s-5: 24px;
  --s-6: 32px;

  /* Radii + shadows */
  --r-card: 20px;
  --r-control: 14px;
  --shadow: 0 18px 55px rgba(15, 23, 42, 0.12);

  /* Color tokens (light) — calibrés pour rester lisibles */
  --bg: #f5f7ff;
  --bg2: #f8fafc;
  --surface: #ffffff;
  --text: #111827;
  --muted: #475569;
  --muted2: #64748b;

  /* UI boundaries: assez contrastées pour être perçues */
  --border: #828ca0;

  /* Primary CTA */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --on-primary: #ffffff;

  /* Focus */
  --focus: #2563eb;

  /* Status colors */
  --danger: #b42318; /* text on light background */
  --danger-bg: #fee4e2;
}

@media (prefers-color-scheme: dark){
  :root{
    --bg: #070b14;
    --bg2: #0b1220;
    --surface: #0f172a;
    --text: rgba(255,255,255,0.92);
    --muted: rgba(255,255,255,0.74);
    --muted2: rgba(255,255,255,0.60);
    --border: #64748b;

    --primary: #2563eb;
    --primary-hover: #3b82f6;
    --on-primary: #ffffff;

    --focus: #93c5fd;

    --danger: #fecaca;
    --danger-bg: rgba(180,35,24,0.18);

    --shadow: 0 28px 80px rgba(0,0,0,0.52);
  }
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }

body{
  margin: 0;
  font-family: var(--font-sans);
  line-height: var(--lh);
  font-size: var(--fs-body);
  color: var(--text);

  background:
    radial-gradient(1200px 600px at 20% 10%, rgba(37,99,235,0.18), transparent 55%),
    radial-gradient(900px 520px at 80% 0%, rgba(99,102,241,0.14), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

a{ color: inherit; }

.skip-link{
  position: absolute;
  left: 12px;
  top: 12px;
  transform: translateY(-160%);
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--focus);
  box-shadow: var(--shadow);
  z-index: 999;
}
.skip-link:focus{ transform: translateY(0); }

.page{
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar{
  padding: var(--s-5) var(--s-5) var(--s-2);
  display: flex;
  justify-content: center;
}

.topbar__brand{
  width: min(560px, 100%);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.brand-mark{
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), rgba(99,102,241,1));
  box-shadow: 0 8px 22px rgba(37,99,235,0.25);
}

.brand-name{
  font-weight: 600;
  letter-spacing: -0.01em;
}

.main{
  display: grid;
  place-items: center;
  padding: var(--s-5);
}

.card{
  width: min(560px, 100%);
  max-width: 460px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: var(--s-6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  animation: cardIn 220ms ease-out;
}

@keyframes cardIn{
  from{ opacity: 0; transform: translateY(8px); }
  to{ opacity: 1; transform: translateY(0); }
}

.card__head{
  text-align: center;
  margin-bottom: var(--s-5);
}

.card__logo{
  display: grid;
  place-items: center;
  margin-bottom: var(--s-3);
}

.logo-dot{
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), rgba(99,102,241,1));
  box-shadow: 0 18px 42px rgba(37,99,235,0.28);
}

.card__title{
  margin: 0;
  font-size: var(--fs-title);
  letter-spacing: -0.02em;
}

.card__subtitle{
  margin: var(--s-2) 0 0;
  color: var(--muted);
}

.status{
  margin: 0 0 var(--s-3);
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  color: var(--text);
}

.form{ margin-top: var(--s-3); }

.field{ margin-bottom: var(--s-4); }

.field__label{
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text);
}

.field__input{
  width: 100%;
  padding: 14px 14px;
  border-radius: var(--r-control);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;

  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.field__input::placeholder{
  color: var(--muted2);
}

.field__input:focus-visible{
  border-color: var(--focus);
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.field__input[aria-invalid="true"]{
  border-color: var(--danger);
}

.field__helper{
  margin: 10px 0 0;
  color: var(--muted);
}

.field__error{
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
}

.field__error--empty{
  padding: 0;
  border: 0;
  background: transparent;
}

.actions{
  margin-top: var(--s-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.btn{
  border: 0;
  cursor: pointer;
  font-weight: 650;
  padding: 12px 16px;
  border-radius: 999px;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.btn--primary{
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 14px 36px rgba(37,99,235,0.28);
}

.btn--primary:hover{ background: var(--primary-hover); }
.btn--primary:active{ transform: translateY(1px); }

.btn:focus-visible{
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.link{
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.link:hover{ text-decoration: underline; text-underline-offset: 3px; }

.link--muted{
  color: var(--muted);
  font-weight: 600;
}

.demo-note{
  margin: var(--s-4) 0 0;
  color: var(--muted2);
  font-size: 0.95em;
}

.footer{
  padding: var(--s-4) var(--s-5) var(--s-5);
  display: flex;
  justify-content: center;
}

.footer > *{
  width: min(560px, 100%);
}

.footer{
  gap: var(--s-3);
  align-items: center;
  flex-wrap: wrap;
}

.lang{
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang__select{
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

.lang__select:focus-visible{
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.lang__apply{
  border-radius: 999px;
  border: 2px solid var(--border);
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  cursor: pointer;
}

.footer__links{
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted2);
  justify-content: flex-end;
  flex: 1;
}

.sep{ color: var(--muted2); }

/* SR-only helper */
.sr-only{
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Responsive tweaks */
@media (max-width: 420px){
  .topbar, .main, .footer{ padding-left: var(--s-4); padding-right: var(--s-4); }
  .card{ padding: var(--s-5); }
  .actions{ flex-direction: column; align-items: stretch; }
  .actions__right .btn{ width: 100%; }
  .footer__links{ justify-content: flex-start; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  *{
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
