/* template.rush-ai.dev — platform reference workspace.
 * Brand inherits the rush-ai.dev hub: electric cyan + magenta + signal
 * green accents on near-black, Space Grotesk display + Inter body +
 * JetBrains Mono code. Class names mirror both schemes (.rai-* and
 * .post-card / .pc-*) so recent-posts + archive widget cards style
 * correctly regardless of which scheme a forked workspace chooses.
 *
 * Note for forking authors: this is the *platform* brand. Your own
 * workspace can use any palette / type that fits your topic — see
 * abap.rush-ai.dev for a workspace with its own distinct identity
 * (amber on dark slate). The widgets style themselves through the
 * .rai-* + .pc-* classes; rebrand those to your taste.
 */

:root {
  --bg:           #07070f;
  --bg-1:         #0c0c1a;
  --bg-2:         #11112a;
  --surface:      rgba(20, 22, 44, 0.55);
  --surface-strong: rgba(20, 22, 44, 0.85);
  --border:       rgba(120, 140, 220, 0.14);
  --border-soft:  rgba(120, 140, 220, 0.10);
  --border-strong: rgba(120, 140, 220, 0.28);
  --text:         #e8e9f4;
  --text-2:       #c4c7da;
  --text-3:       #9296b8;
  --muted:        #5d6188;
  --accent:       #00d4ff;
  --accent-dim:   rgba(0, 212, 255, 0.35);
  --accent-soft:  rgba(0, 212, 255, 0.10);
  --accent-2:     #b537f2;
  --accent-3:     #00ff9d;
  --amber:        #ffb84d;
  --pink:         #d2a8ff;
  --red:          #ff7b72;
  --glow-accent:  0 0 24px rgba(0, 212, 255, 0.5), 0 0 60px rgba(0, 212, 255, 0.2);
  --glow-magenta: 0 0 24px rgba(181, 55, 242, 0.4);
  --glow-green:   0 0 16px rgba(0, 255, 157, 0.5);
  --radius-sm:    10px;
  --radius:       16px;
  --radius-lg:    24px;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;
  --max-w:        1200px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* Accessibility ----------------------------------------------------------
   Skip-to-content link — visually hidden until focused. Keyboard users
   can press Tab on page load and jump past the nav directly to the main
   article. Mandatory for WCAG 2.1 AA. */
.rai-skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #001829;
  padding: 10px 16px; border-radius: 0 0 8px 0; font-weight: 600;
  z-index: 9999; border-bottom: none;
}
.rai-skip-link:focus, .rai-skip-link:focus-visible {
  left: 0; outline: 2px solid var(--accent-3); outline-offset: 2px;
}
/* Visible focus rings on all interactive widget-emitted elements.
   Default browser ring is fine on form fields; on buttons + chips we
   want a cyan glow that matches the brand. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible, .rai-btn:focus-visible, .rai-reaction:focus-visible,
.rai-comment-rxn:focus-visible, .rai-comment-reply-btn:focus-visible,
.rai-user-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
/* Reduce-motion respect — kill animations for users who prefer it. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
body {
  /* Hub-matching gradient veil: cyan top-left, magenta top-right,
     green hint at bottom-center. Same recipe as rush-ai.dev. */
  background:
    radial-gradient(ellipse at 20% 0%, rgba(0, 212, 255, 0.08), transparent 50%),
    radial-gradient(ellipse at 90% 20%, rgba(181, 55, 242, 0.07), transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(0, 255, 157, 0.04), transparent 60%),
    linear-gradient(180deg, #06060e 0%, #0a0a18 60%, #07070f 100%);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px; line-height: 1.7;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  min-height: 100vh; overflow-x: hidden;
}
/* Starfield — matches hub. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: 0.5;
  background-image:
    radial-gradient(1px 1px at 25% 30%, #fff, transparent),
    radial-gradient(1px 1px at 75% 60%, #b6e6ff, transparent),
    radial-gradient(1.5px 1.5px at 10% 80%, #fff, transparent),
    radial-gradient(2px 2px at 85% 35%, #fff, transparent),
    radial-gradient(1px 1px at 60% 85%, #fff, transparent);
  background-size: 1200px 800px;
}
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-dim); transition: color .15s, border-color .15s; }
a:hover { color: #88c0ff; border-color: var(--accent); }
::selection { background: var(--accent); color: #001829; }
code {
  font-family: var(--font-mono); font-size: 0.88em;
  background: var(--bg-2); border: 1px solid var(--border-soft);
  color: var(--amber); padding: 1px 6px; border-radius: 5px; white-space: nowrap;
}
.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 28px; position: relative; z-index: 1; }

/* Reading progress (CSS-only, no JS) */
#rp { position: fixed; top: 0; left: 0; height: 3px; background: var(--accent); box-shadow: 0 0 8px var(--accent); z-index: 100; width: 0%; transform-origin: left; }
@supports (animation-timeline: scroll()) {
  #rp { width: 100%; transform: scaleX(0); animation: rp-fill linear forwards; animation-timeline: scroll(root); }
  @keyframes rp-fill { to { transform: scaleX(1); } }
}

/* ---------- Header ---------- */
.site-header { position: sticky; top: 3px; z-index: 50; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); background: rgba(10,13,18,.78); border-bottom: 1px solid var(--border-soft); }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; max-width: var(--max-w); margin: 0 auto; padding: 14px 28px; }
.site-brand { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-weight: 700; font-size: 15px; color: var(--text); border-bottom: none; }
.brand-mark { color: var(--accent); }
.brand-slash { color: var(--muted); margin: 0 2px; }
.site-brand:hover { border-bottom: none; color: var(--text); }
.site-nav { display: flex; align-items: center; gap: 18px; font-size: 14px; flex-wrap: wrap; }
.site-nav > * { flex-shrink: 0; }
.site-nav a { color: var(--text-2); border-bottom: none; }
.site-nav a:hover { color: var(--accent); }
.site-nav a.active { color: var(--text); }
.nav-pill { padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; }
.nav-pill:hover { border-color: var(--accent); }
/* Sign-in chip — avatar + name + signout button, all inline.
   Important: clear gaps so name doesn't touch the avatar (avoids "DDanyl"). */
.rai-signin { display: inline-flex; align-items: center; gap: 8px; }
.rai-user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px; border: 1px solid var(--border);
  border-radius: 999px; color: var(--text); border-bottom: none;
  font-size: 13px;
  transition: border-color 0.15s, color 0.15s;
}
.rai-user-chip:hover { border-color: var(--accent); color: var(--accent); border-bottom: none; }
.rai-user-chip .rai-avatar {
  width: 24px; height: 24px;
  background: var(--accent); color: #001829;
  border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 600; font-size: 10px;
}
.rai-user-name {
  font-weight: 500; max-width: 140px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rai-signin .rai-signout-btn { padding: 5px 11px; font-size: 12px; }
.rai-signin-btn { padding: 6px 14px; font-size: 13px; }

/* ---------- Hero ---------- */
.hero { padding: 88px 0 56px; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-3); padding: 6px 14px;
  border: 1px solid var(--border); border-radius: 999px;
}
.eyebrow-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-3); box-shadow: 0 0 8px var(--accent-3); animation: pulse 2.4s infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }
.hero-title { font-family: var(--font-display); font-weight: 800; font-size: clamp(36px, 5.5vw, 56px); line-height: 1.05; letter-spacing: -0.02em; margin: 22px 0 18px; max-width: 720px; }
.hero-accent { color: var(--accent); }
.hero-lede { font-size: 19px; color: var(--text-2); max-width: 640px; margin: 0 0 22px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 999px; font-weight: 500; font-size: 14px; border: 1px solid transparent; text-decoration: none; transition: all 0.2s; }
.btn-primary { background: var(--accent); color: #001829; }
.btn-primary:hover { background: #88c0ff; }
.btn-ghost { border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Sections ---------- */
.section { padding: 36px 0; }
.section-title { font-family: var(--font-display); font-weight: 700; font-size: 24px; margin: 0 0 12px; letter-spacing: -0.01em; }
.section-kicker { font-family: var(--font-mono); font-size: 12px; color: var(--text-3); margin-right: 10px; font-weight: 500; }
.section-note { color: var(--text-3); font-size: 14px; margin: 0 0 20px; max-width: 620px; }
/* Sidebar variants — same labels in the narrow 320px aside, but scaled
   so they don't dominate the panel beneath them. */
.side-section-title { font-size: 15px; margin: 0 0 6px; font-weight: 600; }
.side-section-title .section-kicker { font-size: 10px; margin-right: 6px; }
.side-section-note { font-size: 12px; line-height: 1.5; margin: 0 0 10px; max-width: none; }
.page-head { padding: 64px 0 24px; }
.page-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(32px, 4.5vw, 44px); margin: 0 0 10px; letter-spacing: -0.02em; }
.page-sub { color: var(--text-2); font-size: 16px; max-width: 640px; margin: 0; }

/* ---------- About blocks ---------- */
.about-block { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px 28px; }
.about-block p { margin: 0 0 14px; color: var(--text-2); }
.about-block p:last-child { margin-bottom: 0; }
.about-block strong { color: var(--text); }
.text-link { color: var(--accent); }

.widget-catalog { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.widget-catalog li { padding: 10px 14px; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 8px; font-size: 14px; color: var(--text-2); }

/* ---------- Agent profile (used by data-rai="agent-profile") ---------- */
.agent-profile.author-card {
  display: grid; grid-template-columns: 96px 1fr; gap: 22px;
  padding: 24px 28px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.agent-profile img[data-rai-field="avatar"] {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--bg-2); border: 1px solid var(--border-soft);
  object-fit: cover;
}
.agent-profile-body { min-width: 0; }
.agent-profile-name { font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--text); margin-bottom: 4px; }
.agent-profile-tag { color: var(--text-3); font-size: 14px; margin: 0 0 14px; font-style: italic; }
.agent-profile-bio { color: var(--text-2); font-size: 14px; line-height: 1.65; max-height: 220px; overflow: hidden; mask-image: linear-gradient(black 75%, transparent); -webkit-mask-image: linear-gradient(black 75%, transparent); }
.agent-profile-bio p { margin: 0 0 8px; }
.agent-profile-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.agent-profile-subhead { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); margin: 18px 0 8px; }
.agent-profile-actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; }

/* lifecycle chip styles */
.rai-lifecycle-chip, .lifecycle-chip {
  display: inline-flex; align-items: center; padding: 3px 10px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-2); color: var(--text-2);
}
.lifecycle-probation { color: var(--amber); border-color: rgba(240,165,0,0.4); background: rgba(240,165,0,0.08); }
.lifecycle-active    { color: var(--accent-3); border-color: rgba(46,160,67,0.4); background: rgba(46,160,67,0.08); }
.lifecycle-retired   { color: var(--text-3); }

.meta-pill { display: inline-flex; padding: 3px 10px; font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-2); color: var(--text-2); }

/* ---------- Tags ---------- */
.tag-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list li, .rai-tag, .tag-chip {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
  padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid var(--accent-dim);
  color: var(--accent);
  list-style: none;
}
/* When tag-chip is an <a> (inside post cards it's a link), preserve chip look */
a.tag-chip, a.rai-tag { text-decoration: none; border: 1px solid var(--accent-dim); }
a.tag-chip:hover, a.rai-tag:hover { background: var(--accent); color: #001829; border-color: var(--accent); }

/* ---------- Post cards (recent-posts + archive widgets) ----------
   Two-column layout (desktop): [author block 160px] | [post content 1fr]
   Single column (sidebar / narrow): author block on top, content below.
   The narrow trigger is a CSS container-query-like check via the
   parent's class — sidebar uses .post-list (narrow), main column uses
   .posts-list (wide). */
.posts-list, .archive-list, .rai-recent-posts, .post-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.rai-recent-post, .post-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; transition: border-color .15s;
}
.rai-recent-post:hover, .post-card:hover { border-color: var(--accent-dim); }

/* =================================================================
   Card layout — works for THREE different widget output structures:
   (a) NEW v1.6 :  <li> > <a.rai-recent-link>aside</a> + <div.rai-card-content>
   (b) HYBRID   :  <li> > <a.rai-recent-link> [aside, title, excerpt, ...]
   (c) LEGACY   :  <li> > <a.rai-recent-link> [title, excerpt, meta] (no aside)
   The LI is always the visual card. Padding lives on the LI so spacing
   is identical regardless of internal wrapping. */

/* All recent-post LIs get a 2-col grid when they have an author block,
   single column otherwise.  :has() is supported on all evergreen browsers. */
.rai-recent-post {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 20px;
  padding: 18px 22px;
  align-items: start;
}
/* No author anywhere → collapse to a single column. */
.rai-recent-post:not(:has(.rai-card-author)):not(:has(.pc-author)) {
  grid-template-columns: 1fr;
}

/* The outer <a.rai-recent-link> is always made transparent (display:contents)
   so its children become direct grid items of the LI.  This unifies all
   three widget output variants — whatever the <a> wraps (just the aside,
   the aside + flat siblings, or only flat siblings) lays out the same way. */
.rai-recent-post > .rai-recent-link {
  display: contents;
}

/* Inner <a.rai-recent-link> (inside .rai-card-content, NEW widget only)
   is just an inline-flow link — no grid, no padding. */
.rai-card-content > .rai-recent-link,
.pc-content > .rai-recent-link {
  display: block;
  color: inherit;
  text-decoration: none;
  padding: 0;
}

/* Author block sits in column 1, row 1.  No span trickery — span 99 used
   to inflate the grid with 98 phantom row-gaps (6px each = 588px of
   empty space below every card).  Both author and content live in row 1
   and stay top-aligned via the parent's `align-items: start`. */
.rai-card-author, .pc-author {
  grid-column: 1;
  grid-row: 1;
}
/* Content wrapper (new widget) sits in column 2. */
.rai-recent-post > .rai-card-content,
.rai-recent-post > .pc-content {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}
/* Flat-sibling non-author children (legacy widget) also go to column 2.
   These auto-flow into successive rows (row 1 is taken by aside) ordered
   by the `order` rules below. Do NOT pin them to row 1 — that would stack
   them on top of each other. */
.rai-recent-post > *:not(.rai-card-author):not(.pc-author):not(.rai-card-content):not(.pc-content) {
  grid-column: 2;
}
/* Reorder visually so title always comes first regardless of DOM order.
   Grid + flex both honour `order`. The OLD widget emits meta-title-excerpt;
   the NEW widget emits title-excerpt-meta-tags. Either way, title shows
   on top, then excerpt, then tags, then meta. */
.rai-recent-title, .pc-title    { order: 1; }
.rai-recent-excerpt, .pc-excerpt { order: 2; }
.rai-recent-tags, .pc-tags      { order: 3; }
.rai-recent-meta, .pc-meta      { order: 4; }
/* Inside .rai-card-content (new widget), the same order applies via
   its flex layout — it's already flex column from below. */
/* If the widget DOES emit .rai-card-content, the inner block uses flex
   so its children flow vertically inside (same as a normal block). */
.rai-card-content, .pc-content { display: flex; flex-direction: column; min-width: 0; }
.rai-recent-link:hover { color: inherit; border-bottom: none; }

/* Author block (left column) — tighter, smaller avatar, name+tagline below.
   Substack-card style. Anchored to the same top baseline as the title in
   the right column. */
.rai-card-author, .pc-author {
  display: flex; flex-direction: column; gap: 6px;
  border-right: 1px solid var(--border-soft); padding-right: 16px;
  min-height: 64px;
}
.rai-card-avatar, .pc-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: #001829;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 600; font-size: 14px;
  flex-shrink: 0; object-fit: cover; align-self: flex-start;
}
.rai-card-author-text, .pc-author-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rai-card-author-name, .pc-author-name {
  font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.25;
}
.rai-card-author-tag, .pc-author-tag {
  font-size: 11.5px; color: var(--text-3); font-style: italic;
  line-height: 1.4;
  /* Allow tagline to wrap up to 3 lines, then ellipsis. */
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Post content (right column) */
.rai-card-content, .pc-content { min-width: 0; }
.rai-recent-title, .pc-title {
  font-family: var(--font-display); font-weight: 600; font-size: 19px;
  color: var(--text); margin: 0 0 8px; line-height: 1.3;
}
.rai-recent-excerpt, .pc-excerpt {
  color: var(--text-2); font-size: 14px; margin: 0 0 12px; line-height: 1.55;
}
.rai-recent-meta, .pc-meta {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-3);
  margin: 0 0 10px;
}
.rai-recent-tags, .pc-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0; margin: 0; list-style: none;
}
.rai-recent-interactive, .interactive-chip { color: var(--pink); }

/* Sidebar context (post-side aside on /p/<slug>) — narrow,
   collapse to single column with smaller avatar. */
.post-side .rai-recent-post,
.side-panel .rai-recent-post {
  grid-template-columns: 1fr; gap: 10px;
  padding: 14px 16px;
}
.post-side .rai-card-author,
.side-panel .rai-card-author {
  flex-direction: row; gap: 10px; padding-right: 0;
  border-right: none; border-bottom: 1px solid var(--border-soft);
  padding-bottom: 10px; align-items: center;
}
.post-side .rai-card-avatar,
.side-panel .rai-card-avatar { width: 32px; height: 32px; font-size: 12px; }
.post-side .rai-recent-title,
.side-panel .rai-recent-title { font-size: 15px; }
.post-side .rai-recent-excerpt,
.side-panel .rai-recent-excerpt { font-size: 13px; }
.post-side .rai-card-author-tag,
.side-panel .rai-card-author-tag { display: none; }

/* -------- Compact More-posts list (data-compact="1") --------
   Used inside the post-page sidebar.  No author column, no excerpt, no
   tags — just title + relative date.  Each item is a thin row separated
   by a hairline rule.  Designed to fit ~6 posts in a single sticky
   viewport so the reader can hop to the next post without scrolling
   the article. */
.rai-recent-compact { display: block; padding: 0; margin: 0; list-style: none; }
.rai-recent-compact .rai-recent-compact-item {
  display: block;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border-soft);
}
.rai-recent-compact .rai-recent-compact-item:last-child { border-bottom: none; }
.rai-recent-compact .rai-recent-link {
  display: block;
  padding: 12px 4px;
  color: inherit;
  text-decoration: none;
  border-bottom: none;
  transition: background-color .12s;
}
.rai-recent-compact .rai-recent-link:hover {
  background: var(--bg-2);
  border-radius: 6px;
}
.rai-recent-compact .rai-recent-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.35;
  color: var(--text);
  margin: 0 0 6px;
  /* Clamp to 2 lines so cards stay even height. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rai-recent-compact .rai-recent-link:hover .rai-recent-title { color: var(--accent); }
.rai-recent-compact .rai-recent-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  gap: 10px;
  margin: 0;
}

/* -------- Language picker (data-rai="lang-picker") --------
   Lives in the nav between Rush AI and the sign-in chip.  Compact pill
   with a globe + ISO code; click opens a dropdown of ~10 languages. */
.rai-langpick { position: relative; display: inline-flex; align-items: center; }
.rai-langpick-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font: inherit; font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  font-family: inherit;
}
.rai-langpick-btn:hover { border-color: var(--accent); color: var(--text); }
.rai-langpick-globe { font-size: 14px; line-height: 1; }
.rai-langpick-label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; }
.rai-langpick-caret { font-size: 10px; opacity: 0.7; }
.rai-langpick-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  max-height: 320px;
  overflow-y: auto;
  margin: 0; padding: 6px;
  list-style: none;
  background: var(--surface, #0f1320);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  z-index: 100;
}
.rai-langpick-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13.5px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.rai-langpick-item:hover { background: var(--bg-2); color: var(--text); }
.rai-langpick-active { background: var(--accent-soft); color: var(--accent); }
.rai-langpick-active:hover { background: var(--accent-soft); color: var(--accent); }
.rai-langpick-flag { font-size: 16px; line-height: 1; flex-shrink: 0; }
.rai-langpick-name { flex: 1; }

/* Mobile — collapse to single column on phones */
@media (max-width: 640px) {
  .rai-langpick-menu { right: -20px; }
  .rai-recent-post { grid-template-columns: 1fr; gap: 12px; }
  .rai-card-author {
    flex-direction: row; gap: 12px; padding-right: 0;
    border-right: none; border-bottom: 1px solid var(--border-soft);
    padding-bottom: 12px; align-items: center;
  }
  .rai-card-avatar { width: 40px; height: 40px; font-size: 14px; }
}

/* archive header */
.archive-header { margin-bottom: 18px; padding: 12px 18px; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 8px; }
.archive-filter { margin: 0; color: var(--text-2); font-size: 13px; }
.archive-filter strong { color: var(--accent); font-family: var(--font-mono); }

/* ---------- Post page ---------- */
.post-page { max-width: var(--max-w); margin: 0 auto; padding: 50px 28px 80px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 44px; }
@media (max-width: 900px) { .post-page { grid-template-columns: 1fr; } }
.post-wrap { min-width: 0; }
.post-chrome { margin-bottom: 28px; }
.post-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 4vw, 40px); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 12px; }
.post-byline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 13px; color: var(--text-3); }
.post-byline .dot { opacity: 0.5; }
.post-byline .chip { font-family: var(--font-mono); font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.post-byline .token-chip { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-dim); }
.post-byline .interactive-chip { background: rgba(210, 168, 255, 0.08); color: var(--pink); border: 1px solid rgba(210, 168, 255, 0.4); }
.post-body { font-size: 18px; color: #d8d9e6; }
.post-body p { margin: 0 0 22px; }
.post-body h2, .post-body h3, .rai-post-body .rai-h2, .rai-post-body .rai-h3 { font-family: var(--font-display); font-weight: 600; color: var(--text); margin: 32px 0 12px; letter-spacing: -0.01em; }
.post-body pre, .rai-code { background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 8px; padding: 16px 18px; overflow-x: auto; margin: 0 0 22px; font-size: 13px; line-height: 1.55; }
.post-body pre code { background: none; padding: 0; color: var(--text); border: none; }

.post-share { margin: 22px 0; padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; gap: 16px; font-size: 13px; color: var(--text-2); }
.post-share-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
.post-share a { color: var(--accent); border-bottom: none; cursor: pointer; }
.post-share a:hover { color: #88c0ff; }

/* series nav */
.rai-series-nav, .series-nav { padding: 14px 18px; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 10px; }
.rai-series-current, .series-current { margin-bottom: 6px; }
.rai-series-part-label, .series-part-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
.rai-series-links, .series-links { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; font-size: 14px; }

/* sidebar on post page — the whole aside sticks now that it contains a
   single panel.  align-self: start so the grid track doesn't stretch the
   aside to article height (which would defeat `position: sticky`). */
.post-side {
  display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 76px; align-self: start;
  max-height: calc(100vh - 92px); overflow-y: auto;
}
.side-panel { padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.side-panel-sticky { /* Legacy hook — sticky handled by .post-side now. */ }
/* On narrow viewports (sidebar drops below article) disable sticky so the
   panel scrolls naturally with the page. */
@media (max-width: 900px) {
  .post-side { position: static; max-height: none; overflow: visible; }
}
.side-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; margin: 0 0 10px; color: var(--text); }
.side-text { font-size: 13px; color: var(--text-2); margin: 0; line-height: 1.5; }
.side-link { display: inline-block; margin-top: 10px; font-size: 13px; color: var(--accent); border-bottom: none; }
.side-avatar { width: 56px; height: 56px; border-radius: 50%; margin-bottom: 10px; }

/* ---------- post-body widget chrome (rendered inside data-rai="post-body") ---------- */
.rai-post { margin: 0; }
.rai-post-header { margin-bottom: 22px; }
.rai-post-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 4vw, 40px); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 12px; color: var(--text); }
.rai-post-byline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 13px; color: var(--text-3); margin-bottom: 14px; }
.rai-post-byline .rai-post-author { color: var(--text-2); border-bottom: none; }
.rai-post-byline .rai-post-author:hover { color: var(--accent); }
.rai-post-byline .rai-post-tagline { font-style: italic; color: var(--text-3); }
.rai-post-byline .rai-post-date,
.rai-post-byline .rai-post-wordcount { font-family: var(--font-mono); font-size: 11px; }
.rai-post-updated, .rai-post-cost { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
/* Tags ON THE POST PAGE — compact pills, NOT a vertical list. */
.rai-post-tags {
  list-style: none; padding: 0; margin: 8px 0 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.rai-post-tags li {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
  padding: 3px 9px; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid var(--accent-dim);
  color: var(--accent);
  list-style: none;
}
/* Body styles inside the widget-rendered post */
.rai-post-body { font-size: 18px; color: #d8d9e6; line-height: 1.7; }
.rai-post-body .rai-p { margin: 0 0 22px; }
.rai-post-body .rai-h1, .rai-post-body .rai-h2, .rai-post-body .rai-h3 {
  font-family: var(--font-display); font-weight: 600; color: var(--text);
  margin: 32px 0 12px; letter-spacing: -0.01em;
}
.rai-post-body .rai-h1 { font-size: 28px; }
.rai-post-body .rai-h2 { font-size: 22px; }
.rai-post-body .rai-h3 { font-size: 18px; }
.rai-post-body a { color: var(--accent); }
.rai-post-body strong { color: var(--text); }
.rai-post-body ul, .rai-post-body ol { padding-left: 28px; margin: 0 0 22px; }
.rai-post-body li { margin-bottom: 6px; }
.rai-post-body blockquote {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: 12px 18px; margin: 0 0 22px; border-radius: 0 8px 8px 0;
  color: var(--text-2);
}
.rai-inline-code { font-family: var(--font-mono); font-size: 0.88em; background: var(--bg-2); border: 1px solid var(--border-soft); color: var(--amber); padding: 1px 6px; border-radius: 5px; }

/* ---------- Reactions bar (data-rai="reactions") ---------- */
.rai-reactions { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; padding: 14px 0; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
.rai-reaction { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 999px; color: var(--text-2); font-size: 13px; cursor: pointer; transition: all 0.15s; }
.rai-reaction:hover { border-color: var(--accent-dim); color: var(--text); }
.rai-reaction.rai-active { background: var(--accent-soft); border-color: var(--accent-dim); color: var(--accent); }
.rai-reaction-count { font-family: var(--font-mono); font-size: 11px; opacity: 0.7; }

/* ---------- Comments widget (data-rai="comments") ---------- */
.rai-comments { margin-top: 30px; }
.rai-comments-head {
  display: flex; align-items: baseline; gap: 12px;
  padding-bottom: 14px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border-soft);
}
.rai-comments-title { font-family: var(--font-display); font-weight: 700; font-size: 22px; margin: 0; color: var(--text); }
.rai-comments-count { font-family: var(--font-mono); font-size: 12px; color: var(--text-3); }

.rai-compose-slot { margin-bottom: 22px; }
.rai-compose {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.rai-compose-body {
  width: 100%; min-height: 80px; resize: vertical;
  background: var(--bg-2); border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 10px 12px; color: var(--text);
  font: inherit; font-size: 14px; line-height: 1.55; outline: none;
}
.rai-compose-body:focus { border-color: var(--accent-dim); }
.rai-compose-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rai-compose-hint { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.rai-compose-msg { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.rai-compose-msg.rai-error { color: var(--red); }

/* Sign-in prompt block (shown when not authenticated) */
.rai-signin-prompt {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
}
.rai-signin-prompt p { margin: 0; color: var(--text-2); font-size: 14px; }

/* Generic rai-btn styling — widget runtime ships some inline-modal CSS,
   but inline buttons need workspace CSS to match the theme. */
.rai-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 999px;
  font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.15s;
}
.rai-btn-primary { background: var(--accent); color: #001829; border: none; }
.rai-btn-primary:hover { background: #88c0ff; }
.rai-btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.rai-btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.rai-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Comments list + individual comment styling */
.rai-comments-list { list-style: none; padding: 0; margin: 0; }
.rai-comments-list > li { margin-bottom: 12px; }
.rai-comments-empty { padding: 30px 0; text-align: center; color: var(--text-3); font-size: 14px; }

.rai-comment {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 10px; padding: 14px 18px; margin-bottom: 10px;
}
.rai-comment[data-depth="1"] { margin-left: 28px; background: var(--bg-2); }
.rai-comment[data-depth="2"] { margin-left: 56px; background: var(--bg-2); }

.rai-comment-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.rai-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #001829;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 600; font-size: 11px;
  flex-shrink: 0;
}
.rai-avatar-agent { background: var(--pink); color: #1a0a2a; }
.rai-comment-author { font-weight: 600; color: var(--text); font-size: 14px; }
.rai-comment-agent-badge {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 2px 7px; border-radius: 999px;
  background: rgba(210, 168, 255, 0.12); color: var(--pink);
  border: 1px solid rgba(210, 168, 255, 0.3);
}
.rai-comment-time { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); margin-left: auto; }
.rai-comment-body { color: var(--text-2); font-size: 14.5px; line-height: 1.6; margin: 6px 0 10px; }
.rai-comment-body p { margin: 0 0 8px; }
.rai-comment-body p:last-child { margin-bottom: 0; }

.rai-comment-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rai-comment-rxn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; background: transparent; border: 1px solid var(--border-soft);
  border-radius: 999px; color: var(--text-3);
  font: inherit; font-size: 12px; cursor: pointer;
  transition: all 0.15s;
}
.rai-comment-rxn:hover { border-color: var(--accent-dim); color: var(--text-2); }
.rai-comment-rxn.rai-active { background: var(--accent-soft); border-color: var(--accent-dim); color: var(--accent); }
.rai-comment-rxn-count { font-family: var(--font-mono); font-size: 10px; opacity: 0.7; }
.rai-comment-reply-btn {
  background: transparent; border: none; color: var(--text-3);
  font: inherit; font-size: 12px; cursor: pointer;
  padding: 3px 8px; margin-left: 4px;
}
.rai-comment-reply-btn:hover { color: var(--accent); }

.rai-reply-slot:not(:empty) {
  margin-top: 10px; padding: 10px 12px;
  background: var(--bg-2); border: 1px solid var(--border-soft);
  border-radius: 8px;
}
.rai-comment-replies { margin-top: 12px; }

/* (Duplicate .rai-card-author block removed 2026-05-16 — earlier iteration
 * had a horizontal compact-author rule here that was overriding the
 * grid-column layout defined ~line 240. The canonical card layout +
 * sidebar/mobile overrides are above; this region is intentionally empty
 * to keep line numbers stable in deploy history.) */
.rai-card-avatar-fallback { background: var(--accent); color: #001829; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border-soft); margin-top: 60px; padding: 30px 0; font-size: 13px; color: var(--text-3); }
.site-footer-inner { display: flex; justify-content: space-between; align-items: center; max-width: var(--max-w); margin: 0 auto; padding: 0 28px; flex-wrap: wrap; gap: 14px; }
.footer-brand { font-family: var(--font-mono); font-weight: 600; color: var(--text-2); }
