/* ==========================================================================
   Ciao VIP • base commune aux trois espaces : polices (hébergées ici, licence libre OFL), couleurs de
   marque, boutons, champs, messages, boîtes de confirmation. Repris du Sondage Ciao.
   ========================================================================== */

@font-face { font-family: 'Bricolage Grotesque'; src: url('../assets/fonts/bricolage-grotesque.woff2') format('woff2'); font-weight: 500 800; font-stretch: 75% 100%; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('../assets/fonts/figtree.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('../assets/fonts/geist.woff2') format('woff2'); font-weight: 400 600; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('../assets/fonts/geist-mono.woff2') format('woff2'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'Libre Franklin'; src: url('../assets/fonts/libre-franklin-italic.woff2') format('woff2'); font-weight: 800 900; font-style: italic; font-display: swap; }

@property --p { syntax: '<number>'; inherits: true; initial-value: 0; }
@property --split { syntax: '<percentage>'; inherits: true; initial-value: 50%; }

:root {
  --brown: #2f2521;
  --cream: #fcf6ec;
  --k-display: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
  --k-body: 'Figtree', system-ui, sans-serif;
  --e-display: 'Libre Franklin', 'Arial Black', sans-serif;
  --e-body: 'Geist', system-ui, sans-serif;
  --e-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --gutter: clamp(16px, 4vw, 56px);
  --error: #b3261e;
  --ok: #1d7a45;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--cream);
  color: var(--brown);
  font-family: var(--k-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
[hidden] { display: none !important; }

.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;
}
:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }
.noscript { padding: 24px; text-align: center; font-size: 1.125rem; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- boutons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  font: 700 1rem/1.1 var(--k-body);
  -webkit-tap-highlight-color: transparent;
  transition: transform .3s var(--spring), background-color .2s, color .2s, box-shadow .25s, opacity .2s;
}
.btn:active:not([disabled]) { transform: scale(.96); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.is-busy { cursor: progress; opacity: .75; }
.btn.is-busy::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn--primary { background: var(--brown); color: var(--cream); }
.btn--ghost { background: transparent; color: inherit; box-shadow: inset 0 0 0 2px color-mix(in srgb, currentColor 35%, transparent); }
.btn--danger { background: var(--error); color: #fff; }
.btn--small { min-height: 40px; padding: 0 16px; font-size: .9rem; }
@media (hover: hover) {
  .btn--primary:hover:not([disabled]) { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(47, 37, 33, .22); }
  .btn--ghost:hover:not([disabled]) { box-shadow: inset 0 0 0 2px currentColor; }
}
@keyframes spin { to { rotate: 360deg; } }

.link-button {
  padding: 4px 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------------------------------------------------------------- champs */

.field-group { display: grid; gap: 7px; }
.field-label { font-weight: 600; font-size: .95rem; }
.field-hint { font-size: .85rem; opacity: .7; }
.field {
  width: 100%;
  min-height: 52px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 2px solid color-mix(in srgb, var(--brown) 18%, transparent);
  background: rgba(255, 255, 255, .7);
  color: var(--brown);
  font-size: 1.0625rem;
  line-height: 1.4;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.field::placeholder { color: rgba(47, 37, 33, .45); }
.field:focus { outline: none; border-color: var(--brown); background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--brown) 14%, transparent); }
.field[aria-invalid="true"] { border-color: var(--error); }
.field--area { min-height: 96px; resize: vertical; }
.field-error { font-size: .9rem; font-weight: 600; color: var(--error); }
.field-error:empty { display: none; }
.form-error:empty { display: none; }
.form-error { padding: 11px 16px; border-radius: 14px; background: color-mix(in srgb, var(--error) 12%, #fff); color: var(--error); font-weight: 600; }
.password { position: relative; }
.password .field { padding-right: 96px; }
.password__toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  translate: 0 -50%;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  opacity: .7;
}
.password__toggle:hover { opacity: 1; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: .95rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brown); flex: none; }

/* ---------------------------------------------------------------- messages */

.toasts {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  translate: -50% 0;
  display: grid;
  gap: 8px;
  width: min(92vw, 440px);
  pointer-events: none;
}
.toast {
  padding: 13px 18px;
  border-radius: 16px;
  background: var(--brown);
  color: var(--cream);
  font-weight: 600;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .25);
  opacity: 0;
  transform: translateY(14px) scale(.98);
  transition: opacity .3s var(--ease), transform .4s var(--spring);
}
.toast.is-in { opacity: 1; transform: none; }
.toast--error { background: var(--error); color: #fff; }
.toast--ok { background: var(--ok); color: #fff; }

/* ---------------------------------------------------------------- confirmations */

dialog.confirm {
  width: min(92vw, 440px);
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: var(--cream);
  color: var(--brown);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
dialog.confirm::backdrop { background: rgba(20, 14, 12, .5); backdrop-filter: blur(3px); }
dialog[open].confirm { animation: dialog-in .35s var(--spring); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.confirm__box { display: grid; gap: 14px; padding: 26px; }
.confirm__title { font: 800 1.45rem/1.15 var(--k-display); font-variation-settings: 'wdth' 90; }
.confirm__text { line-height: 1.5; opacity: .85; }
.confirm__actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ---------------------------------------------------------------- divers */

.spinner {
  width: 28px;
  height: 28px;
  margin: 40px auto;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  opacity: .5;
  animation: spin .8s linear infinite;
}

/* Fenêtre où du texte a été tapé : un clic à côté ne la ferme pas, elle bouge un peu pour le montrer. */

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

.field[readonly] { background: transparent; border-style: dashed; cursor: default; }
.field[readonly]:focus { box-shadow: none; border-color: color-mix(in srgb, var(--brown) 30%, transparent); }

/* ---------------------------------------------------------------- voir avec les yeux de (propriétaire) */
.viewing {
  position: sticky; top: 0; z-index: 1000;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px;
  padding: 8px 16px;
  background: #ffd84d; color: #1a1a1a;
  font-family: var(--k-body); font-size: .875rem; line-height: 1.3; text-align: center;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .15);
}
.viewing__text b { font-weight: 700; }
.viewing__back {
  padding: 6px 14px; border: 0; border-radius: 999px;
  background: #1a1a1a; color: #fff; font-weight: 600; cursor: pointer;
}
.viewing__back:disabled { opacity: .6; cursor: progress; }
