/* =============================================================================
   Intentioned Blog — shared design system
   Mirrors the tokens used by the intentioned.tech landing page so the blog
   feels like a native part of the product.
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: local('Inter'), local('Arial'), local('Helvetica Neue'), local('sans-serif');
}

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-tertiary: #171717;
  --bg-card: #18181b;
  --bg-card-hover: #1f1f23;
  --border-color: #27272a;
  --border-subtle: #1f1f23;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #9ca3af;
  --accent-purple: #a855f7;
  --accent-blue: #3b82f6;
  --accent-gradient: linear-gradient(135deg, #a855f7 0%, #6366f1 50%, #3b82f6 100%);
  --accent-glow: rgba(168, 85, 247, 0.4);
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --max-w: 760px;
  --max-w-wide: 1100px;
}

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

html {
  scroll-behavior: smooth;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.65;
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-blue); }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---------------------------------------------------------------- Navbar */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.navbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0.75rem 16px;
}
.logo {
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  white-space: nowrap;
  text-decoration: none;
}
.logo .logo-sub {
  color: var(--text-muted);
  -webkit-text-fill-color: var(--text-muted);
  font-weight: 600;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}
.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--text-primary); }

/* ----------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 0 20px var(--accent-glow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px var(--accent-glow), 0 10px 40px rgba(168, 85, 247, 0.3);
}
.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.btn-ghost:hover { color: var(--text-primary); border-color: var(--text-muted); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ------------------------------------------------------------------ Layout */
.page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 7rem 20px 4rem;
}
.page-wide { max-width: var(--max-w-wide); }

.page-header { margin-bottom: 3rem; animation: fadeInUp 0.6s cubic-bezier(0.16,1,0.3,1) forwards; }
.page-header h1 {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.page-header .accent {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.page-header p {
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 60ch;
}

/* ----------------------------------------------------------- Post listing */
.post-list { display: flex; flex-direction: column; gap: 1.25rem; }
.post-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all 0.2s;
  animation: fadeInUp 0.5s cubic-bezier(0.16,1,0.3,1) forwards;
}
.post-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-purple);
  transform: translateY(-2px);
}
.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}
.post-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}
.post-card p { color: var(--text-secondary); font-size: 0.98rem; }
.tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  font-size: 0.72rem;
  color: var(--text-secondary);
}
.tag-row { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.9rem; }

.empty-state, .loading-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

/* ----------------------------------------------------------- Article view */
.article-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.article-title {
  font-size: clamp(2rem, 6vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1rem;
}
.article-cover {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  margin: 1.5rem 0 2rem;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 2rem;
}
.back-link:hover { color: var(--text-primary); }

/* Rendered markdown */
.prose { font-size: 1.05rem; color: var(--text-primary); }
.prose > * + * { margin-top: 1.25rem; }
.prose h1, .prose h2, .prose h3, .prose h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-top: 2.5rem;
}
.prose h1 { font-size: 1.9rem; }
.prose h2 { font-size: 1.55rem; }
.prose h3 { font-size: 1.25rem; }
.prose h4 { font-size: 1.1rem; }
.prose p { color: var(--text-secondary); }
.prose a { color: var(--accent-blue); text-decoration: underline; text-underline-offset: 2px; }
.prose strong { color: var(--text-primary); }
.prose ul, .prose ol { padding-left: 1.5rem; color: var(--text-secondary); }
.prose li + li { margin-top: 0.4rem; }
.prose blockquote {
  border-left: 3px solid var(--accent-purple);
  padding: 0.4rem 0 0.4rem 1.2rem;
  color: var(--text-secondary);
  font-style: italic;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.12em 0.4em;
}
.prose pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  overflow-x: auto;
}
.prose pre code { background: none; border: none; padding: 0; font-size: 0.85rem; }
.prose img { max-width: 100%; border-radius: var(--radius-md); border: 1px solid var(--border-color); }
.prose hr { border: none; border-top: 1px solid var(--border-color); margin: 2.5rem 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.prose th, .prose td { border: 1px solid var(--border-color); padding: 0.5rem 0.75rem; text-align: left; }
.prose th { background: var(--bg-tertiary); }

/* -------------------------------------------------------------- Admin form */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.panel h2 { font-size: 1.1rem; margin-bottom: 1rem; }
.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}
.field .hint { font-weight: 400; color: var(--text-muted); }
.input, .textarea, select.input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.92rem;
  padding: 0.65rem 0.8rem;
  transition: border-color 0.2s;
}
.input:focus, .textarea:focus { outline: none; border-color: var(--accent-purple); }
.textarea { min-height: 360px; resize: vertical; font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.55; }
.row { display: flex; gap: 0.8rem; }
.row > * { flex: 1; }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; }

.toast {
  position: fixed;
  bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.8rem 1.2rem;
  font-size: 0.9rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
  z-index: 2000;
  max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

.callout {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-blue);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1.2rem;
}
.callout strong { color: var(--text-primary); }

/* --------------------------------------------------------------- Footer */
.footer {
  border-top: 1px solid var(--border-subtle);
  padding: 2rem 16px;
  margin-top: 3rem;
}
.footer-inner {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-left { color: var(--text-secondary); font-size: 0.9rem; }
.footer-links { display: flex; gap: 1.75rem; flex-wrap: wrap; }
.footer-link { color: var(--text-secondary); text-decoration: none; font-size: 0.9rem; transition: color 0.2s; }
.footer-link:hover { color: var(--text-primary); }

/* --------------------------------------------------------------- Mobile */
@media (max-width: 720px) {
  .admin-grid { grid-template-columns: 1fr; }
  .nav-links { gap: 1rem; }
  .nav-links .nav-link.hide-sm { display: none; }
  .footer-inner { flex-direction: column; text-align: center; }
}
