/* Charte commune OneConnector : accueil et espace (index.html), documentation (docs.html),
   pages servies par le Worker (connexion, /b/<domaine>). Sombre par défaut ; le clair est
   choisi par le sélecteur de thème (cookie oc_theme, lu aussi par le serveur).

   Deux couleurs portent la marque : le bleu de l'anneau (liens, repères, focus) et le vert
   « joignable », celui de la pastille posée sur les sites, réservé à l'état en ligne.
   Titres en Bricolage Grotesque, interface en Geist, code en Geist Mono. */

@font-face {
  font-family: "Geist";
  src: url("/fonts/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/geist-mono.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #090c12;
  --bg-2: #0d1118;
  --surface: #11161f;
  --surface-2: #171d28;
  --raised: #1b2230;
  --fg: #d6dbe4;
  --fg-strong: #f3f5f9;
  --muted: #98a1b0;
  --faint: #687183;
  --line: rgba(166, 186, 226, 0.085);
  --line-strong: rgba(166, 186, 226, 0.15);
  --hover: rgba(166, 186, 226, 0.06);
  --active: rgba(166, 186, 226, 0.1);
  --field: rgba(9, 12, 18, 0.55);
  --code: rgba(166, 186, 226, 0.045);
  --accent: #6b98ff;
  --accent-text: #93b3ff;
  --accent-soft: rgba(107, 152, 255, 0.13);
  --accent-line: rgba(107, 152, 255, 0.42);
  --on-accent: #070a10;
  --primary: #eef1f6;
  --primary-hover: #ffffff;
  --on-primary: #0b0f16;
  --signal: #3ed68e;
  --signal-soft: rgba(62, 214, 142, 0.13);
  --ok: #4fdc98;
  --ok-bg: rgba(62, 214, 142, 0.11);
  --warn: #f1c35b;
  --warn-bg: rgba(241, 195, 91, 0.11);
  --warn-dot: #f1c35b;
  --ko: #ff8778;
  --ko-bg: rgba(255, 135, 120, 0.1);
  --ring: rgba(107, 152, 255, 0.45);
  --highlight: rgba(255, 255, 255, 0.045);
  --shadow: 0 1px 0 var(--highlight) inset, 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-lg:
    0 1px 0 var(--highlight) inset, 0 2px 6px rgba(0, 0, 0, 0.3),
    0 32px 80px -32px rgba(0, 0, 0, 0.75);
  --overlay: rgba(3, 5, 9, 0.65);
  --font:
    "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    sans-serif;
  --display: "Bricolage Grotesque", var(--font);
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --r-sm: 7px;
  --r: 10px;
  --r-lg: 16px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --bg-2: #eef0f4;
  --surface: #ffffff;
  --surface-2: #f4f6f9;
  --raised: #ffffff;
  --fg: #1d2330;
  --fg-strong: #0a0e17;
  --muted: #576072;
  --faint: #8890a0;
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.14);
  --hover: rgba(15, 23, 42, 0.04);
  --active: rgba(15, 23, 42, 0.07);
  --field: #ffffff;
  --code: rgba(15, 23, 42, 0.04);
  --accent: #2f5cf0;
  --accent-text: #2349d0;
  --accent-soft: rgba(47, 92, 240, 0.08);
  --accent-line: rgba(47, 92, 240, 0.38);
  --on-accent: #ffffff;
  --primary: #0e1320;
  --primary-hover: #252c3d;
  --on-primary: #f6f7fa;
  --signal: #12a36a;
  --signal-soft: rgba(18, 163, 106, 0.1);
  --ok: #0f8a59;
  --ok-bg: rgba(18, 163, 106, 0.1);
  --warn: #8a5a00;
  --warn-bg: rgba(240, 175, 30, 0.16);
  --warn-dot: #e5a00d;
  --ko: #c0321f;
  --ko-bg: rgba(220, 60, 40, 0.08);
  --ring: rgba(47, 92, 240, 0.35);
  --highlight: rgba(255, 255, 255, 0.9);
  --shadow:
    0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.02);
  --shadow-lg:
    0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 20px -6px rgba(15, 23, 42, 0.08),
    0 32px 70px -30px rgba(15, 23, 42, 0.22);
  --overlay: rgba(15, 23, 42, 0.32);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  font:
    14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}
::selection {
  background: var(--accent-soft);
  color: var(--fg-strong);
}
a {
  color: inherit;
}
h1,
h2,
h3 {
  color: var(--fg-strong);
  text-wrap: balance;
}
p {
  text-wrap: pretty;
}
.display {
  font-family: var(--display);
  font-weight: 560;
  letter-spacing: -0.025em;
}
.hidden {
  display: none !important;
}
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.num,
.tnum {
  font-variant-numeric: tabular-nums;
}

/* Icônes au trait */
svg.i {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Marque : anneau + point, « un » connecteur */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--fg-strong);
  text-decoration: none;
}
.brand .mark {
  width: 22px;
  height: 22px;
  flex: none;
}
.mark .ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
}
.mark .core {
  fill: var(--accent);
}

/* La pastille « Joignable par les IA », telle qu'elle apparaît sur les sites */
.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 13px 0 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.live-dot {
  position: relative;
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 3px var(--signal-soft);
}
.live-dot.ping::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--signal);
  animation: ping 2.4s var(--ease) infinite;
}
@keyframes ping {
  0% {
    transform: scale(1);
    opacity: 0.55;
  }
  70%,
  100% {
    transform: scale(3.2);
    opacity: 0;
  }
}

/* Boutons en pilule */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 15px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  box-shadow: var(--shadow);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s,
    box-shadow 0.15s,
    transform 0.1s var(--ease),
    opacity 0.15s;
}
.btn:hover {
  background: var(--raised);
  border-color: var(--line-strong);
  color: var(--fg-strong);
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn svg.i {
  width: 15px;
  height: 15px;
}
.btn.primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: transparent;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 1px 2px rgba(0, 0, 0, 0.2);
}
.btn.primary:hover {
  background: var(--primary-hover);
  color: var(--on-primary);
}
.btn.accent {
  background: var(--accent);
  color: var(--on-accent);
  border-color: transparent;
}
.btn.accent:hover {
  filter: brightness(1.07);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
}
.btn.ghost:hover {
  color: var(--fg);
  background: var(--hover);
}
.btn.danger {
  color: var(--ko);
}
.btn.danger:hover {
  background: var(--ko-bg);
  border-color: transparent;
  color: var(--ko);
}
.btn.danger.armed {
  background: var(--ko);
  color: #fff;
  border-color: transparent;
}
.btn.sm {
  height: 28px;
  padding: 0 11px;
  font-size: 12.5px;
}
.btn.lg {
  height: 42px;
  padding: 0 20px;
  font-size: 14.5px;
}
.btn.block {
  width: 100%;
  height: 42px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.btn.busy {
  pointer-events: none;
}
.btn.busy::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}
.icon-btn:hover {
  background: var(--hover);
  border-color: var(--line-strong);
  color: var(--fg);
}

/* Sélecteur de thème : le soleil en sombre (passer au clair), la lune en clair */
.theme-toggle .moon,
:root[data-theme="light"] .theme-toggle .sun {
  display: none;
}
:root[data-theme="light"] .theme-toggle .moon {
  display: block;
}

.link {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  transition:
    color 0.15s,
    text-decoration-color 0.15s;
}
.link:hover {
  color: var(--fg);
  text-decoration-color: currentColor;
}

/* Étiquette discrète (documentation) */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--accent-text);
}
.tag .chip {
  display: none;
}

/* Pastilles d'état */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  font-size: 12px;
  font-weight: 500;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--muted);
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill.plain::before {
  display: none;
}
.pill.ok {
  background: var(--ok-bg);
  color: var(--ok);
}
.pill.ok::before {
  background: var(--signal);
  box-shadow: 0 0 0 2px var(--signal-soft);
}
.pill.warn {
  background: var(--warn-bg);
  color: var(--warn);
}
.pill.warn::before {
  background: var(--warn-dot);
}
.pill.ko {
  background: var(--ko-bg);
  color: var(--ko);
}
.pill.accent {
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* Champs */
input[type="text"],
input[type="url"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font: inherit;
  color: var(--fg-strong);
  background: var(--field);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  outline: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06) inset;
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    background 0.15s;
}
input:hover:not(:disabled):not(:focus),
textarea:hover:not(:disabled):not(:focus),
select:hover:not(:disabled):not(:focus) {
  border-color: color-mix(in srgb, var(--line-strong), var(--fg) 12%);
}
input::placeholder,
textarea::placeholder {
  color: var(--faint);
}
textarea {
  height: auto;
  min-height: 120px;
  padding: 10px 12px;
  line-height: 1.55;
  resize: vertical;
}
textarea.code {
  font:
    12.5px/1.65 var(--mono);
}
select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  cursor: pointer;
}
select option {
  background: var(--surface);
  color: var(--fg);
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
::-webkit-calendar-picker-indicator {
  opacity: 0.6;
  cursor: pointer;
}
:root:not([data-theme="light"]) ::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

/* Cases à cocher */
input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  flex: none;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--field);
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}
input[type="checkbox"]::after {
  content: "";
  width: 8px;
  height: 4px;
  margin-top: -2px;
  border: solid var(--on-accent);
  border-width: 0 0 1.8px 1.8px;
  transform: rotate(-45deg) scale(0);
  transition: transform 0.12s var(--ease);
}
input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
input[type="checkbox"]:checked::after {
  transform: rotate(-45deg) scale(1);
}
input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Interrupteur : une case à cocher habillée */
input[type="checkbox"].switch {
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: var(--active);
  border-color: var(--line-strong);
  place-items: center start;
  padding: 0 2px;
}
input[type="checkbox"].switch::after {
  width: 12px;
  height: 12px;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: var(--fg-strong);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transform: none;
  transition: transform 0.18s var(--ease);
}
input[type="checkbox"].switch:checked {
  background: var(--signal);
  border-color: var(--signal);
}
input[type="checkbox"].switch:checked::after {
  background: #fff;
  transform: translateX(14px);
}

/* Code */
code {
  font:
    12.5px var(--mono);
  background: var(--code);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: var(--r-sm);
}
pre {
  margin: 0;
  padding: 14px 16px;
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font:
    12.5px/1.7 var(--mono);
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--fg);
}
pre code {
  background: none;
  border: 0;
  padding: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
