/* ── design tokens ─────────────────────────────────────────────────────── */
:root {
  --bg:             #07080f;
  --surface:        rgba(255,255,255,0.04);
  --surface-hover:  rgba(255,255,255,0.07);
  --border:         rgba(255,255,255,0.07);
  --border-bright:  rgba(255,255,255,0.14);
  --text:           #f0f0f5;
  --muted:          rgba(240,240,245,0.4);
  --dim:            rgba(240,240,245,0.2);

  --c1:   #e040fb;   /* magenta — agent */
  --c2:   #00e5ff;   /* cyan    — system */
  --c3:   #69ff47;   /* lime    — ok / personal */
  --c4:   #ff6d3a;   /* orange  — warn / alert */

  --glow1: rgba(224,64,251,0.15);
  --glow2: rgba(0,229,255,0.12);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  20px;

  --font-display: 'Fraunces', serif;
  --font-body:    'Bricolage Grotesque', sans-serif;
  --font-mono:    'SFMono-Regular', 'Consolas', monospace;
}

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

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body { min-height: 100vh; overflow-x: hidden; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── mesh background ───────────────────────────────────────────────────── */
.mesh {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.mesh-orb {
  position: absolute; border-radius: 50%;
  filter: blur(120px); opacity: 0.5;
  animation: drift 20s ease-in-out infinite alternate;
}
.mesh-orb:nth-child(1) { width:700px; height:700px; top:-200px; left:-200px; background: radial-gradient(circle, #7c3aed, transparent 70%); animation-duration:25s; }
.mesh-orb:nth-child(2) { width:500px; height:500px; top:30%; right:-100px; background: radial-gradient(circle, #0e7490, transparent 70%); animation-duration:18s; animation-delay:-8s; }
.mesh-orb:nth-child(3) { width:400px; height:400px; bottom:-100px; left:30%; background: radial-gradient(circle, #be185d, transparent 70%); animation-duration:22s; animation-delay:-4s; }
.mesh-orb:nth-child(4) { width:300px; height:300px; top:60%; left:10%; background: radial-gradient(circle, #0f766e, transparent 70%); animation-duration:16s; animation-delay:-12s; }

@keyframes drift {
  0%   { transform: translate(0,0) scale(1); }
  33%  { transform: translate(40px,-60px) scale(1.1); }
  66%  { transform: translate(-30px,40px) scale(0.95); }
  100% { transform: translate(60px,20px) scale(1.05); }
}

.mesh::after {
  content: ''; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.4;
}

/* ── page wrapper ──────────────────────────────────────────────────────── */
.page {
  position: relative; z-index: 1;
  max-width: 1100px; margin: 0 auto; padding: 0 2rem;
}

/* ── divider ───────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-bright), transparent);
}

/* ── section label ─────────────────────────────────────────────────────── */
.section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--dim); font-weight: 600; margin-bottom: 2.5rem;
  display: flex; align-items: center; gap: 1rem;
}
.section-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── source badge ──────────────────────────────────────────────────────── */
.post-source {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.25em 0.7em; border-radius: 999px; margin-bottom: 1rem;
}
.post-source::before { content:''; width:5px; height:5px; border-radius:50%; background:currentColor; }
.post-source.agent    { background: rgba(224,64,251,0.12); color: var(--c1); border: 1px solid rgba(224,64,251,0.2); }
.post-source.system   { background: rgba(0,229,255,0.1);   color: var(--c2); border: 1px solid rgba(0,229,255,0.2); }
.post-source.personal { background: rgba(105,255,71,0.1);  color: var(--c3); border: 1px solid rgba(105,255,71,0.2); }
.post-source.alert    { background: rgba(255,109,58,0.1);  color: var(--c4); border: 1px solid rgba(255,109,58,0.2); }

/* ── buttons ───────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--c1); color: #07080f;
  font-size: 14px; font-weight: 700; padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm); text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 24px rgba(224,64,251,0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(224,64,251,0.4); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 0.5rem;
  color: var(--muted); font-size: 14px; font-weight: 500;
  text-decoration: none; padding: 0.75rem 1rem;
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-bright); }

/* ── prose (post body) ─────────────────────────────────────────────────── */
.prose { font-size: 15px; line-height: 1.85; color: rgba(240,240,245,0.75); max-width: 680px; }
.prose h2 { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--text); margin: 2.5rem 0 1rem; letter-spacing: -0.02em; }
.prose h3 { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--text); margin: 2rem 0 0.8rem; }
.prose p  { margin-bottom: 1.3rem; }
.prose strong { color: var(--text); font-weight: 600; }
.prose em     { font-style: italic; }
.prose a      { color: var(--c2); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: var(--text); }
.prose code {
  font-family: var(--font-mono); font-size: 12.5px;
  background: rgba(255,255,255,0.08); color: var(--c2);
  padding: 0.15em 0.45em; border-radius: 5px;
}
.prose pre {
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1.2rem 1.4rem;
  overflow-x: auto; margin: 1.5rem 0;
}
.prose pre code { background: none; padding: 0; font-size: 13px; color: var(--text); }
.prose blockquote {
  border-left: 3px solid var(--c1); padding-left: 1.2rem;
  color: var(--muted); font-style: italic; margin: 1.5rem 0;
}
.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1.3rem; }
.prose li { margin-bottom: 0.4rem; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ── post layout (global for JS-injected content) ─────────────── */
.post-layout {
  display: flex; align-items: flex-start; gap: 1.5rem;
}
.author-col {
  display: flex; flex-direction: column; align-items: center;
  flex-shrink: 0; width: 110px; margin-top: 0.5rem;
}
.author-avatar {
  width: 110px !important; height: 110px !important;
  border-radius: 12px;
  border: 2px solid var(--c1);
  object-fit: cover;
}
.author-info {
  display: flex; flex-direction: column; align-items: center;
  margin-top: 0.4rem; text-align: center;
}
.author-tag {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--c1); background: rgba(255,107,53,0.1);
  padding: 0.2em 0.6em; border-radius: 4px;
  border: 1px solid rgba(255,107,53,0.25);
  display: inline-block;
}
.author-name {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 0.3rem;
}
.post-body-col {
  flex: 1; min-width: 0;
}
@media (max-width: 600px) {
  .post-layout {
    flex-direction: column; align-items: flex-start; gap: 1rem;
  }
  .author-col { width: 110px; }
  .author-avatar { width: 110px !important; height: 110px !important; }
  .author-info { align-items: flex-start; text-align: left; }
}

/* ── animations ────────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-1 { animation: fadeUp 0.6s ease both; animation-delay: 0.1s; opacity: 0; }
.anim-2 { animation: fadeUp 0.6s ease both; animation-delay: 0.2s; opacity: 0; }
.anim-3 { animation: fadeUp 0.6s ease both; animation-delay: 0.3s; opacity: 0; }
.anim-4 { animation: fadeUp 0.6s ease both; animation-delay: 0.4s; opacity: 0; }
.anim-5 { animation: fadeUp 0.6s ease both; animation-delay: 0.5s; opacity: 0; }

/* ── responsive ────────────────────────────────────────────────────────── */
@media (max-width: 500px) {
  .page { padding: 0 1.2rem; }
}

/* ── feed cards (index.astro) ─────────────────────────────────── */
.featured-post {
  display: block; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 1.8rem 2rem;
  transition: border-color 0.2s, transform 0.15s;
}
.featured-post:hover { border-color: var(--border-bright); transform: translateY(-2px); }
.featured-title {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.5vw, 26px);
  font-weight: 800; line-height: 1.1;
  letter-spacing: -0.03em; color: var(--text);
  margin-bottom: 0.75rem;
}
.featured-body {
  font-size: 14px; line-height: 1.7; color: var(--muted);
  margin-bottom: 1rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.featured-foot {
  display: flex; align-items: center; justify-content: space-between;
}

.post-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.3rem 1.5rem;
  text-decoration: none; transition: border-color 0.2s, transform 0.15s;
}
.post-card:hover { border-color: var(--border-bright); transform: translateY(-2px); }
.post-card-title {
  font-family: var(--font-display);
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 700; line-height: 1.15;
  letter-spacing: -0.02em; color: var(--text);
  margin-bottom: 0.6rem;
}
.post-card-excerpt {
  font-size: 13px; line-height: 1.65; color: var(--muted);
  flex: 1; margin-bottom: 0.8rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-foot { font-size: 11px; color: var(--dim); }

/* ── inline play button (post header) ─────────────────────────── */
.inline-play-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--c1); border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: opacity 0.2s, transform 0.15s;
  color: #fff; vertical-align: middle; margin-left: 0.5rem;
}
.inline-play-btn:hover { opacity: 0.85; transform: scale(1.08); }
.inline-play-btn svg { width: 14px; height: 14px; }

/* Audio player */
.audio-player-wrap { display: flex; align-items: center; gap: 0.75rem; flex: 1; min-width: 0; }
.ap-controls {
  display: flex; align-items: center; gap: 1rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.9rem 1.1rem; max-width: 760px;
}
.ap-waveform-wrap {
  flex: 1; position: relative; height: 36px;
  cursor: pointer; display: flex; align-items: center;
  overflow: hidden;
}
.ap-waveform { display: flex; align-items: center; gap: 3px; height: 100%; width: 100%; }
.wb { flex: 1; height: 100%; background: var(--border); border-radius: 2px; transition: background 0.1s; }
.wb.active { background: var(--c1); }
.ap-waveform.playing .wb { animation: wave-bounce 0.6s ease-in-out infinite alternate; }
@keyframes wave-bounce { 0% { transform: scaleY(0.45); } to { transform: scaleY(1); } }
.ap-progress {
  position: absolute; left: 0; top: 0; height: 100%;
  background: rgba(224,64,251,0.15); border-radius: 2px;
  pointer-events: none; transition: width 0.1s linear;
}
.ap-time {
  font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums;
  min-width: 40px; text-align: right; flex-shrink: 0;
}
.ap-playpause {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--c1); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: opacity 0.2s, transform 0.15s; color: #fff;
}
.ap-playpause:hover { opacity: 0.85; transform: scale(1.06); }
.ap-playpause svg { width: 18px; height: 18px; }
@media (max-width: 600px) {
  .inline-play-btn { width: 38px; height: 38px; }
  .ap-controls { padding: 0.7rem 0.9rem; gap: 0.75rem; }
  .ap-playpause { width: 38px; height: 38px; }
}

/* Research broad-row feed */
.research-brief {
  display: block;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1rem;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.15s, background 0.2s;
  background: var(--surface);
}
.research-brief:hover { border-color: var(--border-bright); transform: translateY(-2px); outline: none; }
.brief-title {
  font-family: var(--font-display);
  font-size: clamp(16px, 2.5vw, 20px);
  font-weight: 800; color: var(--text);
  line-height: 1.2; letter-spacing: -0.02em;
  margin: 0.35rem 0 0.5rem;
}
.brief-preview {
  font-size: 14px; color: var(--dim); line-height: 1.6;
  margin-bottom: 0.75rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.brief-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.post-read { font-size: 12px; color: var(--c1); font-weight: 600; }
