/* ============================================================
   Editor — note風の記事エディタ
   ============================================================ */

:root {
  --n-text: #08131a;
  --n-text-sub: #757575;
  --n-line: #e6e6e6;
  --n-bg: #ffffff;
  --n-bg-soft: #f5f5f5;
  --n-placeholder: #b8b8b8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--n-bg);
  color: var(--n-text);
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- top bar ---------- */

.ed-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 56px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--n-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.ed-close {
  font-size: 14px;
  color: var(--n-text);
  text-decoration: none;
  font-weight: 600;
}

.ed-close:hover { color: var(--n-text-sub); }

.ed-topbar-right { display: flex; align-items: center; gap: 12px; }

.ed-charcount { font-size: 13px; color: var(--n-text-sub); margin-right: 6px; }

.ed-btn {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--n-line);
  background: #fff;
  color: var(--n-text);
  cursor: pointer;
  transition: border-color 0.15s, opacity 0.15s;
}

.ed-btn:hover { border-color: var(--n-text); }

.ed-btn-primary {
  background: var(--n-text);
  border-color: var(--n-text);
  color: #fff;
}

.ed-btn-primary:hover { opacity: 0.82; border-color: var(--n-text); }

/* ---------- layout ---------- */

.ed-layout { display: flex; min-height: calc(100vh - 56px); }

.ed-sidebar {
  width: 300px;
  flex: none;
  border-right: 1px solid var(--n-line);
  padding: 28px 24px;
}

.ed-toc-title { font-size: 15px; font-weight: 800; margin-bottom: 18px; }

.ed-toc-empty { font-size: 13px; color: var(--n-text-sub); }

.ed-toc a {
  display: block;
  font-size: 13.5px;
  color: var(--n-text-sub);
  text-decoration: none;
  padding: 6px 0;
  line-height: 1.5;
}

.ed-toc a:hover { color: var(--n-text); }

.ed-toc a.toc-h3 { padding-left: 16px; font-size: 12.5px; }

.ed-main {
  flex: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 40px 120px;
}

/* ---------- title ---------- */

.ed-title {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 32px;
  font-weight: 800;
  line-height: 1.5;
  color: var(--n-text);
  margin-bottom: 28px;
  overflow: hidden;
}

.ed-title::placeholder { color: var(--n-placeholder); }

/* ---------- body ---------- */

.ed-body-area { position: relative; display: flex; gap: 14px; }

.ed-plus-wrap { position: relative; flex: none; padding-top: 2px; }

.ed-plus {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--n-line);
  background: #fff;
  color: var(--n-text-sub);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.ed-plus:hover { border-color: var(--n-text); color: var(--n-text); }

.ed-plus.open { transform: rotate(45deg); }

.ed-plus-menu {
  position: absolute;
  top: 48px;
  left: 0;
  z-index: 40;
  background: #fff;
  border: 1px solid var(--n-line);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  padding: 6px;
  width: 170px;
}

.ed-plus-menu button {
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 13.5px;
  padding: 9px 12px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  color: var(--n-text);
}

.ed-plus-menu button:hover { background: var(--n-bg-soft); }

.ed-body {
  flex: 1;
  min-height: 55vh;
  outline: none;
  font-size: 16.5px;
  line-height: 2.0;
  letter-spacing: 0.02em;
}

.ed-body.empty::before {
  content: attr(data-placeholder);
  color: var(--n-placeholder);
  pointer-events: none;
  position: absolute;
}

.ed-body p, .ed-body div { margin: 0 0 1.2em; }

.ed-body h2 {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.6;
  margin: 1.6em 0 0.7em;
}

.ed-body h3 { font-size: 18px; font-weight: 700; margin: 1.4em 0 0.6em; }

.ed-body blockquote {
  border-left: 3px solid #d0d0d0;
  padding-left: 18px;
  color: #555;
  margin: 0 0 1.2em;
}

.ed-body ul, .ed-body ol { margin: 0 0 1.2em; padding-left: 1.5em; }

.ed-body img { max-width: 100%; border-radius: 8px; margin: 0.4em 0 1.2em; display: block; }

.ed-body pre {
  background: #f4f4f4;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13.5px;
  font-family: Consolas, "Courier New", monospace;
  white-space: pre-wrap;
  margin: 0 0 1.2em;
}

.ed-body hr { border: none; border-top: 1px solid var(--n-line); margin: 2em 0; }

.ed-body a { color: #0f83fd; }

/* ---------- modal ---------- */

.ed-modal-overlay[hidden] { display: none; }

.ed-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(8, 19, 26, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ed-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 460px;
  padding: 28px 28px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.ed-modal-title { font-size: 18px; font-weight: 800; margin-bottom: 20px; }

.ed-field { display: block; margin-bottom: 14px; }

.ed-field span {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--n-text-sub);
  margin-bottom: 6px;
}

.ed-field input {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--n-line);
  border-radius: 8px;
  outline: none;
}

.ed-field input:focus { border-color: var(--n-text); }

.ed-modal-note {
  font-size: 12.5px;
  color: var(--n-text-sub);
  line-height: 1.7;
  background: var(--n-bg-soft);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 16px 0;
}

.ed-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

.ed-field input[type="file"] {
  border: 1px dashed var(--n-line);
  background: var(--n-bg-soft);
  font-size: 13px;
  cursor: pointer;
}

.ed-eyecatch-preview {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 8px;
  margin: -4px 0 14px;
  border: 1px solid var(--n-line);
}

.ed-login-error {
  font-size: 13px;
  font-weight: 700;
  color: #e0245e;
  margin: -6px 0 10px;
}

.ed-btn.admin-on {
  border-color: #12b886;
  color: #12b886;
}

/* ---------- toast ---------- */

.ed-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: var(--n-text);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 22px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .ed-sidebar { display: none; }
  .ed-main { padding: 32px 20px 100px; }
  .ed-title { font-size: 26px; }
}
