/* ============================================================================
   Faden v2 · Direction C · motion.css — motion and modern finish (owner, 18-10-2026)
   Mockup · datos ficticios. Linked last by screens 01-04, after palettes.css.

   CSS only, no script. Every moving rule sits behind
   @media (prefers-reduced-motion: no-preference) and :root:not([data-motion='reduced']),
   so a user who asks for less motion sees the same page, still and complete.
   Each animation runs once (entry) or follows the pointer (hover, press); nothing
   loops or blinks, nothing moves for more than about one second (WCAG 2.2.2), and
   no content waits for an animation to be readable.

     1. Static finish: frosted topbar, soft brand wash on the record header.
     2. Entry: cards rise in a short stagger; bars fill; silhouettes pop in.
     3. Pointer: figure tiles and module cards lift, buttons press, the
        primary button shows a light sheen, attendance days and silhouettes respond.
     4. Disclosure: <details> and the course table's row expansion open smoothly.
     5. Page to page: cross-document view transitions keep the sidebar and the
        student header in place between Resumen and Académico.
     6. Scroll: the topbar gains its shadow as the page scrolls.
   ============================================================================ */

:root {
  --fd-motion-base: 240ms;
  --fd-motion-entry: 520ms;
  --fd-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --fd-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --fd-shadow-lift: 0 2px 4px rgb(16 24 28 / 0.06), 0 10px 24px rgb(16 24 28 / 0.10);
}

/* ---- 1. Static finish (no motion) ---------------------------------------- */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .fd-topbar {
    background: color-mix(in srgb, var(--fd-surface) 84%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    backdrop-filter: saturate(1.4) blur(12px);
  }
}
/* A faint wash of the brand colour behind the student name; text stays on near-white. */
.fd-record-header {
  background-image: linear-gradient(120deg, var(--fd-primary-50) 0%, var(--fd-surface) 46%);
}

@media (prefers-reduced-motion: no-preference) {

  /* ---- 2. Entry ---------------------------------------------------------- */
  @keyframes fd-rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes fd-fill { from { transform: scaleX(0); } }
  @keyframes fd-pop {
    from { opacity: 0; transform: translateY(6px) scale(0.6); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes fd-fade { from { opacity: 0; } }

  :root:not([data-motion='reduced']) .fd-record-header,
  :root:not([data-motion='reduced']) .c03-course,
  :root:not([data-motion='reduced']) .fd-home-head,
  :root:not([data-motion='reduced']) .fd-grid > *,
  :root:not([data-motion='reduced']) .fd-modules {
    animation: fd-rise var(--fd-motion-entry) var(--fd-ease-out) both;
  }
  :root:not([data-motion='reduced']) .fd-grid > :nth-child(2) { animation-delay: 60ms; }
  :root:not([data-motion='reduced']) .fd-grid > :nth-child(3) { animation-delay: 120ms; }
  :root:not([data-motion='reduced']) .fd-grid > :nth-child(4) { animation-delay: 180ms; }
  :root:not([data-motion='reduced']) .fd-grid > :nth-child(5) { animation-delay: 240ms; }
  :root:not([data-motion='reduced']) .fd-grid > :nth-child(n+6) { animation-delay: 300ms; }
  :root:not([data-motion='reduced']) .fd-modules { animation-delay: 300ms; }

  /* Coverage bars grow from the left once; the printed n/N never moves. */
  :root:not([data-motion='reduced']) .c03-bar__fill,
  :root:not([data-motion='reduced']) .fd-coverage__fill {
    transform-origin: left center;
    animation: fd-fill 900ms var(--fd-ease-out) 260ms both;
  }

  /* Silhouettes arrive one after another inside each row. */
  :root:not([data-motion='reduced']) .c03-kid {
    animation: fd-pop 420ms var(--fd-ease-spring) both;
    animation-delay: 320ms;
  }
  :root:not([data-motion='reduced']) .c03-kid:nth-child(2) { animation-delay: 370ms; }
  :root:not([data-motion='reduced']) .c03-kid:nth-child(3) { animation-delay: 420ms; }
  :root:not([data-motion='reduced']) .c03-kid:nth-child(4) { animation-delay: 470ms; }
  :root:not([data-motion='reduced']) .c03-kid:nth-child(5) { animation-delay: 520ms; }
  :root:not([data-motion='reduced']) .c03-kid:nth-child(6) { animation-delay: 570ms; }
  :root:not([data-motion='reduced']) .c03-kid:nth-child(n+7) { animation-delay: 620ms; }

  /* Acta steps (screen 01): the dots pop in order, then the done connector draws once. */
  :root:not([data-motion='reduced']) .fd-acta__step::before { animation: fd-pop 420ms var(--fd-ease-spring) 320ms both; }
  :root:not([data-motion='reduced']) .fd-acta__step:nth-child(2)::before { animation-delay: 420ms; }
  :root:not([data-motion='reduced']) .fd-acta__step:nth-child(3)::before { animation-delay: 520ms; }
  :root:not([data-motion='reduced']) .fd-acta__step[data-step="done"]::after {
    transform-origin: left center;
    animation: fd-fill 600ms var(--fd-ease-out) 380ms both;
  }

  /* ---- 3. Pointer -------------------------------------------------------- */
  :root:not([data-motion='reduced']) .fd-card,
  :root:not([data-motion='reduced']) .fd-figure,
  :root:not([data-motion='reduced']) .fd-module,
  :root:not([data-motion='reduced']) .c03-coverage__item {
    transition: transform var(--fd-motion-base) var(--fd-ease-out), box-shadow var(--fd-motion-base) var(--fd-ease-out),
      border-color var(--fd-motion-fast) var(--fd-ease);
  }
  :root:not([data-motion='reduced']) .fd-card:hover { box-shadow: var(--fd-shadow-lift); }
  :root:not([data-motion='reduced']) .fd-figure:hover,
  :root:not([data-motion='reduced']) .fd-module:hover,
  :root:not([data-motion='reduced']) .c03-coverage__item:hover {
    transform: translateY(-2px); box-shadow: var(--fd-shadow-lift);
  }
  /* The tile icon gives a small nod when its figure is hovered. */
  :root:not([data-motion='reduced']) .fd-tile .fd-icon { transition: transform var(--fd-motion-base) var(--fd-ease-spring); }
  :root:not([data-motion='reduced']) .fd-figure:hover .fd-tile .fd-icon,
  :root:not([data-motion='reduced']) .fd-module:hover .fd-tile .fd-icon,
  :root:not([data-motion='reduced']) .fd-card__head:hover .fd-tile .fd-icon { transform: scale(1.12) rotate(-6deg); }

  /* Buttons and toggles press in; the primary button carries a light sheen on hover. */
  :root:not([data-motion='reduced']) .fd-btn,
  :root:not([data-motion='reduced']) .c03-toggle,
  :root:not([data-motion='reduced']) .c03-expand {
    transition: background-color var(--fd-motion-fast) var(--fd-ease), color var(--fd-motion-fast) var(--fd-ease),
      border-color var(--fd-motion-fast) var(--fd-ease), transform 120ms var(--fd-ease), box-shadow var(--fd-motion-base) var(--fd-ease-out);
  }
  :root:not([data-motion='reduced']) .fd-btn:active,
  :root:not([data-motion='reduced']) .c03-toggle:active,
  :root:not([data-motion='reduced']) .c03-expand:active { transform: scale(0.96); }
  :root:not([data-motion='reduced']) .fd-btn--primary { position: relative; overflow: hidden; isolation: isolate; }
  :root:not([data-motion='reduced']) .fd-btn--primary::after {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: linear-gradient(105deg, transparent 30%, rgb(255 255 255 / 0.22) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform 700ms var(--fd-ease-out);
  }
  :root:not([data-motion='reduced']) .fd-btn--primary:hover::after { transform: translateX(120%); }
  :root:not([data-motion='reduced']) .fd-btn--primary:hover { box-shadow: 0 4px 14px color-mix(in srgb, var(--fd-primary-600) 28%, transparent); }

  /* Record tabs: the underline slides in from the centre. */
  :root:not([data-motion='reduced']) .fd-tabs__item { position: relative; }
  :root:not([data-motion='reduced']) .fd-tabs__item:not([aria-current="page"]):hover { border-bottom-color: transparent; }
  :root:not([data-motion='reduced']) .fd-tabs__item:not([aria-current="page"])::after {
    content: ""; position: absolute; left: 12px; right: 12px; bottom: -2px; height: 2px;
    background: var(--fd-border-control); transform: scaleX(0);
    transition: transform var(--fd-motion-base) var(--fd-ease-out);
  }
  :root:not([data-motion='reduced']) .fd-tabs__item:not([aria-current="page"]):hover::after { transform: scaleX(1); }

  /* Attendance days and silhouettes answer the pointer. */
  :root:not([data-motion='reduced']) .fd-grid-attendance td { transition: transform var(--fd-motion-fast) var(--fd-ease-spring); }
  :root:not([data-motion='reduced']) .fd-grid-attendance td:hover { transform: scale(1.08); }
  :root:not([data-motion='reduced']) .c03-kids__row:hover .c03-kid { transform: translateY(-3px); }
  :root:not([data-motion='reduced']) .c03-kids__row .c03-kid { transition: transform var(--fd-motion-base) var(--fd-ease-spring); }

  /* ---- 4. Disclosure ------------------------------------------------------ */
  :root:not([data-motion='reduced']) { interpolate-size: allow-keywords; }
  :root:not([data-motion='reduced']) details::details-content {
    height: 0; overflow: clip;
    transition: height var(--fd-motion-base) var(--fd-ease-out), content-visibility var(--fd-motion-base) allow-discrete;
  }
  :root:not([data-motion='reduced']) details[open]::details-content { height: auto; }
  :root:not([data-motion='reduced']) .c03-expand .fd-icon { transition: transform var(--fd-motion-base) var(--fd-ease-out); }
  :root:not([data-motion='reduced']) .c03-detail:not([hidden]) > td { animation: fd-fade var(--fd-motion-base) var(--fd-ease) both; }

  /* ---- 5. Page to page (same-origin navigations, progressive) ------------- */
  @view-transition { navigation: auto; }
  .fd-nav { view-transition-name: fd-nav; }
  .fd-topbar { view-transition-name: fd-topbar; }
  .fd-record-header { view-transition-name: fd-record-header; }
  ::view-transition-old(root) { animation: 160ms var(--fd-ease) both fd-fade reverse; }
  ::view-transition-new(root) { animation: 280ms var(--fd-ease-out) both fd-rise; }

  /* ---- 6. Scroll: the topbar shadow follows the page scroll --------------- */
  @supports (animation-timeline: scroll()) {
    @keyframes fd-elevate { to { box-shadow: 0 6px 18px rgb(16 24 28 / 0.10); border-bottom-color: transparent; } }
    :root:not([data-motion='reduced']) .fd-topbar {
      animation: fd-elevate linear both;
      animation-timeline: scroll(root block);
      animation-range: 0 96px;
    }
  }
}
