/* VibeStream: navigation helpers and motion polish. Loaded after style.css (and editor.css).
   Everything here is additive. Every effect is switched off by prefers-reduced-motion. CSP-safe: no inline styles. */

html { scroll-padding-top: 76px; }
main:focus { outline: none; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  /* soft cross-fade when moving between VibeStream pages (Chrome / Edge / Safari 18+; ignored elsewhere) */
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.28s; }
}

/* ---------- skip link (keyboard users) ---------- */
.fx-skip {
  position: fixed; left: 12px; top: -64px; z-index: 200; padding: 10px 16px; border-radius: 4px;
  background: var(--pink); color: #1a000f; font: inherit; font-weight: 700; text-decoration: none;
  transition: top 0.2s ease;
}
.fx-skip:focus { top: 12px; outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- scroll progress ---------- */
.fx-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 70; pointer-events: none; }
.fx-progress i {
  display: block; height: 100%; transform-origin: left center; transform: scaleX(0);
  background: linear-gradient(90deg, var(--teal), var(--pink)); box-shadow: 0 0 10px var(--pink);
}
body.in-room .fx-progress { display: none; }

/* ---------- sticky site bar: slides in once the page header has scrolled away (desktop; phones have the bottom tab bar) ---------- */
.fx-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
  background: rgba(16, 4, 44, 0.9); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-family: var(--mono);
  transform: translateY(-110%); opacity: 0; visibility: hidden;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.25s ease, visibility 0s linear 0.35s;
}
.fx-bar.on { transform: none; opacity: 1; visibility: visible; transition-delay: 0s; }
.fx-bar a { color: var(--pink-soft); text-decoration: none; }
.fx-brand {
  display: inline-flex; align-items: center; gap: 10px; margin-right: auto; font-weight: 700; font-size: 0.95rem;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--pink) !important; text-shadow: 0 0 10px rgba(255, 63, 164, 0.6);
}
.fx-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; }
.fx-eq i { display: block; width: 3px; height: 100%; border-radius: 1px; background: var(--teal); transform-origin: bottom; transform: scaleY(0.5); }
.fx-link {
  position: relative; padding: 8px 12px; border-radius: 4px; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase;
  background-image: linear-gradient(var(--pink), var(--pink)); background-repeat: no-repeat; background-position: 50% 100%; background-size: 0% 2px;
  transition: background-size 0.25s ease, color 0.25s ease, background-color 0.25s ease;
}
.fx-link:hover, .fx-link:focus-visible { color: var(--pink-pale); background-size: 70% 2px; }
.fx-link[aria-current="page"] { background-color: var(--pink); color: #1a000f; font-weight: 700; background-image: none; }
.fx-bar a:focus-visible { outline: 2px solid var(--pink-soft); outline-offset: 2px; }
@media (max-width: 700px) { .fx-bar { display: none; } }
body.in-room .fx-bar { display: none; }

/* ---------- back to top ---------- */
button.fx-top {
  position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 55;
  width: 46px; height: 46px; padding: 0; border-radius: 50%; display: grid; place-items: center; font-size: 1.2rem; letter-spacing: 0;
  background: rgba(16, 4, 44, 0.9); box-shadow: 0 0 16px rgba(255, 63, 164, 0.45);
  opacity: 0; visibility: hidden; transform: translateY(16px) scale(0.8);
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.3s, background 0.25s ease;
}
button.fx-top.on { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
@media (max-width: 700px) { button.fx-top { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } }
body.in-room button.fx-top { display: none; }

/* ---------- scroll reveal (classes are added by fx.js only, so no-JS visitors and crawlers always see everything) ---------- */
.fx-rv { opacity: 0; transform: translateY(22px); transition: opacity 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) var(--fx-d, 0s), transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) var(--fx-d, 0s); }
.fx-rv.fx-in { opacity: 1; transform: none; }

/* ---------- cards: lift + cursor spotlight ---------- */
.info article, .explore a.card { position: relative; transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease; }
.info article::before, .explore a.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity 0.25s ease;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 63, 164, 0.24), transparent 70%);
}
@media (hover: hover) {
  .info article:hover, .explore a.card:hover { transform: translateY(-4px); border-color: var(--pink); box-shadow: 0 10px 28px rgba(255, 63, 164, 0.28); }
  .info article:hover::before, .explore a.card:hover::before { opacity: 1; }
}

/* ---------- FAQ open animation + hover ---------- */
.info summary { transition: color 0.2s ease, padding-left 0.2s ease; }
@media (hover: hover) { .info summary:hover { color: var(--pink); padding-left: 4px; } }
.info details[open] > p { animation: fxDrop 0.32s ease both; }
@keyframes fxDrop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- keyword line under the home heading: flowing gradient ---------- */
h1 .kw {
  background: linear-gradient(90deg, var(--teal), var(--pink-soft), var(--pink), var(--teal)); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; text-shadow: none;
  animation: fxFlow 7s linear infinite;
}
@keyframes fxFlow { to { background-position: -220% 0; } }

/* ---------- button ripple ---------- */
.fx-rip-host { position: relative; overflow: hidden; }
.fx-clip { overflow: hidden; }
.fx-rip { position: absolute; border-radius: 50%; pointer-events: none; background: rgba(255, 255, 255, 0.45); transform: scale(0); animation: fxRip 0.6s ease-out forwards; }
@keyframes fxRip { to { transform: scale(1); opacity: 0; } }

/* ---------- breadcrumbs + explore cards (rendered by seo.js / index.html) ---------- */
.crumbs { margin: 0 0 14px; font-size: 0.78rem; color: var(--pink-soft); letter-spacing: 0.04em; }
.crumbs a { color: var(--pink); }
.crumbs span[aria-hidden] { margin: 0 6px; opacity: 0.6; }
.explore { margin: 26px 0 6px; }
.explore h2 { margin-top: 0; }
.explore .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.explore a.card {
  display: grid; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 4px; background: rgba(0, 0, 0, 0.3);
  text-decoration: none; color: var(--pink-pale);
}
.explore a.card strong { color: var(--pink); letter-spacing: 0.04em; }
.explore a.card span { font-size: 0.82rem; color: var(--pink-soft); line-height: 1.45; }
.explore a.card::after { content: "\2192"; justify-self: end; color: var(--teal); transition: transform 0.25s ease; }
@media (hover: hover) { .explore a.card:hover::after { transform: translateX(5px); } }

/* ---------- footer links: sliding underline ---------- */
footer nav a { text-decoration: none; background-image: linear-gradient(var(--pink), var(--pink)); background-repeat: no-repeat; background-position: 0 100%; background-size: 0% 1px; transition: background-size 0.25s ease, color 0.25s ease; padding-bottom: 2px; }
footer nav a:hover, footer nav a:focus-visible { background-size: 100% 1px; }

/* ---------- 404 page ---------- */
.nf { width: min(560px, 100%); margin: auto; padding: 30px 22px; text-align: center; display: grid; gap: 14px; }
.nf strong { font-size: clamp(3.5rem, 18vw, 6rem); line-height: 1; color: var(--pink); text-shadow: 0 0 18px var(--pink), 4px 4px 0 rgba(46, 242, 224, 0.55); }
.nf p { margin: 0; color: var(--pink-soft); }
.nf nav { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 6px; }
.nf nav a { text-decoration: none; padding: 10px 14px; border: 1px solid var(--pink); border-radius: 4px; color: var(--pink-pale); background: rgba(255, 63, 164, 0.16); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.8rem; }
.nf nav a:first-child { background: var(--pink); color: #1a000f; font-weight: 700; }

/* ---------- motion that only runs when the visitor allows it ---------- */
@media (prefers-reduced-motion: no-preference) {
  .fx-eq i { animation: fxEq 1s ease-in-out infinite; }
  .fx-eq i:nth-child(2) { animation-delay: 0.2s; }
  .fx-eq i:nth-child(3) { animation-delay: 0.4s; }
  .fx-bar.on .fx-brand { animation: fxBrandIn 0.6s 0.1s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
}
@keyframes fxEq { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }
@keyframes fxBrandIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .fx-rv { opacity: 1; transform: none; transition: none; }
  .fx-bar, button.fx-top, .fx-skip { transition: none; }
  .info article, .explore a.card, .info summary, footer nav a, .fx-link { transition: none; }
  .info article:hover, .explore a.card:hover { transform: none; }
  .info details[open] > p, h1 .kw, .fx-rip { animation: none !important; }
  h1 .kw { background: none; -webkit-text-fill-color: currentColor; color: var(--pink); }
}
