/* ==========================================================================
   LUMINA — HIGH-CONTRAST EDITORIAL TYPOGRAPHY & ZERO-CHROME CANVAS EDITOR
   ========================================================================== */

/* Reading Progress Bar (Fixed directly to bottom edge of sticky header) */
.reading-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0%;
  height: 3.5px;
  background: linear-gradient(90deg, #16A34A, #22C55E, #4ADE80, #86EFAC);
  box-shadow: 0 2px 14px rgba(74, 222, 128, 0.95);
  z-index: 1001;
  transition: width 40ms linear;
  pointer-events: none;
  display: none;
}

.reading-progress-bar.active {
  display: block;
}

/* ── Article Reader Header ── */
.article-header {
  padding-top: var(--space-8);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-8);
}
.article-category { margin-bottom: var(--space-4); }

.article-title {
  font-size: 2.75rem;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-4);
  color: var(--text-primary) !important;
}

.article-lead {
  font-size: 1.25rem;
  line-height: 1.55;
  color: var(--text-secondary) !important;
  margin-bottom: var(--space-6);
  font-weight: 400;
}

.article-byline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.9rem;
  color: var(--text-muted) !important;
}
.author-info { display: flex; align-items: center; gap: var(--space-3); }
.author-name { font-weight: 700; color: var(--text-primary) !important; }

.article-hero-cover {
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-8);
  border: 1px solid var(--border-subtle);
}
.article-hero-cover img {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
}
.article-cover-caption {
  padding: var(--space-3) var(--space-4);
  background-color: var(--bg-surface);
  font-size: 0.825rem;
  color: var(--text-muted) !important;
  border-top: 1px solid var(--border-subtle);
}

/* ── FORCE OVERRIDE ALL INLINE STYLES FOR PUBLISHED BODY ── */
.article-body,
.article-body *,
.article-body p,
.article-body p *,
.article-body span,
.article-body div {
  color: var(--text-primary) !important;
  background-color: transparent !important;
}

.article-body h1,
.article-body h1 *,
.article-body h2,
.article-body h2 * {
  font-size: 1.85rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
  color: var(--text-primary) !important;
}

.article-body h3,
.article-body h3 * {
  font-size: 1.4rem;
  font-weight: 800;
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  color: var(--text-primary) !important;
}

.article-body blockquote,
.article-body blockquote * {
  border-left: 3px solid var(--accent-primary);
  padding-left: var(--space-6);
  margin: var(--space-6) 0;
  font-size: 1.2rem;
  font-style: italic;
  line-height: 1.6;
  color: var(--text-secondary) !important;
}

.article-body ul, .article-body ol, .article-body li, .article-body li * {
  color: var(--text-primary) !important;
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: var(--space-8) 0;
}

/* ── Inline Photo in Published Articles ── */
.inline-photo-block {
  margin: var(--space-6) 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}
.inline-photo-block img {
  width: 100%;
  max-height: 600px;
  object-fit: cover;
  display: block;
}
.inline-photo-caption, .inline-photo-caption * {
  padding: 10px 16px;
  font-size: 0.85rem;
  color: var(--text-muted) !important;
  text-align: center;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  outline: none;
}

/* ===========================================================================
   ZERO-CHROME CANVAS EDITOR (FORCE OVERRIDE INLINE PASTED STYLES)
   =========================================================================== */

.editor-shell {
  max-width: var(--max-width-article);
  margin: 0 auto;
  padding: var(--space-8) var(--space-4) var(--space-16);
}

/* Minimal Top Bar */
.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-8);
}
.editor-topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.editor-pillar-pill {
  padding: 6px 18px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.editor-pillar-pill.active {
  background: var(--text-primary);
  color: var(--text-inverse);
  border-color: var(--text-primary);
}
.btn-publish {
  padding: 10px 28px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: var(--text-inverse);
  font-size: 0.925rem;
  font-weight: 800;
  transition: all var(--transition-fast);
  border: none;
  cursor: pointer;
}
.btn-publish:hover { opacity: 0.9; }

/* Title Input */
.editor-title-input {
  width: 100%;
  font-size: 2.75rem;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text-primary) !important;
  background: transparent;
  border: none;
  outline: none;
  margin-bottom: var(--space-2);
  font-family: var(--font-sans);
}
.editor-title-input::placeholder {
  color: var(--text-muted) !important;
  opacity: 0.6;
}

/* Byline Input */
.editor-byline-input {
  width: 100%;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-muted) !important;
  background: transparent;
  border: none;
  outline: none;
  margin-bottom: var(--space-8);
  font-family: var(--font-sans);
}
.editor-byline-input::placeholder {
  color: var(--text-muted) !important;
  opacity: 0.6;
}

/* 💥 EDITOR CANVAS WRITING SURFACE 💥 */
.editor-canvas,
.editor-canvas *,
.editor-canvas p,
.editor-canvas p *,
.editor-canvas span,
.editor-canvas div,
.editor-canvas font {
  color: var(--text-primary) !important;
  background-color: transparent !important;
  font-family: var(--font-sans) !important;
}

.editor-canvas {
  width: 100%;
  min-height: 65vh;
  font-size: 1.15rem;
  line-height: 1.8;
  outline: none;
  position: relative;
  caret-color: #3B82F6;
}

.editor-canvas:empty::before {
  content: 'Почніть писати тут...';
  color: #64748B !important;
  opacity: 0.5;
  pointer-events: none;
}

.editor-canvas p {
  margin-bottom: var(--space-6);
  font-weight: 400;
}

.editor-canvas h1,
.editor-canvas h1 *,
.editor-canvas h2,
.editor-canvas h2 * {
  font-size: 1.85rem;
  font-weight: 900;
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
  color: #FFFFFF !important;
}

.editor-canvas h3,
.editor-canvas h3 * {
  font-size: 1.4rem;
  font-weight: 800;
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  color: #F8FAFC !important;
}

.editor-canvas blockquote,
.editor-canvas blockquote * {
  border-left: 3px solid var(--accent-primary);
  padding-left: var(--space-6);
  margin: var(--space-6) 0;
  font-style: italic;
  color: #94A3B8 !important;
}

.editor-canvas ul, .editor-canvas ol, .editor-canvas li, .editor-canvas li * {
  color: #F1F5F9 !important;
}

.editor-canvas hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: var(--space-8) 0;
}

/* Drop overlay */
.editor-canvas.drag-over {
  background: var(--accent-subtle) !important;
  border-radius: var(--radius-lg);
}

/* Inline Editor Photo Block */
.editor-canvas .inline-photo-block {
  position: relative;
  margin: var(--space-6) 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  user-select: none;
}
.editor-canvas .inline-photo-block img {
  width: 100%;
  max-height: 550px;
  object-fit: cover;
  display: block;
}
.editor-canvas .inline-photo-block figcaption,
.editor-canvas .inline-photo-block figcaption * {
  padding: 10px 16px;
  font-size: 0.85rem;
  color: #94A3B8 !important;
  text-align: center;
  border-top: 1px solid var(--border-subtle);
  outline: none;
  user-select: text;
}

.photo-remove-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.75);
  color: #fff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  z-index: 10;
  backdrop-filter: blur(4px);
  transition: all var(--transition-fast);
}
.photo-remove-btn:hover { background: rgba(220,38,38,0.95); }

/* Floating Format Bubble */
.format-bubble {
  position: absolute;
  display: none;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: #1E293B;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  z-index: 200;
  animation: bubblePop 120ms var(--ease-smooth) forwards;
}
.format-bubble.visible { display: flex; }
.format-bubble-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  color: #F8FAFC !important;
  background: transparent;
  cursor: pointer;
  transition: background var(--transition-fast);
  white-space: nowrap;
}
.format-bubble-btn:hover { background: rgba(255,255,255,0.15); }
.format-bubble-divider {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.2);
  margin: 0 4px;
}

@keyframes bubblePop {
  from { opacity: 0; transform: translateY(6px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Plus (+) Block Inserter */
.block-inserter {
  position: absolute;
  display: none;
  align-items: center;
  z-index: 100;
}
.block-inserter.visible { display: flex; }

.block-inserter-trigger {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface);
  color: #FFFFFF !important;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  font-weight: 300;
  transition: all var(--transition-fast);
}
.block-inserter-trigger:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary) !important;
  transform: rotate(90deg);
}

.block-inserter-menu {
  display: none;
  position: absolute;
  left: 40px;
  top: -4px;
  background: #111318;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  padding: 8px;
  min-width: 220px;
  animation: bubblePop 120ms var(--ease-smooth) forwards;
}
.block-inserter-menu.open { display: block; }

.block-inserter-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: #F8FAFC !important;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.block-inserter-item:hover { background: var(--bg-surface-hover); }
.block-inserter-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

/* Bottom Metadata Footer */
.editor-meta-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-subtle);
}
.editor-meta-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94A3B8 !important;
  margin-bottom: var(--space-4);
}
.editor-file-drop {
  padding: var(--space-4);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.editor-file-drop:hover {
  border-color: var(--accent-primary);
  background: var(--accent-subtle);
}
