/* The fluid layer (apple-design skill, 20 Oct 2026): Apple's WWDC
   interface principles applied to the chrome the site already has.
   Same tokens, same shapes; this file only refines behaviour. It is
   deliberately separate so rolling the whole treatment back is
   removing its link and script tags. */

/* Response: feedback lives on the press and it is instant. Replaces
   the old 1px down-shift with a compression the hand recognises. */
.btn:active,
.cta:active,
.themebtn:active,
.tarr:active {
  transform: scale(.98);
  transition-duration: .08s;
}

/* Scroll edge: the nav's hairline exists only once content is under
   it. At the top of the page the bar dissolves into the surface; the
   edge fades in over the first 120px of scroll. Browsers without
   scroll-driven animations keep the constant hairline. */
@supports (animation-timeline: scroll()) {
  .nav {
    border-bottom-color: transparent;
    animation: nav-edge linear both;
    animation-timeline: scroll(root);
    animation-range: 0 120px;
  }
  @keyframes nav-edge {
    to { border-bottom-color: var(--hair); }
  }
}

/* The menu materialises instead of fading: blur and a breath of scale
   arrive together, so the surface reads as a material, not a jpeg.
   Scoped to no-preference; the page's reduced-motion rule already
   makes the panel appear statically. */
@media (prefers-reduced-motion: no-preference) {
  .mpanel {
    -webkit-backdrop-filter: blur(0) saturate(100%);
    backdrop-filter: blur(0) saturate(100%);
    transform: scale(1.012);
    transition:
      opacity .3s ease,
      visibility .3s,
      transform .3s cubic-bezier(.2, .7, .2, 1),
      -webkit-backdrop-filter .3s ease,
      backdrop-filter .3s ease;
  }
  .mpanel.open {
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    transform: none;
  }
}

/* Theme changes cross-fade. fluid.js holds .theming on <html> for
   350ms around a data-theme flip; everything eases instead of
   jumping between brightnesses. */
:root.theming,
:root.theming body {
  transition: background-color .3s ease, color .3s ease;
}
:root.theming *,
:root.theming *::before,
:root.theming *::after {
  transition:
    background-color .3s ease,
    color .3s ease,
    border-color .3s ease,
    box-shadow .3s ease,
    fill .3s ease,
    stroke .3s ease !important;
}

/* Tracking is size-specific: display sizes tighten as they grow,
   and their leading comes in with them. Body copy stays untouched. */
.display-lg { letter-spacing: -.022em; line-height: 1.1; }
.display-md { letter-spacing: -.016em; line-height: 1.14; }

/* Transparency and contrast are preferences, not constants. */
@media (prefers-reduced-transparency: reduce) {
  .nav, .mpanel {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--surface);
  }
}
@media (prefers-contrast: more) {
  .nav {
    background: var(--surface);
    border-bottom: 1px solid var(--ink-2);
    animation: none;
  }
}
