/* Blog Studio - builds on the admin theme (base.css, a copy of admin/style.css). The writing area is
   light, like the published page, so writers see roughly what readers will. */

.link-btn {
  background: none; border: none; padding: 4px; cursor: pointer;
  color: var(--dim); font-size: .85rem; text-decoration: underline;
}
.link-btn:hover { color: var(--ink); }
.login-note { margin: 0; font-size: .85rem; color: var(--good); }

.topbar-link { text-decoration: none; font-size: .85rem; }

.studio-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.studio-head h1 { margin: 0 0 4px; font-size: 1.5rem; }
.studio-head p { margin: 0; font-size: .88rem; }
.studio-head .btn-primary { padding: 11px 20px; }
.studio-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.chip--active { border-color: var(--purple) !important; color: var(--ink); background: rgba(139,92,246,.18) !important; }

/* posts list */
.post-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.post-row:last-child { border-bottom: none; }
.post-row:hover { background: var(--panel-2); }
.post-thumb {
  width: 88px; height: 56px; border-radius: 8px; overflow: hidden;
  background: var(--panel-2); display: flex; align-items: center; justify-content: center;
}
.post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-row-title { font-weight: 700; margin: 0 0 4px; }
.post-row-meta { margin: 0; font-size: .8rem; color: var(--dim); }
.post-row-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.empty-state { text-align: center; padding: 36px 12px; }
.empty-state p { margin: 0 0 14px; }

/* editor */
.editor-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.save-state { font-size: .85rem; color: var(--dim); }
.save-state--dirty { color: var(--warn); }
.editor-notice {
  margin: 0 0 16px; padding: 10px 14px; border-radius: 10px;
  background: rgba(224,168,62,.12); color: var(--warn); font-size: .88rem;
}
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.editor-side { display: grid; gap: 16px; position: sticky; top: 16px; }

.title-input {
  width: 100%;
  background: transparent; border: none; resize: none; overflow: hidden;
  color: var(--ink); font: inherit; font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; line-height: 1.2;
  padding: 4px 0;
}
.title-input:focus { outline: none; }
.title-input::placeholder { color: #5d5873; }
.slug-line { margin: 4px 0 16px; font-size: .82rem; color: var(--dim); word-break: break-all; }
.slug-line span { color: var(--ink); }

.paper { background: #fff8ef; color: #201d2b; border-radius: var(--radius); overflow: hidden; }
.paper .ql-toolbar.ql-snow {
  border: none; border-bottom: 1px solid #ece5f5; background: #fff;
  position: sticky; top: 0; z-index: 2; padding: 10px 12px;
}
.paper .ql-container.ql-snow { border: none; font: inherit; }
.paper .ql-editor {
  min-height: 460px; padding: 28px 32px 48px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.05rem; line-height: 1.8;
}
.paper .ql-editor.ql-blank::before { color: #9a94b3; font-style: normal; left: 32px; }
.paper .ql-editor h2 { font-size: 1.5rem; margin: 1.6rem 0 .6rem; }
.paper .ql-editor h3 { font-size: 1.2rem; margin: 1.4rem 0 .5rem; }
.paper .ql-editor p { margin-bottom: .9rem; }
.paper .ql-editor blockquote { border-left: 4px solid #e0a83e; padding-left: 16px; font-style: italic; }
.paper .ql-editor img { border-radius: 12px; margin: 12px 0; }
.paper .ql-editor a { color: #6a3aa0; }
.paper .ql-snow .ql-tooltip { z-index: 5; }

.side-note { font-size: .8rem; margin: 8px 0 0; line-height: 1.5; }
.side-actions { display: grid; gap: 8px; margin-top: 12px; }
.side-actions a { text-align: center; text-decoration: none; }
.side-actions--row { grid-template-columns: 1fr 1fr; }
.side-error { color: var(--bad); font-size: .85rem; margin: 10px 0 0; min-height: 0; }
.side-error:empty { display: none; }

.cover-box {
  aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  background: var(--panel-2); border: 1px dashed var(--border);
  display: flex; align-items: center; justify-content: center; font-size: .85rem;
}
.cover-box img { width: 100%; height: 100%; object-fit: cover; }

.excerpt-input {
  width: 100%; resize: vertical;
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: .9rem;
}
.excerpt-input:focus-visible { outline: 2px solid var(--purple); outline-offset: 1px; }

/* preview */
.preview-panel {
  width: min(860px, 100%); height: 100%; margin: 0 auto;
  background: #fff8ef; color: #201d2b; overflow-y: auto;
}
#preview-overlay { justify-content: center; }
.preview-bar {
  position: sticky; top: 0; z-index: 1;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.preview-article { max-width: 720px; margin: 0 auto; padding: 36px 24px 64px; font-size: 1.06rem; line-height: 1.8; }
.preview-article .eyebrow { text-transform: uppercase; letter-spacing: .12em; font-weight: 700; font-size: .78rem; color: #6a3aa0; margin: 0 0 .6rem; }
.preview-article h1 { font-size: 2.2rem; line-height: 1.15; margin: 0 0 .6rem; }
.preview-article .byline { color: #6b6578; font-weight: 600; }
.preview-article .cover { width: 100%; border-radius: 16px; margin: 20px 0 28px; }
.preview-article h2 { font-size: 1.5rem; margin: 2rem 0 .7rem; }
.preview-article h3 { font-size: 1.2rem; margin: 1.6rem 0 .5rem; }
.preview-article a { color: #6a3aa0; }
.preview-article img { max-width: 100%; border-radius: 14px; }
.preview-article blockquote { margin: 1.4rem 0; padding: 12px 20px; border-left: 4px solid #e0a83e; background: #fff; font-style: italic; }

@media (max-width: 960px) {
  .editor-grid { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .paper .ql-editor { padding: 20px 18px 36px; }
  .paper .ql-editor.ql-blank::before { left: 18px; }
}
@media (max-width: 600px) {
  .content { padding: 16px; }
  .topbar-email { display: none; }
  .post-row { grid-template-columns: 64px 1fr; }
  .post-thumb { width: 64px; height: 44px; }
  .post-row-right { grid-column: 2; align-items: flex-start; flex-direction: row; }
}
