/* =============================================================================
   Scribe — Design System (Editorial Dark, "late-night writing studio")
   Loaded by inc/layout.php on every page.
   ============================================================================= */

:root {
  /* ── Palette ────────────────────────────────────────────────────────────── */
  --ink:          #0E0E12;
  --surface:      #16161B;
  --surface-2:    #1F1F26;
  --surface-3:    #2A2A33;
  --line:         rgba(255, 255, 255, 0.08);
  --line-strong:  rgba(255, 255, 255, 0.16);

  --text:         #EDEAE2;          /* warm white */
  --text-muted:   #9A9692;
  --text-faint:   #61605C;

  --accent:       #FF6B35;          /* warm coral — primary action */
  --accent-soft:  rgba(255, 107, 53, 0.16);
  --accent-2:     #FF8155;          /* hover */
  --accent-glow:  0 0 0 1px rgba(255, 107, 53, 0.5), 0 8px 24px rgba(255, 107, 53, 0.25);

  --ai:           #3B82F6;          /* semantic AI blue, kept */
  --ai-2:         #60A5FA;
  --ai-soft:      rgba(59, 130, 246, 0.14);

  --success:      #34D399;
  --danger:       #F87171;
  --danger-soft:  rgba(248, 113, 113, 0.14);

  /* ── Type ───────────────────────────────────────────────────────────────── */
  --font-display: "Fraunces", "Times New Roman", Georgia, serif;
  --font-body:    "Geist", "Inter Tight", "Inter", system-ui, -apple-system, sans-serif;
  --font-mono:    "Geist Mono", ui-monospace, "JetBrains Mono", "SF Mono", monospace;

  /* ── Easing & Motion ────────────────────────────────────────────────────── */
  --ease-soft:   cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast:    160ms;
  --dur-base:    240ms;
  --dur-slow:    420ms;

  /* ── Radius ─────────────────────────────────────────────────────────────── */
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 16px;
  --r-xl: 22px;

  /* ── Elevation (shadows) ────────────────────────────────────────────────── */
  --shadow-1: 0 1px 2px rgba(0,0,0,0.30), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-2: 0 8px 24px rgba(0,0,0,0.40), 0 0 0 1px rgba(255,255,255,0.05);
  --shadow-3: 0 30px 60px -20px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.06);
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
html, body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Tell browsers to render form controls in dark-mode flavour so user-agent
     stylesheets don't paint white-on-white inputs in our modals. */
  color-scheme: dark;
}
/* Use a strong coral background + near-black text — high contrast on every
   Scribe surface (dark UI chrome, white doc paper, gradient cover). */
::selection      { background: var(--accent); color: #1A0A03; }
::-moz-selection { background: var(--accent); color: #1A0A03; }

/* ── Display heading reset for cohesive headlines ─────────────────────────── */
.display, h1.display, h2.display {
  font-family: var(--font-display);
  font-weight: 500;
  font-style: normal;
  font-variation-settings: "opsz" 144, "SOFT" 50, "WONK" 0;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--text);
}
.display-italic {
  font-family: var(--font-display);
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}

/* =============================================================================
   ATMOSPHERE  —  film grain overlay + subtle mesh
   ============================================================================= */
.scribe-atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(1100px 700px at 12% -10%, rgba(255, 107, 53, 0.06), transparent 60%),
    radial-gradient(900px 600px at 110% 0%, rgba(59, 130, 246, 0.05), transparent 55%),
    radial-gradient(800px 500px at 50% 110%, rgba(255, 107, 53, 0.04), transparent 60%);
}
.scribe-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* =============================================================================
   GLASS SURFACES
   ============================================================================= */
.scribe-glass {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
}
.scribe-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}

/* =============================================================================
   BUTTONS
   ============================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font: 500 14px/1 var(--font-body);
  letter-spacing: -0.005em;
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
  user-select: none;
  white-space: nowrap;
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.35);
}
.btn:active { transform: translateY(1px); }
.btn-sm  { padding: 7px 12px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-lg  { padding: 13px 22px; font-size: 15.5px; }

.btn-primary {
  background: var(--accent);
  color: #1A0A03;
  font-weight: 600;
  border-color: var(--accent);
  box-shadow: 0 6px 18px -8px rgba(255, 107, 53, 0.5);
}
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); transform: translateY(-1px); box-shadow: 0 12px 28px -10px rgba(255, 107, 53, 0.6); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.22); }

.btn-soft {
  background: rgba(255,255,255,0.05);
  color: var(--text);
  border-color: var(--line);
}
.btn-soft:hover { background: rgba(255,255,255,0.08); }

.btn-ai {
  background: var(--ai);
  color: white;
  font-weight: 600;
  border-color: var(--ai);
}
.btn-ai:hover { background: var(--ai-2); border-color: var(--ai-2); transform: translateY(-1px); }
.btn-ai-off {
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  border-color: var(--line);
}
.btn-ai-off:hover { background: rgba(255,255,255,0.10); color: var(--text); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.35);
}
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: var(--r);
}

/* Segmented button group */
.btn-group {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: var(--r);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
}
.btn-group > .btn {
  padding: 6px 14px;
  font-size: 12.5px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 7px;
  box-shadow: none;
}
.btn-group > .btn[aria-pressed="true"] {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 0 0 1px var(--line-strong);
}
.btn-group > .btn:hover:not([aria-pressed="true"]) { color: var(--text); }

/* =============================================================================
   INPUTS
   ============================================================================= */
.scribe-input,
.scribe-textarea {
  width: 100%;
  padding: 12px 14px;
  font: 400 14.5px/1.45 var(--font-body);
  /* Force dark-themed inputs even when Tailwind forms plugin or browser
     defaults try to paint them white. */
  color: var(--text) !important;
  background: rgba(255,255,255,0.04) !important;
  border: 1px solid var(--line);
  border-radius: var(--r);
  outline: none;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--accent);
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}
/* Browser autofill doesn't honour our background — force it. */
.scribe-input:-webkit-autofill,
.scribe-textarea:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset !important;
  -webkit-text-fill-color: var(--text) !important;
}
.scribe-input::placeholder,
.scribe-textarea::placeholder { color: var(--text-faint); }
.scribe-input:hover,
.scribe-textarea:hover { background: rgba(255,255,255,0.05); }
.scribe-input:focus,
.scribe-textarea:focus {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255, 107, 53, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.18);
}
.scribe-label {
  display: block;
  font: 600 10.5px/1 var(--font-body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* =============================================================================
   TOGGLE SWITCH
   ============================================================================= */
.scribe-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.scribe-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.scribe-toggle .track {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  border: 1px solid var(--line);
  transition: background-color var(--dur-base) var(--ease-out);
}
.scribe-toggle .thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
  transition: transform var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}
.scribe-toggle input:checked + .track { background: var(--accent); border-color: var(--accent-2); }
.scribe-toggle input:checked + .track .thumb { transform: translateX(16px); background: #1A0A03; }
.scribe-toggle .label-text { font-size: 13.5px; color: var(--text); }

/* =============================================================================
   MODAL
   ============================================================================= */
.scribe-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 8, 12, 0.65);
  backdrop-filter: blur(8px) saturate(110%);
  -webkit-backdrop-filter: blur(8px) saturate(110%);
  animation: scribe-fade-in var(--dur-base) var(--ease-out);
}
.scribe-modal.is-open { display: flex; }
.scribe-modal-dialog {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: scribe-modal-rise var(--dur-slow) var(--ease-out);
}
.scribe-modal-dialog.is-wide { max-width: 920px; }
.scribe-modal-header {
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.scribe-modal-title {
  font: 500 22px/1.15 var(--font-display);
  font-variation-settings: "opsz" 72, "SOFT" 50;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0;
}
.scribe-modal-sub {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
}
.scribe-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}
.scribe-modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.scribe-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.scribe-modal-close:hover { background: rgba(255,255,255,0.10); color: var(--text); }

/* =============================================================================
   MOTION  —  reusable enter animations
   ============================================================================= */
@keyframes scribe-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scribe-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scribe-fade-down {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scribe-modal-rise {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes scribe-slide-in-right {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes scribe-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}
@keyframes scribe-cursor {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.fx-fade-up    { animation: scribe-fade-up   var(--dur-slow) var(--ease-out) both; }
.fx-fade-down  { animation: scribe-fade-down var(--dur-slow) var(--ease-out) both; }
.fx-fade-in    { animation: scribe-fade-in   var(--dur-base) var(--ease-out) both; }
.fx-slide-r    { animation: scribe-slide-in-right var(--dur-slow) var(--ease-out) both; }
.fx-d-1   { animation-delay:  60ms; }
.fx-d-2   { animation-delay: 120ms; }
.fx-d-3   { animation-delay: 200ms; }
.fx-d-4   { animation-delay: 280ms; }
.fx-d-5   { animation-delay: 360ms; }
.fx-d-6   { animation-delay: 440ms; }

/* Streaming text caret pulse */
.scribe-cursor::after {
  content: "▍";
  display: inline-block;
  margin-left: 2px;
  color: var(--accent);
  animation: scribe-cursor 1s steps(1) infinite;
}

/* Streaming "thinking" dots */
.scribe-typing {
  display: inline-flex;
  gap: 4px;
}
.scribe-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: scribe-pulse 1.2s var(--ease-in-out) infinite;
}
.scribe-typing span:nth-child(2) { animation-delay: 0.15s; }
.scribe-typing span:nth-child(3) { animation-delay: 0.30s; }

/* =============================================================================
   COVER FIELD TAGS  —  floating label that pops up on focus showing the
   field's friendly name + the data-key, so users know what to call each
   piece when asking the AI ("update the strapline / cover_lead").
   ============================================================================= */
.scribe-cover-tag {
  position: absolute;
  z-index: 8;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: var(--ai);
  color: white;
  border-radius: 999px;
  box-shadow: 0 6px 16px -4px rgba(59, 130, 246, 0.45);
  pointer-events: none;
  white-space: nowrap;
  animation: scribe-fade-down var(--dur-fast) var(--ease-out);
}
.scribe-cover-tag.is-active { display: inline-flex; }
.scribe-cover-tag-name {
  font: 600 10.5px/1 var(--font-body);
  letter-spacing: 0.02em;
}
.scribe-cover-tag-key {
  font: 500 10px/1 var(--font-mono);
  letter-spacing: 0.02em;
  opacity: 0.78;
  padding: 2px 6px;
  background: rgba(255,255,255,0.16);
  border-radius: 999px;
}

/* Subtle ring on the focused cover field itself, complements the tag. */
.scribe-cover [data-key]:focus,
.scribe-cover [data-key]:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.55);
  outline-offset: 4px;
  border-radius: 4px;
}

/* =============================================================================
   AI BLOCK-SCOPE  —  visuals when "edit this block" is active
   ============================================================================= */

/* The block being edited gets a soft AI-blue ring inside the canvas. */
.is-ai-scoped {
  position: relative;
  outline: 2px solid var(--ai);
  outline-offset: 6px;
  border-radius: 6px;
  background: var(--ai-soft);
  transition:
    background-color var(--dur-base) var(--ease-out),
    outline-color    var(--dur-base) var(--ease-out);
}
.is-ai-scoped::after {
  content: "✨ Editing";
  position: absolute;
  top: -10px; right: -6px;
  font: 600 9.5px/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: white;
  background: var(--ai);
  padding: 4px 8px;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.35);
  pointer-events: none;
  z-index: 5;
  animation: scribe-fade-down var(--dur-base) var(--ease-out);
}

/* Removable badge that sits above the AI input when a block is scoped. */
.scribe-ai-scope-badge {
  display: none;
  align-items: center;
  gap: 10px;
  margin: 0 14px 10px;
  padding: 10px 12px;
  background: var(--ai-soft);
  border: 1px solid rgba(59, 130, 246, 0.30);
  border-radius: var(--r);
  animation: scribe-fade-down var(--dur-base) var(--ease-out);
}
.scribe-ai-scope-badge.is-active { display: flex; }
.scribe-ai-scope-icon {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ai);
  border-radius: 8px;
  font-size: 14px;
  filter: drop-shadow(0 2px 4px rgba(59, 130, 246, 0.35));
}
.scribe-ai-scope-meta { min-width: 0; flex: 1; }
.scribe-ai-scope-top {
  font: 600 10.5px/1 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ai-2);
  margin-bottom: 4px;
}
.scribe-ai-scope-preview {
  font: 400 12.5px/1.35 var(--font-body);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scribe-ai-scope-clear {
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 16px; line-height: 1;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    color            var(--dur-fast) var(--ease-out),
    border-color     var(--dur-fast) var(--ease-out);
}
.scribe-ai-scope-clear:hover {
  background: rgba(255,255,255,0.10);
  color: var(--text);
  border-color: var(--line-strong);
}

/* =============================================================================
   AUTH-NEUTRAL HELPERS  (used by login/landing/dashboard alike)
   ============================================================================= */
.scribe-grid-bg {
  /* Override the older slate-only gradient with the new editorial palette */
  background: var(--ink);
}

/* =============================================================================
   COMPOSE PROGRESS CARD  (index.php → js/compose.js)
   The streaming "drafting…" card that replaces the form once the user submits.
   Lots of motion but all CSS-driven (no JS animation loops).
   ============================================================================= */
.scribe-compose-progress {
  position: relative;
  margin: 32px auto 0;
  max-width: 620px;
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, rgba(20,20,28,0.92), rgba(14,14,18,0.96));
  border: 1px solid var(--line);
  box-shadow:
    0 30px 80px -20px rgba(0,0,0,0.55),
    0 0 0 1px rgba(255,107,53,0.08) inset;
  padding: 30px 32px 26px;
  overflow: hidden;
  text-align: center;
  animation: scribe-compose-rise .55s var(--ease-out) both;
}
.scribe-compose-progress.is-done { animation: scribe-compose-done .35s var(--ease-out) both; }
.scribe-compose-progress.hidden { display: none; }
@keyframes scribe-compose-rise {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
@keyframes scribe-compose-done {
  0%   { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.0); }
  60%  { box-shadow: 0 0 0 18px rgba(52, 211, 153, 0.08); }
  100% { box-shadow: 0 30px 80px -20px rgba(0,0,0,0.55), 0 0 0 1px rgba(52,211,153,0.30) inset; }
}

/* Aurora — slow-drifting blurred coral/blue glow behind the content. */
.scribe-compose-progress-aurora {
  position: absolute; inset: -40%;
  background:
    radial-gradient(40% 50% at 30% 30%, rgba(255,107,53,0.22), transparent 60%),
    radial-gradient(35% 45% at 70% 70%, rgba(59,130,246,0.18),  transparent 60%),
    radial-gradient(45% 55% at 50% 50%, rgba(255,255,255,0.04), transparent 70%);
  filter: blur(28px);
  animation: scribe-compose-aurora 14s var(--ease-in-out) infinite alternate;
  pointer-events: none;
  z-index: 0;
}
@keyframes scribe-compose-aurora {
  0%   { transform: translate(-3%, -2%) rotate(0deg); }
  50%  { transform: translate(4%, 3%)  rotate(15deg); }
  100% { transform: translate(-2%, 4%) rotate(-12deg); }
}
.scribe-compose-progress.is-done .scribe-compose-progress-aurora {
  background:
    radial-gradient(40% 55% at 50% 40%, rgba(52,211,153,0.20), transparent 60%),
    radial-gradient(40% 55% at 50% 60%, rgba(52,211,153,0.10), transparent 60%);
}

.scribe-compose-progress-inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}

/* Mark — animated orbits around a glowing core. Acts as the focal point. */
.scribe-compose-progress-mark {
  position: relative;
  width: 64px; height: 64px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.scribe-compose-progress-orbit {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255,107,53,0.45);
  border-top-color: transparent; border-right-color: transparent;
  animation: scribe-compose-spin 2.4s linear infinite;
}
.scribe-compose-progress-orbit.is-2 {
  inset: 8px;
  border-color: rgba(59,130,246,0.45);
  border-bottom-color: transparent; border-left-color: transparent;
  animation-direction: reverse;
  animation-duration: 3.2s;
}
.scribe-compose-progress-core {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 24px 3px rgba(255,107,53,0.55);
  animation: scribe-compose-core 1.4s var(--ease-in-out) infinite alternate;
}
@keyframes scribe-compose-spin { to { transform: rotate(360deg); } }
@keyframes scribe-compose-core {
  from { transform: scale(.85); opacity: .85; }
  to   { transform: scale(1.05); opacity: 1; }
}
.scribe-compose-progress.is-done .scribe-compose-progress-orbit { animation: none; opacity: .35; }
.scribe-compose-progress.is-done .scribe-compose-progress-core  {
  background: #34D399;
  box-shadow: 0 0 26px 4px rgba(52,211,153,0.55);
  animation: none;
}

/* Title row — Fraunces "Drafting" + animated dots. */
.scribe-compose-progress-title {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-family: var(--font-display);
  font-size: 30px; font-weight: 500;
  letter-spacing: -0.01em; color: var(--text);
}
.scribe-compose-progress-dots {
  display: inline-flex; gap: 4px; padding-bottom: 4px;
}
.scribe-compose-progress-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  opacity: .35;
  animation: scribe-compose-dot 1.2s var(--ease-in-out) infinite;
}
.scribe-compose-progress-dots span:nth-child(2) { animation-delay: .15s; }
.scribe-compose-progress-dots span:nth-child(3) { animation-delay: .30s; }
@keyframes scribe-compose-dot {
  0%, 70%, 100% { opacity: .35; transform: translateY(0); }
  35%           { opacity: 1;   transform: translateY(-3px); }
}
.scribe-compose-progress.is-done .scribe-compose-progress-dots { display: none; }

/* Live status line — fades through different messages, key=`data-fade`. */
.scribe-compose-progress-status {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  min-height: 18px;
  transition: opacity .25s var(--ease-out), transform .25s var(--ease-out);
}
.scribe-compose-progress-status.is-fading {
  opacity: 0;
  transform: translateY(4px);
}

/* Trail of completed steps — small list under the live status, each row
   fades up with a gentle check. Cap visual height; oldest scrolls off. */
.scribe-compose-progress-trail {
  list-style: none; padding: 0; margin: 6px 0 0;
  display: flex; flex-direction: column; gap: 4px;
  width: 100%; max-width: 420px;
}
.scribe-compose-progress-trail li {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  animation: scribe-compose-step .35s var(--ease-out) both;
}
.scribe-compose-progress-trail li::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: rgba(52, 211, 153, 0.65);
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.45);
  flex: 0 0 auto;
}
.scribe-compose-progress-trail li.is-error { color: var(--danger); }
.scribe-compose-progress-trail li.is-error::before { background: var(--danger); box-shadow: 0 0 6px rgba(248,113,113,0.55); }
@keyframes scribe-compose-step {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

@media (max-width: 560px) {
  .scribe-compose-progress { padding: 24px 18px 22px; }
  .scribe-compose-progress-title { font-size: 26px; }
}
