/* Production writing workspace styles. Deep-sea dark, warm amber, compact Markdown layout. */

body { font-variant-numeric: tabular-nums; }

/* ---- The article index: a readme-style table, no card, no banner ---- */
.list-tools,
.metrics-row {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.metrics {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  color: var(--faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.metrics strong {
  color: var(--text);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  margin-right: 1px;
}
.metrics-dot { color: rgba(230, 236, 242, 0.2); }
.metrics .list-count { margin-left: 8px; }
.tools-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.search-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 230px;
  margin: 0;
}
.search-field svg {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--faint);
  pointer-events: none;
}
.tools-right .search-field input,
.tools-right select { margin: 0; }
.search-field input { padding-left: 33px; font-size: 13px; }
.tools-right select { width: 96px; flex: none; font-size: 13px; }
.article-list { display: grid; }
/* Column labels once, in the muted tone of a table heading. */
.list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  gap: 20px;
  /* The column heading sits on the row's own text edge: one left edge per list. */
  padding: 10px 14px 9px;
  border-bottom: 1px solid var(--border);
  color: var(--faint);
  font-size: 12px;
}
.list-head span:nth-child(2) { display: none; }
.list-head span:last-child { text-align: right; }
/* A row is a small shelf: a warm marker grows from its middle, the row leans right, the
   rest of the list steps back so the eye has exactly one place to land. */
.article-entry {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 20px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--border);
  transition: background 260ms var(--ease-expo), transform 260ms var(--ease-expo), box-shadow 260ms var(--ease-expo);
}
.article-entry::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 2px;
  height: 26px;
  margin-top: -13px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0;
  transform: scaleY(0);
  transform-origin: center;
  transition: transform 260ms var(--ease-expo), opacity 200ms var(--ease);
}
.article-entry:hover,
.article-entry:focus-within {
  background: rgba(223, 170, 115, 0.035);
  transform: translateX(3px);
  box-shadow: inset 0 -1px 0 rgba(230, 236, 242, 0.03);
}
.article-entry:hover::before,
.article-entry:focus-within::before { opacity: 1; transform: scaleY(1); }
@media (hover: hover) and (pointer: fine) {
  .article-list:hover .article-entry:not(:hover) { opacity: 0.78; transition: opacity 200ms var(--ease-expo), background 260ms var(--ease-expo), transform 260ms var(--ease-expo); }
}
.entry-body { min-width: 0; position: relative; z-index: 1; }
.entry-title { font-family: var(--serif); font-weight: 600; font-size: 15.5px; letter-spacing: 0; }
.entry-top {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}
.entry-title {
  min-width: 0;
  font-family: var(--serif);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-align: left;
  background: none;
  border: 0;
  color: var(--text);
  padding: 0;
  min-height: auto;
  line-height: 1.55;
  overflow-wrap: anywhere;
  transition: color 200ms var(--ease-expo);
}
.entry-title::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.entry-title:hover { color: var(--accent); }
.entry-top, .entry-meta { position: relative; z-index: 1; pointer-events: none; }
.entry-title { pointer-events: auto; }
.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 3px 0 0;
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.entry-meta .sep { color: rgba(230, 236, 242, 0.18); }
.entry-controls {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
}
.entry-controls a { text-decoration: none; }
/* A permanent delete stays quiet until the row is under the pointer: an active
   list should never read as a wall of red controls. */
.entry-controls .subtle {
  padding: 5px 10px;
  min-height: 30px;
  font-size: 13px;
  color: rgba(230, 236, 242, 0.5);
  border-radius: var(--radius-ui);
  transition: color 140ms, background 140ms;
}
.entry-controls .subtle:hover { color: var(--text); }
.entry-controls .subtle.danger { color: rgba(232, 169, 169, 0.62); }
.entry-controls .subtle.danger:hover,
.entry-controls .subtle.danger:focus-visible { color: var(--negative); background: rgba(232, 169, 169, 0.08); }

/* Status words: type, not pills */
.status-tag {
  flex: none;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.4;
}
.status-published { color: #93b9a1; }
.status-draft { color: #cf9b63; }
.status-archived { color: var(--faint); }

/* ---- Markdown writing workspace ----
   The writer shares the shell's one page axis: `.studio-shell-inner` widens to
   1360px in focus mode, so the editor's toolbar and its columns start on the
   very same left edge as every other screen's title. No width of its own. */
.view-posts { min-width: 0; }
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 36px;
  padding-bottom: 12px;
  margin-bottom: 6px;
}
.editor-toolbar .back {
  min-height: 30px;
  padding: 0 6px 0 0;
  border: 0;
  background: none;
  color: var(--faint);
  font-size: 13px;
  border-radius: var(--radius-ui);
}
.editor-toolbar .back:hover { color: var(--text); }
.toolbar-spacer { flex: 1; }
.editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.editor-actions button { min-height: 34px; padding: 5px 14px; font-size: 13px; }
.writer-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 12px;
  color: var(--faint);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.writer-status::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--positive);
  flex: none;
  transition: background 160ms;
}
.writer-status[data-state="dirty"] { color: var(--accent); }
.writer-status[data-state="dirty"]::before { background: var(--accent); }
.writer-status[data-state="saving"]::before { background: #bdc8d2; }
.writer-status[data-state="error"] { color: var(--negative); }
.writer-status[data-state="error"]::before { background: var(--negative); }

/* Title and the one-line property strip */
.writing-meta { margin: 0 0 14px; }
.title-field {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.title-input {
  width: 100%;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--control-border);
  border-radius: 0;
  box-shadow: none;
  padding: 6px 0 12px;
  margin: 0;
  min-height: auto;
  line-height: 1.35;
  outline: 0;
  transition: border-color 220ms var(--ease-expo);
}
.title-input:hover { border-bottom-color: var(--control-border-hover); background: transparent; box-shadow: none; }
.title-input:focus { border-bottom-color: var(--accent); box-shadow: none; background: transparent; }
.title-input::placeholder { color: var(--faint); font-weight: 500; }
.writing-secondary {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(220px, 1fr) auto;
  gap: 12px;
  margin-top: 12px;
  align-items: end;
}
/* Collapsed: the summary button sits on the same baseline as the two labelled
   inputs beside it. Open: the panel leaves the third column behind and spans the
   whole strip, so its fields keep full width and line up with the title above
   and the editor below. */
.writing-secondary:has(> .advanced[open]) { align-items: start; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); }
.writing-secondary > .advanced[open] { grid-column: 1 / -1; }
.secondary-field { font-size: 12px; font-weight: 400; color: var(--faint); }
.secondary-field input,
.secondary-field select { margin-top: 4px; min-height: 34px; padding: 5px 10px; font-size: 13px; }
.writing-secondary .field-help { display: none; }
.advanced {
  border: 1px solid var(--control-border);
  border-radius: var(--radius-ui);
  background: transparent;
  min-width: 0;
}
.advanced summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  list-style: none;
  white-space: nowrap;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-1px); transition: transform 280ms var(--ease-overshoot); }
.advanced[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.advanced summary:hover { color: var(--text); }
.advanced[open] > summary { color: var(--text); }
.writing-secondary .advanced summary { margin-top: 0; }
.writing-secondary .advanced { align-self: start; }
.writing-secondary .advanced-inner { margin-top: 0; border-top: 1px solid var(--border); }
.advanced-inner {
  padding: 14px;
  background: rgba(8, 14, 21, 0.42);
  border-radius: 0 0 var(--radius-ui) var(--radius-ui);
}
.advanced[open] > .advanced-inner { animation: drawer-open 280ms var(--ease-expo) both; }
.advanced-inner label { margin: 0; }
.detail .advanced { margin-top: 2px; }
/* One disclosure, one flat grid: the advanced panel reads top to bottom with
   no second fold. The quiet rule names the optional group instead. */
.advanced-full { display: block; min-width: 0; margin: 0 0 14px; }
.advanced-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 10px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}
.advanced-section-label::after {
  content: "";
  flex: 1;
  height: 0;
  border-bottom: 1px solid var(--border);
  opacity: 0.75;
}

/* Writing space (split / write / preview) */
.writing-space {
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--panel);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.writing-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(20, 31, 42, 0.55), rgba(15, 24, 33, 0));
}
.layout-switch {
  display: inline-flex;
  gap: 1px;
  padding: 2px;
  border-radius: var(--radius-ui);
  background: rgba(230, 236, 242, 0.045);
}
.layout-switch button {
  min-height: 26px;
  padding: 2px 11px;
  font-size: 12px;
  color: var(--faint);
  border: 0;
  background: transparent;
  border-radius: 6px;
  transition: color 180ms var(--ease), background 220ms var(--ease-expo), transform 140ms var(--ease-overshoot);
}
.layout-switch button:hover { color: var(--text); }
.layout-switch button:active:not(:disabled) { transform: scale(0.96); }
.layout-switch button[aria-pressed="true"] { color: var(--text); background: var(--raised); font-weight: 500; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.writing-toolbar .subtle { min-height: 28px; padding: 2px 8px; font-size: 12px; color: var(--faint); }
.writing-toolbar .subtle:hover { color: var(--text); }

.writing-space .editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  transition: grid-template-columns 320ms var(--ease-expo);
}
.writing-space .editor { min-width: 0; }
.writing-space .editor textarea {
  width: 100%;
  height: clamp(400px, 60vh, 780px);
  margin: 0;
  padding: 18px 22px;
  border: 0;
  border-radius: 0;
  background: rgba(8, 14, 21, 0.66);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
  outline: 0;
  resize: vertical;
  color: var(--text);
  font-family: Consolas, "Cascadia Code", "Microsoft YaHei", monospace;
  font-size: 14px;
  line-height: 1.85;
  tab-size: 2;
  caret-color: var(--accent);
  transition: box-shadow 260ms var(--ease-expo), background 260ms var(--ease-expo);
}
.writing-space .editor textarea:hover { border: 0; background: rgba(8, 14, 21, 0.72); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3); }
.writing-space .editor textarea:focus-visible {
  outline: 0;
  box-shadow: inset 0 0 0 1px rgba(228, 178, 123, 0.4), inset 0 1px 2px rgba(0, 0, 0, 0.24), 0 0 0 1px rgba(228, 178, 123, 0.22);
}
.writing-space .editor.preview-panel {
  border-left: 1px solid var(--border);
  background: radial-gradient(70% 30% at 20% 0%, rgba(223, 170, 115, 0.03), transparent 70%), var(--panel);
  display: flex;
  flex-direction: column;
}
.preview-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 400;
  color: var(--faint);
}
.preview-heading small { font-size: 12px; color: var(--faint); }
.writing-space .md-preview {
  height: clamp(400px, 60vh, 780px);
  padding: 18px 22px;
  overflow: auto;
  line-height: 1.85;
  color: var(--text);
}
.writing-space .md-preview h1,
.writing-space .md-preview h2,
.writing-space .md-preview h3 {
  margin-top: 1.2em;
  margin-bottom: 0.6em;
  color: var(--text);
}
.writing-space .md-preview p { margin: 0.8em 0; }
/* Same emphasis rule as the published article: weight plus warm accent, so the
   preview shows exactly how a **bold** run will read on the site. */
.writing-space .md-preview strong,
.writing-space .md-preview b { font-weight: 700; color: var(--accent); }
.writing-space .md-preview a { color: var(--accent); }
.writing-space .md-preview code {
  font-family: Consolas, monospace;
  background: var(--raised);
  padding: 2px 6px;
  border-radius: 6px;
  color: #d1dbe2;
}
.writing-space .md-preview pre {
  background: var(--input);
  padding: 12px;
  border-radius: var(--radius-ui);
  overflow-x: auto;
  border: 1px solid var(--border);
}
.writing-space .md-preview pre code { background: transparent; padding: 0; }
.writing-space .md-preview blockquote {
  border-left: 2px solid rgba(228, 178, 123, 0.5);
  margin: 1em 0;
  padding-left: 14px;
  color: var(--muted);
}

/* Layout modes */
.writing-space[data-layout="write"] .editor-grid { grid-template-columns: minmax(0, 1fr); }
.writing-space[data-layout="write"] .preview-panel { display: none; }
.writing-space[data-layout="write"] .editor textarea { padding-inline: clamp(24px, 7vw, 96px); }
.writing-space[data-layout="preview"] .editor-grid { grid-template-columns: minmax(0, 1fr); }
.writing-space[data-layout="preview"] .editor-grid > .editor:first-child { display: none; }
.writing-space[data-layout="preview"] .editor.preview-panel { border-left: 0; animation: panel-arrive 280ms var(--ease-expo) both; }
.writing-space[data-layout="preview"] .md-preview { max-width: 720px; margin: 0 auto; }
.writing-space[data-layout="split"] .editor.preview-panel { animation: panel-arrive 280ms var(--ease-expo) both; }
@keyframes panel-arrive { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* One quiet status row closes the writing surface */
.writing-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 9px 16px 9px 20px;
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  border-top: 1px solid var(--border);
}
.status-left { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; }
.status-sep { width: 3px; height: 3px; border-radius: 50%; background: rgba(230, 236, 242, 0.22); }
.writing-statusbar #archive-post,
.writing-statusbar #delete-post { min-height: 26px; padding: 2px 8px; font-size: 12px; color: var(--faint); }
.writing-statusbar #archive-post:hover:not(:disabled),
.writing-statusbar #delete-post:hover:not(:disabled) { color: var(--negative); background: rgba(232, 169, 169, 0.08); }
.writing-statusbar #archive-post:disabled,
.writing-statusbar #delete-post:disabled { color: rgba(230, 236, 242, 0.2); background: none; }

/* ---- Columns: the card gallery lives in admin.css; the modal owns the form ---- */
.cover-line { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.cover-line-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.cover-thumb { width: 128px; height: 40px; flex: none; border-radius: var(--radius-ui); overflow: hidden; border: 1px dashed var(--line-hover); background: var(--surface); display: grid; place-items: center; color: var(--faint); font-size: 11px; }
.cover-thumb:empty::after { content: "无封面"; }
.cover-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- Comments inbox: one toolbar, then the list ---- */
.inbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.inbox-bar select { width: 122px; margin: 0; font-size: 13px; }
.inbox-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inbox-sep { width: 1px; height: 14px; background: var(--border); flex: none; }
.comment-list { display: grid; gap: 2px; }
.comment-list .comment-item { position: relative; padding-left: 14px; padding-right: 12px; border-top: 0; border-bottom: 1px solid var(--border); border-radius: 6px; transition: background 260ms var(--ease-expo), transform 260ms var(--ease-expo), opacity 200ms var(--ease-expo); }
.comment-list .comment-item::before { content: ""; position: absolute; left: 0; top: 16px; width: 2px; height: 24px; border-radius: 2px; background: var(--accent); opacity: 0; transform: scaleY(0); transform-origin: center; transition: transform 260ms var(--ease-expo), opacity 200ms var(--ease); }
.comment-list .comment-item:hover { background: rgba(223, 170, 115, 0.032); transform: translateX(3px); }
.comment-list .comment-item:hover::before { opacity: 1; transform: scaleY(1); }
@media (hover: hover) and (pointer: fine) {
  .comment-list:hover .comment-item:not(:hover) { opacity: 0.78; }
}
.comment-list .comment-item p { max-width: 68ch; }
.comment-list .comment-item small { font-variant-numeric: tabular-nums; }

/* Responsive adjustments */
@media (max-width: 1180px) {
  .writing-secondary { grid-template-columns: minmax(150px, 200px) minmax(0, 1fr); }
  .writing-secondary .advanced { grid-column: 1 / -1; justify-self: start; }
  .writing-secondary > .advanced[open] { justify-self: stretch; }
}
@media (max-width: 900px) {
  .cover-grid { grid-template-columns: minmax(0, 1fr); }
  .advanced-inner .fields.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .advanced-inner .fields.four { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 768px) {
  .writing-space .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .writing-space .editor.preview-panel { border-left: 0; border-top: 1px solid var(--border); }
  .writing-space .editor textarea,
  .writing-space .md-preview { height: auto; min-height: 300px; }
}
@media (max-width: 640px) {
  .list-tools { flex-direction: column; align-items: stretch; gap: 12px; }
  .tools-right { flex-wrap: wrap; }
  .search-field { width: 100%; flex: 1; }
  .tools-right select { width: 116px; }
  .article-entry { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .entry-controls { margin-left: -10px; }
  .entry-controls .subtle { min-height: 36px; display: inline-flex; align-items: center; }
  .writing-secondary { grid-template-columns: minmax(0, 1fr); }
  .title-input { font-size: 21px; }
  .editor-toolbar { flex-wrap: wrap; gap: 10px; }
  .editor-toolbar .writer-status { order: 3; width: 100%; margin-left: 0; }
  .editor-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .editor-actions button { min-height: 40px; justify-content: center; }
  .writing-toolbar { flex-wrap: wrap; }
  .writing-toolbar .inline { justify-content: space-between; }
  .writing-space .editor textarea { padding: 14px; font-size: 16px; min-height: 260px; }
  .writing-space .md-preview { padding: 14px; min-height: 260px; }
  .inbox-bar { align-items: stretch; }
  .inbox-bar .inline { width: 100%; }
  .inbox-bar .inline select { min-width: 0; }
  .inbox-tools { justify-content: space-between; width: 100%; }
  .comment-item button { min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .article-entry, .article-list:hover .article-entry:not(:hover),
  .comment-list .comment-item, .comment-list:hover .comment-item:not(:hover) { opacity: 1 !important; transform: none !important; }
}

/* .nav is display:flex and outranks a bare class, so the visually hidden label
   helper has to win here too: 写文章 keeps ONE visible line beside its icon. */
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip-path: inset(50%) !important; white-space: nowrap !important; border: 0 !important; }
