/* Aafnopan CMS — Main Stylesheet */
/* Tailwind CDN is loaded as a separate <link> in base.html (parallel download);
   do NOT re-import it here — a CSS @import forces a serial, render-blocking
   request chain that noticeably slows first paint. */

/* ── Custom Properties ──────────────────────────────────────────── */
:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-grad: linear-gradient(90deg, #1d4ed8, #2563eb, #0ea5e9);
  --elev-1: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --elev-2: 0 4px 12px rgba(16,24,40,.08), 0 2px 4px rgba(16,24,40,.04);
  --elev-3: 0 12px 32px rgba(16,24,40,.12), 0 4px 8px rgba(16,24,40,.05);
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-serif: 'Merriweather', Georgia, serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Dark mode ──────────────────────────────────────────────────── */
.dark { color-scheme: dark; }

/* ── Tailwind utility shims (for envs where Tailwind CDN not used) */
.container { width: 100%; max-width: 1280px; margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Alpine: hide x-cloak elements until Alpine initializes (it removes the attribute) */
[x-cloak] { display: none !important; }
.flex { display: flex; } .flex-col { flex-direction: column; }
.grid { display: grid; }
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }
.fixed { position: fixed; }
.inset-0 { inset: 0; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rounded-full { border-radius: 9999px; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded { border-radius: 0.25rem; }
.cursor-pointer { cursor: pointer; }
.transition-colors { transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; }
.transition-all { transition: all 0.15s ease; }
.transition-opacity { transition: opacity 0.3s ease; }
.transition-transform { transition: transform 0.3s ease; }
.opacity-0 { opacity: 0; }
.opacity-100 { opacity: 1; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }
.max-w-none { max-width: none; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.mx-auto { margin-inline: auto; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-8 > * + * { margin-top: 2rem; }
.space-x-2 > * + * { margin-left: 0.5rem; }

/* Spacing */
.p-1 { padding: 0.25rem; } .p-2 { padding: 0.5rem; } .p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; } .p-5 { padding: 1.25rem; } .p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; } .p-10 { padding: 2.5rem; }
.px-1 { padding-inline: 0.25rem; } .px-2 { padding-inline: 0.5rem; }
.px-3 { padding-inline: 0.75rem; } .px-4 { padding-inline: 1rem; }
.px-5 { padding-inline: 1.25rem; } .px-6 { padding-inline: 1.5rem; }
.py-0\.5 { padding-block: 0.125rem; } .py-1 { padding-block: 0.25rem; }
.py-1\.5 { padding-block: 0.375rem; } .py-2 { padding-block: 0.5rem; }
.py-2\.5 { padding-block: 0.625rem; } .py-3 { padding-block: 0.75rem; }
.py-4 { padding-block: 1rem; } .py-5 { padding-block: 1.25rem; }
.py-6 { padding-block: 1.5rem; } .py-8 { padding-block: 2rem; }
.py-10 { padding-block: 2.5rem; } .py-12 { padding-block: 3rem; }
.px-1\.5 { padding-inline: 0.375rem; }
.m-0 { margin: 0; } .mb-1 { margin-bottom: 0.25rem; } .mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; } .mb-4 { margin-bottom: 1rem; } .mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; } .mb-7 { margin-bottom: 1.75rem; } .mb-8 { margin-bottom: 2rem; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; } .mt-4 { margin-top: 1rem; } .mt-5 { margin-top: 1.25rem; }
.ml-2 { margin-left: 0.5rem; } .ml-4 { margin-left: 1rem; } .ml-8 { margin-left: 2rem; }
.mr-2 { margin-right: 0.5rem; }

/* Typography */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-5xl { font-size: 3rem; line-height: 1; }
.text-6xl { font-size: 3.75rem; }
.text-7xl { font-size: 4.5rem; }
.text-8xl { font-size: 6rem; }
.font-light { font-weight: 300; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }
.italic { font-style: italic; }
.uppercase { text-transform: uppercase; }
.capitalize { text-transform: capitalize; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }
.tracking-tight { letter-spacing: -0.025em; }
.leading-tight { line-height: 1.25; }
.leading-snug { line-height: 1.375; }
.leading-relaxed { line-height: 1.625; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.whitespace-nowrap { white-space: nowrap; }

/* Colors */
.text-white { color: #fff; }
.text-black { color: #000; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-gray-900 { color: #111827; }
.text-red-400 { color: #f87171; }
.text-red-500 { color: #ef4444; }
.text-red-600 { color: #dc2626; }
.text-red-700 { color: #b91c1c; }
.text-red-800 { color: #991b1b; }
.text-green-400 { color: #4ade80; }
.text-green-500 { color: #22c55e; }
.text-green-600 { color: #16a34a; }
.text-green-700 { color: #15803d; }
.text-blue-400 { color: #60a5fa; }
.text-blue-500 { color: #3b82f6; }
.text-blue-600 { color: #2563eb; }
.text-blue-700 { color: #1d4ed8; }
.text-blue-800 { color: #1e40af; }
.text-orange-400 { color: #fb923c; }
.text-orange-500 { color: #f97316; }
.text-orange-600 { color: #ea580c; }
.text-amber-500 { color: #f59e0b; }
.text-amber-600 { color: #d97706; }
.text-purple-400 { color: #c084fc; }
.text-purple-500 { color: #a855f7; }
.text-purple-600 { color: #9333ea; }
.text-sky-400 { color: #38bdf8; }
.text-sky-500 { color: #0ea5e9; }
.text-pink-400 { color: #f472b6; }
.text-pink-600 { color: #db2777; }

/* Dark mode text */
.dark .dark\:text-white { color: #fff !important; }
.dark .dark\:text-gray-100 { color: #f3f4f6 !important; }
.dark .dark\:text-gray-200 { color: #e5e7eb !important; }
.dark .dark\:text-gray-300 { color: #d1d5db !important; }
.dark .dark\:text-gray-400 { color: #9ca3af !important; }
.dark .dark\:text-gray-500 { color: #6b7280 !important; }
.dark .dark\:text-red-400 { color: #f87171 !important; }
.dark .dark\:text-green-400 { color: #4ade80 !important; }
.dark .dark\:text-blue-400 { color: #60a5fa !important; }
.dark .dark\:text-amber-400 { color: #fbbf24 !important; }
.dark .dark\:text-purple-400 { color: #c084fc !important; }
.dark .dark\:text-purple-300 { color: #d8b4fe !important; }
.dark .dark\:text-blue-300 { color: #93c5fd !important; }
.dark .dark\:text-blue-200 { color: #bfdbfe !important; }
.dark .dark\:text-green-200 { color: #bbf7d0 !important; }
.dark .dark\:text-green-300 { color: #86efac !important; }
.dark .dark\:text-red-300 { color: #fca5a5 !important; }
.dark .dark\:text-red-200 { color: #fecaca !important; }
.dark .dark\:text-red-100 { color: #fee2e2 !important; }

/* Backgrounds */
.bg-white { background-color: #fff; }
.bg-black { background-color: #000; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-200 { background-color: #e5e7eb; }
.bg-gray-300 { background-color: #d1d5db; }
.bg-gray-600 { background-color: #4b5563; }
.bg-gray-700 { background-color: #374151; }
.bg-gray-800 { background-color: #1f2937; }
.bg-gray-900 { background-color: #111827; }
.bg-red-50 { background-color: #fef2f2; }
.bg-red-100 { background-color: #fee2e2; }
.bg-red-600 { background-color: #dc2626; }
.bg-red-700 { background-color: #b91c1c; }
.bg-red-800 { background-color: #991b1b; }
.bg-green-100 { background-color: #dcfce7; }
.bg-green-600 { background-color: #16a34a; }
.bg-green-700 { background-color: #15803d; }
.bg-blue-50 { background-color: #eff6ff; }
.bg-blue-100 { background-color: #dbeafe; }
.bg-blue-600 { background-color: #2563eb; }
.bg-blue-700 { background-color: #1d4ed8; }
.bg-blue-800 { background-color: #1e40af; }
.bg-yellow-100 { background-color: #fef9c3; }
.bg-orange-100 { background-color: #ffedd5; }
.bg-amber-50 { background-color: #fffbeb; }
.bg-purple-50 { background-color: #faf5ff; }
.bg-sky-500 { background-color: #0ea5e9; }
.bg-sky-600 { background-color: #0284c7; }
.bg-gradient-to-br { background-image: linear-gradient(to bottom right, var(--tw-gradient-stops)); }
.bg-gradient-to-t { background-image: linear-gradient(to top, var(--tw-gradient-stops)); }

.dark .dark\:bg-black { background-color: #000 !important; }
.dark .dark\:bg-gray-700 { background-color: #374151 !important; }
.dark .dark\:bg-gray-800 { background-color: #1f2937 !important; }
.dark .dark\:bg-gray-900 { background-color: #111827 !important; }
.dark .dark\:bg-red-900 { background-color: #7f1d1d !important; }
.dark .dark\:bg-green-900 { background-color: #14532d !important; }
.dark .dark\:bg-blue-900 { background-color: #1e3a5f !important; }

/* Borders */
.border { border-width: 1px; }
.border-2 { border-width: 2px; }
.border-4 { border-width: 4px; }
.border-l-2 { border-left-width: 2px; }
.border-l-4 { border-left-width: 4px; }
.border-t { border-top-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-gray-100 { border-color: #f3f4f6; }
.border-gray-200 { border-color: #e5e7eb; }
.border-gray-300 { border-color: #d1d5db; }
.border-gray-600 { border-color: #4b5563; }
.border-gray-700 { border-color: #374151; }
.border-gray-800 { border-color: #1f2937; }
.border-red-200 { border-color: #fecaca; }
.border-red-500 { border-color: #ef4444; }
.border-red-600 { border-color: #dc2626; }
.border-green-200 { border-color: #bbf7d0; }
.border-blue-200 { border-color: #bfdbfe; }
.border-blue-800 { border-color: #1e40af; }
.border-purple-200 { border-color: #e9d5ff; }
.border-purple-800 { border-color: #6b21a8; }
.border-dashed { border-style: dashed; }
.divide-y > * + * { border-top-width: 1px; }
.divide-gray-100 > * + * { border-color: #f3f4f6; }
.dark .divide-gray-700 > * + * { border-color: #374151 !important; }

.dark .dark\:border-gray-600 { border-color: #4b5563 !important; }
.dark .dark\:border-gray-700 { border-color: #374151 !important; }
.dark .dark\:border-gray-800 { border-color: #1f2937 !important; }
.dark .dark\:border-blue-800 { border-color: #1e3a5f !important; }
.dark .dark\:border-green-700 { border-color: #166534 !important; }
.dark .dark\:border-red-200 { border-color: rgba(254,202,202,.3) !important; }
.dark .dark\:border-purple-800 { border-color: rgba(107,33,168,.5) !important; }
.dark .dark\:border-purple-700 { border-color: rgba(126,34,206,.5) !important; }
.dark .dark\:border-blue-700 { border-color: rgba(29,78,216,.5) !important; }

/* Shadows */
.shadow-sm { box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.shadow-md { box-shadow: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06); }
.shadow-lg { box-shadow: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05); }
.shadow-xl { box-shadow: 0 20px 25px rgba(0,0,0,.1), 0 10px 10px rgba(0,0,0,.04); }
.hover\:shadow-md:hover { box-shadow: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06); }

/* Sizing */
.w-0 { width: 0; }
.w-3 { width: 0.75rem; } .h-3 { height: 0.75rem; }
.w-4 { width: 1rem; } .h-4 { height: 1rem; }
.w-9 { width: 2.25rem; } .h-9 { height: 2.25rem; }
.w-14 { width: 3.5rem; } .h-14 { height: 3.5rem; }
.w-32 { width: 8rem; }
.h-24 { height: 6rem; } .h-28 { height: 7rem; }
.h-40 { height: 10rem; } .h-48 { height: 12rem; } .h-64 { height: 16rem; }
.w-2 { width: 0.5rem; } .w-5 { width: 1.25rem; } .w-6 { width: 1.5rem; }
.w-7 { width: 1.75rem; } .w-8 { width: 2rem; } .w-10 { width: 2.5rem; }
.w-12 { width: 3rem; } .w-16 { width: 4rem; } .w-64 { width: 16rem; }
.h-2 { height: 0.5rem; } .h-5 { height: 1.25rem; } .h-6 { height: 1.5rem; }
.h-7 { height: 1.75rem; } .h-8 { height: 2rem; } .h-10 { height: 2.5rem; }
.h-12 { height: 3rem; } .h-16 { height: 4rem; } .h-32 { height: 8rem; }
.h-screen { height: 100vh; }
.aspect-video { aspect-ratio: 16/9; }
.aspect-square { aspect-ratio: 1/1; }
.max-h-48 { max-height: 12rem; }
.max-h-72 { max-height: 18rem; }
.max-h-96 { max-height: 24rem; }
.min-w-0 { min-width: 0; }
.max-w-xs { max-width: 20rem; }
.max-w-lg { max-width: 32rem; }
.max-w-md { max-width: 28rem; }
.min-h-64 { min-height: 16rem; }

/* Object fit */
.object-cover { object-fit: cover; }
.object-contain { object-fit: contain; }

/* Grid */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Flex wrap */
.flex-wrap { flex-wrap: wrap; }

/* z-index */
.z-10 { z-index: 10; } .z-20 { z-index: 20; } .z-30 { z-index: 30; }
.z-50 { z-index: 50; }

/* Overflow */
.overflow-x-auto { overflow-x: auto; }
.overflow-y-scroll { overflow-y: scroll; }

/* Top / Bottom */
.top-0 { top: 0; } .top-1 { top: 0.25rem; } .top-4 { top: 1rem; }
.top-20 { top: 5rem; } .bottom-0 { bottom: 0; } .bottom-4 { bottom: 1rem; }
.right-0 { right: 0; } .right-1 { right: 0.25rem; } .right-6 { right: 1.5rem; }
.left-0 { left: 0; }

/* Opacity */
.opacity-70 { opacity: 0.7; }

/* Transforms */
.hover\:scale-105:hover { transform: scale(1.05); }
.rotate-45 { transform: rotate(45deg); }
.origin-left { transform-origin: left center; }

/* Resize */
.resize-none { resize: none; }

/* ── Article Content Styles ─────────────────────────────────────── */
.article-content h1, .article-content h2, .article-content h3,
.article-content h4, .article-content h5, .article-content h6 {
  font-family: var(--font-serif);
  font-weight: 700;
  color: #1f2937;
  margin: 1.5rem 0 0.75rem;
  line-height: 1.3;
}

.dark .article-content h1, .dark .article-content h2, .dark .article-content h3,
.dark .article-content h4 { color: #f3f4f6; }

.article-content h2 { font-size: 1.5rem; border-bottom: 2px solid #e5e7eb; padding-bottom: 0.5rem; }
.dark .article-content h2 { border-color: #374151; }
.article-content h3 { font-size: 1.25rem; }

.article-content p {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.8;
  color: #374151;
  margin: 1.25rem 0;
  text-align: justify;
  text-align-last: left;
  overflow-wrap: break-word;
}
.dark .article-content p { color: #d1d5db; }

/* Belt-and-braces: rich-text content is user-authored HTML (CKEditor) and
   can contain fixed-width tables/figures — keep it from breaking mobile
   layout with a horizontal scroll. */
.article-content { max-width: 100%; overflow-x: hidden; }
.article-content figure { max-width: 100%; }

.article-content a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.article-content a:hover { color: var(--brand-dark); }

.article-content blockquote {
  border-left: 4px solid var(--brand);
  margin: 1.5rem 0;
  padding: 0.75rem 1.5rem;
  background: #eff6ff;
  border-radius: 0 0.5rem 0.5rem 0;
  font-style: italic;
}
.dark .article-content blockquote { background: rgba(37,99,235,.1); }

.article-content pre, .article-content code {
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.875rem;
}

.article-content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1.25rem;
  border-radius: 0.75rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  line-height: 1.6;
}

.article-content code:not(pre code) {
  background: #f1f5f9;
  color: var(--brand-dark);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
}
.dark .article-content code:not(pre code) { background: #1e293b; color: #93c5fd; }

.article-content ul, .article-content ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
  color: #374151;
  line-height: 1.7;
  overflow-wrap: break-word;
}
.dark .article-content ul, .dark .article-content ol { color: #d1d5db; }
.article-content ul { list-style-type: disc; }
.article-content ol { list-style-type: decimal; }
.article-content li { margin: 0.375rem 0; }

.article-content table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.875rem;
}
.article-content th {
  background: #f8fafc;
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
}
.dark .article-content th { background: #1e293b; border-color: #334155; }
.article-content td {
  padding: 0.625rem 1rem;
  border: 1px solid #e2e8f0;
  color: #374151;
}
.dark .article-content td { border-color: #334155; color: #d1d5db; }
.article-content tr:hover { background: #f8fafc; }
.dark .article-content tr:hover { background: #1e293b; }

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1.25rem 0;
}

.article-content iframe {
  width: 100%;
  border-radius: 0.75rem;
}

/* ── Dashboard form inputs ──────────────────────────────────────── */
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  background: #fff;
  color: #111827;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dark .form-input, .dark .form-textarea, .dark .form-select {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 99px; }
.dark ::-webkit-scrollbar-thumb { background: #4b5563; }

/* ── Media queries ──────────────────────────────────────────────── */
@media (min-width: 640px) {
  .sm\:flex { display: flex; }
  .sm\:hidden { display: none; }
  .sm\:block { display: block; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:flex-row { flex-direction: row; }
  .sm\:table-cell { display: table-cell; }
}

@media (min-width: 768px) {
  .md\:block { display: block; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:table-cell { display: table-cell; }
  .md\:p-10 { padding: 2.5rem; }
  .md\:text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
  .md\:col-span-2 { grid-column: span 2; }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:col-span-2 { grid-column: span 2; }
  .lg\:col-span-1 { grid-column: span 1; }
  .lg\:flex { display: flex; }
  .lg\:hidden { display: none !important; }
  .lg\:block { display: block; }
  .lg\:table-cell { display: table-cell; }
}

@media (min-width: 1280px) {
  .xl\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .xl\:col-span-2 { grid-column: span 2; }
  .xl\:table-cell { display: table-cell; }
}

/* ═══════════════════════════════════════════════════════════════
   PREMIUM LAYER — elevation, motion, interaction polish
═══════════════════════════════════════════════════════════════ */

/* Selection & focus (accessibility) */
::selection { background: rgba(37,99,235,.18); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* Headings: tighter, balanced */
h1, h2, h3 { text-wrap: balance; }

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--brand); color: #fff; font-weight: 600;
  padding: .625rem 1rem; border-radius: 0 0 .5rem 0; text-decoration: none;
}
.skip-link:focus { left: 0; }

/* Cards: lift + shadow bloom + border tint */
.card {
  transition: transform .25s cubic-bezier(.2,.8,.3,1), box-shadow .25s ease, border-color .25s ease;
  will-change: transform;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--elev-3);
  border-color: rgba(37,99,235,.25);
}
.dark .card:hover { border-color: rgba(96,165,250,.35); }

/* Reveal on scroll (JS adds .reveal, then .reveal-in when visible) */
.reveal { opacity: 0; transform: translateY(16px); }
.reveal-in {
  opacity: 1; transform: translateY(0);
  transition: opacity .55s ease, transform .55s cubic-bezier(.2,.8,.3,1);
  transition-delay: var(--reveal-delay, 0s);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
  .card, .card:hover { transform: none; }
  html { scroll-behavior: auto; }
}

/* Reading progress bar */
.reading-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--brand-grad); z-index: 9999;
  box-shadow: 0 0 8px rgba(37,99,235,.5);
}

/* Back-to-top button */
.back-to-top {
  position: fixed; bottom: 24px; right: 24px; width: 44px; height: 44px;
  background: #111827; color: #fff; border: none; border-radius: 50%;
  cursor: pointer; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--elev-2);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s, background .15s;
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--brand); }
.back-to-top svg { width: 18px; height: 18px; }
.dark .back-to-top { background: #374151; }
.dark .back-to-top:hover { background: var(--brand); }

/* Table of contents (auto-generated) */
.toc {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 1.25rem 1.375rem; margin: 1.5rem 0; font-size: .875rem;
}
.dark .toc { background: #1e293b; border-color: #334155; }
.toc-title { font-weight: 700; margin: 0 0 .75rem; color: #1f2937; font-family: var(--font-sans); }
.dark .toc-title { color: #f3f4f6; }
.toc ol { margin: 0; padding-left: 1.25rem; }
.toc li { margin: .375rem 0; }
.toc li.toc-sub { margin-left: 1rem; }
.toc a {
  color: #4b5563; text-decoration: none;
  border-bottom: 1px solid transparent; transition: color .15s, border-color .15s;
}
.dark .toc a { color: #cbd5e1; }
.toc a:hover { color: var(--brand); border-bottom-color: var(--brand); }
.toc a.is-active { color: var(--brand); font-weight: 600; }

/* Copy-code button */
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  padding: 3px 10px; font-size: 11px; font-weight: 600;
  font-family: var(--font-sans);
  background: rgba(255,255,255,.12); color: #e2e8f0;
  border: 1px solid rgba(255,255,255,.15); border-radius: 6px; cursor: pointer;
  transition: background .15s;
}
.copy-btn:hover { background: rgba(255,255,255,.22); }

/* Skeleton shimmer (loading states) */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e8edf3 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: .5rem;
}
.dark .skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #263449 50%, #1e293b 75%);
  background-size: 200% 100%;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Section headers (premium accent) */
.section-head-bar {
  display: inline-block; width: 2.25rem; height: .25rem; border-radius: 99px;
  background: var(--sec-color, var(--brand-grad)); margin-bottom: .5rem;
}

/* Hero Ken Burns effect */
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.08); } }
.hero-kenburns { animation: kenburns 7s ease-out forwards; }
@media (prefers-reduced-motion: reduce) { .hero-kenburns { animation: none; } }

/* Line clamp 3 (used by premium cards) */
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Print ──────────────────────────────────────────────────────── */
@media print {
  header, footer, .sidebar, .ad-placement, .share-buttons,
  .back-to-top, .reading-progress { display: none !important; }
  .article-content { font-size: 12pt; line-height: 1.6; }
}
