/* The demo at index.html: the canvas and its views. Tokens come from site.css. */

html, body { height: 100%; }
body { overflow: hidden; line-height: 1.6; background: var(--abyss); }
#app { position: absolute; inset: 0; }

/* Every section view */
.v {
  width: 100%; height: 100%;
  font-family: var(--font); color: var(--text);
  overflow-y: auto; overscroll-behavior: contain;
}
.v-section {
  background: radial-gradient(ellipse 80% 50% at 50% 0%, var(--glow), transparent 70%), var(--bg);
  padding: 80px 24px 72px;
}
.v-inner { max-width: 880px; margin: 0 auto; }
.v-section h2.v-title {
  font-size: clamp(1.7rem, 4vw, 2.25rem); font-weight: 700;
  text-align: center; margin-bottom: 6px;
}
.v-section .v-sub { text-align: center; color: var(--text-dim); margin-bottom: 28px; }

/* ━━━ Home ━━━ */
.v-home {
  position: relative; overflow-x: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: safe center;
  text-align: center; padding: 48px 20px 40px;
  background:
    radial-gradient(circle at 50% 24%, rgba(140, 205, 255, 0.14), transparent 38%),
    linear-gradient(180deg, #06223d 0%, #04101d 45%, #020912 100%);
}
.home-fish { position: relative; width: 190px; height: 190px; margin-bottom: 4px; }
.home-fish img { width: 100%; height: 100%; animation: swim 6s ease-in-out infinite; }
/* The lure's light (the image's lure sits at about 16%, 26%) */
.home-fish::before {
  content: ''; position: absolute; left: 16%; top: 26%; width: 90px; height: 90px;
  transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(223, 243, 255, 0.55), transparent 65%);
  animation: lure 3.2s ease-in-out infinite;
}
@keyframes swim { 50% { transform: translate(4px, -6px) rotate(-2deg); } }
@keyframes lure { 50% { opacity: 0.45; transform: translate(-50%, -50%) scale(0.8); } }
.bubble {
  position: absolute; bottom: -20px; border-radius: 50%; pointer-events: none;
  border: 1px solid rgba(140, 205, 255, 0.35); background: rgba(140, 205, 255, 0.06);
  animation: rise linear infinite;
}
@keyframes rise { to { transform: translateY(-110vh) translateX(20px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .home-fish img, .home-fish::before, .bubble { animation: none; }
  .bubble { display: none; }
}

.home-title-wrap { position: relative; display: inline-block; }
.home-title {
  font-size: clamp(3rem, 10vw, 5rem); font-weight: 700; line-height: 1;
  color: var(--text);
}
.home-version {
  position: absolute; bottom: 4px; left: calc(100% + 8px);
  font-size: 0.7rem; font-weight: 500; color: var(--accent); white-space: nowrap;
  border: 1px solid var(--line-strong); padding: 1px 7px; border-radius: 99px;
}
/* Filled from npm when the page loads; hidden until then. */
.home-version:empty { display: none; }
.home-tagline { font-size: 0.95rem; font-weight: 500; color: var(--fish); margin: 10px 0 12px; }
.home-sub { font-size: clamp(1rem, 2.4vw, 1.18rem); color: var(--text-mid); max-width: 460px; margin: 0 auto 30px; }

.targets { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; max-width: 760px; }
.zt {
  width: 160px; padding: 18px 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  cursor: zoom-in; text-align: center;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.zt:hover, .zt:focus-visible { transform: translateY(-3px); border-color: var(--line-strong); background: var(--surface-hover); }
.zt-icon { display: block; width: 30px; height: 30px; margin: 0 auto 8px; color: var(--fish); }
.zt-title { display: block; font-weight: 500; font-size: 1rem; }
.zt-desc { display: block; font-size: 0.8rem; color: var(--text-dim); margin-top: 2px; }

.home-install {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 28px;
  font-family: var(--mono); font-size: 0.86rem; color: var(--text-mid);
  padding: 8px 8px 8px 16px; border-radius: 99px; border: 1px solid var(--line); background: var(--code-bg);
}
.home-install button {
  font: 500 0.75rem var(--font); color: var(--text); background: var(--surface-hover);
  border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; cursor: pointer;
}
/* GitHub and Sponsor as buttons: the two asks on the home */
.home-cta { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 22px; }
.home-cta a {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 99px;
  font-weight: 500; font-size: 0.9rem; text-decoration: none; transition: background 0.2s, border-color 0.2s;
}
.home-star { color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); }
.home-star:hover { color: var(--text); background: var(--surface-hover); border-color: var(--fish); }
.home-star svg { width: 17px; height: 17px; }
.home-stars { color: var(--fish); font-weight: 500; padding-left: 9px; border-left: 1px solid var(--line-strong); }
.home-stars:empty { display: none; }
.home-sponsor { color: #e0447a; background: color-mix(in srgb, #e0447a 8%, transparent); border: 1px solid color-mix(in srgb, #e0447a 45%, transparent); }
.home-sponsor:hover { color: #e0447a; background: color-mix(in srgb, #e0447a 16%, transparent); }
.home-footer {
  margin-top: 30px; display: flex; gap: 8px 16px; flex-wrap: wrap; justify-content: center;
  max-width: 760px; font-size: 0.9rem; color: var(--text-dim);
}
.home-footer + .home-footer { margin-top: 10px; }
.home-footer:last-child { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 0.76rem; }
.home-footer strong { font-weight: 500; color: var(--text-mid); }
.home-footer a { color: var(--text-dim); text-decoration: none; }
.home-footer a:hover { color: var(--accent); }

/* ━━━ Learn view ━━━ */
.learn-head { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 6px; }
.learn-head img { width: 64px; height: 64px; }
.v-learn .step-list { max-width: 620px; margin: 0 auto 24px; }
.v-learn .cta-row { justify-content: center; }

/* ━━━ Why view ━━━ */
.why-next { text-align: center; margin-top: 24px; }

/* ━━━ Showcases ━━━ */
.sc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.sc-card { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface); transition: border-color 0.2s; }
.sc-card:hover { border-color: var(--line-strong); }
.sc-preview { aspect-ratio: 16 / 10; overflow: hidden; }
/* The thumbnail is the real first view; its container units scale it down */
.sc-mini { width: 100%; height: 100%; container-type: size; pointer-events: none; }
.sc-label { padding: 10px 16px 14px; }
.sc-tag { font-size: 0.8rem; font-weight: 500; color: var(--fish); }
.sc-label h4 { font-size: 1rem; font-weight: 500; margin: 2px 0 0; }
.sc-label p { font-size: 0.8rem; color: var(--text-dim); margin: 3px 0 6px; }
.sc-label a { font-size: 0.78rem; color: var(--accent); }

/* ━━━ API view ━━━ */
.v-doc { background: var(--bg); }
/* The view is the scroller: the sidebar sticks to its top, under the sibling bar */
.v-doc .docs > main { padding: 84px 0 80px; }
.v-doc .docs-side { top: 0; max-height: 100vh; padding-top: 84px; }

/* In the demo, leave room for the sibling bar (top) and the back button (bottom) */
#app > .z-view.sx-root { padding-top: 64px; padding-bottom: 64px; }


@media (max-width: 560px) {
  .v-section { padding: 72px 16px 72px; }
  .home-fish { width: 140px; height: 140px; }
  .home-version { right: -40px; }
  .targets { gap: 10px; }
  .zt { width: calc(50% - 5px); padding: 14px 10px; }
}
