@import 'tailwindcss';
@import '@fontsource/inter/400.css';
@import '@fontsource/inter/500.css';
@import '@fontsource/inter/600.css';
@import '@fontsource/inter/700.css';
@import '@fontsource/inter/800.css';

@custom-variant dark (&:is(.dark *));

/* Nothing may widen the page: on iOS one overflowing row scales the whole
   layout viewport. clip (not hidden) keeps the sticky header working. */
html, body { overflow-x: clip; }

/* ----------------------------------------------------------------
   Color tokens — mirrors web/src/global.css OKLCH neutrals,
   with brand sky/indigo accents for the marketing surface.
---------------------------------------------------------------- */

:root {
  --radius: 14px;

  /* Warmbly — blue sky theme (matches /web auth layout palette) */
  --background:  #ffffff;
  --foreground:  #0f172a;          /* slate-900 */
  --heading:     #0f172a;

  --surface:     #ffffff;
  --surface-2:   #f5f8fc;          /* very light sky for section bands */
  --surface-3:   #e6edf6;

  --muted:        #f5f8fc;
  --muted-foreground: #64748b;     /* slate-500 */

  --border:        #e2e8f0;        /* slate-200 */
  --border-strong: #cbd5e1;        /* slate-300 */
  --input:         #e2e8f0;
  --ring:          #0ea5e9;        /* sky-500 */

  --card: #ffffff;
  --card-foreground: #0f172a;

  /* Brand — sky-blue gradient family, matches web/ accent */
  --brand:           #0284c7;       /* sky-600 — primary buttons + links */
  --brand-soft:      #e0f2fe;       /* sky-100 */
  --brand-strong:    #0369a1;       /* sky-700 */
  --brand-foreground:#ffffff;

  /* Deep-sky hero stops */
  --sky-1: #7dd3fc;                /* sky-300 */
  --sky-2: #38bdf8;                /* sky-400 */
  --sky-3: #0ea5e9;                /* sky-500 */
  --sky-4: #0284c7;                /* sky-600 */
  --sky-5: #075985;                /* sky-800 */
  --sky-6: #0c4a6e;                /* sky-900 */

  --success: #16a34a;
  --warn:    #d97706;
  --danger:  #dc2626;

  --primary: #0f172a;
  --primary-foreground: #ffffff;

  --shadow-xl: rgba(2, 132, 199, 0.20) 0 32px 70px -12px, rgba(15, 23, 42, 0.18) 0 18px 36px -16px, rgba(15, 23, 42, 0.06) 0 0 0 1px;
  --shadow-md: rgba(15, 23, 42, 0.10) 0 18px 40px -16px, rgba(15, 23, 42, 0.05) 0 0 0 1px;
  --shadow-sm: rgba(15, 23, 42, 0.06) 0 4px 14px -4px, rgba(15, 23, 42, 0.05) 0 0 0 1px;
}

.dark {
  --background: oklch(0.13 0.01 260);
  --foreground: oklch(0.95 0.005 260);

  --surface: oklch(0.16 0.01 260);
  --surface-2: oklch(0.18 0.01 260);
  --surface-3: oklch(0.22 0.01 260);

  --muted: oklch(0.20 0.01 260);
  --muted-foreground: oklch(0.65 0.01 260);

  --border: oklch(0.26 0.01 260);
  --border-strong: oklch(0.32 0.01 260);
  --input: oklch(0.26 0.01 260);
  --ring: oklch(0.62 0.02 252);

  --card: oklch(0.16 0.01 260);
  --card-foreground: oklch(0.95 0.005 260);

  --brand: oklch(0.72 0.15 250);
  --brand-soft: oklch(0.28 0.10 252);
  --brand-strong: oklch(0.82 0.15 250);
  --brand-foreground: oklch(0.13 0.01 260);

  --accent: oklch(0.22 0.01 260);
  --accent-foreground: oklch(0.95 0.005 260);

  --success: oklch(0.72 0.16 152);
  --warn: oklch(0.78 0.15 80);
  --danger: oklch(0.70 0.20 22);

  --primary: oklch(0.95 0.005 260);
  --primary-foreground: oklch(0.13 0.01 260);
}

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-heading: var(--heading);
  --color-surface: var(--surface);
  --color-surface-2: var(--surface-2);
  --color-surface-3: var(--surface-3);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-border: var(--border);
  --color-border-strong: var(--border-strong);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-brand: var(--brand);
  --color-brand-soft: var(--brand-soft);
  --color-brand-strong: var(--brand-strong);
  --color-brand-foreground: var(--brand-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-success: var(--success);
  --color-warn: var(--warn);
  --color-danger: var(--danger);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, monospace;

  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --radius-2xl: calc(var(--radius) + 8px);
  --radius-3xl: calc(var(--radius) + 12px);
}

/* ----------------------------------------------------------------
   Base
---------------------------------------------------------------- */

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: color-mix(in oklab, var(--brand) 25%, transparent);
  color: var(--foreground);
}

* {
  border-color: var(--border);
}

/* ----------------------------------------------------------------
   Reusable patterns
---------------------------------------------------------------- */

/* Site-wide content width. Widened to 90rem so the header, hero, footer
   and every section share the same generous width as the feature showcase. */
@utility container-page {
  width: 100%;
  margin-inline: auto;
  padding-inline: 1.25rem;
  max-width: 90rem;
  @media (min-width: 768px) { padding-inline: 2.5rem; }
}

/* Alias kept for the feature showcase; same width as container-page. */
@utility container-wide {
  width: 100%;
  margin-inline: auto;
  padding-inline: 1.25rem;
  max-width: 90rem;
  @media (min-width: 768px) { padding-inline: 2.5rem; }
}

@utility prose-warmbly {
  color: var(--foreground);
  font-size: 1rem;
  line-height: 1.7;
}

/* Tiny grid pattern used by hero sections. */
.bg-dotgrid {
  background-image: radial-gradient(circle, color-mix(in oklab, var(--foreground) 12%, transparent) 1px, transparent 1px);
  background-size: 24px 24px;
}

.bg-linegrid {
  background-image:
    linear-gradient(to right, color-mix(in oklab, var(--foreground) 6%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in oklab, var(--foreground) 6%, transparent) 1px, transparent 1px);
  background-size: 56px 56px;
}

.hairline {
  border-bottom: 1px solid var(--border);
}

/* Subtle background glow behind hero. */
.hero-glow::before {
  content: '';
  position: absolute;
  inset: -10% -20% auto -20%;
  height: 70%;
  background: radial-gradient(60% 60% at 50% 0%, color-mix(in oklab, var(--brand) 22%, transparent), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ----------------------------------------------------------------
   Painted-sky backdrop — Cursor-style soft pastel scene that sits
   behind app-mock cards. Pure CSS gradients + a couple of blurred
   cloud puffs, so it's GPU-cheap and ~0KB extra bytes.
   Two flavours: `dawn` (peach + lavender + blue) and `bright`
   (lavender + sky-blue + mint) for variety across sections.
---------------------------------------------------------------- */

.painted-sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
}

.painted-sky.dawn {
  background:
    radial-gradient(40% 60% at 78% 14%,
      rgba(255, 192, 158, 0.78) 0%,
      rgba(255, 192, 158, 0.32) 30%,
      transparent 70%),
    radial-gradient(50% 60% at 18% 22%,
      rgba(196, 184, 232, 0.70) 0%,
      rgba(196, 184, 232, 0.25) 32%,
      transparent 70%),
    radial-gradient(80% 60% at 50% 78%,
      rgba(214, 224, 233, 0.60) 0%,
      rgba(214, 224, 233, 0.20) 40%,
      transparent 80%),
    linear-gradient(180deg,
      #f0dccb 0%,
      #dccfe4 32%,
      #c4d4e6 58%,
      #d8e2ec 78%,
      #efe7df 100%);
}

.painted-sky.bright {
  background:
    radial-gradient(40% 60% at 18% 14%,
      rgba(255, 224, 176, 0.55) 0%,
      transparent 70%),
    radial-gradient(50% 60% at 78% 22%,
      rgba(173, 200, 230, 0.70) 0%,
      transparent 70%),
    radial-gradient(80% 50% at 50% 78%,
      rgba(225, 220, 240, 0.40) 0%,
      transparent 80%),
    linear-gradient(180deg,
      #dde7f2 0%,
      #c6d6ea 30%,
      #b9cee6 55%,
      #d6e0ee 80%,
      #ece5f0 100%);
}

.painted-sky.dusk {
  background:
    radial-gradient(45% 55% at 75% 18%,
      rgba(255, 168, 145, 0.65) 0%,
      transparent 70%),
    radial-gradient(60% 60% at 22% 28%,
      rgba(168, 156, 215, 0.65) 0%,
      transparent 70%),
    radial-gradient(80% 45% at 50% 82%,
      rgba(210, 196, 220, 0.55) 0%,
      transparent 80%),
    linear-gradient(180deg,
      #e0c8b4 0%,
      #c8b9d8 28%,
      #ad9fcc 55%,
      #c1aac4 78%,
      #e2c8c0 100%);
}

/* Soft white cloud puffs to layer on top of `.painted-sky` */
.cloud-puff {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  filter: blur(28px);
  pointer-events: none;
}

/* Mountain silhouette curve — a simple SVG-less wave */
.painted-horizon {
  position: absolute;
  inset: auto 0 0 0;
  height: 36%;
  pointer-events: none;
  background:
    radial-gradient(60% 100% at 35% 100%,
      rgba(110, 100, 130, 0.40) 0%,
      transparent 70%),
    radial-gradient(50% 100% at 78% 100%,
      rgba(140, 122, 150, 0.45) 0%,
      transparent 70%);
  mask-image: linear-gradient(to bottom, transparent 0%, black 60%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 60%);
}

/* App-window mock chrome — used everywhere */
.app-window {
  background: var(--card);
  border-radius: 14px;
  border: 1px solid color-mix(in oklab, var(--foreground) 14%, transparent);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 24px 60px -28px rgba(15, 23, 42, 0.35),
    0 4px 12px -6px rgba(15, 23, 42, 0.10);
  overflow: hidden;
}

.hero-sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 140% 140% at 72% 25%,
      #7dd3fc 0%,
      #38bdf8 18%,
      #0ea5e9 36%,
      #0284c7 58%,
      #075985 82%
    );
}

/* Soft sun glow in the upper-right */
.hero-sun {
  position: absolute;
  top: 0; right: 0;
  width: 900px; height: 900px;
  pointer-events: none;
  background: radial-gradient(circle,
    rgba(253, 230, 138, 0.30) 0%,
    rgba(253, 186, 116, 0.10) 32%,
    rgba(56, 189, 248, 0.04) 55%,
    transparent 70%
  );
  filter: blur(8px);
  transform: translate(20%, -20%);
}

/* Atmospheric upper-left scatter */
.hero-haze {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 20% 40%,
      rgba(186, 230, 253, 0.18) 0%,
      transparent 60%
    ),
    radial-gradient(ellipse 70% 30% at 60% 80%,
      rgba(125, 211, 252, 0.20) 0%,
      transparent 70%
    );
}

/* Bottom of hero fades into pure white — no white wash on top */
.hero-fade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to bottom,
    transparent 0%,
    transparent 62%,
    rgba(255,255,255,0.5) 82%,
    #ffffff 100%
  );
}

/* Cloud — three soft, blurred white blobs that read as a cumulus.
   No SVG filters; just border-radius + blur on layered divs. */
.cloud {
  position: absolute;
  pointer-events: none;
}
.cloud-back, .cloud-mid, .cloud-front {
  position: absolute;
  border-radius: 50% 50% 40% 40%;
  filter: blur(22px);
}
.cloud-back  { background: rgba(255, 255, 255, 0.95); }
.cloud-mid   { background: rgba(232, 240, 254, 0.85); filter: blur(28px); }
.cloud-front { background: rgba(186, 207, 230, 0.70); filter: blur(34px); }

/* Sky variants for the page header (transparent over sky) */
.header-on-sky {
  background: transparent !important;
  border-color: transparent !important;
  backdrop-filter: none !important;
}
.header-on-sky a,
.header-on-sky button,
.header-on-sky span,
.header-on-sky svg { color: white; }
.header-on-sky .nav-link {
  color: rgba(255, 255, 255, 0.78);
}
.header-on-sky .nav-link:hover {
  color: white;
  background: rgba(255, 255, 255, 0.10);
}
.header-on-sky .nav-link.is-active {
  color: white;
  background: rgba(255, 255, 255, 0.14);
}
.header-on-sky .cta-primary {
  background: white;
  color: #0c4a6e;
}
.header-on-sky .cta-primary:hover { background: rgba(255, 255, 255, 0.9); }
.header-on-sky .cta-ghost {
  color: rgba(255, 255, 255, 0.85);
}
.header-on-sky .cta-ghost:hover {
  color: white;
  background: rgba(255, 255, 255, 0.10);
}

/* Hairline + soft inner-edge for product mock cards */
.glass-card {
  background: color-mix(in oklab, var(--card) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 1px 0 0 color-mix(in oklab, white 70%, transparent) inset,
    0 30px 80px -40px color-mix(in oklab, oklch(0.20 0.06 250) 30%, transparent),
    0 8px 24px -16px color-mix(in oklab, oklch(0.20 0.06 250) 20%, transparent);
}
.dark .glass-card {
  box-shadow:
    0 1px 0 0 color-mix(in oklab, white 8%, transparent) inset,
    0 30px 80px -40px black,
    0 8px 24px -16px black;
}

/* Subtle marquee for logo strip */
@keyframes marquee-x {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.marquee-track {
  animation: marquee-x 38s linear infinite;
}

/* Mask the edges of a horizontal marquee to fade in/out */
.marquee-mask {
  mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
}

/* ----------------------------------------------------------------
   Article typography — shared by the Learn essays and the blog.
   Lives in @layer components so single-class Tailwind utilities on
   elements inside an article (e.g. a custom <pre class="bg-...">)
   still win over these defaults.
---------------------------------------------------------------- */

@layer components {
  .article-prose {
    color: var(--foreground);
  }

  .article-prose h2 {
    position: relative;
    margin-top: 3.5rem;
    margin-bottom: 1.25rem;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--heading);
    scroll-margin-top: 6.5rem;
  }
  .article-prose h2:first-child { margin-top: 0; }
  @media (min-width: 768px) {
    .article-prose h2 { font-size: 28px; }
    /* Section glyph sits in the left margin; gated to md+ so it cannot
       poke past the px-6 container edge on phones. */
    .article-prose h2::before {
      content: '§';
      position: absolute;
      left: -1.75rem;
      top: 0.25rem;
      font-family: var(--font-mono);
      font-size: 18px;
      color: color-mix(in oklab, #0284c7 30%, transparent);
    }
  }

  /* Hover anchor for deep links; the <a> is injected by the article script. */
  .article-prose h2 .heading-anchor {
    position: absolute;
    right: 100%;
    top: 0;
    bottom: 0;
    display: inline-flex;
    align-items: center;
    padding-right: 0.4rem;
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 400;
    color: #0284c7;
    opacity: 0;
    text-decoration: none;
    transition: opacity 160ms ease;
  }
  .article-prose h2:hover .heading-anchor,
  .article-prose h2 .heading-anchor:focus-visible { opacity: 1; }
  @media (min-width: 768px) {
    /* When the § glyph is visible, the anchor replaces it on hover. */
    .article-prose h2:hover::before { opacity: 0; }
  }

  .article-prose h3 {
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    font-size: 17px;
    font-weight: 600;
    color: var(--heading);
  }

  .article-prose p {
    margin-top: 1rem;
    font-size: 15.5px;
    line-height: 1.75;
    color: color-mix(in oklab, var(--foreground) 85%, transparent);
  }
  .article-prose p:first-child { margin-top: 0; }
  @media (min-width: 768px) {
    .article-prose p { font-size: 16px; }
  }

  .article-prose ul {
    margin-top: 1rem;
    font-size: 15px;
    color: color-mix(in oklab, var(--foreground) 85%, transparent);
  }
  .article-prose ul > li {
    position: relative;
    padding-left: 1.25rem;
    line-height: 1.6;
  }
  .article-prose ul > li + li { margin-top: 0.5rem; }
  .article-prose ul > li::before {
    content: '·';
    position: absolute;
    left: 0.25rem;
    color: #0284c7;
    font-weight: 700;
  }

  .article-prose ol {
    margin-top: 1rem;
    list-style: none;
    counter-reset: step;
    font-size: 15px;
    color: color-mix(in oklab, var(--foreground) 85%, transparent);
  }
  .article-prose ol > li {
    counter-increment: step;
    position: relative;
    padding-left: 2.5rem;
    line-height: 1.6;
  }
  .article-prose ol > li + li { margin-top: 0.5rem; }
  .article-prose ol > li::before {
    content: counter(step, decimal-leading-zero) '.';
    position: absolute;
    left: 0;
    top: 0;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: #0284c7;
  }

  .article-prose a {
    color: #0369a1;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: color-mix(in oklab, #0284c7 30%, transparent);
  }
  .article-prose a:hover { color: #075985; }

  .article-prose strong {
    color: var(--heading);
    font-weight: 600;
  }

  .article-prose code {
    font-family: var(--font-mono);
    font-size: 0.92em;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    background: var(--surface-2);
    box-shadow: 0 0 0 1px var(--border);
  }

  .article-prose blockquote {
    margin-top: 2rem;
    margin-bottom: 2rem;
    border-left: 2px solid #0284c7;
    padding: 0.5rem 0 0.5rem 1.5rem;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.35;
    color: var(--heading);
  }
  @media (min-width: 768px) {
    .article-prose blockquote { font-size: 22px; }
  }
  .article-prose blockquote p {
    margin: 0;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
  }

  .article-prose pre {
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
    background: #0c1224;
    color: rgba(255, 255, 255, 0.85);
    padding: 1.25rem;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
  }
  .article-prose pre code {
    background: transparent;
    box-shadow: none;
    padding: 0;
    font-size: inherit;
  }

  .article-prose table {
    width: 100%;
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
    border-collapse: collapse;
    font-size: 13.5px;
    line-height: 1.5;
  }
  .article-prose thead th {
    text-align: left;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted-foreground);
    padding: 0 0.75rem 0.5rem 0;
    border-bottom: 1px solid var(--border);
  }
  .article-prose tbody td {
    padding: 0.625rem 0.75rem 0.625rem 0;
    border-bottom: 1px solid var(--border);
    color: color-mix(in oklab, var(--foreground) 80%, transparent);
    vertical-align: top;
  }
  .article-prose tbody td:first-child {
    color: var(--heading);
    font-weight: 500;
  }

  .article-prose hr {
    margin-top: 2.5rem;
    margin-bottom: 2.5rem;
    border: 0;
    border-top: 1px solid var(--border);
  }
}

/* 2px sky reading-progress bar pinned under the article top bar. */
.reading-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 0%;
  background: linear-gradient(to right, #38bdf8, #0284c7);
  transition: width 80ms linear;
}

/* Inline code style for the docs/learn pages. */
.kbd {
  font-family: var(--font-mono);
  font-size: 0.78em;
  padding: 0.1em 0.45em;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

/* Animations */

@keyframes float-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-float-up {
  animation: float-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.animate-pulse-soft { animation: pulse-soft 2.4s ease-in-out infinite; }

/* ----------------------------------------------------------------
   Warmbly hero atmosphere — deep sky gradient with breathing
   animation, layered drifting clouds, sun pulse.
   Mirrors web/src/app/auth/layout.tsx palette.
---------------------------------------------------------------- */

.sky-base {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 140% 140% at 72% 25%,
    #7dd3fc 0%,
    #38bdf8 18%,
    #0ea5e9 36%,
    #0284c7 58%,
    #075985 82%
  );
}

.sky-breathe {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 140% 140% at 72% 25%,
    rgba(186, 230, 253, 0.85) 0%,
    rgba(56, 189, 248, 0.42) 18%,
    rgba(14, 165, 233, 0.18) 36%,
    transparent 60%
  );
  animation: sky-breathe 30s ease-in-out infinite;
}

@keyframes sky-breathe {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(1.05); }
}

.sky-haze-bottom {
  position: absolute;
  inset: auto 0 0 0;
  height: 55%;
  pointer-events: none;
  background: linear-gradient(to top,
    rgba(125, 211, 252, 0.18) 0%,
    rgba(56, 189, 248, 0.08) 35%,
    transparent 100%
  );
}

.sun-glow {
  position: absolute;
  top: 8%;
  right: 14%;
  width: 700px;
  height: 700px;
  border-radius: 9999px;
  pointer-events: none;
  filter: blur(40px);
  background: radial-gradient(circle,
    rgba(253, 230, 138, 0.30) 0%,
    rgba(253, 186, 116, 0.10) 32%,
    rgba(186, 230, 253, 0.04) 55%,
    transparent 70%
  );
  animation: sun-pulse 22s ease-in-out infinite;
}

@keyframes sun-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(1.10); }
}

.hero-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image:
    radial-gradient(circle at 30% 30%, rgba(0,0,0,0.04) 1px, transparent 2px),
    radial-gradient(circle at 70% 70%, rgba(0,0,0,0.04) 1px, transparent 2px);
  background-size: 32px 32px;
}

/* Outlined cloud — drifts slowly across the hero */
.cloud-drift {
  position: absolute;
  pointer-events: none;
  opacity: 0.55;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

@keyframes cloud-glide-1 {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(60px, -10px, 0); }
}
@keyframes cloud-glide-2 {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50px, 8px, 0); }
}
@keyframes cloud-glide-3 {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(40px, 18px, 0); }
}

.cloud-1 { animation-name: cloud-glide-1; animation-duration: 32s; }
.cloud-2 { animation-name: cloud-glide-2; animation-duration: 40s; }
.cloud-3 { animation-name: cloud-glide-3; animation-duration: 26s; }

/* Subtle floating animation for elevated cards */
@keyframes card-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
.animate-card-float { animation: card-float 6s ease-in-out infinite; }

/* Lift effect on hover */
.lift-on-hover {
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 220ms ease;
}
.lift-on-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

@media (prefers-reduced-motion: reduce) {
  .hero-aurora, .cloud-drift, .animate-card-float, .animate-pulse-soft {
    animation: none !important;
  }
}

/* ----------------------------------------------------------------
   Grain frame.

   Paper Shaders injects its own `@layer paper-shaders` at runtime, and a
   layer registered after Tailwind's beats Tailwind at ANY specificity. Two
   of its rules matter here:

     :where([data-paper-shader]) { position: relative }
     :where([data-paper-shader]) canvas { height: 100%; border-radius: inherit }

   It puts that attribute on whatever element we mount to. So its `position:
   relative` was overriding the `absolute inset-0` on our mount target, which
   left the target auto-height (its only child is the absolute canvas), which
   made the canvas 100% of zero. Declaring position here, unlayered, wins it
   back: unlayered CSS beats every layer.

   The radius travels as a custom property because the canvas is created by
   the library at a depth we do not control, and `inherit` only reads one
   level up. clip-path is the belt to that pair of braces: it clips
   descendants whatever their overflow, z-index or containment.
---------------------------------------------------------------- */
/* The shadow lives on the shell, outside the clip, or the frame's own
   clip-path would cut it off. */
.feat-frame-shell {
  --frame-radius: 28px;

  border-radius: var(--frame-radius);
}

/* The one clip every visual on the page goes through: a plain box, overflow
   hidden, one radius. A transformed child (a scaled screen, a sliding track)
   gets its own compositor layer, and Safari and Chrome both skip a rounded
   overflow clip on those unless the box is a layer itself and masked. */
/* Phones: a backdrop filter inside a scaled app shell makes iOS Safari keep a
   snapshot of everything behind it per mock, and at that size the blur is
   invisible anyway. Desktop keeps the real thing. */
@media (hover: none) {
  [data-stage] [class*="backdrop-blur"] {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* clip-path, not the translateZ + mask-image trick: that pairs a forced 3D
   layer with a mask buffer per frame, and iOS Safari runs out of GPU memory
   with fourteen of them on one page. clip-path clips composited children
   (the WebGL canvas, scaled screens) just as well. */
.round-clip {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  isolation: isolate;
  clip-path: inset(0 round 28px);
}

/* A shell that is off screen (AppShellMock's observer) keeps its pings and
   pulses still; a phone with fifteen shells cannot animate them all. */
[data-stage].is-off *,
[data-stage].is-off *::before,
[data-stage].is-off *::after {
  animation-play-state: paused !important;
}

/* Diagnostics for the phone: ?noshell hides every app shell, ?noanim stops
   every animation, ?nogl (GrainBackdrop) skips WebGL. */
html[data-diag~="noshell"] [data-stage] { display: none !important; }
html[data-diag~="noanim"] *, html[data-diag~="noanim"] *::before, html[data-diag~="noanim"] *::after { animation: none !important; transition: none !important; }

/* The outer clip. clip-path (not just overflow) because the shader canvas
   carries `contain: strict` and a negative z-index from the library's own
   layer; this clips it regardless. */
.feat-frame {
  border-radius: var(--frame-radius);
  clip-path: inset(0 round var(--frame-radius));
}

.feat-frame .grain-backdrop {
  border-radius: var(--frame-radius);
}

.feat-frame .grain-canvas {
  position: absolute;
  inset: 0;
  border-radius: var(--frame-radius);
}

.feat-frame .grain-canvas canvas {
  border-radius: var(--frame-radius);
}

/* The demo pointer (DemoCursor.astro), moved by lib/cursor.ts. Hidden until
   the engine takes over, so a mock never shows a pointer parked at 0,0. */
.demo-cursor {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 50;
  width: 23px;
  height: 27px;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 4px 6px rgba(15, 23, 42, 0.4));
  will-change: transform;
}
.is-playing > .demo-cursor,
.is-playing .demo-cursor {
  opacity: 1;
}
.demo-cursor svg {
  display: block;
  transform-origin: 3px 2px;
  transition: transform 90ms ease-out;
}
.demo-cursor.is-down svg {
  transform: scale(0.82);
}
.demo-ripple {
  position: absolute;
  left: -6px;
  top: -6px;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: rgba(2, 132, 199, 0.5);
  transform: scale(0);
  opacity: 0;
}
.demo-ripple.is-rip {
  animation: demo-rip 520ms ease-out forwards;
}
@keyframes demo-rip {
  from { transform: scale(0.25); opacity: 0.7; }
  to { transform: scale(1.9); opacity: 0; }
}
.is-static .demo-cursor,
.is-static .demo-ripple {
  display: none;
}
/* Inside an app window (the shell is the containing block via contain:paint)
   the pointer is fixed, so it travels the whole screen, dialogs included. */
[data-stage] .demo-cursor {
  position: fixed;
}
/* Inside an app window the dashboard's own theme applies: its radius scale
   (--radius 0.5rem, so rounded-md is 6px), its neutral OKLCH text colours and
   its system font stack (web/src/global.css). Lucide icons are round-capped. */
[data-stage] {
  --radius: 0.5rem;
  --foreground: oklch(0.15 0.01 260);
  --muted-foreground: oklch(0.55 0.01 260);

  color: var(--foreground);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
[data-stage] svg[stroke="currentColor"] {
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Sidebar activity motifs, copied from web/src/global.css ── */
.campaign-grid {
  display: inline-block;
  position: relative;
  width: 14px;
  height: 14px;
  vertical-align: middle;
}
.campaign-grid::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  aspect-ratio: 1;
  border-radius: 50%;
  transform-origin: 0 0;
  transform: scale(0.26) translateX(-38px);
  box-shadow:
    19px -19px 0 0px, 38px -19px 0 0px, 57px -19px 0 0px,
    19px 0     0 5px, 38px 0     0 5px, 57px 0     0 5px,
    19px 19px  0 0px, 38px 19px  0 0px, 57px 19px  0 0px;
  animation: campaign-grid 3.5s infinite linear;
}
@keyframes campaign-grid {
  12.5% { box-shadow:
    19px -19px 0 0px, 38px -19px 0 0px, 57px -19px 0 5px,
    19px 0     0 5px, 38px 0     0 0px, 57px 0     0 5px,
    19px 19px  0 0px, 38px 19px  0 0px, 57px 19px  0 0px; }
  25%   { box-shadow:
    19px -19px 0 5px, 38px -19px 0 0px, 57px -19px 0 5px,
    19px 0     0 0px, 38px 0     0 0px, 57px 0     0 0px,
    19px 19px  0 0px, 38px 19px  0 5px, 57px 19px  0 0px; }
  50%   { box-shadow:
    19px -19px 0 5px, 38px -19px 0 5px, 57px -19px 0 0px,
    19px 0     0 0px, 38px 0     0 0px, 57px 0     0 0px,
    19px 19px  0 0px, 38px 19px  0 0px, 57px 19px  0 5px; }
  62.5% { box-shadow:
    19px -19px 0 0px, 38px -19px 0 0px, 57px -19px 0 0px,
    19px 0     0 5px, 38px 0     0 0px, 57px 0     0 0px,
    19px 19px  0 0px, 38px 19px  0 5px, 57px 19px  0 5px; }
  75%   { box-shadow:
    19px -19px 0 0px, 38px -19px 0 5px, 57px -19px 0 0px,
    19px 0     0 0px, 38px 0     0 0px, 57px 0     0 5px,
    19px 19px  0 0px, 38px 19px  0 0px, 57px 19px  0 5px; }
  87.5% { box-shadow:
    19px -19px 0 0px, 38px -19px 0 5px, 57px -19px 0 0px,
    19px 0     0 0px, 38px 0     0 5px, 57px 0     0 0px,
    19px 19px  0 5px, 38px 19px  0 0px, 57px 19px  0 0px; }
}
.flame-flicker {
  transform-origin: center bottom;
  animation: flame-flicker 1.1s ease-in-out infinite;
}
@keyframes flame-flicker {
  0%, 100% { transform: scale(1) rotate(-1.5deg); opacity: 0.82; }
  25%      { transform: scale(1.09) rotate(1.5deg); opacity: 1; }
  50%      { transform: scale(0.97) rotate(-1deg); opacity: 0.9; }
  75%      { transform: scale(1.05) rotate(1deg); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .campaign-grid::before, .flame-flicker { animation: none !important; }
}
