:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elevated: #f7f7fb;
  --bg-soft: #f1f1f9;
  --border: #e7e7f1;
  --text: #14162b;
  --text-dim: #6b7089;
  --accent: #6d5ef8;
  --accent-2: #8f6ffb;
  --accent-ink: #ffffff;
  --max-width: 1160px;
  --radius: 16px;
  --shadow: 0 10px 30px -14px rgba(20, 22, 43, 0.18);
  --shadow-hover: 0 18px 40px -16px rgba(20, 22, 43, 0.24);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.site-logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}
.site-logo span { color: var(--accent); }
.site-nav { display: flex; align-items: center; gap: 28px; }
.site-nav a { color: var(--text-dim); font-weight: 600; font-size: 0.92rem; }
.site-nav a:hover { color: var(--text); text-decoration: none; }

/* Ad slots */
.ad-slot {
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.ad-slot--header { margin: 20px auto 0; max-width: var(--max-width); min-height: 90px; }
.ad-slot--sidebar { min-height: 250px; margin-bottom: 24px; }
.ad-slot--in-article { min-height: 120px; margin: 32px 0; }

/* Hero */
.hero { padding: 72px 0 56px; text-align: center; }
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 22px;
}
.hero-eyebrow::before { content: ""; width: 28px; height: 1px; background: var(--accent); display: inline-block; }
.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
}
.hero-title .accent-text {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-subtitle {
  color: var(--text-dim);
  font-size: 1.12rem;
  max-width: 620px;
  margin: 0 auto;
}

/* Layout */
.page { padding: 8px 0 60px; }
.layout { display: grid; grid-template-columns: 1fr 300px; gap: 44px; align-items: start; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
}

/* Post grid */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
@media (max-width: 980px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .post-grid { grid-template-columns: 1fr; }
}
.post-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.post-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }
.post-card__thumb {
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;
  background: var(--bg-soft);
}
.post-card__body { padding: 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-card__title { font-size: 1.2rem; font-weight: 700; line-height: 1.35; margin: 0; }
.post-card__title a { color: var(--text); }
.post-card__title a:hover { color: var(--accent); text-decoration: none; }
.post-card__excerpt {
  color: var(--text-dim);
  font-size: 0.93rem;
  margin: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card__date { color: var(--text-dim); font-size: 0.78rem; font-weight: 600; }

/* Pagination */
.pagination { display: flex; gap: 10px; justify-content: center; margin-top: 48px; }
.pagination a, .pagination span {
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}
.pagination .current { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Post page */
.post-header { margin-bottom: 24px; }
.post-title { font-size: 2.2rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 10px; }
.post-meta { color: var(--text-dim); font-size: 0.85rem; font-weight: 600; }
.post-thumb { width: 100%; border-radius: var(--radius); margin: 20px 0; box-shadow: var(--shadow); }
.post-content { font-size: 1.08rem; }
.post-content h2, .post-content h3 { margin-top: 1.6em; letter-spacing: -0.01em; }
.post-content img { border-radius: 12px; margin: 16px 0; }
.post-content pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  overflow-x: auto;
}
.post-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 20px 0;
  padding: 4px 16px;
  color: var(--text-dim);
}

/* Sidebar */
.sidebar-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}
.sidebar-box h3 { margin-top: 0; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.sidebar-box ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  color: var(--text-dim);
  font-size: 0.85rem;
  text-align: center;
}

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-dim); }

/* ============ Admin (kept dark, scoped independently of the public theme) ============ */
body.admin {
  --bg: #0d1117;
  --bg-elevated: #121623;
  --bg-soft: #171d2c;
  --border: #232a3b;
  --text: #e7e9ee;
  --text-dim: #9aa3b5;
  --accent: #6ea8fe;
  --accent-2: #7ef0c0;
  --accent-ink: #06121f;
  --radius: 10px;
  --shadow: none;
  background: var(--bg);
}
.admin-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.admin-header .container { display: flex; justify-content: space-between; align-items: center; }
.admin-header a.brand { font-weight: 800; color: var(--text); font-size: 1.1rem; }
.admin-wrap { max-width: 960px; margin: 0 auto; padding: 32px 20px; }
.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.92rem;
}
.btn:hover { opacity: 0.9; text-decoration: none; }
.btn.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.danger { background: #ef5c5c; color: #2a0a0a; }
.btn.small { padding: 6px 12px; font-size: 0.82rem; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; color: var(--text); }
.form-group input[type=text], .form-group input[type=email], .form-group input[type=password],
.form-group textarea, .form-group select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}
.form-group textarea { resize: vertical; }
.hint { color: var(--text-dim); font-size: 0.8rem; margin-top: 4px; }
.error-banner {
  background: #3a1414;
  border: 1px solid #ef5c5c;
  color: #ffb3b3;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
}
.success-banner {
  background: #123a22;
  border: 1px solid #7ef0c0;
  color: #b6ffe0;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
}
.login-box {
  max-width: 380px;
  margin: 90px auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.login-box h1 { font-size: 1.3rem; margin-top: 0; color: var(--text); }

table.posts-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
table.posts-table th, table.posts-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
  color: var(--text);
}
.badge { padding: 3px 9px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.badge.published { background: #123a22; color: #7ef0c0; }
.badge.draft { background: #3a3212; color: #f0d97e; }
.actions-row { display: flex; gap: 8px; }

.thumb-preview { width: 160px; border-radius: 8px; margin-top: 8px; border: 1px solid var(--border); }

#editor {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  min-height: 380px;
  color: var(--text);
}
.ql-toolbar.ql-snow {
  border: 1px solid var(--border) !important;
  border-radius: 8px 8px 0 0;
  background: var(--bg-soft);
}
.ql-snow .ql-stroke { stroke: var(--text-dim); }
.ql-snow .ql-fill { fill: var(--text-dim); }
.ql-snow .ql-picker { color: var(--text-dim); }
.ql-editor { min-height: 380px; }
