/* ═══════════════════════════════════════════════════════════════════════════
   taaawk — dark glass over a living field (3RDNature design system).
   Surfaces are white-alpha; colour comes from the field bleeding through
   the frost. One purple→blue gradient per screen: the primary action.
   ═══════════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/inter-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --void: #0a0a12;
  --glass: rgba(18, 16, 30, 0.45);
  --glass-rest: rgba(255, 255, 255, 0.03);
  --glass-pill: rgba(20, 18, 32, 0.55);
  --glass-side: rgba(10, 10, 18, 0.55);
  --scrim: rgba(10, 8, 18, 0.85);
  --hair: rgba(255, 255, 255, 0.05);
  --edge: rgba(255, 255, 255, 0.07);
  --edge-ui: rgba(255, 255, 255, 0.08);
  --text: #f5f3ff;
  --muted: #a8a4c2;
  --dim: #6c6981;
  --nav: #7c7891;
  --grad: linear-gradient(135deg, #785aff, #4c8eff);
  --select: linear-gradient(135deg, rgba(120, 90, 255, 0.25), rgba(76, 142, 255, 0.18));
  --live: #1aff8a;
  --danger: #ff7575;
  --violet: #785aff;
  --blue: #4c8eff;
  --frost: blur(22px) saturate(140%);
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

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

html, body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--void);
  color: var(--muted);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

::selection { background: rgba(120, 90, 255, 0.35); color: var(--text); }
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }

/* ── The field ─────────────────────────────────────────────────────────── */

.field {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--void);
  pointer-events: none;
}
/* Behind text, the field is a mood, not a picture: dimmed into the void. */
.field canvas { width: 100%; height: 100%; display: block; opacity: 0.5; }
.field .fallback {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.7s;
  background:
    radial-gradient(ellipse at 25% 20%, rgba(255, 0, 170, 0.18), transparent 55%),
    radial-gradient(ellipse at 75% 70%, rgba(0, 229, 255, 0.18), transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(136, 0, 255, 0.12), transparent 60%),
    var(--void);
}
.field.failed .fallback { opacity: 1; }

/* ── Type ──────────────────────────────────────────────────────────────── */

.eyebrow {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}
.eyebrow.violet { color: #a996ff; }

h1, h2, h3 { color: var(--text); margin: 0; font-weight: 600; }
.h-hero { font-size: clamp(40px, 7vw, 76px); letter-spacing: -0.04em; line-height: 1.02; }
.h-page { font-size: 32px; letter-spacing: -0.025em; line-height: 1.15; }
.h-card { font-size: 22px; letter-spacing: -0.02em; line-height: 1.2; }
.lead { font-size: 16px; color: var(--muted); max-width: 560px; line-height: 1.65; }
.small { font-size: 12px; }
.micro { font-size: 10px; color: var(--dim); }
.num { font-variant-numeric: tabular-nums; }

/* ── Wordmark: the three a's and the w are a waveform ─────────────────── */

.wordmark { display: inline-flex; align-items: center; font-size: 20px; font-weight: 650;
  letter-spacing: -0.03em; color: var(--text); line-height: 1; }
.wordmark .wave { width: 35px; height: 14px; margin: 1px 2px 0 1px; overflow: visible; }
.wave .pk { fill: none; stroke: url(#wm-grad); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
  transform-box: fill-box; transform-origin: 50% 100%; animation: amp 2.4s ease-in-out infinite; }
.wave .pk.w { transform-origin: 50% 0; }
.wave .pk:nth-child(2) { animation-delay: -0.4s; }
.wave .pk:nth-child(3) { animation-delay: -1.2s; }
.wave .pk:nth-child(4) { animation-delay: -2s; }
.wave .pk:nth-child(5) { animation-delay: -0.8s; }
@keyframes amp { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(0.6); } }

/* ── Glass ─────────────────────────────────────────────────────────────── */

.glass {
  background: var(--glass);
  border: 1px solid var(--edge);
  border-radius: 22px;
  backdrop-filter: var(--frost);
  -webkit-backdrop-filter: var(--frost);
}

.card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  transition: transform 0.45s var(--spring), box-shadow 0.45s var(--spring);
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 70% 0%, var(--wash, rgba(120, 90, 255, 0.22)), transparent 60%);
  opacity: 0.5;
  transition: opacity 0.7s;
}
.card:hover::before { opacity: 1; }
.card.interactive { cursor: pointer; }
.card.interactive:hover {
  transform: translateY(-4px);
  box-shadow: inset 0 0 0 1px rgba(120, 90, 255, 0.16), 0 24px 60px rgba(120, 90, 255, 0.08);
}
.card.interactive:active { transform: translateY(-2px) scale(0.99); }
.card > * { position: relative; }

/* ── Controls: every control is fully round ───────────────────────────── */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--edge-ui);
  background: var(--glass-pill);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  color: var(--text);
  font: 500 12.5px/1 'Inter', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.25s var(--spring), background 0.2s, border-color 0.2s, opacity 0.2s;
}
.btn:hover { background: rgba(40, 36, 60, 0.6); border-color: rgba(255, 255, 255, 0.14); text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn.primary {
  background: var(--grad);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 30px rgba(120, 90, 255, 0.28);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.btn.danger { color: var(--danger); }
.btn.small { height: 30px; padding: 0 13px; font-size: 11.5px; }
.btn.icon { width: 38px; padding: 0; }
.btn.icon.small { width: 30px; }
.btn.close:hover svg { transform: rotate(90deg); }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round; transition: transform 0.3s var(--spring); }

.input, .textarea, .select {
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--edge-ui);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: 400 13px/1.4 'Inter', sans-serif;
  padding: 10px 16px;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.textarea { border-radius: 18px; resize: vertical; min-height: 90px; line-height: 1.55; }
.select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a8a4c2' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.select option { background: #14121f; color: var(--text); }
.input:focus, .textarea:focus, .select:focus {
  border-color: rgba(120, 90, 255, 0.5);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 4px rgba(120, 90, 255, 0.12);
}
.input::placeholder, .textarea::placeholder { color: var(--dim); }
label.field-label { display: block; margin: 0 0 7px 4px; }

@media (pointer: coarse) {
  .input, .textarea, .select { font-size: 16px; }
}

/* ── Live dot ──────────────────────────────────────────────────────────── */

.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 6px var(--live);
  animation: pulse 2.4s ease-in-out infinite;
}
.dot.off { background: var(--dim); box-shadow: none; animation: none; }
.dot.warn { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.55; transform: scale(1.35); } }

/* ── Pills (shared-element tabs) ───────────────────────────────────────── */

.pills {
  position: relative;
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass-pill);
  border: 1px solid var(--edge);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.pills::-webkit-scrollbar { display: none; }
.pill {
  position: relative;
  z-index: 1;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--nav);
  font: 500 12px/1 'Inter', sans-serif;
  height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s;
}
.pill.active { color: var(--text); }
.pills .slider {
  position: absolute;
  z-index: 0;
  top: 4px;
  height: 30px;
  border-radius: 999px;
  background: var(--select);
  box-shadow: inset 0 0 0 1px rgba(120, 90, 255, 0.28);
  transition: left 0.45s var(--spring), width 0.45s var(--spring);
}

/* ── Takeover (full-screen detail view) ───────────────────────────────── */

.takeover {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  background: var(--scrim);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 0.28s var(--spring), transform 0.4s var(--spring);
}
.takeover.open { opacity: 1; transform: none; }
.takeover-head { display: flex; align-items: center; gap: 14px; padding: 24px 48px 18px; border-bottom: 1px solid var(--hair); }
.takeover-head .grow { flex: 1; min-width: 0; }
.takeover-body { overflow-y: auto; padding: 26px 48px 40px; }
.takeover-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 48px 24px; border-top: 1px solid var(--hair); }
@media (max-width: 640px) {
  .takeover-head { padding: 16px 16px 14px; }
  .takeover-body { padding: 18px 16px 30px; }
  .takeover-foot { padding: 12px 16px 16px; }
}

/* ── Toast ─────────────────────────────────────────────────────────────── */

.toasts { position: fixed; z-index: 90; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--glass-pill);
  border: 1px solid var(--edge-ui);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  color: var(--text);
  font-size: 12.5px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.4s var(--spring);
}
.toast.show { opacity: 1; transform: none; }
.toast.error { border-color: rgba(255, 117, 117, 0.4); }

/* ── Markdown (summaries) ─────────────────────────────────────────────── */

.md h3 { font-size: 15px; letter-spacing: -0.01em; margin: 22px 0 8px; }
.md h3:first-child { margin-top: 0; }
.md h4 { font-size: 13px; margin: 16px 0 6px; color: var(--text); }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 20px; }
.md li { margin: 3px 0; }
.md strong { color: var(--text); font-weight: 600; }

/* ── Empty states ──────────────────────────────────────────────────────── */

.empty { text-align: center; color: var(--dim); font-size: 13px; padding: 48px 16px; }

/* ── Motion: stagger on mount ─────────────────────────────────────────── */

.rise { opacity: 0; transform: translateY(16px); animation: rise 0.6s var(--spring) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
