/* ═══════════════════════════════════════════════════════════════════════
   Verse Island — design layer (UEFN-282)
   Tailwind (Play CDN) handles utilities + the theme tokens defined in
   base.html. This file adds the brand's component primitives and the
   ambient "ocean-night" atmosphere that gives the dark mode its identity.
   ═════════════════════════════════════════════════════════════════════ */

:root {
  --vi-brand: #06b6d4;
  --vi-brand-bright: #22d3ee;
  --vi-accent: #f59e0b;
  --vi-ink-950: #0a1422;
  --vi-ink-900: #0e1726;
  --vi-ink-800: #152135;
}

/* Display headings use Sora for a confident, modern brand voice. */
h1, h2, h3, .font-display { font-family: 'Sora', 'Inter', ui-sans-serif, system-ui, sans-serif; }
h1 { letter-spacing: -0.02em; }

/* ── Ambient ocean-night backdrop (dark mode only) ───────────────────────
   Two soft radial glows (cyan + amber) fixed behind everything, evoking
   bioluminescent islands without hurting readability. */
.dark .vi-body {
  background-color: var(--vi-ink-950);
  background-image:
    radial-gradient(900px 600px at 12% -8%, rgba(34,211,238,0.10), transparent 60%),
    radial-gradient(800px 600px at 92% 0%, rgba(245,158,11,0.06), transparent 55%),
    radial-gradient(1200px 800px at 50% 120%, rgba(6,182,212,0.07), transparent 60%);
  background-attachment: fixed;
}

/* ── Nav links ───────────────────────────────────────────────────────── */
/* Friendly rounded display for hero wordmarks — cartoon-adventure, not pirate kitsch. */
.vi-wordmark { font-family: 'Fredoka','Sora',ui-sans-serif,system-ui,sans-serif; letter-spacing: -0.01em; }

/* Click-to-travel: native cross-fade on same-origin navigation (MPA), so moving
   between pages feels like sailing to a new place. Degrades to a hard nav where
   unsupported; the default UA fade already respects reduced-motion, and we hard-
   disable our custom timing under it too. */
/* Slow, subtle ken-burns drift for hero scenes — a touch of life, not distraction. */
.vi-kenburns { animation: vi-kenburns 42s ease-in-out infinite alternate; will-change: transform; }
@keyframes vi-kenburns { from { transform: scale(1) translate(0,0); } to { transform: scale(1.06) translate(-1.5%, -1%); } }
@media (prefers-reduced-motion: reduce) { .vi-kenburns { animation: none !important; } }

/* Animated parrot guide — an 11-frame sprite sheet (rendered via LTX i2v, cream
   keyed out). Rests on frame 0 (wings tucked); spreads its wings in a welcoming
   flap on hover, and greets once per session. Uses the steps(n, jump-none) sprite
   technique. */
.vi-parrot-sprite {
  aspect-ratio: 274 / 300;
  background: url('/static/mascot/parrot-sprite.png') no-repeat 0% center / 1100% 100%;
}
@keyframes vi-parrot-wave { from { background-position-x: 0%; } to { background-position-x: 100%; } }
#vi-guide-toggle:hover .vi-parrot-sprite,
.vi-parrot-sprite:hover { animation: vi-parrot-wave 1s steps(11, jump-none) infinite alternate; }
.vi-parrot-sprite.is-greeting { animation: vi-parrot-wave .85s steps(11, jump-none) 2 alternate; }
@media (prefers-reduced-motion: reduce) {
  .vi-parrot-sprite, #vi-guide-toggle:hover .vi-parrot-sprite, .vi-parrot-sprite:hover { animation: none !important; }
}

/* Gentle idle-float for the guide mascot (global). */
.vi-float { animation: vi-float 4.5s ease-in-out infinite; transform-origin: center bottom; }
@keyframes vi-float { 0%,100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-8px) rotate(1.5deg); } }
@media (prefers-reduced-motion: reduce) { .vi-float { animation: none !important; } }

@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.34s; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}

.vi-navlink {
  position: relative;
  padding: 0.4rem 0.75rem;
  border-radius: 0.6rem;
  color: rgb(82 82 91);              /* zinc-600 */
  font-weight: 500;
  transition: color .16s, background-color .16s, transform .16s;
}
/* Tactile point-and-click hover: a warm island tint + a tiny lift. */
.vi-navlink:hover { color: rgb(24 24 27); background: rgba(6,182,212,0.10); transform: translateY(-1px); }
.dark .vi-navlink { color: #aebdd0; }                       /* ink-200 */
.dark .vi-navlink:hover { color: #fff; background: rgba(34,211,238,0.12); }
/* "You are here" — the active destination gets a lagoon tint + a wayfinding underline. */
.vi-navlink-active { color: var(--vi-brand); background: rgba(6,182,212,0.12); }
.dark .vi-navlink-active { color: #67e8f9; background: rgba(34,211,238,0.14); }
.vi-navlink-active::after {
  content: "";
  position: absolute; left: 0.75rem; right: 0.75rem; bottom: 0.12rem;
  height: 2px; border-radius: 2px; background: var(--vi-brand-bright);
}
@media (prefers-reduced-motion: reduce) { .vi-navlink:hover { transform: none; } }

/* ── Surfaces / cards ────────────────────────────────────────────────────
   `.vi-card` is the canonical panel. On dark it's a translucent ink panel
   with a hairline edge; hover lifts it with a faint cyan glow. */
.vi-card {
  border-radius: 1rem;
  border: 1px solid rgb(228 228 231);
  background: #fff;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.dark .vi-card {
  border-color: rgba(255,255,255,0.07);
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.012));
}
.vi-card-hover:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(34,211,238,0.10), 0 14px 40px -16px rgba(6,182,212,0.40); }
.dark .vi-card-hover:hover { border-color: rgba(34,211,238,0.30); }

/* Gradient hairline accent used on hero/feature panels. */
.vi-edge-glow { position: relative; }
.vi-edge-glow::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(135deg, rgba(34,211,238,0.55), rgba(245,158,11,0.30) 60%, transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.vi-btn-primary {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .55rem 1.05rem; border-radius: .625rem;
  font-weight: 600; font-size: .875rem; color: #06121c;
  background: linear-gradient(135deg,#22d3ee 0%,#06b6d4 45%,#0e7490 100%);
  box-shadow: 0 0 0 1px rgba(34,211,238,0.10), 0 8px 24px -10px rgba(6,182,212,0.55);
  transition: filter .15s, transform .15s;
}
.vi-btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.vi-btn-ghost {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem 1rem; border-radius: .625rem; font-weight: 600; font-size: .875rem;
  color: rgb(63 63 70); border: 1px solid rgb(228 228 231); background: #fff;
  transition: border-color .15s, color .15s, background-color .15s;
}
.vi-btn-ghost:hover { border-color: var(--vi-brand-bright); color: var(--vi-brand); }
.dark .vi-btn-ghost { color: #d7dfea; border-color: rgba(255,255,255,0.10); background: rgba(255,255,255,0.03); }
.dark .vi-btn-ghost:hover { border-color: rgba(34,211,238,0.45); color: #67e8f9; }

/* ── Badges / chips ──────────────────────────────────────────────────── */
.vi-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .15rem .55rem; border-radius: 9999px;
  font-size: .6875rem; font-weight: 600; letter-spacing: .02em;
}
.vi-eyebrow {
  font-family: 'Sora', sans-serif; font-weight: 700;
  font-size: .6875rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--vi-brand);
}
.dark .vi-eyebrow { color: var(--vi-brand-bright); }

/* Minimal overrides — the heavy lifting is Tailwind's typography plugin
   loaded via the Play CDN (`?plugins=typography,forms`). We only adjust
   things the plugin doesn't quite get right and the code-block container. */

/* HTMX request-in-flight indicator on the live search panel */
#live-results.htmx-request { opacity: 0.6; transition: opacity 100ms; }

/* Code blocks: rounded, scrollable, monospace fix */
.prose pre.code-block,
.prose .highlight pre,
.prose pre {
  background: #0a1422; /* ink-950 */
  color: rgb(228 228 231);    /* zinc-200 */
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 0.625rem;
  padding: 1rem;
  overflow-x: auto;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 0.875rem;
  line-height: 1.6;
}
.prose pre code,
.prose pre.code-block code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* Inline code: subtle, monospace */
.prose :not(pre) > code {
  background: rgb(244 244 245); /* zinc-100 */
  color: rgb(190 24 93);        /* pink-700 */
  padding: 0.125rem 0.35rem;
  border-radius: 0.25rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.875em;
  font-weight: 500;
}
.dark .prose :not(pre) > code {
  background: rgb(39 39 42);   /* zinc-800 */
  color: rgb(244 114 182);     /* pink-400 */
}

/* The typography plugin gives `prose-invert` for dark mode automatically — we
   only need to override colors the plugin can't infer (links, code, hr). */
.dark .prose a { color: #22d3ee; } /* brand-400 */
.dark .prose a:hover { color: #67e8f9; } /* brand-300 */
.dark .prose { color: #d7dfea; }
.dark .prose strong, .dark .prose h1, .dark .prose h2, .dark .prose h3, .dark .prose h4 { color: #eef2f7; }

/* Mermaid diagrams (UEFN-311): pre-rendered branded SVGs (preferred) + JS
   fallback. The SVG already carries its own self-contained card (light+dark
   safe), so the figure is just centering + spacing. */
.prose figure.mermaid-figure {
  margin: 1.5rem auto;
  text-align: center;
}
.prose figure.mermaid-figure img.mermaid-svg {
  display: inline-block;
  max-width: 100%;
  height: auto;
}
.prose div.mermaid {
  margin: 1.5rem auto;
  text-align: center;
}

/* Line clamp helpers (Tailwind ships these as utilities; this is the fallback) */
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Search input search-cancel button looks ugly across browsers — hide it. */
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
