/* Motion for nabilkamel.com (2026-10-24), from the transitions.dev skill.
   Shared motion tokens, then three transitions pasted verbatim:
   modal (screenshot viewer), accordion (FAQ and role details),
   learn-more hover (tool card arrows), plus a plain 200ms hero fade.
   Site wiring overrides last. */

:root {
  /* ── Motion tokens — shared scale ──────────────────────────────
     Reference these with var(--…) anywhere in your project. The
     transitions below ship literal values so each snippet works on
     its own; `transitions refine` maps hardcoded values back to
     these tokens. */
  /* Durations */
  --duration-stagger: 40ms;  /* per-item stagger offset */
  --duration-micro: 80ms;  /* tooltip/path delay, shake segment, large stagger */
  --duration-quick: 150ms;  /* modal/dropdown close, text swap, tooltip appear */
  --duration-fast: 250ms;  /* icon swap, dropdown/modal open, tabs sliding, page slide */
  --duration-medium: 350ms;  /* panel close, toast close */
  --duration-slow: 400ms;  /* panel open, skeleton content reveal, input clear */
  --duration-very-slow: 500ms;  /* emphasis moments, badge appear, text reveal, success check */
  /* Easings */
  --ease-smooth-out: cubic-bezier(0.22, 1, 0.36, 1);  /* modal/dropdown/panel open + close, page slide, resize, position change */
  --ease-in-out: ease-in-out;  /* icon swap, text swap, text reveal, skeleton reveal */
  --ease-out: ease-out;  /* tooltip open / close */
  --ease-linear: linear;  /* shimmer, skeleton pulse, spinner */
  --ease-bounce: cubic-bezier(0.34, 1.36, 0.64, 1);  /* badge pop open */
  --ease-bounce-strong: cubic-bezier(0.34, 3.85, 0.64, 1);  /* bouncy hover-out (avatar return) */
  /* Distances */
  --distance-micro: 4px;  /* text swap */
  --distance-small: 6px;  /* error shake (small segment) */
  --distance-base: 8px;  /* badge diagonal reveal, page slide, error shake (large segment) */
  --distance-medium: 12px;  /* text reveal */
  --distance-large: 30px;  /* check badge appear */
  /* Scales */
  --scale-large: 0.96;  /* modal open / close */
  --scale-medium: 0.97;  /* dropdown open */
  --scale-small: 0.98;  /* tooltip open */
  --scale-tiny: 0.99;  /* dropdown close */
  /* Blur */
  --blur-small: 2px;  /* panel reveal, icon swap, text swap, skeleton reveal, number pop-in */
  --blur-medium: 3px;  /* page slide, text reveal */
  --blur-large: 8px;  /* success check open */
  }

/* ===== Modal open / close (06-modal.md) ===== */
:root {
  --modal-open-dur: 250ms;
  --modal-close-dur: 150ms;
  --modal-scale: 0.96;
  --modal-scale-close: 0.96;
  --modal-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.t-modal {
  transform-origin: center;
  transform: scale(var(--modal-scale));
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--modal-open-dur) var(--modal-ease),
    opacity   var(--modal-open-dur) var(--modal-ease);
  will-change: transform, opacity;
}
.t-modal.is-open {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
}
.t-modal.is-closing {
  transform: scale(var(--modal-scale-close));
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--modal-close-dur) var(--modal-ease),
    opacity   var(--modal-close-dur) var(--modal-ease);
}

@media (prefers-reduced-motion: reduce) {
  .t-modal { transition: none !important; }
}

/* ===== Hero fade (replaces the texts reveal, 2026-10-24) ===== */
/* One quiet 200ms fade for the whole hero block: no slide, no blur,
   no per-line stagger (build rules: quiet fades only on websites).
   The JS adds .is-shown to .t-stagger on load. */
.t-stagger {
  opacity: 0;
  transition: opacity 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.t-stagger.is-shown { opacity: 1; }
.t-stagger-line { display: block; }

@media (prefers-reduced-motion: reduce) {
  .t-stagger { transition: none !important; }
}

/* ===== Accordion expand (21-accordion.md) ===== */
:root {
  --acc-expand: 250ms;
  --acc-collapse: 250ms;
  --acc-chevron: 250ms;
  --acc-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* grid-template-rows 0fr → 1fr gives a clean height animation
   with no JS measurement; the inner element clips overflow. */
.t-acc-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--acc-collapse) var(--acc-ease);
}
.t-acc[data-open="true"] .t-acc-panel {
  grid-template-rows: 1fr;
  transition: grid-template-rows var(--acc-expand) var(--acc-ease);
}
.t-acc-panel-inner {
  overflow: hidden;
  opacity: 0;
  filter: blur(2px);
  transition:
    opacity var(--acc-collapse) var(--acc-ease),
    filter var(--acc-collapse) var(--acc-ease);
}
.t-acc[data-open="true"] .t-acc-panel-inner {
  opacity: 1;
  filter: blur(0);
  transition:
    opacity var(--acc-expand) var(--acc-ease),
    filter var(--acc-expand) var(--acc-ease);
}
/* Flip the chevron vertically to turn the "v" into a "^".
   scaleY(-1) about the centre passes through a flat line at
   the midpoint (same look as a `d:` path morph) but animates
   in every browser, unlike CSS `d:` morphing (Chromium only).
   The chevron path is symmetric about the 16x16 viewBox
   centre, so the flip lands exactly on the "^"; non-scaling
   -stroke keeps the stroke width constant through the flip. */
.t-acc-chevron {
  display: inline-flex;
  transform: scaleY(1);
  transform-origin: center;
  transition: transform var(--acc-chevron) var(--acc-ease);
}
.t-acc-chevron path { vector-effect: non-scaling-stroke; }
.t-acc[data-open="true"] .t-acc-chevron {
  transform: scaleY(-1);
}

@media (prefers-reduced-motion: reduce) {
  .t-acc-panel, .t-acc-panel-inner, .t-acc-chevron {
    transition: none !important;
  }
}

/* ===== Learn more hover (24-learn-more-hover.md) ===== */
:root {
  --learn-shift: 2px;
  --learn-spread: 8deg;
  --learn-in: 200ms;  /* hover budget (Emil pass 2026-10-24, was 350ms) */
  --learn-out: 200ms;
  --learn-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.t-learn-chevron {
  display: inline-flex;
  transform: translateX(0);
  transition: transform var(--learn-out) var(--learn-ease);
}
.t-learn-arm {
  transform-box: view-box;
  transform-origin: 10px 8px;
  vector-effect: non-scaling-stroke;
  transition: transform var(--learn-out) var(--learn-ease);
}
.t-learn:hover .t-learn-chevron { transform: translateX(var(--learn-shift)); transition-duration: var(--learn-in); }
.t-learn:hover .t-learn-arm { transition-duration: var(--learn-in); }
.t-learn:hover .t-learn-arm-top { transform: rotate(var(--learn-spread)); }
.t-learn:hover .t-learn-arm-bot { transform: rotate(calc(var(--learn-spread) * -1)); }

@media (prefers-reduced-motion: reduce) {
  .t-learn-chevron, .t-learn-arm { transition: none !important; }
}

/* ===== Site wiring (nabilkamel.com) ===== */
/* Without JS, hero lines stay visible and every accordion stays open. */
html:not(.js) .t-stagger { opacity: 1; }
html:not(.js) .t-acc-panel { grid-template-rows: 1fr; }
html:not(.js) .t-acc-panel-inner { opacity: 1; filter: none; }
html:not(.js) .t-acc-chevron { display: none; }

/* Hero: flex lines keep their own layout. */
.mast .trust-row.t-stagger-line, .mast .actions.t-stagger-line { display: flex; }

/* Screenshot viewer: the backdrop fades with the modal. */
.lightbox.t-modal::backdrop { opacity: 0; transition: opacity var(--modal-open-dur) var(--modal-ease); }
.lightbox.t-modal.is-open::backdrop { opacity: 1; }
.lightbox.t-modal.is-closing::backdrop { opacity: 0; transition-duration: var(--modal-close-dur); }

/* Accordion heads (FAQ rows and role "Show details") */
.t-acc-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; margin: 0; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.t-acc-chevron svg { width: 16px; height: 16px; fill: none; stroke: var(--green-bright); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.faq .t-acc { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.faq .t-acc[data-open="true"] { border-color: var(--line-2); }
.faq .t-acc-head { min-height: 52px; padding: 14px 18px; border-radius: 12px; }
.faq .t-acc-panel-inner p { padding: 0 18px 16px; color: var(--ink-2); }
.more.t-acc { margin-top: 12px; }
.more .t-acc-head { width: auto; justify-content: flex-start; gap: 8px; min-height: 44px; font-size: 15px; }
.more .c, .more[data-open="true"] .o { display: none; }
.more[data-open="true"] .c { display: inline; }
.more .t-acc-panel-inner ul { margin: 4px 0 0; padding: 0 0 4px 20px; display: grid; gap: 8px; }
.more .t-acc-panel-inner li { font-size: 16px; line-height: 1.55; }
.more .t-acc-panel-inner li::marker { color: var(--green-bright); }

/* Tool card arrows */
.tool .go { display: inline-flex; align-items: center; gap: 6px; }
.t-learn-chevron svg { width: 16px; height: 16px; fill: none; stroke: var(--green-bright); stroke-width: 2; stroke-linecap: round; }
