/* ──────────────────────────────────────────────
   Blog styles — listing, post, and admin editor
   ────────────────────────────────────────────── */

/* ── Blog listing ──────────────────────────── */
.blog-header {
  padding-top: 120px;
  padding-bottom: 32px;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  padding-bottom: 80px;
}

.blog-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid rgba(94, 122, 176, 0.24);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: inherit;
  transition: transform 0.28s ease, border-color 0.28s ease;
}

.blog-card:hover {
  transform: translateY(-5px);
  border-color: rgba(65, 110, 197, 0.4);
}

.blog-card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.blog-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.blog-card-date {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.blog-card-title {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.3;
}

.blog-card-excerpt {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.blog-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* ── Single post ───────────────────────────── */
.post-hero {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: 32px;
}

.post-meta {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.post-title {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 32px;
}

.post-body {
  max-width: 72ch;
  font-size: clamp(1.02rem, 1.3vw, 1.12rem);
  line-height: 1.8;
  color: #2f4772;
}

.post-body h2 {
  margin: 2em 0 0.6em;
  font-size: 1.5rem;
}

.post-body h3 {
  margin: 1.8em 0 0.5em;
  font-size: 1.22rem;
}

.post-body p {
  margin: 0 0 1.2em;
}

.post-body img {
  max-width: 100%;
  border-radius: var(--radius-md);
  margin: 1.6em 0;
}

.post-body blockquote {
  margin: 1.4em 0;
  padding: 0.6em 1.2em;
  border-left: 4px solid var(--electric-blue);
  background: rgba(49, 107, 255, 0.06);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: #1f3971;
}

.post-body pre {
  margin: 1.4em 0;
  padding: 1em 1.2em;
  background: #1b2540;
  color: #c8d8f4;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 0.92rem;
  line-height: 1.6;
}

.post-body code {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 0.9em;
}

.post-body :not(pre) > code {
  background: rgba(49, 107, 255, 0.08);
  padding: 0.15em 0.4em;
  border-radius: 6px;
}

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

.post-body li {
  margin-bottom: 0.4em;
}

.post-body a {
  color: var(--electric-blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.post-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.post-back:hover {
  color: var(--text);
}

/* ── Admin ─────────────────────────────────── */
.admin-wrap {
  padding-top: 100px;
  padding-bottom: 60px;
  min-height: 100vh;
}

.admin-login {
  max-width: 380px;
  margin: 80px auto 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-login input {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface-strong);
  color: var(--text);
}

.admin-login .btn {
  margin-top: 4px;
}

.admin-login .login-error {
  color: #c0392b;
  font-size: 0.9rem;
}

/* Dashboard */
.admin-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

.admin-table th {
  font-weight: 620;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.admin-table a {
  color: var(--electric-blue);
  text-decoration: none;
}

.admin-table a:hover {
  text-decoration: underline;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.published {
  background: #27ae60;
}

.status-dot.draft {
  background: #bdc3c7;
}

/* Editor form */
.editor-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.editor-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 620;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.editor-field input,
.editor-field textarea,
.editor-field select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface-strong);
  color: var(--text);
}

.editor-field textarea {
  min-height: 80px;
  resize: vertical;
}

.hero-preview {
  max-width: 480px;
  border-radius: var(--radius-md);
  margin-top: 8px;
}

.editor-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 8px;
}

.btn-danger {
  color: #fff;
  background: #c0392b;
  border: 0;
  cursor: pointer;
}

.btn-danger:hover {
  background: #a93226;
}

/* Quill overrides to match site theme */
.ql-toolbar.ql-snow {
  border-color: var(--line) !important;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--surface-strong);
}

.ql-container.ql-snow {
  border-color: var(--line) !important;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-family: inherit;
  font-size: 1.05rem;
  line-height: 1.7;
  min-height: 320px;
  background: var(--surface-strong);
  color: var(--text);
}

.ql-editor {
  min-height: 320px;
}

.ql-editor img {
  max-width: 100%;
  border-radius: var(--radius-md);
}

/* Responsive */
@media (max-width: 620px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }

  .admin-bar {
    flex-direction: column;
    align-items: stretch;
  }
}
