/* Blog editor extras: subtitle field, word count, more menu and dialogs. */

#subtitleInput {
  outline: none; margin-top: 6px; min-height: 1.4em;
  font: 400 clamp(18px, 3vw, 22px)/1.4 var(--font-sans);
  color: var(--fg-muted); caret-color: var(--fg);
}
#subtitleInput:empty::before { content: attr(data-placeholder); opacity: .35; pointer-events: none; }

.ex-stat { margin-left: auto; padding-right: 12px; font: 400 12.5px var(--font-sans); color: var(--fg-muted); white-space: nowrap; }

.ex-more { position: relative; display: inline-flex; }
.ex-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 120; min-width: 240px; padding: 6px 0;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.28);
}
.ex-menu[hidden] { display: none; }
.ex-menu button { display: block; width: 100%; padding: 9px 16px; text-align: left; background: none; border: 0; cursor: pointer; font: 400 14px var(--font-sans); color: var(--fg); }
.ex-menu button:hover, .ex-menu button:focus-visible { background: var(--accent-soft); outline: none; }
.ex-menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }

.ex-modal { position: fixed; inset: 0; z-index: 310; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; background: rgba(0,0,0,.5); }
.ex-card { width: min(520px, 100%); max-height: 84vh; overflow: auto; background: var(--bg); color: var(--fg); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 48px rgba(0,0,0,.4); }
.ex-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 8px; }
.ex-head h3 { margin: 0; font: 600 16px var(--font-sans); }
.ex-close { background: none; border: 0; font-size: 24px; line-height: 1; color: var(--fg-muted); cursor: pointer; }
.ex-close:hover { color: var(--fg); }
.ex-body { padding: 4px 20px 20px; }
.ex-body h4 { margin: 18px 0 8px; font: 600 11.5px var(--font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--fg-muted); }
.ex-note { margin: 12px 0 0; font: 400 13px/1.5 var(--font-sans); color: var(--fg-muted); }

.ex-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--border); font: 400 14px var(--font-sans); }
.ex-row kbd { padding: 2px 8px; border: 1px solid var(--border); border-radius: 6px; font: 500 12.5px var(--font-mono); white-space: pre; }

.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 8px; }
.ex-thumb { padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--border); aspect-ratio: 4 / 3; }
.ex-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ex-thumb.on { border-color: var(--accent); }
.ex-thumb:hover { border-color: var(--fg-muted); }

.ex-rev { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.ex-rev strong { display: block; font: 600 14px var(--font-sans); }
.ex-rev small { display: block; margin-top: 2px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 12.5px var(--font-sans); color: var(--fg-muted); }
.ex-rev button { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: none; color: var(--fg); font: 500 13px var(--font-sans); cursor: pointer; }
.ex-rev button:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 700px) { .ex-stat { display: none; } }

/* image tools */
.ex-imgtools {
  position: fixed; z-index: 130; display: flex; align-items: center; gap: 2px; padding: 5px 6px;
  background: #1c1c1c; color: #fff; border-radius: 8px; box-shadow: 0 6px 22px rgba(0,0,0,.35);
}
.ex-imgtools::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; margin-left: -6px; background: #1c1c1c; transform: rotate(45deg); }
.ex-imgtools button { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: #bbb; cursor: pointer; font: 500 13px var(--font-sans); }
.ex-imgtools button:hover { color: #fff; background: rgba(255,255,255,.1); }
.ex-imgtools button.on { color: #fff; }
.ex-imgtools button.alt { padding: 0 12px; }
.ex-imgtools .sep { width: 1px; height: 20px; margin: 0 6px; background: rgba(255,255,255,.25); }

#bodyEditor figure.img-fig { margin: 28px auto; }
#bodyEditor figure.img-fig img { display: block; max-width: 100%; margin: 0 auto; cursor: pointer; }
#bodyEditor figure.img-fig[data-size="outset"] { width: min(920px, calc(100vw - 48px)); max-width: none; position: relative; left: 50%; transform: translateX(-50%); }
#bodyEditor figure.img-fig[data-size="fill"] { width: 100vw; max-width: none; position: relative; left: 50%; transform: translateX(-50%); }
#bodyEditor figure.img-fig[data-size="fill"] img { border-radius: 0; width: 100%; }
#bodyEditor figure.img-fig[data-size="outset"] img { width: 100%; }
#bodyEditor figure.img-fig figcaption { width: fit-content; max-width: 100%; min-width: 2px; min-height: 1.5em; margin: 10px auto 0; text-align: center; outline: none; font: 400 14px/1.5 var(--font-sans); color: var(--fg-muted); }
#bodyEditor figure.img-fig figcaption:empty { display: none; text-align: left; }
#bodyEditor figure.img-fig.is-active figcaption:empty { display: block; }
#bodyEditor figure.img-fig figcaption:empty::before { content: 'Type caption for image (optional)'; opacity: .55; pointer-events: none; }

/* the text formatting bar stays out of the way while an image is selected */
body.ex-img-active #toolbar { display: none !important; }

.ex-field { display: block; margin-top: 14px; }
.ex-field span { display: block; margin-bottom: 6px; font: 600 12.5px var(--font-sans); color: var(--fg-muted); }
.ex-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 12px; }
.ex-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--fg); font: 500 13.5px var(--font-sans); }
.ex-chip button { width: 20px; height: 20px; border: 0; border-radius: 50%; background: none; color: var(--fg-muted); cursor: pointer; font-size: 16px; line-height: 1; }
.ex-chip button:hover { color: var(--fg); background: rgba(127,127,127,.2); }
.ex-switch { display: flex; align-items: flex-start; gap: 12px; margin-top: 14px; cursor: pointer; }
.ex-switch input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.ex-switch strong { display: block; font: 600 14.5px var(--font-sans); }
.ex-switch small { display: block; margin-top: 3px; font: 400 13px/1.45 var(--font-sans); color: var(--fg-muted); }
.ex-alt-pic { display: block; max-width: 220px; max-height: 160px; margin: 14px auto; border-radius: 4px; }
.ex-alt-input { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--fg); font: 400 14px var(--font-sans); outline: none; }
.ex-alt-input:focus { border-color: var(--accent); }
.ex-alt-actions { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.ex-alt-actions button { padding: 7px 18px; border: 1px solid var(--border); border-radius: 999px; background: none; color: var(--fg); font: 500 13.5px var(--font-sans); cursor: pointer; }
.ex-alt-save { border-color: var(--fg) !important; }
.ex-alt-actions button:hover { border-color: var(--accent); color: var(--accent); }
