/* =========================================================================
   GJDC Webmail — design tokens (motion, radius, schaduw)
   -------------------------------------------------------------------------
   Laadt ná huisstijl.css (die uit GJDC-Mijn komt en we niet aanpassen) en
   vóór webmail.css. Alle bewegingen, hoeken en schaduwen in de webmail
   komen hiervandaan; JavaScript leest dezelfde waarden via WM.motion.

   Regels
   - Entrances: ease-out. Exits: 20% korter, ease-in.
   - Dropdowns/popovers: 150–250 ms. Lijstrijen: 30 ms stagger (max 10).
   - Press: scale(.97). Bewegend element: max 12% stretch, via een boog.
   - Geen spring/bounce voor alledaagse UI.
   - prefers-reduced-motion: alleen fades (alle afstanden/schalen → 0/1).
   ========================================================================= */

:root {
  /* ── Easing ───────────────────────────────────────────────────────────── */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);   /* entrances */
  --ease-in:     cubic-bezier(0.7, 0, 0.84, 0);   /* exits */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);  /* van A naar B (panelen, bogen) */
  --ease-linear: linear;                           /* alleen voor loops/voortgang */

  /* ── Duur (entrance → exit = ×0.8) ────────────────────────────────────── */
  --dur-press:        100ms;  /* indrukken/loslaten */
  --dur-fast:         150ms;  /* hover, kleur, kleine statuswissel */
  --dur-fast-exit:    120ms;
  --dur-popover:      200ms;  /* dropdowns, contextmenu's, suggesties */
  --dur-popover-exit: 160ms;
  --dur-base:         240ms;  /* toasts, kaarten, panelen in beeld */
  --dur-base-exit:    192ms;
  --dur-slow:         320ms;  /* volledige schermen, sheets */
  --dur-slow-exit:    256ms;
  --dur-shake:        280ms;  /* foutmelding (max 6px, geen bounce) */
  --dur-pulse:        360ms;  /* succes-bevestiging op knoppen */
  --dur-loop:         1200ms; /* skeletons, voortgangsbalk */

  /* ── Choreografie ─────────────────────────────────────────────────────── */
  --stagger:      30ms;   /* per lijstrij; JS stopt na --stagger-cap rijen */
  --stagger-cap:  10;
  --settle-delay: 60ms;   /* eerst container, dan inhoud */

  /* ── Afstanden en schalen (worden 0/1 bij reduced motion) ─────────────── */
  --m-shift:   8px;    /* hoe ver iets "binnenschuift" */
  --m-rise:    24px;   /* grotere oppervlakken (opstellen, sheets) */
  --m-shake:   6px;    /* maximale uitslag van een fout-shake */
  --m-pop:     .96;    /* beginschaal van popovers (vanaf de trigger) */
  --m-press:   .97;    /* press-state */
  --m-pulse:   1.04;   /* piek van de succes-pulse */
  --m-stretch: 1.12;   /* max. rek tijdens beweging */
  --m-fade:    1;      /* 1 = beweging aan; JS leest dit voor bogen */

  /* ── Iconen ──────────────────────────────────────────────────────────── *
     Eén set (Bootstrap Icons, 1px-lijn op 16px). Drie maten, zodat de
     lijndikte overal gelijk oogt. */
  --icon-s: 1rem;      /* in kleine knoppen, chips, menu's */
  --icon-m: 1.125rem;  /* standaard: iconknoppen, mappen */
  --icon-l: 1.375rem;  /* FAB, vegen, lege staat-tegel (×1.6) */

  /* ── Hoeken ───────────────────────────────────────────────────────────── *
     Concentrisch: binnenradius = buitenradius − padding. Gebruik daarvoor
     calc(var(--r-…) - var(--pad-…)) in plaats van een losse waarde. */
  --r-2xs:  6px;
  --r-xs:   8px;
  --r-s:    10px;
  --r-m:    var(--gj-r-sm);  /* 12px */
  --r-l:    14px;
  --r-xl:   var(--gj-r-md);  /* 16px */
  --r-2xl:  20px;
  --r-3xl:  var(--gj-r-lg);  /* 22px */
  --r-4xl:  var(--gj-r-xl);  /* 26px */
  --r-pill: 999px;
  --r-round: 50%;

  /* ── Schaduwen ────────────────────────────────────────────────────────── *
     Altijd 2–3 lagen, getint naar de achtergrond (nooit puur zwart).
     --sh-tint is de RGB van de schaduwkleur zonder alpha. */
  --sh-tint: 28 52 112;
  --sh-accent: 10 132 255;
  --sh-1:
    0 1px 1px rgb(var(--sh-tint) / .05),
    0 2px 6px -1px rgb(var(--sh-tint) / .08);
  --sh-2:
    0 1px 2px rgb(var(--sh-tint) / .06),
    0 6px 14px -6px rgb(var(--sh-tint) / .14),
    0 16px 32px -16px rgb(var(--sh-tint) / .18);
  --sh-3:
    0 2px 4px rgb(var(--sh-tint) / .06),
    0 12px 28px -10px rgb(var(--sh-tint) / .2),
    0 32px 64px -28px rgb(var(--sh-tint) / .32);
  --sh-btn:
    0 1px 2px rgb(var(--sh-accent) / .22),
    0 6px 14px -6px rgb(var(--sh-accent) / .45),
    0 14px 28px -14px rgb(var(--sh-accent) / .5);
  --sh-btn-hover:
    0 1px 2px rgb(var(--sh-accent) / .26),
    0 8px 18px -6px rgb(var(--sh-accent) / .52),
    0 18px 34px -14px rgb(var(--sh-accent) / .58);
  --sh-inset-hi: inset 0 1px 0 rgb(255 255 255 / .7);
  --sh-glass: var(--sh-2), var(--sh-inset-hi);
  --ring: 0 0 0 4px rgb(var(--sh-accent) / .16);
  --ring-ai: 0 0 0 4px rgb(124 92 255 / .16);
  --sh-ai: 0 1px 2px rgb(124 92 255 / .25), 0 6px 14px -6px rgb(124 92 255 / .55);

  /* Huisstijl-schaduwen (huisstijl.css) ook gelaagd maken, zonder dat
     bestand aan te passen: dezelfde namen, nieuwe waarden. */
  --gj-sh-sm: var(--sh-1);
  --gj-sh-md: var(--sh-2);
  --gj-sh-lg: var(--sh-3);
  --gj-sh-btn: var(--sh-btn);
  --gj-glass-sh: var(--sh-glass);
}

html[data-theme="dark"] {
  --sh-tint: 2 6 20;
  --sh-1:
    0 1px 1px rgb(var(--sh-tint) / .3),
    0 2px 6px -1px rgb(var(--sh-tint) / .35);
  --sh-2:
    0 1px 2px rgb(var(--sh-tint) / .35),
    0 6px 14px -6px rgb(var(--sh-tint) / .5),
    0 16px 32px -16px rgb(var(--sh-tint) / .6);
  --sh-3:
    0 2px 4px rgb(var(--sh-tint) / .35),
    0 12px 28px -10px rgb(var(--sh-tint) / .6),
    0 32px 64px -28px rgb(var(--sh-tint) / .75);
  --sh-inset-hi: inset 0 1px 0 rgb(255 255 255 / .06);

  /* Huisstijl-schaduwen (huisstijl.css) ook gelaagd maken, zonder dat
     bestand aan te passen: dezelfde namen, nieuwe waarden. */
  --gj-sh-sm: var(--sh-1);
  --gj-sh-md: var(--sh-2);
  --gj-sh-lg: var(--sh-3);
  --gj-sh-btn: var(--sh-btn);
  --gj-glass-sh: var(--sh-glass);
}

/* Reduced motion: dezelfde animaties, maar zonder verplaatsing of schaal.
   Wat overblijft zijn fades. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --m-shift: 0px;
    --m-rise: 0px;
    --m-shake: 0px;
    --m-pop: 1;
    --m-press: 1;
    --m-pulse: 1;
    --m-stretch: 1;
    --m-fade: 0;
    --stagger: 0ms;
    --settle-delay: 0ms;
  }
}

/* ── Gedeelde keyframes ──────────────────────────────────────────────────── */

@keyframes wm-in-up    { from { opacity: 0; transform: translateY(var(--m-shift)); } }
@keyframes wm-in-rise  { from { opacity: 0; transform: translateY(var(--m-rise)); } }
@keyframes wm-in-pop   { from { opacity: 0; transform: scale(var(--m-pop)); } }
@keyframes wm-out-pop  { to   { opacity: 0; transform: scale(var(--m-pop)); } }
@keyframes wm-in-fade  { from { opacity: 0; } }
@keyframes wm-out-fade { to   { opacity: 0; } }
/* Binnenkomen met rek in de bewegingsrichting (max. --m-stretch), die
   wegvalt zodra het element op zijn plek is. */
@keyframes wm-in-stretch {
  0%   { opacity: 0; transform: translateY(var(--m-rise)) scaleY(var(--m-stretch)); }
  60%  { opacity: 1; transform: translateY(0) scaleY(1); }
}
@keyframes wm-pulse {
  0%   { transform: scale(1); }
  45%  { transform: scale(var(--m-pulse)); }
  100% { transform: scale(1); }
}
@keyframes wm-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(calc(var(--m-shake) * -1)); }
  40%      { transform: translateX(var(--m-shake)); }
  60%      { transform: translateX(calc(var(--m-shake) * -.5)); }
  80%      { transform: translateX(calc(var(--m-shake) * .5)); }
}

/* Hulpmiddelen die JS aan/uit zet */
.wm-pulse { animation: wm-pulse var(--dur-pulse) var(--ease-out); }
.wm-shake { animation: wm-shake var(--dur-shake) var(--ease-in-out); }
.wm-stagger > * {
  animation: wm-in-up var(--dur-base) var(--ease-out) both;
  animation-delay: calc(min(var(--i, 0), var(--stagger-cap)) * var(--stagger));
}

/* Ongeldig veld: korte shake (max. 6px, geen vering) */
.form-control.is-invalid,
.form-select.is-invalid,
.wm-shake-field { animation: wm-shake var(--dur-shake) var(--ease-in-out); }
