/**
 * Seesweet Base Styles
 *
 * Reset, global element styles, and common utility classes.
 * Requires tokens.css loaded first.
 *
 * Usage: <link rel="stylesheet" href="/css/base.css">
 */

/* ── Webfonts ─────────────────────────────────────────────────────────────── */
@import url('https://api.fontshare.com/v2/css?f[]=general-sans@300,400,500,600,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Material Symbols Outlined icon font ─────────────────────────────────── */

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 1em;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  direction: ltr;
  user-select: none;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

html {
  background-color: var(--bg);
}

body {
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/**
 * Ambient bottom glow — stacked ellipses (irregular mesh), not a single linear
 * or radial. Animates opacity only (compositor-friendly). Paused via
 * html.ambient-static, prefers-reduced-motion, and prefers-reduced-data; see
 * /public/ambient-bg.js for tab visibility / save-data / low-memory / battery.
 */
body::before {
  content: '';
  position: fixed;
  z-index: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(56vh, 720px);
  pointer-events: none;
  background:
    radial-gradient(ellipse 130% 88% at 6% 100%, var(--ambient-blob-1) 0%, transparent 52%),
    radial-gradient(ellipse 115% 78% at 94% 100%, var(--ambient-blob-2) 0%, transparent 50%),
    radial-gradient(ellipse 95% 62% at 48% 106%, var(--ambient-blob-3) 0%, transparent 48%),
    radial-gradient(ellipse 70% 48% at 28% 100%, var(--ambient-blob-4) 0%, transparent 46%),
    radial-gradient(ellipse 55% 36% at 72% 101%, var(--ambient-blob-2) 0%, transparent 44%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  animation: ambient-breathe-dark 6s ease-in-out infinite;
}

:root[data-theme='light'] body::before {
  animation-name: ambient-breathe-light;
}

/* Wider opacity swing + faster cycle = more visible motion at lower base opacity.
 * Pairs with the desaturated blob tokens (tokens.css) so the visual energy
 * comes from movement, not from raw saturation. */
@keyframes ambient-breathe-dark {
  0%, 100% { opacity: 0.30; }
  50% { opacity: 1; }
}

@keyframes ambient-breathe-light {
  0%, 100% { opacity: 0.22; }
  50% { opacity: 0.85; }
}

/* Siri-style aurora strip along the bottom edge.
 * Blobs are centered at/just below the bottom edge — the ::before element is
 * kept short so blobs never reach mid-page. X drift creates the horizontal
 * flow; Y breathing makes each blob gently rise into view. */

@property --tblob1-x { syntax: '<percentage>'; initial-value:  5%; inherits: false; }
@property --tblob1-y { syntax: '<percentage>'; initial-value: 106%; inherits: false; }
@property --tblob2-x { syntax: '<percentage>'; initial-value: 32%; inherits: false; }
@property --tblob2-y { syntax: '<percentage>'; initial-value: 103%; inherits: false; }
@property --tblob3-x { syntax: '<percentage>'; initial-value: 57%; inherits: false; }
@property --tblob3-y { syntax: '<percentage>'; initial-value: 105%; inherits: false; }
@property --tblob4-x { syntax: '<percentage>'; initial-value: 78%; inherits: false; }
@property --tblob4-y { syntax: '<percentage>'; initial-value: 102%; inherits: false; }
@property --tblob5-x { syntax: '<percentage>'; initial-value: 95%; inherits: false; }
@property --tblob5-y { syntax: '<percentage>'; initial-value: 104%; inherits: false; }

body.agent-thinking::before {
  height: min(16vh, 190px);
  opacity: 1;
  mask-image: linear-gradient(to bottom, transparent 0%, black 55%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 55%);
  background:
    radial-gradient(ellipse 72% 62% at var(--tblob1-x) var(--tblob1-y), hsla(260, 100%, 62%, 0.95), transparent 70%),
    radial-gradient(ellipse 65% 55% at var(--tblob2-x) var(--tblob2-y), hsla(220, 100%, 58%, 0.90), transparent 70%),
    radial-gradient(ellipse 78% 68% at var(--tblob3-x) var(--tblob3-y), hsla(300, 100%, 58%, 0.92), transparent 70%),
    radial-gradient(ellipse 60% 52% at var(--tblob4-x) var(--tblob4-y), hsla( 15, 100%, 62%, 0.88), transparent 70%),
    radial-gradient(ellipse 68% 58% at var(--tblob5-x) var(--tblob5-y), hsla(270,  90%, 72%, 0.91), transparent 70%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  animation:
    ambient-rainbow 5s linear infinite,
    thinking-siri1 4.1s ease-in-out infinite,
    thinking-siri2 5.3s ease-in-out infinite,
    thinking-siri3 3.7s ease-in-out infinite,
    thinking-siri4 6.1s ease-in-out infinite,
    thinking-siri5 4.7s ease-in-out infinite;
}
:root[data-theme='light'] body.agent-thinking::before {
  background:
    radial-gradient(ellipse 72% 62% at var(--tblob1-x) var(--tblob1-y), hsla(260,  90%, 55%, 0.80), transparent 70%),
    radial-gradient(ellipse 65% 55% at var(--tblob2-x) var(--tblob2-y), hsla(220,  90%, 52%, 0.76), transparent 70%),
    radial-gradient(ellipse 78% 68% at var(--tblob3-x) var(--tblob3-y), hsla(300,  90%, 52%, 0.78), transparent 70%),
    radial-gradient(ellipse 60% 52% at var(--tblob4-x) var(--tblob4-y), hsla( 15,  90%, 56%, 0.74), transparent 70%),
    radial-gradient(ellipse 68% 58% at var(--tblob5-x) var(--tblob5-y), hsla(270,  80%, 65%, 0.76), transparent 70%);
}
@keyframes ambient-rainbow {
  0%   { filter: hue-rotate(0deg)   saturate(2.0) brightness(1.2); }
  50%  { filter: hue-rotate(180deg) saturate(2.3) brightness(1.3); }
  100% { filter: hue-rotate(360deg) saturate(2.0) brightness(1.2); }
}
/* X: horizontal drift (Siri flow). Y: gentle rise ±5% to peek above input. */
@keyframes thinking-siri1 {
  0%, 100% { --tblob1-x:  5%; --tblob1-y: 106%; }
  50%      { --tblob1-x: 36%; --tblob1-y:  98%; }
}
@keyframes thinking-siri2 {
  0%, 100% { --tblob2-x: 32%; --tblob2-y: 103%; }
  50%      { --tblob2-x:  7%; --tblob2-y:  96%; }
}
@keyframes thinking-siri3 {
  0%, 100% { --tblob3-x: 57%; --tblob3-y: 105%; }
  50%      { --tblob3-x: 74%; --tblob3-y:  97%; }
}
@keyframes thinking-siri4 {
  0%, 100% { --tblob4-x: 78%; --tblob4-y: 102%; }
  50%      { --tblob4-x: 48%; --tblob4-y:  94%; }
}
@keyframes thinking-siri5 {
  0%, 100% { --tblob5-x: 95%; --tblob5-y: 104%; }
  50%      { --tblob5-x: 68%; --tblob5-y:  97%; }
}
/* Reduce-motion: static strip at the very bottom edge. */
@media (prefers-reduced-motion: reduce) {
  body.agent-thinking::before {
    animation: none;
    --tblob1-y: 100%; --tblob2-y: 100%; --tblob3-y: 100%;
    --tblob4-y: 100%; --tblob5-y: 100%;
    filter: saturate(2.0) brightness(1.2);
  }
}

html.ambient-static body::before {
  animation: none;
  opacity: 0.92;
}

html.ambient-static[data-theme='light'] body::before {
  opacity: 0.68;
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
    opacity: 0.92;
  }

  :root[data-theme='light'] body::before {
    opacity: 0.68;
  }
}

@media (prefers-reduced-data: reduce) {
  body::before {
    animation: none;
    opacity: 0.88;
  }

  :root[data-theme='light'] body::before {
    opacity: 0.64;
  }
}

/* ── Links ─────────────────────────────────────────────────────────────────── */

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ── Code ──────────────────────────────────────────────────────────────────── */

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
}

pre {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  overflow-x: auto;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--text-base);
  line-height: 1.5;
}

/* ── Scrollbars ────────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-2);
}

/* ── Animations ────────────────────────────────────────────────────────────── */

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
