/* ==========================================================================
   Motion & atmosphere (2026-11 redesign)
   The harbour city canvas, scroll reveals, pointer spotlights, animated
   gradient edges, and the admin load monitor. Everything here is additive:
   without JS or WebGL the page is the static design in app.css, and
   prefers-reduced-motion turns the motion off.
   ========================================================================== */

@property --edge-angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }

/* --- city canvas ---------------------------------------------------------- */
.city-canvas {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%; display: block;
  opacity: 0; transition: opacity 1.6s var(--ease);
}
.city-canvas.city-ready { opacity: 1; }
.city-canvas.city-unsupported { display: none; }
.city-scrim {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(48% 62% at 18% 52%, rgba(3, 18, 25, 0.58) 0%, rgba(3, 18, 25, 0.26) 55%, transparent 100%),
    linear-gradient(180deg, rgba(3, 18, 25, 0.3) 0%, transparent 14%, transparent 82%, rgba(3, 18, 25, 0.75) 100%);
}
.hero-city { min-height: min(92vh, 900px); display: grid; align-items: center; }
.hero-city::before { opacity: 0.18; }
.hero-city::after { opacity: 0.22; }
.hero-city .hero-inner { width: 100%; }
@media (max-width: 960px) {
  .hero-city .city-scrim { background: linear-gradient(180deg, rgba(3, 18, 25, 0.45), rgba(3, 18, 25, 0.8) 45%, rgba(3, 18, 25, 0.95)); }
}
.auth-city { position: relative; isolation: isolate; overflow: hidden; }
/* app.css caps every child of the aside at 520px to keep the copy readable;
   the scene and its scrim are backdrops and must fill the whole panel. */
.auth-city > .city-canvas,
.auth-city > .city-scrim { max-width: none; position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-city::before, .auth-city::after { opacity: 0.15; }
.auth-city .city-scrim {
  background: linear-gradient(180deg, rgba(3, 18, 25, 0.25) 0%, rgba(3, 18, 25, 0.65) 55%, rgba(3, 18, 25, 0.94) 100%);
}

/* A live caption pinned to the hero's bottom edge. */
.hero-caption {
  position: absolute; left: var(--gutter); bottom: 22px; z-index: 1;
  display: inline-flex; align-items: center; gap: 10px;
  font: 500 0.7rem/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(214, 236, 239, 0.7);
}
.hero-caption::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: #3ad49a; animation: beacon 2.4s var(--ease) infinite;
}
@keyframes beacon {
  0% { box-shadow: 0 0 0 0 rgba(58, 212, 154, 0.55); }
  80%, 100% { box-shadow: 0 0 0 12px rgba(58, 212, 154, 0); }
}

/* --- headline ------------------------------------------------------------- */
.hero h1 { text-shadow: 0 2px 30px rgba(0, 0, 0, 0.55); }
.hero-city .lede, .hero-city .hero-note, .hero-city .eyebrow { text-shadow: 0 1px 14px rgba(2, 12, 17, 0.95), 0 0 2px rgba(2, 12, 17, 0.8); }
.hero h1 .serif, .auth-aside h2 .serif {
  background: linear-gradient(100deg, var(--accent-300), var(--accent-500) 30%, #ffd1b8 50%, var(--brand-300) 75%, var(--accent-300));
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none;
  animation: sheen 9s linear infinite;
}
@keyframes sheen { to { background-position: -250% 0; } }

/* --- reveal --------------------------------------------------------------- */
.fx [data-reveal] {
  opacity: 0; transform: translateY(22px) scale(0.985); filter: blur(6px);
  transition:
    opacity 0.9s var(--ease) var(--reveal-delay, 0ms),
    transform 0.9s var(--ease) var(--reveal-delay, 0ms),
    filter 0.9s var(--ease) var(--reveal-delay, 0ms);
}
.fx [data-reveal].is-in { opacity: 1; transform: none; filter: none; }

/* --- pointer spotlight + gradient edge on cards ---------------------------- */
.card, .stat, .price-card, .monitor-tile { position: relative; isolation: isolate; }
.card::before, .stat::before, .price-card::before, .monitor-tile::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, -20%), color-mix(in srgb, var(--brand-400) 16%, transparent), transparent 60%);
  opacity: 0; transition: opacity 0.4s var(--ease);
}
.card:hover::before, .stat:hover::before, .price-card:hover::before, .monitor-tile:hover::before { opacity: 1; }
.card::after, .stat::after, .monitor-tile::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; padding: 1px;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, -20%), color-mix(in srgb, var(--brand-300) 70%, transparent), transparent 65%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity 0.4s var(--ease);
}
.card:hover::after, .stat:hover::after, .monitor-tile:hover::after { opacity: 1; }
.card { transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease); }
.card.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.feature-icon { transition: transform 0.5s var(--ease); }
.card.feature:hover .feature-icon { transform: rotate(-8deg) scale(1.08); }

/* The hero board gets a slowly orbiting conic edge. */
.hero-board { transition: transform 0.4s var(--ease); will-change: transform; background: linear-gradient(180deg, rgba(8, 34, 46, 0.55), rgba(5, 22, 30, 0.4)); backdrop-filter: blur(10px) saturate(1.3); -webkit-backdrop-filter: blur(10px) saturate(1.3); }
.hero-board::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: conic-gradient(from var(--edge-angle), transparent 0 55%, var(--brand-300) 68%, var(--accent-400) 78%, transparent 88%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: edge-orbit 7s linear infinite;
}
@keyframes edge-orbit { to { --edge-angle: 360deg; } }
.hero-step { transition: transform 0.35s var(--ease); }
.hero-step:hover { transform: translateX(6px); }
.hero-step b { transition: box-shadow 0.35s var(--ease), transform 0.35s var(--ease); }
.hero-step:hover b { transform: scale(1.08); box-shadow: 0 0 24px -2px rgba(114, 211, 214, 0.6); }

/* --- buttons: a light sweep across the primary action ---------------------- */
.btn-accent { position: relative; overflow: hidden; isolation: isolate; }
.btn-accent::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.38) 50%, transparent 70%);
  transform: translateX(-120%); animation: sweep 4.5s var(--ease) infinite 1.2s;
}
@keyframes sweep { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
.btn-accent { box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--accent-500) 80%, transparent); }
.btn-accent:hover { box-shadow: 0 14px 36px -10px color-mix(in srgb, var(--accent-500) 95%, transparent); transform: translateY(-1px); }

.trust-inner span svg { transition: transform 0.4s var(--ease); }
.trust-inner span:hover svg { transform: scale(1.2) rotate(-6deg); }

:root[data-theme="dark"] .section-head h2 {
  background: linear-gradient(180deg, #ffffff 30%, color-mix(in srgb, var(--brand-200) 80%, #fff));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* --- app shell atmosphere -------------------------------------------------- */
.app { position: relative; isolation: isolate; }
.app::before {
  content: ""; position: fixed; inset: -20vmax; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40vmax 30vmax at 15% 10%, color-mix(in srgb, var(--brand-400) 10%, transparent), transparent 70%),
    radial-gradient(36vmax 28vmax at 85% 0%, color-mix(in srgb, var(--accent-500) 7%, transparent), transparent 70%),
    radial-gradient(44vmax 30vmax at 60% 110%, color-mix(in srgb, var(--brand-500) 9%, transparent), transparent 70%);
  animation: aurora 38s ease-in-out infinite alternate;
}
@keyframes aurora {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50% { transform: translate3d(3vmax, -2vmax, 0) rotate(6deg); }
  100% { transform: translate3d(-2vmax, 2vmax, 0) rotate(-4deg); }
}
.side-nav a { position: relative; transition: background 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease); }
.side-nav a:hover { transform: translateX(3px); }
.side-nav a.is-active::before {
  content: ""; position: absolute; left: -10px; top: 22%; bottom: 22%; width: 3px; border-radius: 3px;
  background: linear-gradient(180deg, var(--brand-300), var(--accent-400));
  box-shadow: 0 0 12px var(--brand-400);
}

/* The dashboard banner: a small window onto the same harbour. */
.city-banner {
  position: relative; isolation: isolate; overflow: hidden;
  border-radius: var(--radius-lg); min-height: 190px; margin-bottom: 26px;
  display: flex; align-items: flex-end; padding: 24px clamp(20px, 3vw, 32px);
  background: var(--brand-950); color: #e6f4f6;
  border: 1px solid color-mix(in srgb, var(--brand-300) 18%, transparent);
  box-shadow: var(--shadow-lg);
}
.city-banner .city-scrim {
  background: linear-gradient(90deg, rgba(3, 18, 25, 0.72), rgba(3, 18, 25, 0.12) 45%, transparent), linear-gradient(0deg, rgba(3, 18, 25, 0.45), transparent 55%);
}
.city-banner h2 { color: #fff; margin: 0 0 4px; font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
.city-banner p { color: #b9d6db; margin: 0; }

/* --- live load monitor (admin) -------------------------------------------- */
.monitor { margin-top: 22px; }
.monitor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.monitor-head h2 { margin: 0; display: flex; align-items: center; gap: 10px; }
.monitor-live {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px;
  font: 600 0.68rem/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--ok-bg); color: var(--ok-fg);
}
.monitor-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: beacon 2s var(--ease) infinite; }
.monitor-live.is-down { background: var(--err-bg); color: var(--err-fg); }
.monitor-live.is-down::before { animation: none; }
.monitor-meta { font: 500 0.78rem/1.4 var(--mono); color: var(--ink-3); }
.monitor-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.monitor-tile {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 14px 16px 10px; overflow: hidden; min-width: 0;
}
.monitor-tile header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.monitor-tile header span { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.monitor-sub { font: 500 0.7rem/1.35 var(--mono); color: var(--ink-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.monitor-value { font: 700 1.7rem/1.15 var(--display); letter-spacing: -0.02em; color: var(--ink); margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.monitor-value em { font-style: normal; font-size: 0.9rem; font-weight: 600; color: var(--ink-3); margin-left: 4px; }
.monitor-bar { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin: 6px 0 8px; }
.monitor-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--brand-400), var(--brand-300)); transition: width 0.6s var(--ease); }
.monitor-bar i.is-warn { background: linear-gradient(90deg, #e9a63a, #ffcf7a); }
.monitor-bar i.is-hot { background: linear-gradient(90deg, var(--accent-600), var(--accent-400)); }
.monitor-tile canvas { display: block; width: 100%; height: 54px; }
.monitor-note { margin: 12px 2px 0; font-size: 0.82rem; color: var(--ink-3); }

@media (prefers-reduced-motion: reduce) {
  .city-canvas { transition: none; }
  .hero h1 .serif, .auth-aside h2 .serif, .hero-board::before, .btn-accent::after,
  .app::before, .hero-caption::before, .monitor-live::before { animation: none; }
}

/* --- daytime: the city follows the light theme ---------------------------- */
:root[data-theme="light"] .hero-city { background: #cfe2ec; color: var(--ink); }
:root[data-theme="light"] .hero-city .city-scrim {
  background:
    radial-gradient(44% 58% at 17% 52%, rgba(247, 250, 251, 0.7) 0%, rgba(247, 250, 251, 0.3) 55%, transparent 100%),
    linear-gradient(180deg, rgba(247, 250, 251, 0.35) 0%, transparent 14%, transparent 80%, rgba(247, 250, 251, 0.85) 100%);
}
:root[data-theme="light"] .hero-city h1 { color: var(--ink); text-shadow: 0 1px 24px rgba(255, 255, 255, 0.7); }
:root[data-theme="light"] .hero-city .eyebrow { color: var(--brand-700); }
:root[data-theme="light"] .hero-city p,
:root[data-theme="light"] .hero-city .lede { color: var(--ink-2); }
:root[data-theme="light"] .hero-city .lede,
:root[data-theme="light"] .hero-city .hero-note,
:root[data-theme="light"] .hero-city .eyebrow { text-shadow: 0 1px 12px rgba(255, 255, 255, 0.95), 0 0 2px rgba(255, 255, 255, 0.9); }
:root[data-theme="light"] .hero-city .hero-note { color: var(--ink-2); }
:root[data-theme="light"] .hero-city .btn-ghost { background: rgba(255, 255, 255, 0.7); color: var(--ink); border-color: rgba(10, 22, 32, 0.16); }
:root[data-theme="light"] .hero-city .btn-ghost:hover { background: #fff; color: var(--ink); border-color: rgba(10, 22, 32, 0.3); }
:root[data-theme="light"] .hero-city .hero-board {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.6));
  border-color: rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 1px 0 #fff, 0 40px 80px -30px rgba(5, 34, 48, 0.35);
}
:root[data-theme="light"] .hero-city .hero-board h2 { color: var(--brand-700); }
:root[data-theme="light"] .hero-city .hero-step { border-bottom-color: rgba(10, 22, 32, 0.08); }
:root[data-theme="light"] .hero-city .hero-step span { color: var(--ink-2); }
:root[data-theme="light"] .hero-city .hero-step strong { color: var(--ink); }
:root[data-theme="light"] .hero-city .hero-step b { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-700); }
:root[data-theme="light"] .hero-city .hero-caption { color: var(--ink-2); }
:root[data-theme="light"] .auth-city { background: #cfe2ec; }
:root[data-theme="light"] .auth-city .city-scrim {
  background: linear-gradient(180deg, rgba(3, 18, 25, 0.05) 0%, rgba(3, 18, 25, 0.45) 50%, rgba(3, 18, 25, 0.86) 100%);
}
