/* ==========================================================================
   Ismilink — Design system « Glass »
   Couleur primaire : bleu électrique · Couleur secondaire : violet
   Contrastes vérifiés (WCAG AA) dans les deux thèmes.
   ========================================================================== */

/* ---------- Jetons ---------- */
:root {
  --font-display: 'Sora', 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'JetBrains Mono', Consolas, monospace;

  --blue-500: #5b74ff;
  --blue-600: #3d5afe;
  --blue-700: #3346e8;
  --violet-400: #a78bfa;
  --violet-500: #8b5cf6;
  --violet-600: #7c3aed;
  --violet-700: #6d28d9;

  --primary: var(--blue-600);
  --secondary: var(--violet-600);
  --grad: linear-gradient(135deg, var(--blue-600) 0%, var(--violet-600) 100%);
  --grad-soft: linear-gradient(135deg, rgb(61 90 254 / .18), rgb(124 58 237 / .18));
  --on-grad: #ffffff;

  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px;
  --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px; --s-24: 96px;

  --content: 1280px;
  --gutter: 24px;
  --nav-h: 72px;
  --blur: 22px;
  --control-h: 48px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur: 160ms;

  color-scheme: light;
  /* Thème clair */
  --bg: #f3f1fa;
  --orb-1: rgb(167 139 250 / .55);
  --orb-2: rgb(129 140 248 / .45);
  --orb-3: rgb(240 171 252 / .38);
  --surface: rgb(255 255 255 / .58);
  --surface-2: rgb(255 255 255 / .74);
  --surface-strong: rgb(255 255 255 / .88);
  --surface-hover: rgb(255 255 255 / .82);
  --input-bg: rgb(255 255 255 / .9);
  --border: rgb(255 255 255 / .8);
  --border-soft: rgb(30 27 75 / .10);
  --border-strong: rgb(30 27 75 / .5);
  --highlight: inset 0 1px 0 rgb(255 255 255 / .9);
  --shadow-sm: 0 1px 2px rgb(30 27 75 / .06), 0 2px 8px rgb(30 27 75 / .06);
  --shadow-md: 0 8px 24px rgb(30 27 75 / .10), 0 2px 6px rgb(30 27 75 / .06);
  --shadow-lg: 0 24px 64px rgb(49 46 129 / .18), 0 8px 20px rgb(30 27 75 / .08);
  --glow: 0 10px 30px -8px rgb(124 58 237 / .55);
  --text: #16142b;
  --text-muted: #4a4766;
  --text-subtle: #5f5c7a;
  --primary-text: #3346e8;
  --secondary-text: #6d28d9;
  --focus: #6d28d9;
  --success: #15803d;
  --success-bg: rgb(21 128 61 / .1);
  --danger: #b91c1c;
  --danger-bg: rgb(185 28 28 / .08);
  --warning: #a16207;
  --warning-bg: rgb(161 98 7 / .1);
  --code-bg: #15132a;
  --code-text: #e9e7f7;
}

/* Thème sombre : préférence système (si aucun choix manuel) ou choix manuel */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #09090f;
    --orb-1: rgb(124 58 237 / .42);
    --orb-2: rgb(61 90 254 / .34);
    --orb-3: rgb(192 38 211 / .22);
    --surface: rgb(255 255 255 / .055);
    --surface-2: rgb(255 255 255 / .08);
    --surface-strong: rgb(20 19 36 / .82);
    --surface-hover: rgb(255 255 255 / .1);
    --input-bg: rgb(10 10 20 / .55);
    --border: rgb(255 255 255 / .11);
    --border-soft: rgb(255 255 255 / .08);
    --border-strong: rgb(255 255 255 / .34);
    --highlight: inset 0 1px 0 rgb(255 255 255 / .08);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-md: 0 10px 30px rgb(0 0 0 / .35);
    --shadow-lg: 0 30px 80px rgb(0 0 0 / .5), 0 0 0 1px rgb(255 255 255 / .02);
    --glow: 0 10px 34px -8px rgb(124 58 237 / .7);
    --text: #ecebf5;
    --text-muted: #b4b2c8;
    --text-subtle: #9896b0;
    --primary-text: #93a4ff;
    --secondary-text: #c4a5ff;
    --focus: #b69cff;
    --success: #4ade80;
    --success-bg: rgb(74 222 128 / .1);
    --danger: #f87171;
    --danger-bg: rgb(248 113 113 / .1);
    --warning: #fbbf24;
    --warning-bg: rgb(251 191 36 / .1);
    --code-bg: #0d0c1a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09090f;
  --orb-1: rgb(124 58 237 / .42);
  --orb-2: rgb(61 90 254 / .34);
  --orb-3: rgb(192 38 211 / .22);
  --surface: rgb(255 255 255 / .055);
  --surface-2: rgb(255 255 255 / .08);
  --surface-strong: rgb(20 19 36 / .82);
  --surface-hover: rgb(255 255 255 / .1);
  --input-bg: rgb(10 10 20 / .55);
  --border: rgb(255 255 255 / .11);
  --border-soft: rgb(255 255 255 / .08);
  --border-strong: rgb(255 255 255 / .34);
  --highlight: inset 0 1px 0 rgb(255 255 255 / .08);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-md: 0 10px 30px rgb(0 0 0 / .35);
  --shadow-lg: 0 30px 80px rgb(0 0 0 / .5), 0 0 0 1px rgb(255 255 255 / .02);
  --glow: 0 10px 34px -8px rgb(124 58 237 / .7);
  --text: #ecebf5;
  --text-muted: #b4b2c8;
  --text-subtle: #9896b0;
  --primary-text: #93a4ff;
  --secondary-text: #c4a5ff;
  --focus: #b69cff;
  --success: #4ade80;
  --success-bg: rgb(74 222 128 / .1);
  --danger: #f87171;
  --danger-bg: rgb(248 113 113 / .1);
  --warning: #fbbf24;
  --warning-bg: rgb(251 191 36 / .1);
  --code-bg: #0d0c1a;
}

:root[lang="ar"] {
  --font-display: 'Readex Pro', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans Arabic', 'Readex Pro', system-ui, sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* Fond aurora (décoratif) */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(40vmax 40vmax at 12% 8%, var(--orb-1), transparent 60%),
    radial-gradient(38vmax 38vmax at 88% 18%, var(--orb-2), transparent 62%),
    radial-gradient(34vmax 34vmax at 50% 100%, var(--orb-3), transparent 60%),
    var(--bg);
}
.aurora::before, .aurora::after {
  content: '';
  position: absolute;
  width: 46vmax;
  height: 46vmax;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .55;
  animation: drift 26s var(--ease) infinite alternate;
}
.aurora::before { background: var(--orb-1); top: -12vmax; inset-inline-start: -10vmax; }
.aurora::after { background: var(--orb-2); bottom: -16vmax; inset-inline-end: -12vmax; animation-duration: 32s; animation-direction: alternate-reverse; }
.aurora .noise {
  position: absolute;
  inset: 0;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(6vmax, 4vmax, 0) scale(1.12); }
}

img, svg, video { max-width: 100%; height: auto; }
img { display: block; }
.ic { width: 20px; height: 20px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 24px; height: 24px; }
.ic-xl { width: 32px; height: 32px; }
[dir="rtl"] .ic-flip { transform: scaleX(-1); }

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text); margin: 0; font-weight: 700; letter-spacing: -0.02em; }
:root[lang="ar"] h1, :root[lang="ar"] h2, :root[lang="ar"] h3, :root[lang="ar"] h4 { letter-spacing: 0; }
h1 { font-size: clamp(2.5rem, 1.5rem + 4.2vw, 4.75rem); line-height: 1; margin-bottom: 32px; }
h2 { font-size: clamp(2rem, 1.35rem + 2.6vw, 3.25rem); line-height: 1; margin-bottom: 32px; }
h3 { font-size: 1.25rem; line-height: 1.25; }
h4 { font-size: 1rem; line-height: 1.3; }
p { margin: 0 0 16px; }
p:last-child { margin-bottom: 0; }
p a, li a, td a, .prose a { color: var(--primary-text); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
p a:hover, li a:hover, .prose a:hover { text-decoration-thickness: 2px; }
nav a, footer a, header a:not(.btn) { text-decoration: none; color: inherit; }
code, kbd, pre { font-family: var(--font-mono); font-size: .9em; }
:not(pre) > code { background: var(--surface-2); border: 1px solid var(--border-soft); padding: 2px 6px; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--border-soft); margin: 24px 0; }
::selection { background: rgb(124 58 237 / .3); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; transition: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link {
  position: fixed; top: 12px; inset-inline-start: 12px; z-index: 1000;
  padding: 12px 20px; border-radius: var(--r-md); background: var(--surface-strong); color: var(--text);
  font-weight: 700; transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

.container { width: 100%; max-width: calc(var(--content) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
@media (max-width: 640px) { :root { --gutter: 16px; } }

/* ---------- Surfaces verre ---------- */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--highlight), var(--shadow-md);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(170%);
  backdrop-filter: blur(var(--blur)) saturate(170%);
}
.glass-strong { background: var(--surface-strong); }
.card { padding: 24px; }
.card-lg { padding: 32px; }
@media (max-width: 640px) { .card-lg { padding: 24px; } }

/* ---------- Boutons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--control-h); padding: 0 20px;
  border: 1px solid transparent; border-radius: var(--r-md);
  background: var(--btn-bg); color: var(--btn-fg);
  font: 600 1rem/1 var(--font-body);
  white-space: nowrap; flex-shrink: 0; cursor: pointer; text-decoration: none;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), filter var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px) scale(.985); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }
.btn-primary { --btn-bg: var(--grad); --btn-fg: var(--on-grad); background: var(--grad); box-shadow: var(--glow), inset 0 1px 0 rgb(255 255 255 / .25); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08) saturate(1.05); box-shadow: 0 14px 40px -8px rgb(124 58 237 / .75), inset 0 1px 0 rgb(255 255 255 / .3); transform: translateY(-1px); }
.btn-glass {
  background: var(--surface-2); border-color: var(--border-strong);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: var(--highlight);
}
.btn-glass:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--text-subtle); }
.btn-ghost { background: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 16%, transparent); }
.btn-icon { width: var(--control-h); padding: 0; }
.btn-block { width: 100%; }
.btn[aria-busy="true"] { pointer-events: none; opacity: .75; }
.btn[aria-busy="true"] .ic-spin { display: inline-block; }
.ic-spin { display: none; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.icon-cluster { display: flex; gap: 4px; align-items: center; }

/* ---------- Formulaires ---------- */
.field { display: grid; gap: 8px; }
.field + .field, .field + .field-row, .field-row + .field, .field-row + .field-row { margin-top: 20px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px 16px; align-items: start; }
.field-row > .field { margin-top: 0; }
.label { font-weight: 600; font-size: .9375rem; color: var(--text); display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.label .opt { font-weight: 500; color: var(--text-subtle); font-size: .875rem; }
.hint { font-size: .875rem; color: var(--text-subtle); margin: 0; }
.error-text { font-size: .875rem; color: var(--danger); display: flex; gap: 6px; align-items: center; margin: 0; }
.input, .select, .textarea {
  width: 100%; min-height: var(--control-h);
  padding: 12px 16px; border-radius: var(--r-sm);
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border-strong);
  font: 500 1rem/1.4 var(--font-body);
  transition: border-color var(--dur), box-shadow var(--dur), background-color var(--dur);
}
.input::placeholder, .textarea::placeholder { color: var(--text-subtle); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-subtle); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.textarea { min-height: 112px; resize: vertical; line-height: 1.55; }
.select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  padding-inline-end: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237d7a99' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
}
[dir="rtl"] .select { background-position: left 14px center; }
.select option { background: var(--surface-strong); color: var(--text); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group > .ic { position: absolute; inset-inline-start: 14px; color: var(--text-subtle); pointer-events: none; }
.input-group > .input { padding-inline-start: 46px; }
.input-affix { display: flex; align-items: stretch; border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--input-bg); overflow: hidden; }
.input-affix:focus-within { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.input-affix .affix { display: flex; align-items: center; padding-inline: 14px; color: var(--text-subtle); font-weight: 600; white-space: nowrap; background: var(--surface-2); border-inline-end: 1px solid var(--border-soft); direction: ltr; }
.input-affix .input { border: 0; border-radius: 0; background: transparent; min-width: 0; }
.input-affix .input:focus-visible { outline: none; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: .9375rem; color: var(--text-muted); }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--secondary); flex-shrink: 0; }

/* Interrupteur */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; min-height: 44px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; width: 44px; height: 26px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border-strong); transition: background var(--dur); flex-shrink: 0; }
.switch .track::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-subtle); transition: transform var(--dur) var(--ease), background var(--dur); }
.switch input:checked + .track { background: var(--grad); border-color: transparent; }
.switch input:checked + .track::after { background: #fff; transform: translateX(18px); }
[dir="rtl"] .switch input:checked + .track::after { transform: translateX(-18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Curseur */
.range { width: 100%; accent-color: var(--secondary); min-height: 32px; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row output { min-width: 48px; text-align: end; font-variant-numeric: tabular-nums; color: var(--text-muted); font-weight: 600; }

/* Couleur */
.color-field { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--input-bg); padding: 6px; min-height: var(--control-h); }
.color-field input[type="color"] { width: 36px; height: 36px; border: 0; padding: 0; background: none; border-radius: 10px; cursor: pointer; flex-shrink: 0; }
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type="color"]::-webkit-color-swatch { border: 1px solid var(--border-soft); border-radius: 10px; }
.color-field .input { border: 0; min-height: 36px; padding: 4px 8px; background: transparent; font-family: var(--font-mono); font-size: .9375rem; direction: ltr; }
.color-field:focus-within { outline: 3px solid var(--focus); outline-offset: 1px; }
.color-field .input:focus-visible { outline: none; }

/* Choix segmentés */
.segmented { display: inline-flex; padding: 4px; gap: 4px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border-soft); flex-wrap: wrap; }
.segmented button, .segmented label {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 10px;
  border: 0; background: transparent; color: var(--text-muted); font: 600 .9375rem/1 var(--font-body); cursor: pointer; white-space: nowrap;
}
.segmented [aria-pressed="true"], .segmented [aria-selected="true"], .segmented input:checked + span { background: var(--surface-strong); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }

/* ---------- Badges, alertes ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill); font-size: .75rem; font-weight: 700; letter-spacing: .02em; background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--text-muted); width: auto; white-space: nowrap; }
.badge .ic { width: 14px; height: 14px; }
.badge-success { background: var(--success-bg); color: var(--success); border-color: transparent; }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.badge-accent { background: var(--grad-soft); color: var(--secondary-text); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 16px 20px; border-radius: var(--r-lg); border: 1px solid var(--border-soft); background: var(--surface-2); color: var(--text); }
.alert .ic { margin-top: 2px; }
.alert-success { background: var(--success-bg); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert-success > .ic { color: var(--success); }
.alert-danger { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-danger > .ic { color: var(--danger); }
.alert-warning { background: var(--warning-bg); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.alert-warning > .ic { color: var(--warning); }

/* ---------- En-tête du site ---------- */
.site-header { position: fixed; top: 0; inset-inline: 0; z-index: 50; padding-top: 12px; }
.site-header .bar {
  height: 60px; display: flex; align-items: center; gap: 24px; padding-inline: 12px 12px; padding-inline-start: 20px;
  border-radius: var(--r-lg);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.125rem; color: var(--text); letter-spacing: -0.01em; text-decoration: none; }
.brand img, .brand svg.logo { width: 32px; height: 32px; }
.main-nav { display: flex; gap: 24px; margin-inline-start: 8px; }
.main-nav a { color: var(--text-muted); font-weight: 600; font-size: .9375rem; padding: 8px 0; transition: color var(--dur); }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 16px; margin-inline-start: auto; }
.header-actions .icon-cluster .btn { width: 44px; min-height: 44px; }
.menu-toggle { display: none; }
@media (max-width: 1024px) {
  .main-nav { display: none; }
  .menu-toggle { display: inline-flex; }
  .header-actions .hide-sm { display: none; }
}
.mobile-nav { display: none; margin-top: 8px; padding: 16px; }
.mobile-nav.open { display: grid; gap: 4px; }
.mobile-nav a:not(.btn) { padding: 12px 8px; font-weight: 600; color: var(--text); border-radius: 10px; }
.mobile-nav a:not(.btn):hover { background: var(--surface-2); }
.mobile-nav .btn-row { margin-top: 8px; }

/* Menus déroulants (langue) */
.menu { position: relative; }
.menu-panel {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 200px; padding: 8px; z-index: 60;
  display: none; border-radius: var(--r-lg);
}
.menu.open .menu-panel { display: grid; gap: 2px; }
.menu-panel a, .menu-panel button { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); font-weight: 600; font-size: .9375rem; background: none; border: 0; cursor: pointer; text-align: start; width: 100%; min-height: 44px; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); }
.menu-panel [aria-current="true"] { color: var(--secondary-text); }

/* ---------- Sections marketing ---------- */
.section { padding-block: 96px; position: relative; }
@media (max-width: 768px) { .section { padding-block: 64px; } }
.section-head { max-width: 760px; margin-bottom: 56px; }
.section-head.center { margin-inline: auto; text-align: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: .875rem; letter-spacing: .06em; text-transform: uppercase; color: var(--secondary-text); margin-bottom: 20px; }
:root[lang="ar"] .eyebrow { letter-spacing: 0; text-transform: none; }
.lead { font-size: clamp(1.0625rem, 1rem + .35vw, 1.25rem); color: var(--text-muted); line-height: 1.6; }
.accent-text { color: var(--secondary-text); }

/* Hero */
.hero { padding-top: calc(var(--nav-h) + 96px); padding-bottom: 96px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
@media (max-width: 1024px) { .hero-grid { grid-template-columns: 1fr; } }
.hero h1 { max-width: 12ch; }
:root[lang="ar"] .hero h1 { max-width: 14ch; line-height: 1.15; }
.hero .lead { max-width: 54ch; margin-bottom: 32px; }
.claim { display: flex; gap: 12px; flex-wrap: wrap; max-width: 560px; }
.claim .input-affix { flex: 1 1 260px; min-height: var(--control-h); }
.claim-status { min-height: 24px; margin-top: 12px; font-size: .9375rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.claim-status.ok { color: var(--success); }
.claim-status.ko { color: var(--danger); }
.trust-row { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 32px; color: var(--text-muted); font-weight: 600; font-size: .9375rem; }
.trust-row span { display: inline-flex; align-items: center; gap: 8px; }
.trust-row .ic { color: var(--secondary-text); }

/* Composition visuelle du hero */
.showcase { position: relative; min-height: 560px; }
.showcase > * { position: absolute; }
.mock-phone { width: 290px; inset-inline-start: 4%; top: 0; border-radius: 40px; padding: 12px; z-index: 2; }
.mock-phone .screen { border-radius: 30px; padding: 32px 20px 24px; min-height: 520px; background: linear-gradient(160deg, #2b1b6b, #12103a 55%, #1a2a7a); color: #f4f2ff; text-align: center; position: relative; overflow: hidden; }
.mock-phone .screen::before { content: ''; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: rgb(124 58 237 / .55); filter: blur(50px); top: -60px; inset-inline-end: -60px; }
.mock-phone .screen > * { position: relative; }
.mock-avatar { width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 12px; background: linear-gradient(135deg, #a5b4ff, #c084fc); display: grid; place-items: center; font: 700 1.5rem var(--font-display); color: #1e1b4b; box-shadow: 0 0 0 4px rgb(255 255 255 / .15); }
.mock-name { font: 700 1.0625rem var(--font-display); }
.mock-bio { font-size: .8125rem; opacity: .8; margin: 4px 0 16px; }
.mock-socials { display: flex; justify-content: center; gap: 10px; margin-bottom: 18px; }
.mock-socials span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgb(255 255 255 / .12); }
.mock-socials .ic { width: 15px; height: 15px; }
.mock-link { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 10px; border-radius: 14px; background: rgb(255 255 255 / .1); border: 1px solid rgb(255 255 255 / .16); font-size: .8125rem; font-weight: 600; text-align: start; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.mock-link.featured { background: linear-gradient(135deg, rgb(61 90 254 / .65), rgb(124 58 237 / .75)); border-color: rgb(255 255 255 / .3); box-shadow: 0 8px 24px -6px rgb(124 58 237 / .7); }
.mock-link .ic { width: 16px; height: 16px; }
.mock-portfolio { width: 340px; inset-inline-end: 0; top: 40px; padding: 20px; padding-inline-start: 92px; z-index: 1; border-radius: 26px; }
.mock-portfolio .bar-dots { display: flex; gap: 6px; margin-bottom: 16px; }
.mock-portfolio .bar-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); opacity: .5; }
.mock-portfolio .ph-title { font: 700 1.25rem/1.15 var(--font-display); margin-bottom: 8px; }
.mock-portfolio .ph-sub { color: var(--text-muted); font-size: .875rem; margin-bottom: 16px; }
.mock-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.mock-chips span { padding: 4px 10px; border-radius: 99px; font-size: .75rem; font-weight: 700; background: var(--grad-soft); color: var(--secondary-text); }
.mock-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mock-tiles div { aspect-ratio: 4 / 3; border-radius: 14px; background: linear-gradient(135deg, rgb(61 90 254 / .35), rgb(124 58 237 / .35)); border: 1px solid var(--border); }
.mock-tiles div:nth-child(2) { background: linear-gradient(135deg, rgb(236 72 153 / .3), rgb(124 58 237 / .35)); }
.mock-tiles div:nth-child(3) { background: linear-gradient(135deg, rgb(14 165 233 / .3), rgb(61 90 254 / .35)); }
.mock-qr { width: 168px; inset-inline-end: 6%; bottom: 0; padding: 16px; z-index: 3; text-align: center; border-radius: 24px; }
.mock-qr .qr { background: #fff; border-radius: 14px; padding: 10px; }
.mock-qr small { display: block; margin-top: 8px; font-weight: 700; font-size: .75rem; color: var(--text-muted); }
.mock-signin { inset-inline-start: 0; bottom: 24px; z-index: 4; padding: 14px 16px; border-radius: 18px; display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: .875rem; }
.mock-signin .logo-mini { width: 32px; height: 32px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; color: #fff; }
@media (max-width: 1024px) { .showcase { min-height: 600px; max-width: 560px; margin-inline: auto; width: 100%; } }
@media (max-width: 560px) {
  .showcase { min-height: 0; display: grid; gap: 16px; }
  .showcase > * { position: static; width: auto !important; }
  .mock-portfolio, .mock-qr { display: none; }
  .mock-phone { max-width: 320px; margin-inline: auto; }
  .mock-signin { justify-self: center; }
}

/* Piliers */
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 960px) { .pillars { grid-template-columns: 1fr; } }
.pillar { padding: 32px; display: flex; flex-direction: column; gap: 16px; position: relative; overflow: hidden; }
.pillar .num { position: absolute; top: 20px; inset-inline-end: 24px; font: 700 3.5rem/1 var(--font-display); color: var(--text); opacity: .06; }
.icon-badge { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--grad); color: #fff; box-shadow: var(--glow); }
.icon-badge.soft { background: var(--grad-soft); color: var(--secondary-text); box-shadow: none; }
.pillar h3 { font-size: 1.375rem; margin-bottom: 0; }
.pillar p { color: var(--text-muted); }
.pillar .more { margin-top: auto; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--secondary-text); text-decoration: none; }
.pillar .more:hover { gap: 12px; }

/* Bloc fonctionnalité */
.feature { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; }
.feature.reverse > :first-child { order: 2; }
@media (max-width: 960px) { .feature, .feature.reverse { grid-template-columns: 1fr; gap: 40px; } .feature.reverse > :first-child { order: 0; } }
.checklist { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 14px; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; color: var(--text-muted); }
.checklist li strong { color: var(--text); }
.checklist .ic { color: var(--secondary-text); margin-top: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; font-size: .9375rem; color: var(--text); }
.chip .ic { color: var(--secondary-text); width: 18px; height: 18px; }
a.chip:hover { background: var(--surface-hover); }

.panel-visual { padding: 24px; border-radius: var(--r-xl); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.feature-tile { padding: 20px; border-radius: var(--r-lg); display: grid; gap: 12px; align-content: start; }
.feature-tile h3 { font-size: 1rem; }
.feature-tile p { font-size: .9375rem; color: var(--text-muted); margin: 0; }
.feature-tile .icon-badge { width: 44px; height: 44px; border-radius: 12px; }

/* Code */
.code-card { border-radius: var(--r-xl); overflow: hidden; background: var(--code-bg); color: var(--code-text); box-shadow: var(--shadow-lg); border: 1px solid rgb(255 255 255 / .08); }
.code-card .code-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid rgb(255 255 255 / .08); font-size: .875rem; color: #b8b5d6; }
.code-card pre { margin: 0; padding: 20px; overflow-x: auto; font-size: .875rem; line-height: 1.7; direction: ltr; text-align: left; }
.code-card .btn { --btn-fg: #e9e7f7; min-height: 36px; padding: 0 12px; background: rgb(255 255 255 / .08); color: #e9e7f7; font-size: .875rem; }
.tok-k { color: #c4a5ff; } .tok-s { color: #86efac; } .tok-c { color: #8c89ad; } .tok-f { color: #93c5fd; }

/* Bouton officiel « Se connecter avec Ismilink » */
.al-signin {
  display: inline-flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 20px 0 6px;
  border-radius: 14px; border: 1px solid rgb(255 255 255 / .18);
  background: linear-gradient(135deg, #3d5afe, #7c3aed); color: #fff;
  font: 600 1rem/1 var(--font-body); text-decoration: none; white-space: nowrap;
  box-shadow: 0 10px 30px -10px rgb(124 58 237 / .8), inset 0 1px 0 rgb(255 255 255 / .25);
}
[dir="rtl"] .al-signin { padding: 0 6px 0 20px; }
.al-signin .al-mark { width: 36px; height: 36px; border-radius: 10px; background: rgb(255 255 255 / .16); display: grid; place-items: center; }
.al-signin:hover { filter: brightness(1.08); }

/* Tarifs */
.pricing-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 48px; align-items: center; }
@media (max-width: 960px) { .pricing-wrap { grid-template-columns: 1fr; } }
.plan { padding: 40px; position: relative; overflow: hidden; }
.plan::before { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: linear-gradient(135deg, rgb(91 116 255 / .8), rgb(167 139 250 / .8), transparent 60%); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.plan-name { font: 700 1.25rem var(--font-display); display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.plan-price { display: flex; align-items: baseline; gap: 8px; margin: 24px 0 8px; }
.plan-price .amount { font: 700 3.5rem/1 var(--font-display); letter-spacing: -0.03em; }
.plan-price .per { color: var(--text-muted); font-weight: 600; }
.plan .checklist { grid-template-columns: 1fr 1fr; gap: 12px 20px; margin: 32px 0; }
@media (max-width: 560px) { .plan .checklist { grid-template-columns: 1fr; } .plan { padding: 28px; } }
.plan .checklist li { font-size: .9375rem; }

/* FAQ */
.faq { max-width: 860px; margin-inline: auto; display: grid; gap: 12px; }
.faq details { border-radius: var(--r-lg); padding: 0; overflow: hidden; }
.faq summary { list-style: none; cursor: pointer; padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; font-weight: 700; font-size: 1.0625rem; min-height: 64px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .ic { transition: transform var(--dur) var(--ease); color: var(--text-subtle); }
.faq details[open] summary .ic { transform: rotate(180deg); }
.faq .answer { padding: 0 24px 24px; color: var(--text-muted); font-size: 1rem; }

/* Appel à l'action final */
.cta-band { padding: 64px; text-align: center; position: relative; overflow: hidden; }
.cta-band::after { content: ''; position: absolute; width: 480px; height: 480px; border-radius: 50%; background: var(--orb-1); filter: blur(80px); top: -240px; inset-inline-start: 50%; transform: translateX(-50%); z-index: -1; }
.cta-band h2 { max-width: 18ch; margin-inline: auto; }
.cta-band .lead { max-width: 56ch; margin: 0 auto 32px; }
@media (max-width: 640px) { .cta-band { padding: 40px 24px; } }

/* Pied de page */
.site-footer { padding: 64px 0 40px; margin-top: 48px; border-top: 1px solid var(--border-soft); }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 40px; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-grid h3 { font-size: .9375rem; color: var(--text); margin-bottom: 16px; font-family: var(--font-body); letter-spacing: 0; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.footer-grid a { color: var(--text-muted); font-size: .9375rem; display: inline-block; padding: 6px 0; }
.footer-grid a:hover { color: var(--text); }
.footer-about p { color: var(--text-muted); font-size: .9375rem; max-width: 36ch; margin-top: 16px; }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border-soft); color: var(--text-subtle); font-size: .875rem; }

/* Pages documentaires */
.doc-hero { padding-top: calc(var(--nav-h) + 96px); padding-bottom: 48px; }
.doc-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 48px; align-items: start; }
.doc-toc { position: sticky; top: calc(var(--nav-h) + 24px); padding: 20px; border-radius: var(--r-lg); }
.doc-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.doc-toc a { display: block; padding: 8px 12px; border-radius: 10px; color: var(--text-muted); font-weight: 600; font-size: .9375rem; }
.doc-toc a:hover { color: var(--text); background: var(--surface-2); }
@media (max-width: 960px) { .doc-layout { grid-template-columns: 1fr; } .doc-toc { position: static; } }
.prose { max-width: 76ch; }
.prose h2 { font-size: 1.75rem; line-height: 1.15; margin: 56px 0 32px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 32px 0 16px; }
.prose p, .prose li { color: var(--text-muted); }
.prose ul, .prose ol { padding-inline-start: 1.25rem; display: grid; gap: 8px; margin: 0 0 16px; }
.prose .code-card { margin: 24px 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 16px 0 24px; font-size: .9375rem; }
.prose th, .prose td { text-align: start; padding: 12px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.prose th { color: var(--text); }
.steps { counter-reset: step; list-style: none; padding: 0 !important; display: grid; gap: 16px !important; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 40px 1fr; gap: 16px; align-items: start; }
.steps li::before { content: counter(step); width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 700; }

/* ---------- Authentification ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: calc(var(--nav-h) + 48px) var(--gutter) 64px; }
.auth-card { width: 100%; max-width: 480px; padding: 40px; }
.auth-card.wide { max-width: 640px; }
@media (max-width: 560px) { .auth-card { padding: 28px 20px; } }
.auth-card h1 { font-size: 2rem; margin-bottom: 12px; line-height: 1.1; }
.auth-card .sub { color: var(--text-muted); margin-bottom: 32px; }
.auth-card form { display: grid; gap: 0; }
.auth-card .btn-block { margin-top: 28px; }
.auth-foot { text-align: center; margin-top: 24px; color: var(--text-muted); font-size: .9375rem; }
.auth-foot a { color: var(--secondary-text); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.tpl-option { position: relative; }
.tpl-option input { position: absolute; opacity: 0; }
.tpl-option span { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; border-radius: var(--r-sm); border: 1px solid var(--border-soft); background: var(--surface-2); font-weight: 600; font-size: .875rem; cursor: pointer; min-height: 76px; transition: border-color var(--dur), background var(--dur); }
.tpl-option span .ic { color: var(--secondary-text); }
.tpl-option input:checked + span { border-color: var(--secondary); background: var(--grad-soft); box-shadow: 0 0 0 1px var(--secondary); }
.tpl-option input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.pw-toggle { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); width: 40px; min-height: 40px; }
.input-group .input.has-toggle { padding-inline-end: 52px; }

/* ---------- OAuth ---------- */
.consent-apps { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 28px; }
.consent-apps .app-logo { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; font: 700 1.5rem var(--font-display); }
.consent-apps .app-logo img { width: 100%; height: 100%; object-fit: cover; }
.consent-apps .app-logo.al { background: var(--grad); color: #fff; border: 0; box-shadow: var(--glow); }
.consent-apps .link-dots { display: flex; gap: 6px; color: var(--text-subtle); }
.scope-list { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 4px; }
.scope-list li { display: flex; gap: 14px; align-items: flex-start; padding: 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.scope-list .ic { color: var(--secondary-text); margin-top: 2px; }
.scope-list strong { display: block; }
.scope-list span { color: var(--text-muted); font-size: .9375rem; }
.account-chip { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-sm); border: 1px solid var(--border-soft); margin-bottom: 20px; }
.avatar-letter { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 700; flex-shrink: 0; }

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
.reveal { opacity: 1; }
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; } }

/* Toasts */
.toasts { position: fixed; bottom: 24px; inset-inline-end: 24px; display: grid; gap: 8px; z-index: 200; }
.toast { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--r-md); background: var(--surface-strong); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-weight: 600; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); animation: toast-in .2s var(--ease); max-width: min(420px, calc(100vw - 48px)); }
.toast.success .ic { color: var(--success); }
.toast.error .ic { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* 404 */
.notfound { min-height: 80vh; display: grid; place-items: center; text-align: center; padding: calc(var(--nav-h) + 48px) var(--gutter) 48px; }
.notfound .big { font: 700 clamp(5rem, 3rem + 10vw, 10rem)/1 var(--font-display); margin-bottom: 16px; }

/* ---------- Durcissement responsive (pages publiques) ---------- */
/* Une colonne de grille « 1fr » ne descend pas sous la largeur de son contenu : minmax(0, 1fr) + min-width: 0 l'y autorisent. */
@media (max-width: 960px) { .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; } }
.doc-layout > * { min-width: 0; }
pre { max-width: 100%; overflow-x: auto; }
.prose { overflow-wrap: break-word; }
.prose code { overflow-wrap: anywhere; }
.pillar .more { min-height: 44px; }
.auth-foot a, .auth-card .field a { display: inline-block; padding-block: 6px; }
@media (max-width: 560px) {
  .auth-card { padding: 28px 20px; }
  .auth-card h1 { font-size: 1.625rem; }
}
