/* Visualize Serenity: motion layer (added 2026-11-06).
   Progressive and optional: nothing here is needed to use the site, and all of it is off
   for visitors who ask for reduced motion. Works with the tokens from vs2026.css. */

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

  /* 1. Gold reading-progress line along the top edge (pure CSS, no scripts) */
  @supports (animation-timeline: scroll()) {
    body::before {
      content: ""; position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 130; pointer-events: none;
      background: var(--gold-grad, linear-gradient(90deg, #ecd28f, #b78626));
      box-shadow: 0 0 12px rgba(215, 181, 99, .55);
      transform-origin: 0 50%; transform: scaleX(0);
      animation: vs-progress linear both; animation-timeline: scroll(root block);
    }
    @keyframes vs-progress { to { transform: scaleX(1); } }
  }

  /* 2. Soft gold spotlight that follows the pointer on cards (position set by vs-motion.js) */
  .vs-spot::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 0;
    opacity: 0; transition: opacity .4s var(--ease, ease);
    background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%),
      color-mix(in srgb, var(--c-accent-hi, #ecd28f) 20%, transparent), transparent 62%);
  }
  .vs-spot:hover::before, .vs-spot:focus-within::before { opacity: 1; }

  /* 3. Cards lift a little on hover, buttons press in */
  .vs-spot { transition: transform .35s var(--ease, ease), box-shadow .35s var(--ease, ease); }
  .vs-spot:hover { transform: translateY(-3px); }
  .btn:active, .btn-gold:active { transform: translateY(1px) scale(.985); }

  /* 4. Scroll-driven reveal for browsers that support it (the older [data-reveal] system stays as the fallback) */
  @supports (animation-timeline: view()) {
    .vs-rise { animation: vs-rise linear both; animation-timeline: view(); animation-range: entry 0% entry 55%; }
    @keyframes vs-rise { from { opacity: 0; transform: translateY(26px) scale(.985); } to { opacity: 1; transform: none; } }
  }

  /* 5. Hero gold dust layer */
  .vs-dust { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; opacity: .9; }
}

/* Long sections below the first screen are laid out when they get close (faster first paint) */
main > section:not(:first-child), main > .section:not(:first-child) {
  content-visibility: auto; contain-intrinsic-size: auto 720px;
}

/* Keyboard focus that is easy to see, in the brand gold */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--c-accent-hi, #d7b563); outline-offset: 3px; border-radius: 6px;
}

/* Admin console tabs (admin-platform.html) */
.ap-nav-btn[role="tab"] { transition: background .25s ease, box-shadow .25s ease, transform .25s ease; }
.ap-nav-btn[role="tab"]:hover { transform: translateX(2px); }
.ap-view[role="tabpanel"].active { animation: vs-panel-in .35s var(--ease, ease) both; }
@keyframes vs-panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .ap-view[role="tabpanel"].active { animation: none; }
  .ap-nav-btn[role="tab"]:hover { transform: none; }
}


/* ===== Polish layer 2 (2026-11-06): crisp type, page transitions, tilt, entrance, ambient glow ===== */
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; accent-color: var(--c-accent-hi, #d7b563); }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }
::selection { background: color-mix(in srgb, #d7b563 45%, transparent); }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* smooth page-to-page transitions (same-origin navigation), header stays in place */
  @view-transition { navigation: auto; }
  .topbar { view-transition-name: site-header; }
  ::view-transition-old(root) { animation: vs-vt-out .2s ease both; }
  ::view-transition-new(root) { animation: vs-vt-in .42s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes vs-vt-out { to { opacity: 0; } }
  @keyframes vs-vt-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

  /* hero entrance: title resolves from a soft blur, the rest follows */
  .hero-shell h1 { animation: vs-title 1.2s cubic-bezier(.2, .7, .2, 1) .1s both, gold-shimmer 9s ease-in-out 1.3s infinite; }
  .hero-shell h1 ~ p, .hero-shell h1 ~ div { animation: vs-fade-up .9s cubic-bezier(.2, .7, .2, 1) .5s both; }
  @keyframes vs-title { from { opacity: 0; filter: blur(14px); transform: translateY(18px) scale(.98); } to { opacity: 1; filter: blur(0); transform: none; } }
  @keyframes vs-fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

  /* slow golden glow drifting behind the page */
  body::after {
    content: ""; position: fixed; inset: -25%; z-index: -1; pointer-events: none;
    background:
      radial-gradient(42vmax 42vmax at 22% 28%, rgba(215, 181, 99, .15), transparent 62%),
      radial-gradient(36vmax 36vmax at 80% 72%, rgba(183, 134, 38, .11), transparent 62%);
    animation: vs-drift 52s ease-in-out infinite alternate; will-change: transform;
  }
  @keyframes vs-drift { to { transform: translate3d(6%, -4%, 0) rotate(9deg) scale(1.1); } }

  /* tilt toward the pointer (set by vs-motion.js) and magnetic buttons */
  .vs-spot:hover { transform: perspective(1000px) translateY(-3px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
  .vs-mag { transition: transform .28s var(--ease, ease), box-shadow .28s var(--ease, ease); transform: translate(var(--tx, 0px), var(--ty, 0px)); }
  .vs-mag:active { transform: translate(var(--tx, 0px), calc(var(--ty, 0px) + 1px)) scale(.985); }
}


/* ===== Polish layer 3: loading skeletons, hero depth ===== */
.vs-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.vs-skel { border-radius: 18px; min-height: 300px; padding: 1rem; display: grid; gap: .75rem; align-content: start; overflow: hidden;
  background: rgba(215, 181, 99, .05); border: 1px solid rgba(215, 181, 99, .18); }
.vs-skel i, .vs-skel b { display: block; border-radius: 10px; background: linear-gradient(90deg, rgba(215,181,99,.10), rgba(215,181,99,.30), rgba(215,181,99,.10)); background-size: 200% 100%; animation: vs-sheen 1.5s ease-in-out infinite; }
.vs-skel i { height: 170px; border-radius: 14px; }
.vs-skel b { height: 14px; width: 82%; }
.vs-skel b:last-child { width: 52%; }
@keyframes vs-sheen { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .vs-skel i, .vs-skel b { animation: none; } }

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: scroll()) {
    .hero-slide-overlay { animation: vs-lift linear both; animation-timeline: scroll(root block); animation-range: 0 75vh; }
    @keyframes vs-lift { to { transform: translateY(-34px); opacity: .5; } }
  }
}
