/* Shared page theme and motion: every page takes the Home look (board P1). Light or dark from the header toggle,
   the ambient layer from ambient.css pinned behind the viewport (.amb--page), a glass topbar with a scanning accent
   line, staggered entrances and soft accent glows. Decorative only; transform/opacity first; off under
   prefers-reduced-motion. Load after every other stylesheet so these overrides win. Tokens only. */
.theme-body { position: relative; isolation: isolate; background: var(--home-bg); color: var(--home-text); }

/* Ambient layer: fixed so it stays put while the page scrolls; quieter than Home so work stays readable. */
.amb--page { position: fixed; }
.amb--page .amb-glow { opacity: 0.7; }
.amb--page .amb-grid { -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, var(--home-bg) 20%, transparent 75%); mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, var(--home-bg) 20%, transparent 75%); }
.amb--page .amb-fleck { animation-duration: 28s; }

/* Glass topbar with a slow scan line along its bottom edge */
.theme-body .topbar { background: var(--glass-bar); border-bottom-color: var(--home-border); -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%); animation: bar-in var(--duration-slow) var(--ease-out) both; }
.theme-body .topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--home-accent), transparent) no-repeat; background-size: 35% 100%; animation: bar-scan 7s linear infinite; }
.theme-body .topbar__brand a { color: var(--home-text); }
.theme-body .topbar__link:hover { background: var(--home-row-hover); }
.theme-body .review-stepper, .theme-body .review-bar { background: var(--glass-bar); border-bottom-color: var(--home-border); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }

/* Page head: Home hero typography at page scale */
.theme-body .page-title { font-size: clamp(1.5rem, 3.2vw, 2.125rem); line-height: var(--leading-tight); letter-spacing: var(--tracking-hero); color: var(--home-text); }
.theme-body .page-lede { color: var(--home-lede); font-size: var(--text-base); line-height: 1.6; }

/* Staggered entrance: each block of the page rises in turn */
.theme-body .container > * { animation: page-rise 560ms var(--ease-out) both; }
.theme-body .container > *:nth-child(2) { animation-delay: 70ms; }
.theme-body .container > *:nth-child(3) { animation-delay: 140ms; }
.theme-body .container > *:nth-child(4) { animation-delay: 210ms; }
.theme-body .container > *:nth-child(n + 5) { animation-delay: 280ms; }

/* Cards and tables: translucent Home cards with an accent glow on hover */
.theme-body :is(.card, .table-wrap, .table-card) { background: var(--home-card-strong); border-color: var(--home-border); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: border-color var(--duration-base) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard), transform var(--duration-base) var(--ease-standard); }
.theme-body :is(.card, .table-wrap, .table-card):hover { border-color: var(--home-row-hover-border); box-shadow: 0 0 0 1px var(--glow-accent-soft), 0 18px 40px -18px var(--glow-accent); }
.theme-body .card--interactive:hover { transform: translateY(-3px); }
.theme-body :is(.responsive-table, .sessions-table, .doc-table, .quality-table) thead th { background: var(--glass-panel); }
.theme-body :is(.responsive-table, .sessions-table, .doc-table, .quality-table) tbody tr:hover { background: var(--home-row-hover); }
.theme-body :is(.responsive-table, .sessions-table, .doc-table) tbody tr { animation: page-rise 420ms var(--ease-out) both; }
.theme-body :is(.responsive-table, .sessions-table, .doc-table) tbody tr:nth-child(2) { animation-delay: 40ms; }
.theme-body :is(.responsive-table, .sessions-table, .doc-table) tbody tr:nth-child(3) { animation-delay: 80ms; }
.theme-body :is(.responsive-table, .sessions-table, .doc-table) tbody tr:nth-child(4) { animation-delay: 120ms; }
.theme-body :is(.responsive-table, .sessions-table, .doc-table) tbody tr:nth-child(n + 5) { animation-delay: 160ms; }

/* Buttons: Home lift and glow */
.theme-body .btn:hover:not(:disabled) { transform: translateY(-1px); }
.theme-body .btn:active:not(:disabled) { transform: scale(0.98); }
.theme-body .btn--primary { background: var(--home-accent); color: var(--home-bg); transition: transform var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard); }
.theme-body .btn--primary:hover:not(:disabled) { color: var(--home-bg); box-shadow: 0 8px 24px -8px var(--glow-accent); }
.theme-body .btn--secondary, .theme-body .btn:not(.btn--primary):not(.btn--ghost):not(.btn--danger):not(.btn--danger-secondary) { background: var(--home-card); border-color: var(--home-border-strong); }

/* Stepper: the current step breathes */
.theme-body .stepper__link { background: var(--home-card); }
.theme-body .stepper__step--current .stepper__link { background: var(--home-accent); color: var(--home-bg); animation: step-pulse 2.4s ease-out infinite; }

/* Upload dropzone: breathing glow and a floating motif */
.theme-body .dropzone { position: relative; isolation: isolate; overflow: hidden; background: var(--home-stage); border-color: var(--home-border-strong); }
.theme-body .dropzone::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(circle at 50% 40%, var(--glow-accent), transparent 60%); animation: glow-breathe 4.5s ease-in-out infinite; }
.theme-body .dropzone__motif { animation: motif-float 5s ease-in-out infinite; }
.theme-body .dropzone:hover, .theme-body .dropzone.is-dragover { border-color: var(--home-accent); background: var(--home-stage); box-shadow: 0 0 0 4px var(--glow-accent-soft); }

/* Toasts sit on the glass too */
.theme-body .toast { background: var(--glass-panel); border-color: var(--home-border); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }

@keyframes bar-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes bar-scan { from { background-position: -40% 0; } to { background-position: 140% 0; } }
@keyframes page-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes step-pulse { 0% { box-shadow: 0 0 0 0 var(--glow-accent); } 70% { box-shadow: 0 0 0 8px var(--glow-accent-off); } 100% { box-shadow: 0 0 0 0 var(--glow-accent-off); } }
@keyframes glow-breathe { 0%, 100% { opacity: 0.35; transform: scale(0.95); } 50% { opacity: 0.8; transform: scale(1.05); } }
@keyframes motif-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

@media (prefers-reduced-motion: reduce) {
  .theme-body .topbar, .theme-body .topbar::after, .theme-body .container > *, .theme-body tbody tr,
  .theme-body .stepper__step--current .stepper__link, .theme-body .dropzone::before, .theme-body .dropzone__motif { animation: none; }
  .theme-body .btn:hover:not(:disabled), .theme-body .btn:active:not(:disabled), .theme-body .card--interactive:hover { transform: none; }
}
