/* ---------------------------------------------------------------------------
   Veilamp blog + admin — neon-glass design system.
   Tokens mirror the marketing site (src/styles/global.css) so /blog and
   /admin feel like one product with the rest of veilamp.com.
   --------------------------------------------------------------------------- */

:root {
  --bg-0: #05060a;
  --bg-1: #0a0d16;
  --bg-2: #10131f;

  --glass: rgba(20, 26, 42, 0.55);
  --glass-strong: rgba(24, 31, 50, 0.72);
  --glass-border: rgba(120, 190, 255, 0.14);
  --glass-border-bright: rgba(120, 210, 255, 0.35);

  --cyan: #26e6ff;
  --cyan-dim: #1aa6c4;
  --magenta: #ff3ea5;
  --magenta-dim: #b52c78;
  --amber: #ffb347;
  --amber-bright: #ffd27a;
  --danger: #ff5c7a;

  --text: #e7edf7;
  --text-dim: #8b97ad;
  --text-faint: #5a6480;

  --accent-grad: linear-gradient(135deg, var(--cyan) 0%, var(--magenta) 100%);
  --accent-grad-h: linear-gradient(90deg, var(--cyan) 0%, var(--magenta) 100%);

  --app-bg:
    radial-gradient(1100px 700px at 12% -8%, rgba(38, 230, 255, 0.12), transparent 60%),
    radial-gradient(1000px 800px at 108% 12%, rgba(255, 62, 165, 0.12), transparent 55%),
    linear-gradient(160deg, var(--bg-1) 0%, var(--bg-0) 100%);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;

  --glow-cyan: 0 0 24px rgba(38, 230, 255, 0.35);

  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-lcd: "Orbitron", "Share Tech Mono", monospace;
  --font-mono: "Share Tech Mono", ui-monospace, monospace;

  --maxw: 1160px;
  --nav-h: 68px;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg-0);
  background-image: var(--app-bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
}

main { flex: 1 0 auto; }

h1, h2, h3, h4 {
  line-height: 1.15;
  margin: 0 0 0.4em;
  font-weight: 700;
  letter-spacing: -0.02em;
}

p { margin: 0 0 1em; }

a {
  color: var(--cyan);
  text-decoration: none;
  transition: color 0.18s ease;
}
a:hover { color: var(--amber-bright); }

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

/* Layout helpers ----------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 24px;
}
.container.narrow { max-width: 760px; }
.container.admin-narrow { max-width: 460px; }

.section { padding-block: clamp(48px, 8vw, 104px); }

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.78rem;
  color: var(--cyan);
  margin: 0 0 14px;
}

.section-title { font-size: clamp(1.9rem, 4vw, 3rem); }

.section-lead {
  color: var(--text-dim);
  font-size: clamp(1.02rem, 1.6vw, 1.2rem);
  max-width: 60ch;
}

.neon-text {
  background: var(--accent-grad-h);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.text-dim { color: var(--text-dim); }
.small { font-size: 0.85rem; }
.empty-note { margin-top: 24px; }

/* Panels ------------------------------------------------------------------- */

.panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 40px rgba(0, 0, 0, 0.45);
}

/* Buttons ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.98rem;
  padding: 13px 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease,
    background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: translateY(1px) scale(0.99); }

.btn-primary {
  background: var(--accent-grad);
  color: #05060a;
  font-weight: 700;
  box-shadow: 0 6px 26px rgba(38, 230, 255, 0.28);
}
.btn-primary:hover {
  color: #05060a;
  transform: translateY(-2px);
  box-shadow: 0 10px 34px rgba(255, 62, 165, 0.42);
}

.btn-ghost {
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.08), rgba(12, 16, 26, 0.6));
  border-color: var(--glass-border);
  color: var(--text);
}
.btn-ghost:hover {
  color: #fff;
  border-color: var(--glass-border-bright);
  box-shadow: var(--glow-cyan);
  transform: translateY(-2px);
}

.btn-danger {
  background: rgba(255, 92, 122, 0.1);
  border-color: rgba(255, 92, 122, 0.4);
  color: var(--danger);
}
.btn-danger:hover {
  background: rgba(255, 92, 122, 0.2);
  color: #fff;
  border-color: var(--danger);
}

.btn-sm { padding: 9px 18px; font-size: 0.9rem; }
.btn-xs { padding: 6px 13px; font-size: 0.8rem; }

/* Header ------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(5, 6, 10, 0.62);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--glass-border);
}
.site-header .bar { display: flex; align-items: center; gap: 20px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
}
.brand:hover { color: var(--text); }
.brand-mark { border-radius: 9px; box-shadow: var(--glow-cyan); }
.brand-name { font-size: 1.18rem; }
.nav { display: flex; gap: 4px; margin-inline: auto; }
.nav-link {
  color: var(--text-dim);
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  transition: color 0.18s ease, background 0.18s ease;
}
.nav-link:hover { color: var(--text); background: rgba(120, 190, 255, 0.08); }
.nav-link.active { color: var(--text); background: rgba(120, 190, 255, 0.12); }
.actions { display: flex; align-items: center; gap: 12px; }
.icon-link {
  display: inline-flex;
  color: var(--text-dim);
  transition: color 0.18s ease, transform 0.18s ease;
}
.icon-link:hover { color: var(--text); transform: translateY(-1px); }

/* Footer ------------------------------------------------------------------- */

.site-footer {
  flex-shrink: 0;
  margin-top: 40px;
  border-top: 1px solid var(--glass-border);
  background: rgba(5, 6, 10, 0.5);
  padding-block: 32px 24px;
}
.site-footer .base {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.site-footer .base p { margin: 0; }
.foot-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.foot-nav a { color: var(--text-dim); font-size: 0.9rem; }
.foot-nav a:hover { color: var(--text); }
.llama-note {
  margin: 16px 0 0;
  font-size: 0.78rem;
  color: var(--text-faint);
  opacity: 0.85;
}

/* Blog index --------------------------------------------------------------- */

.post-list {
  display: grid;
  gap: 20px;
  margin-top: 40px;
}
.post-card { padding: 26px 28px; transition: transform 0.18s ease, border-color 0.18s ease; }
.post-card:hover { transform: translateY(-2px); border-color: var(--glass-border-bright); }
.post-date {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 10px;
}
.post-card-title { font-size: 1.5rem; margin: 0 0 8px; }
.post-card-title a { color: var(--text); }
.post-card-title a:hover { color: var(--amber-bright); }
.post-card-excerpt { margin: 0 0 14px; }
.read-more { font-weight: 600; font-size: 0.92rem; }

/* Blog post ---------------------------------------------------------------- */

.back-link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 18px;
}
.back-link:hover { color: var(--cyan); }
.post-title { font-size: clamp(2rem, 5vw, 3.1rem); margin-bottom: 12px; }
.post .post-date { margin-bottom: 32px; }
.post-rule { border: none; border-top: 1px solid var(--glass-border); margin: 48px 0 24px; }

/* Rendered Markdown -------------------------------------------------------- */

.post-content { font-size: 1.08rem; }
.post-content > *:first-child { margin-top: 0; }
.post-content h2 { font-size: 1.7rem; margin: 1.6em 0 0.5em; }
.post-content h3 { font-size: 1.32rem; margin: 1.4em 0 0.4em; }
.post-content h4 { font-size: 1.1rem; margin: 1.3em 0 0.4em; }
.post-content p { margin: 0 0 1.1em; }
.post-content ul, .post-content ol { margin: 0 0 1.1em; padding-left: 1.5em; }
.post-content li { margin: 0.35em 0; }
.post-content li::marker { color: var(--cyan); }
.post-content a { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(38, 230, 255, 0.4); }
.post-content blockquote {
  margin: 1.4em 0;
  padding: 6px 20px;
  border-left: 3px solid var(--magenta);
  background: rgba(255, 62, 165, 0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-dim);
}
.post-content blockquote p:last-child { margin-bottom: 0; }
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(6, 9, 16, 0.7);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  padding: 0.12em 0.4em;
}
.post-content pre {
  margin: 1.4em 0;
  padding: 18px 20px;
  overflow-x: auto;
  background: rgba(6, 9, 16, 0.8);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
}
.post-content pre code { background: none; border: none; padding: 0; font-size: 0.88rem; }
.post-content img {
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  margin: 1.4em 0;
}
.post-content hr { border: none; border-top: 1px solid var(--glass-border); margin: 2em 0; }
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4em 0;
  font-size: 0.96rem;
}
.post-content th, .post-content td {
  border: 1px solid var(--glass-border);
  padding: 9px 13px;
  text-align: left;
}
.post-content th { background: rgba(120, 190, 255, 0.08); color: var(--text); }

/* Admin -------------------------------------------------------------------- */

.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.admin-head .section-title { margin: 0; }
.admin-head-actions { display: flex; gap: 12px; align-items: center; }
.inline-form { display: inline; margin: 0; }

.admin-card { padding: 34px 32px; margin-top: 24px; }
.admin-title { font-size: 1.9rem; }
.admin-warn {
  background: rgba(255, 179, 71, 0.1);
  border: 1px solid rgba(255, 179, 71, 0.35);
  color: var(--amber-bright);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.92rem;
}
.admin-warn code { font-family: var(--font-mono); color: #fff; }
.admin-error {
  background: rgba(255, 92, 122, 0.12);
  border: 1px solid rgba(255, 92, 122, 0.4);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.92rem;
  margin-bottom: 18px;
}

.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-weight: 600; margin-bottom: 7px; font-size: 0.92rem; }
.field > span em { color: var(--text-faint); font-weight: 400; font-style: normal; }
.field input[type="text"],
.field input[type="password"],
.field input[type="datetime-local"],
.field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: rgba(6, 9, 16, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--glass-border-bright);
  box-shadow: var(--glow-cyan);
}
.field.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}
.field.checkbox > span { margin: 0; font-weight: 500; }
.field.checkbox input { width: 18px; height: 18px; accent-color: var(--cyan); }

.admin-form { margin-top: 8px; }
.admin-form .btn { width: 100%; justify-content: center; }

.editor-form { padding: 26px 28px; }
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
}
.editor-grid .field:first-child { grid-column: 1 / -1; }
.editor-actions { display: flex; gap: 12px; margin-top: 8px; }

.admin-table-wrap { padding: 6px 8px; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td {
  text-align: left;
  padding: 13px 14px;
  border-bottom: 1px solid var(--glass-border);
  vertical-align: middle;
}
.admin-table thead th {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--cyan);
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table .c-title a { color: var(--text); font-weight: 600; }
.admin-table .c-title a:hover { color: var(--amber-bright); }
.admin-table .c-slug code { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-dim); }
.admin-table .c-actions { white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.admin-table .c-date { color: var(--text-dim); font-size: 0.9rem; white-space: nowrap; }

.chip {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
}
.chip.live { color: var(--cyan); border-color: rgba(38, 230, 255, 0.4); }
.chip.draft { color: var(--amber); border-color: rgba(255, 179, 71, 0.4); }

/* EasyMDE dark theming ----------------------------------------------------- */

.EasyMDEContainer .CodeMirror {
  color: var(--text);
  background: rgba(6, 9, 16, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-family: var(--font-mono);
}
.EasyMDEContainer .CodeMirror-cursor { border-color: var(--cyan); }
.EasyMDEContainer .CodeMirror-selected { background: rgba(38, 230, 255, 0.18); }
.editor-toolbar {
  border: 1px solid var(--glass-border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: rgba(20, 26, 42, 0.55);
  opacity: 1;
}
.editor-toolbar button {
  color: var(--text-dim) !important;
  border: none;
}
.editor-toolbar button:hover,
.editor-toolbar button.active {
  background: rgba(120, 190, 255, 0.12);
  border: none;
  color: var(--text) !important;
}
.editor-toolbar i.separator { border-left: 1px solid var(--glass-border); border-right: none; }
.editor-statusbar { color: var(--text-faint); }
.editor-preview,
.editor-preview-side {
  background: rgba(6, 9, 16, 0.9);
  color: var(--text);
}
.editor-preview a, .editor-preview-side a { color: var(--cyan); }
.editor-preview pre, .editor-preview-side pre {
  background: rgba(6, 9, 16, 0.8);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.editor-preview blockquote, .editor-preview-side blockquote {
  border-left: 3px solid var(--magenta);
  color: var(--text-dim);
}
.CodeMirror-fullscreen, .editor-preview-active-side { background: var(--bg-0); }

/* Accessibility ------------------------------------------------------------ */

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(120, 190, 255, 0.18);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(120, 210, 255, 0.35); background-clip: content-box; }

@media (max-width: 720px) {
  .nav { display: none; }
  .editor-grid { grid-template-columns: 1fr; }
  .admin-table .c-slug { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
