:root {
  --bg-deep:  #050b1f;
  --bg:       #0a1638;
  --bg-soft:  #122456;
  --panel:    rgba(13, 32, 78, 0.55);
  --line:     rgba(120, 195, 255, 0.18);
  --ink:      #f1f6ff;
  --ink-2:    #b3c4e6;
  --ink-3:    #6f88b8;
  --accent:   #34c8ff;
  --accent-2: #1aa9e6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  background:
    radial-gradient(ellipse at 70% 35%, rgba(52,200,255,0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 20% 70%, rgba(106,80,255,0.12) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 60%, var(--bg-deep) 100%);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
}

/* ── Animated mesh gradient (pure CSS, no JS) ────────────────
 * Four soft brand-tinted blobs drift behind the SVG curves to
 * give the page a flowing-depth feel. Each blob is a heavily-
 * blurred radial gradient that translates along its own slow
 * orbit; the blobs overlap so colours blend into a single
 * mesh-like field. The filter:blur is what does the heavy
 * lifting — it smears the hard circle edges into a soft glow.
 *
 * Sits at z-index 0 (same layer as .bg-curves) but BEFORE the
 * curves in the source, so the curves render on top. The body's
 * own radial-gradient stack stays below all of this as the
 * deepest layer.
 *
 * Honours prefers-reduced-motion: animations are disabled there
 * so the colours still mix, just statically.
 */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  /* contain:strict isolates the blur so it doesn't bleed into
   * sibling-layer paint cost. */
  contain: strict;
}
.bg-mesh .blob {
  position: absolute;
  width: 60vw;
  height: 60vw;
  max-width: 900px;
  max-height: 900px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  /* will-change hints to the compositor that transforms will
   * animate, so the blob lives on its own GPU layer instead of
   * triggering a paint per frame. */
  will-change: transform;
}
.bg-mesh .blob-1 {
  top: -10vh; left: -15vw;
  background: radial-gradient(circle, rgba(52, 200, 255, 0.55) 0%, transparent 70%);
  animation: blobDrift1 28s ease-in-out infinite;
}
.bg-mesh .blob-2 {
  top: -5vh; right: -20vw;
  background: radial-gradient(circle, rgba(147, 112, 219, 0.45) 0%, transparent 70%);
  animation: blobDrift2 36s ease-in-out infinite;
}
.bg-mesh .blob-3 {
  bottom: -20vh; left: 10vw;
  background: radial-gradient(circle, rgba(106, 80, 255, 0.35) 0%, transparent 70%);
  animation: blobDrift3 32s ease-in-out infinite;
}
.bg-mesh .blob-4 {
  bottom: -10vh; right: -10vw;
  background: radial-gradient(circle, rgba(255, 165, 0, 0.22) 0%, transparent 70%);
  animation: blobDrift4 40s ease-in-out infinite;
}
@keyframes blobDrift1 {
  0%, 100% { transform: translate(0, 0)        scale(1);    }
  33%      { transform: translate(20vw, 8vh)   scale(1.15); }
  66%      { transform: translate(8vw, 22vh)   scale(0.9);  }
}
@keyframes blobDrift2 {
  0%, 100% { transform: translate(0, 0)         scale(1);    }
  40%      { transform: translate(-15vw, 18vh)  scale(1.1);  }
  70%      { transform: translate(-22vw, 4vh)   scale(0.95); }
}
@keyframes blobDrift3 {
  0%, 100% { transform: translate(0, 0)         scale(1);    }
  35%      { transform: translate(18vw, -12vh)  scale(1.2);  }
  65%      { transform: translate(28vw, 6vh)    scale(0.85); }
}
@keyframes blobDrift4 {
  0%, 100% { transform: translate(0, 0)         scale(1);    }
  45%      { transform: translate(-12vw, -16vh) scale(1.1);  }
  75%      { transform: translate(-20vw, -4vh)  scale(0.9);  }
}
@media (prefers-reduced-motion: reduce) {
  .bg-mesh .blob {
    animation: none;
  }
}

/* ── Background flowing curves (procedural SVG) ─────────────── */
.bg-curves {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
}
.bg-curves path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 0.6;
  opacity: 0.4;
}

/* ── Page frame ─────────────────────────────────────────────── */
.frame {
  position: relative;
  z-index: 2;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px clamp(20px, 4vw, 56px) 80px;
}

/* ── Top nav + Footer ──────────────────────────────────────────
   Moved 2026-05-16 to shared/site-blocks/styles/site-blocks.css
   as .site-nav / .site-footer — they're CMS-block-driven now
   (Phase 3). Legacy nav.top / .brand selectors removed; the
   standalone non-CMS Site/public/*.html landing pages used to
   rely on them but those routes are CMS-published since the
   2026-05-16 cutover. */

/* ── Hero / .cta / .hero-visual ────────────────────────────────
   Moved 2026-05-16 to shared/site-blocks/styles/site-blocks.css —
   they're block-internal rules (the hero block emits them), so
   they belong with the rest of the block CSS and must be loadable
   by the CMS editor preview iframe. Published pages still get
   them (PageRenderer links /site-blocks.css). */

/* ── Hero visual companion: glow halo ──────────────────────────
   Stays here because it's only used by the legacy non-CMS
   /index.html (the homepage is CMS-published and uses the
   orbital-sphere svg's own glow). */
.glow-bg {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(52,200,255,0.35) 0%, transparent 60%);
  filter: blur(40px);
  z-index: -1;
}


/* ── Side index (the dots + arrow on the left of the hero) ── */
.side-index {
  position: absolute;
  left: -8px;
  bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--ink-3);
}
.side-index .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
  transition: background 0.2s, transform 0.2s;
}
.side-index .dot.on {
  background: var(--accent);
  transform: scale(1.3);
  box-shadow: 0 0 12px var(--accent);
}
.side-index .arrow {
  width: 14px; height: 14px;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg);
  animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: rotate(45deg) translate(0,0); }
  50%      { transform: rotate(45deg) translate(3px,3px); }
}

/* ── Feature cards ──────────────────────────────────────────────
   Moved 2026-05-16 to shared/site-blocks/styles/site-blocks.css —
   block-internal CSS for three-col / plan-grid (.features + .card). */

/* ── Footer ──────────────────────────────────────────────────
   Moved 2026-05-16 to shared/site-blocks.css as .site-footer. */

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .arrow, .orbit-ring, .pulse-node { animation: none !important; }
}

/* Narrow — page-chrome breakpoints only. Block-internal
   responsive rules (.hero, .features) moved to site-blocks.css. */
@media (max-width: 900px) {
  nav.top ul { display: none; }
  .side-index { display: none; }
}

/* ── Chat widget (lifted from the original chat.html inline <style> on 2026-05-16). Used by the html-embed block on /chat. */
    .chat {
      max-width: 56rem;
      margin: 3rem auto;
      display: grid;
      grid-template-rows: auto 1fr auto;
      gap: 1rem;
      height: calc(100vh - 12rem);
      min-height: 32rem;
    }
    /* Header reads as the "person you're talking to" — large round
       portrait, name underneath, online dot — same layout as the top
       of a one-on-one iMessage thread. */
    .chat header {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.35rem;
      padding-bottom: 0.8rem;
      border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .chat header .bot-avatar {
      position: relative;
      width: 72px; height: 72px;
      border-radius: 50%;
      overflow: hidden;
      background: radial-gradient(circle at 30% 30%, #1d3344, #001a26);
      border: 2px solid rgba(255, 255, 255, 0.18);
      box-shadow: 0 6px 18px rgba(0, 26, 38, 0.45);
    }
    .chat header .bot-avatar img {
      width: 100%; height: 100%;
      object-fit: cover;
      display: block;
    }
    /* Small green presence dot in the bottom-right of the avatar —
       conveys "online / available to chat", same as iMessage / iOS
       contact cards. */
    .chat header .bot-avatar::after {
      content: '';
      position: absolute;
      right: 2px; bottom: 2px;
      width: 14px; height: 14px;
      border-radius: 50%;
      background: #30d158;
      border: 2px solid #001a26;
    }
    .chat header h2 {
      margin: 0.2rem 0 0;
      color: #eaf6ff;
      font-weight: 500;
      font-size: 1.05rem;
      letter-spacing: 0.01em;
    }
    .chat header .meta {
      color: #6a8090;
      font-size: 0.78rem;
    }

    /* ── iMessage-style bubbles ──────────────────────────────────
       Rounded pill bubbles aligned right (sender) / left (receiver)
       to match the iPhone Messages app. The stream sits on a
       slightly lighter panel so iMessage's signature blue + grey
       read as intended; the rest of the page keeps the dark theme. */
    .stream {
      overflow-y: auto;
      padding: 1rem 0.6rem 1.2rem;
      display: flex; flex-direction: column; gap: 0.25rem;
      /* Frosted-glass panel: low-opacity white sits on top of the
         page's blue curves so the gradient reads through, while the
         backdrop-filter softly blurs whatever's behind for a frosted
         iOS-Messages-on-Lock-Screen look. Falls back gracefully to
         translucent white in browsers without backdrop-filter. */
      background: rgba(255, 255, 255, 0.18);
      -webkit-backdrop-filter: blur(22px) saturate(150%);
              backdrop-filter: blur(22px) saturate(150%);
      border-radius: 14px;
      border: 1px solid rgba(255, 255, 255, 0.14);
      box-shadow: 0 6px 22px rgba(0, 26, 38, 0.22);
    }
    .msg {
      display: flex;
      align-items: flex-end;
      gap: 0.45rem;
      max-width: 100%;
    }
    .msg.you  { justify-content: flex-end; }
    .msg.bot  { justify-content: flex-start; }
    /* Small circular avatar to the left of bot bubbles — same
       affordance iMessage uses in group threads. Solid disc with
       a 14×14 SVG icon centred, in the brand cyan. Hidden on
       consecutive bot messages so the bubbles cluster cleanly. */
    .msg .avatar {
      flex: 0 0 28px;
      width: 28px; height: 28px;
      border-radius: 50%;
      background: #0a1f44 url('/Aria.png') no-repeat;
      background-size: 150%;
      background-position: 50% 28%;
      box-shadow: 0 1px 2px rgba(0, 26, 38, 0.2);
    }
    .msg.bot + .msg.bot .avatar { visibility: hidden; }
    .msg.you .avatar { display: none; }

    /* Bigger gap when speaker changes; tight gap when the same
       speaker sends two in a row (iMessage clusters consecutive
       messages from the same side). */
    .msg + .msg.you,
    .msg + .msg.bot { margin-top: 0.15rem; }
    .msg.you + .msg.bot,
    .msg.bot + .msg.you { margin-top: 0.6rem; }

    .msg .body {
      max-width: 72%;
      padding: 0.5rem 0.85rem;
      border-radius: 18px;
      font-size: 0.95rem;
      line-height: 1.35;
      white-space: pre-wrap;
      word-break: break-word;
      position: relative;
    }
    .msg.you .body {
      background: #007aff;          /* iMessage blue */
      color: #ffffff;
      border-bottom-right-radius: 4px;
    }
    .msg.bot .body {
      background: #e5e5ea;          /* iMessage incoming grey */
      color: #111111;
      border-bottom-left-radius: 4px;
    }
    /* Typing/streaming caret — three softly-pulsing dots, the same
       motif iMessage uses for "the other side is typing". */
    .msg.bot.streaming .body::after {
      content: '·  ·  ·';
      display: inline-block;
      letter-spacing: 0;
      color: #6e6e73;
      margin-left: 4px;
      animation: pulse 1.4s ease-in-out infinite;
    }
    @keyframes pulse { 50% { opacity: 0.35; } }
    .err {
      color: #ffadad;
      background: rgba(255, 60, 60, 0.08);
      border: 1px solid rgba(255, 173, 173, 0.4);
      border-radius: 6px; padding: 0.5rem 0.7rem;
      font-size: 0.85rem;
    }

    /* iOS-style composer row — frosted pill input flanked by two
       circular icon buttons: "+" on the left (placeholder for future
       attachment / camera affordance), arrow-up on the right. The
       arrow turns from grey → iMessage blue once the input has
       content, mirroring the iOS Messages send-state animation. */
    form.composer {
      display: flex; gap: 0.5rem;
      align-items: center;
    }
    form.composer .icon-btn {
      flex: 0 0 36px;
      width: 36px; height: 36px;
      border-radius: 50%;
      border: none;
      background: rgba(255, 255, 255, 0.08);
      color: #eaf6ff;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0;
    }
    form.composer .icon-btn:hover { background: rgba(255, 255, 255, 0.16); }
    form.composer .icon-btn svg {
      width: 18px; height: 18px;
      stroke: currentColor; stroke-width: 1.8;
      fill: none; stroke-linecap: round; stroke-linejoin: round;
    }
    form.composer textarea {
      flex: 1;
      background: rgba(255, 255, 255, 0.08);
      border: 1px solid rgba(255, 255, 255, 0.14);
      color: #eaf6ff;
      border-radius: 22px;
      padding: 0.55rem 1rem;
      font-family: inherit;
      font-size: 0.95rem;
      resize: none;
      min-height: 2.5rem;
      max-height: 10rem;
      line-height: 1.4;
    }
    form.composer textarea:focus {
      outline: none;
      border-color: #34c8ff;
      box-shadow: 0 0 0 2px rgba(52, 200, 255, 0.25);
    }
    form.composer #send {
      background: rgba(255, 255, 255, 0.12);
      color: #6a8090;
      transition: background 0.18s, color 0.18s, transform 0.12s;
    }
    /* Active state — set by JS on input — turns the send affordance
       iMessage blue. .has-text on the form is the trigger. */
    form.composer.has-text #send {
      background: #007aff;
      color: #ffffff;
      transform: scale(1.04);
    }
    form.composer #send:disabled {
      opacity: 0.55;
      cursor: not-allowed;
      transform: none;
    }
    form.composer #send:hover:not(:disabled) { filter: brightness(1.1); }

    .footnote {
      color: #6a8090;
      font-size: 0.78rem;
      margin-top: -0.4rem;
    }
