/* ==========================================================================
   Kernel — base theme (dev / tech blog)
   ========================================================================== */

:root {
  --bg: #0f1115;
  --bg-alt: #171a21;
  --bg-card: #14161c;
  --border: #262b35;
  --text: #e4e7ec;
  --text-dim: #9aa3b2;
  --text-dimmer: #5b6270;
  --accent: #3ddc84;
  --accent-bright: #58e89c;
  --accent-2: #c65de0;
  --accent-2-bright: #d685ec;
  --accent-text: #06170e;

  --container-width: 800px;
  --radius: 8px;
  --radius-lg: 14px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'Cascadia Code', Consolas, 'SF Mono', 'Fira Code', monospace;
}

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

body {
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(61, 220, 132, 0.08), transparent 60%),
    radial-gradient(ellipse 700px 400px at 100% 0%, rgba(198, 93, 224, 0.07), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

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

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

h1, h2, h3 { font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; }

/* Header / Footer
   ========================================================================== */

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 28px 0;
}

/* Hero
   ========================================================================== */

.hero {
  position: relative;
  padding: 100px 24px 84px;
  text-align: center;
  color: #fff;
  background: linear-gradient(135deg, #0d2a1c 0%, #170a24 100%);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  margin-bottom: 56px;
  border-bottom: 1px solid var(--border);
}

.hero.has-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(9, 15, 12, 0.6), rgba(6, 8, 10, 0.88));
}

.hero-content { position: relative; z-index: 1; }

.hero .eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent-bright);
  background: rgba(61, 220, 132, 0.12);
  border: 1px solid rgba(61, 220, 132, 0.35);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 22px;
}

.hero h1 { font-size: clamp(34px, 5vw, 54px); color: #fff; margin-bottom: 14px; }

.hero p {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.82);
  max-width: 560px;
  margin: 0 auto;
}

.site-header .logo {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.site-header .logo:hover { text-decoration: none; color: var(--accent-bright); }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 64px;
  text-align: center;
  color: var(--text-dimmer);
  font-size: 13px;
}

.footer-admin-link { margin-top: 4px; }
.footer-admin-link a { color: inherit; text-decoration: underline; opacity: 0.7; }
.footer-admin-link a:hover { opacity: 1; }

.demo-banner {
  background: var(--accent);
  color: var(--accent-text);
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 16px;
}
.demo-banner a { color: var(--accent-text); text-decoration: underline; }

/* Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 8px 20px -10px rgba(61, 220, 132, 0.55);
}
.btn-primary:hover { background: var(--accent-bright); text-decoration: none; transform: translateY(-1px); }

.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--text-dim); text-decoration: none; }

.btn-block { width: 100%; }

/* Flash messages
   ========================================================================== */

.flash {
  margin: 0 auto 24px;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 14px;
}

.flash-success { background: rgba(61, 220, 132, 0.1); border: 1px solid rgba(61, 220, 132, 0.3); color: var(--accent-bright); }
.flash-error { background: rgba(224, 90, 90, 0.12); border: 1px solid rgba(224, 90, 90, 0.35); color: #f08585; }

/* Tag pills
   ========================================================================== */

.tag-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

.tag-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-2-bright);
  background: rgba(198, 93, 224, 0.12);
  border: 1px solid rgba(198, 93, 224, 0.35);
  padding: 3px 10px;
  border-radius: 999px;
}

/* Post list
   ========================================================================== */

.post-list { display: flex; flex-direction: column; gap: 44px; }

.post-card { display: flex; flex-direction: column; gap: 16px; }

.post-card-thumb {
  display: block;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 12px 28px -16px rgba(0, 0, 0, 0.6);
}

.post-card-thumb img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.post-card:hover .post-card-thumb img { transform: scale(1.045); }

.post-date {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dimmer);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.post-card h2 { font-size: 26px; margin: 6px 0 10px; }
.post-card h2 a { color: var(--text); }
.post-card h2 a:hover { color: var(--accent-bright); text-decoration: none; }

.post-card p { color: var(--text-dim); }

.post-read-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-weight: 700;
  font-size: 14px;
  color: var(--accent-2-bright);
  transition: gap 0.15s ease;
}

.post-read-more:hover { gap: 10px; color: var(--accent-2); text-decoration: none; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-dim);
}

.pagination a { font-weight: 700; color: var(--accent-2-bright); }
.pagination a:hover { color: var(--accent-2); }

/* Single post
   ========================================================================== */

.post-single { margin-top: 56px; }

.post-single h1 { font-size: 38px; margin: 8px 0 24px; }

.post-single-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 16px 32px -18px rgba(0, 0, 0, 0.65);
}

.post-body { font-size: 18px; color: var(--text); }
.post-body p { margin-bottom: 20px; }

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--accent-bright);
  background: rgba(61, 220, 132, 0.12);
  border: 1px solid rgba(61, 220, 132, 0.25);
  border-radius: 4px;
  padding: 2px 6px;
}

.empty-state {
  color: var(--text-dimmer);
  padding: 64px 0;
  text-align: center;
}

/* Forms (auth, admin)
   ========================================================================== */

.auth-section { padding: 64px 0 80px; display: flex; justify-content: center; }

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
}

.auth-card h1 { font-size: 24px; margin-bottom: 6px; text-align: center; }
.auth-subtext { color: var(--text-dim); font-size: 13px; text-align: center; margin-bottom: 24px; }

.demo-login-hint {
  background: rgba(61, 220, 132, 0.1);
  border: 1px solid rgba(61, 220, 132, 0.3);
  color: var(--accent-bright);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 20px;
}

.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-dim);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-ui);
}

.form-group textarea { resize: vertical; }

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

.form-errors {
  background: rgba(224, 90, 90, 0.12);
  border: 1px solid rgba(224, 90, 90, 0.35);
  color: #f08585;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 18px;
}

.form-errors ul { list-style: disc; padding-left: 18px; }

.admin-form-hint {
  font-size: 12px;
  color: var(--text-dimmer);
  margin-top: 6px;
}

.admin-image-preview {
  max-width: 220px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  display: block;
}

/* Admin shell
   ========================================================================== */

.admin-body { font-family: var(--font-ui); }

.admin-shell { display: flex; min-height: 100vh; align-items: flex-start; }

.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.admin-sidebar .logo { margin-bottom: 28px; font-size: 18px; }

.admin-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.admin-nav a {
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
}
.admin-nav a:hover { background: var(--bg-alt); text-decoration: none; }
.admin-nav a.is-active { background: rgba(61, 220, 132, 0.12); color: var(--accent-bright); }

.admin-sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.admin-main { flex: 1; padding: 40px; max-width: 900px; }
.admin-main h1 { font-size: 26px; margin-bottom: 6px; }
.admin-subtext { color: var(--text-dim); margin-bottom: 28px; }

.admin-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.admin-header-row h1 { margin-bottom: 0; }

.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }

.admin-stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.admin-stat-value { display: block; font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.admin-stat-label { font-size: 12px; color: var(--text-dim); }

.admin-quicklinks { display: flex; gap: 10px; flex-wrap: wrap; }

.admin-form { max-width: 600px; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.admin-table th, .admin-table td { padding: 12px 16px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--border); }
.admin-table th { color: var(--text-dimmer); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.admin-table tr:last-child td { border-bottom: none; }

.admin-table-actions { display: flex; gap: 12px; align-items: center; }
.admin-table-actions form { margin: 0; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-draft { background: rgba(154, 163, 178, 0.18); color: var(--text-dim); }
.badge-published { background: rgba(61, 220, 132, 0.15); color: var(--accent-bright); }

.link-danger { background: none; border: none; color: #f08585; font-size: 13px; cursor: pointer; padding: 0; font-family: inherit; }
.link-danger:hover { text-decoration: underline; }

/* Install wizard
   ========================================================================== */

.install-body { display: flex; align-items: flex-start; justify-content: center; padding: 60px 20px; font-family: var(--font-ui); }

.install-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
}

.install-card h1 { font-family: var(--font-mono); font-size: 24px; margin-bottom: 24px; }
.install-card h2 { font-size: 16px; margin: 24px 0 12px; }
.install-card p { margin-bottom: 12px; font-size: 14px; color: var(--text-dim); }

.install-checklist { list-style: none; font-size: 14px; }
.install-checklist li { padding: 6px 0; }
.install-checklist .is-ok { color: var(--accent-bright); }
.install-checklist .is-fail { color: #f08585; font-weight: 700; }

.install-error {
  background: rgba(224, 90, 90, 0.12);
  border: 1px solid rgba(224, 90, 90, 0.35);
  color: #f08585;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
}
.install-error ul { list-style: disc; padding-left: 18px; margin: 0; }

.install-success { color: var(--accent-bright); font-weight: 700; font-size: 15px; }
.install-hint { font-size: 12px; color: var(--text-dimmer); }

.install-form .form-group { margin-bottom: 16px; }

/* Responsive
   ========================================================================== */

@media (max-width: 768px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 16px; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .admin-sidebar-footer { flex-direction: row; border-top: none; padding-top: 0; margin-left: auto; }
  .admin-main { padding: 24px; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .post-card-thumb img { height: 220px; }
}
