/* ═══════════════════════════════════════════════════════════════
   spa.css — SPA + блочный редактор
   Подключается ПОСЛЕ main.css
   ═══════════════════════════════════════════════════════════════ */

/* ── Skeleton ──────────────────────────────────────────────────── */
@keyframes skel-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

.skel-hero {
  height: clamp(120px, 18vw, 200px);
  background: linear-gradient(90deg, #e0d9cf 25%, #ede6dc 50%, #e0d9cf 75%);
  background-size: 1200px 100%;
  animation: skel-shimmer 1.5s ease-in-out infinite;
}

.skel-title {
  height: 2rem;
  width: 45%;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  background: linear-gradient(90deg, #e0d9cf 25%, #ede6dc 50%, #e0d9cf 75%);
  background-size: 1200px 100%;
  animation: skel-shimmer 1.5s ease-in-out infinite;
}

.skel-block {
  border-radius: 8px;
  margin-bottom: .875rem;
  background: linear-gradient(90deg, #e0d9cf 25%, #ede6dc 50%, #e0d9cf 75%);
  background-size: 1200px 100%;
  animation: skel-shimmer 1.5s ease-in-out infinite;
}

/* ── Page transitions ──────────────────────────────────────────── */
.fade-in {
  animation: fadeIn .3s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Page hero ─────────────────────────────────────────────────── */
.page-hero {
  padding: clamp(2rem, 5vw, 3.5rem) 0;
  background: linear-gradient(135deg, var(--navy, #0D1B2A) 0%, #1e3a5f 100%);
  color: #fff;
}
.page-hero--img {
  background-size: cover;
  background-position: center;
  position: relative;
}
.page-hero--img::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(13,27,42,.85) 0%, rgba(30,58,95,.75) 100%);
}
.page-hero--img .container { position: relative; }
.page-title {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 700;
  margin: 0;
  text-shadow: 0 1px 4px rgba(0,0,0,.2);
}

/* ── Blocks общее ──────────────────────────────────────────────── */
.block { margin-bottom: 1.5rem; }
.block-empty-placeholder {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  height: 80px;
  border: 2px dashed var(--border, #dee2e6);
  border-radius: 8px;
  color: #aaa;
  font-size: .9rem;
}

/* Text block */
.block-content.prose { line-height: 1.8; }
.block-content.prose img { max-width: 100%; border-radius: 8px; height: auto; }
.block-content.prose h2 { font-size: 1.5rem; margin-top: 1.5rem; }
.block-content.prose h3 { font-size: 1.25rem; margin-top: 1.25rem; }

/* Documents */
.doc-item { color: var(--text, #1e1e1e); transition: background .15s; }
.doc-item:hover { background: #f8f9fa; }
.doc-name { font-size: .93rem; }
.doc-size { font-size: .8rem; }

/* ── Editor toolbar (fixed bottom-left) ─────────────────────────── */
#editor-toolbar {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 1060;
  display: flex !important;
  align-items: center;
  gap: .5rem;
  background: rgba(13,27,42,.93);
  color: #fff;
  border-radius: 50px;
  padding: .45rem .9rem;
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
  backdrop-filter: blur(8px);
  font-size: .85rem;
}
#editor-toolbar.d-none { display: none !important; }
#editor-status { color: rgba(255,255,255,.55); font-size: .8rem; }

/* ── Block in edit mode ─────────────────────────────────────────── */
.block-editable {
  position: relative;
  margin-top: calc(38px + 4px) !important;  /* room for palette */
  outline: 2px dashed rgba(201,151,58,.35);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Block palette ──────────────────────────────────────────────── */
.block-palette {
  position: absolute;        /* relative to .block-editable parent's prev-sibling wrapper */
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  background: #1e2a38;
  border-radius: 6px 6px 0 0;
  padding: 0 8px;
  margin-bottom: 0;
  font-size: .78rem;
}

/* Palette sits ABOVE the block: achieved by inserting before block el */
.block-palette + .block-editable { margin-top: 0 !important; }

.bp-label {
  color: rgba(255,255,255,.6);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.bp-actions { display: flex; gap: 2px; }
.bp-btn {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.75);
  padding: 3px 7px; border-radius: 4px; font-size: .82rem; line-height: 1;
  transition: background .12s, color .12s;
}
.bp-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
.bp-btn-danger:hover { background: rgba(220,53,69,.65); color: #fff; }

/* ── Add block row ──────────────────────────────────────────────── */
.block-add-row {
  display: flex; justify-content: center;
  margin: 2px 0;
  opacity: 0;
  height: 26px;
  transition: opacity .18s;
}
/* Show on hover of adjacent elements */
.block-editable:hover + .block-add-row,
.block-palette:hover ~ .block-editable + .block-add-row,
.block-add-row:hover { opacity: 1; }

.block-add-btn {
  background: none;
  border: 1.5px dashed #ced4da;
  color: #888;
  border-radius: 50px;
  padding: 1px 16px;
  font-size: .78rem; cursor: pointer;
  display: flex; align-items: center; gap: .3rem;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}
.block-add-btn:hover {
  border-color: var(--navy, #0D1B2A);
  color: var(--navy, #0D1B2A);
  background: #eef2ff;
}

/* ── Type picker grid ───────────────────────────────────────────── */
.type-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: .75rem;
}
.type-pick-btn {
  background: #f8f9fa;
  border: 1.5px solid #dee2e6;
  border-radius: 10px;
  padding: .85rem .5rem;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  font-size: .82rem; color: #333;
  transition: border-color .15s, background .15s, transform .1s;
}
.type-pick-btn:hover {
  border-color: var(--navy, #0D1B2A);
  background: #eef2ff;
  transform: translateY(-2px);
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 576px) {
  #editor-toolbar { left: .75rem; bottom: .75rem; padding: .35rem .7rem; font-size: .8rem; }
  .type-pick-grid { grid-template-columns: repeat(3, 1fr); }
  .bp-label { display: none; }
}