:root {
  color-scheme: light dark;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  --surface: #ffffff;
  --surface-soft: #f0f4fb;
  --border: #d9e2ef;
  --page-bg: #eff4fb;
  --header-bg: rgba(255,255,255,0.95);
  --footer-bg: #ffffff;
  --text: #111827;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-soft: rgba(37, 99, 235, 0.08);
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 32px 96px rgba(15, 23, 42, 0.12);
  --trending-gradient: linear-gradient(135deg, #f59e0b, #ef4444);
}

:root[data-theme="dark"] {
  --surface: #111827;
  --surface-soft: #192334;
  --border: #243248;
  --page-bg: #0f172a;
  --header-bg: rgba(15, 23, 42, 0.95);
  --footer-bg: #111827;
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #93c5fd;
  --primary-soft: rgba(147, 197, 253, 0.08);
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.45);
  --shadow-lg: 0 32px 96px rgba(15, 23, 42, 0.55);
  --trending-gradient: linear-gradient(135deg, #fbbf24, #f87171);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--page-bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
  border-radius: 1rem;
}

.container {
  width: min(1110px, calc(100% - 2rem));
  margin: 0 auto;
}

/* ── Header ───────────────────────────────────── */

.site-header {
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1rem 0;
}

.brand {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-logo {
  height: 38px;
  width: auto;
  border-radius: 0;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  flex: 1;
}

.main-nav a {
  color: var(--muted);
  font-size: 0.95rem;
  position: relative;
  transition: color 0.2s ease;
}

.main-nav a:hover {
  color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
}

.hidden {
  display: none !important;
}

/* ── Hero ─────────────────────────────────────── */

.hero {
  padding: 5rem 0 3.5rem;
}

.hero-content {
  display: grid;
  gap: 2.5rem;
  grid-template-columns: 1.5fr 1fr;
  align-items: start;
}

.eyebrow,
.section-eyebrow,
.post-meta,
.hero-card-label {
  display: inline-flex;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 4vw, 4rem);
  line-height: 1.05;
  max-width: 16ch;
}

.text-gradient {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  max-width: 55ch;
  color: var(--muted);
  font-size: 1.1rem;
}

.hero-stats {
  display: flex;
  gap: 2.5rem;
  margin: 2rem 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stat-number {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.9rem 1.35rem;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.primary {
  background: var(--primary);
  color: white;
}

.primary:hover {
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3);
}

.secondary {
  background: transparent;
  border-color: rgba(37, 99, 235, 0.2);
  color: var(--primary);
}

.secondary:hover {
  background: var(--primary-soft);
}

.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: 2rem;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #7c3aed);
}

.hero-card-badge {
  display: inline-flex;
  padding: 0.35rem 0.75rem;
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.hero-card h2 {
  margin: 0 0 1rem;
  font-size: 1.75rem;
  line-height: 1.25;
}

.hero-link {
  color: var(--primary);
  font-weight: 700;
}

/* ── Section Headers ──────────────────────────── */

.section-header {
  padding: 4rem 0 1.5rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.section-action {
  font-size: 0.9rem;
  padding: 0.65rem 1.1rem;
  white-space: nowrap;
}

/* ── Latest Posts ──────────────────────────────── */

.latest-posts {
  padding-bottom: 1rem;
}

.latest-posts .grid-3,
.featured-posts .grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.post-card {
  position: relative;
}

.post-card-badge {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  display: inline-flex;
  padding: 0.3rem 0.65rem;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 999px;
}

.post-card-latest {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
}

.post-card-latest:hover {
  transform: translateY(-10px) scale(1.03);
  box-shadow: 0 20px 60px rgba(37, 99, 235, 0.15), var(--shadow-lg);
  border-color: var(--primary);
  z-index: 2;
}

/* ── Trending Posts ────────────────────────────── */

.trending-posts {
  padding-bottom: 2rem;
}

.trending-eyebrow {
  background: var(--trending-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.grid-trending {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.trending-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.75rem;
  padding: 2rem;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
}

.trending-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 20px 60px rgba(245, 158, 11, 0.12), var(--shadow-lg);
  border-color: rgba(245, 158, 11, 0.4);
  z-index: 2;
}

.trending-number {
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  background: var(--trending-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
  min-width: 3rem;
}

.trending-body h3 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  line-height: 1.3;
}

.trending-body p {
  color: var(--muted);
  margin: 0 0 1rem;
  font-size: 0.95rem;
}

.trending-rank-1 {
  border-color: rgba(245, 158, 11, 0.3);
}

.trending-rank-2 {
  border-color: rgba(239, 68, 68, 0.2);
}

.trending-rank-3 {
  border-color: rgba(168, 85, 247, 0.2);
}

/* ── Upload Section ───────────────────────────── */

.upload-section {
  padding: 3rem 0;
}

.upload-form {
  display: grid;
  gap: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  padding: 2.5rem;
}

.upload-form label {
  display: grid;
  gap: 0.5rem;
  color: var(--text);
  font-weight: 600;
}

.upload-form input[type="text"],
.upload-form input[type="date"],
.upload-form input[type="email"],
.upload-form textarea {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.upload-form input:focus,
.upload-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.upload-form textarea {
  min-height: 130px;
  resize: vertical;
}

.upload-form textarea[name="body"] {
  min-height: 280px;
  font-family: "SF Mono", "Fira Code", Menlo, monospace;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Image upload area */

.upload-image-area {
  border: 2px dashed var(--border);
  border-radius: 1rem;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  position: relative;
}

.upload-image-area:hover,
.upload-image-area.drag-over {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.upload-image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
}

.upload-image-placeholder svg {
  color: var(--primary);
  opacity: 0.6;
}

.upload-image-placeholder span {
  font-size: 0.9rem;
}

.upload-image-hint {
  font-size: 0.75rem !important;
  opacity: 0.6;
}

.upload-image-preview {
  max-height: 240px;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 0.75rem;
  object-fit: contain;
}

.upload-image-remove {
  display: inline-flex;
  margin-top: 0.75rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: transparent;
  color: #ef4444;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.upload-image-remove:hover {
  background: rgba(239, 68, 68, 0.08);
}

/* Formatting toolbar */

.upload-toolbar {
  display: flex;
  gap: 0.35rem;
  padding: 0.5rem;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 0.9rem 0.9rem 0 0;
}

.upload-toolbar + textarea {
  border-radius: 0 0 0.9rem 0.9rem !important;
}

.toolbar-btn {
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: "SF Mono", "Fira Code", Menlo, monospace;
}

.toolbar-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Form actions */

.upload-form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.upload-form-actions .btn {
  width: auto;
}

/* Tags input */

.tags-input-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: var(--surface-soft);
  cursor: text;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tags-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.tags-input-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tags-input-wrapper input {
  flex: 1;
  min-width: 120px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 0.3rem 0;
  outline: none;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  background: var(--primary);
  color: white;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  animation: tagPop 0.2s ease;
}

@keyframes tagPop {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.tag-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(255, 255, 255, 0.25);
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: background 0.15s ease;
}

.tag-chip button:hover {
  background: rgba(255, 255, 255, 0.45);
}

.blog-post-tags {
  margin: 1rem 0 0.5rem;
}

.blog-post-tags .tag-list {
  margin-top: 0;
}

/* Preview panel */

.upload-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  padding: 2.5rem;
  margin-top: 1.5rem;
}

.upload-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.upload-preview-header h3 {
  margin: 0;
}

/* ── Post Cards / Previews / Sidebar ──────────── */

.post-card,
.post-preview,
.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.75rem;
}

.post-card {
  padding: 2rem;
}

.post-card h3,
.post-preview-body h3,
.sidebar-card h3 {
  margin: 0 0 0.8rem;
  font-size: 1.3rem;
  line-height: 1.3;
  transition: color 0.2s ease;
}

.post-card:hover h3 {
  color: var(--primary);
}

.trending-card:hover h3 {
  color: var(--primary);
}

.trending-body h3 {
  transition: color 0.2s ease;
}

.post-card p,
.post-preview-body p,
.sidebar-card p {
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.read-more {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.95rem;
  transition: gap 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.read-more:hover {
  gap: 0.5rem;
}

/* ── Content Area / All Posts ──────────────────── */

.content-area {
  padding: 0 0 4rem;
}

.content-grid {
  display: grid;
  grid-template-columns: 2.5fr 1fr;
  gap: 2rem;
}

.posts-list {
  display: grid;
  gap: 2rem;
}

.post-preview {
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
}

.post-preview:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 20px 60px rgba(37, 99, 235, 0.12), var(--shadow-lg);
  border-color: var(--primary);
  z-index: 2;
}

.post-preview:hover .post-preview-body h3 {
  color: var(--primary);
}

.post-preview:hover img {
  transform: scale(1.05);
}

.post-preview img {
  transition: transform 0.4s ease;
}

.post-preview-body {
  padding: 1.75rem;
}

.sidebar {
  display: grid;
  gap: 1.5rem;
}

.sidebar-card {
  padding: 1.75rem;
}

.newsletter-form {
  display: grid;
  gap: 1rem;
}

.newsletter-form label {
  font-size: 0.9rem;
  color: var(--text);
}

.newsletter-form input {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  font: inherit;
  background: var(--surface-soft);
  color: var(--text);
}

.newsletter-form button {
  width: 100%;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.tag-list span {
  display: inline-flex;
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.tag-list span:hover,
.tag-list .tag-active {
  background: var(--primary);
  color: white;
}

.filter-tags span,
#sidebarTopics span {
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.filter-tags span:active {
  transform: scale(0.95);
}

.filter-count {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.post-tags-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.post-tag-sm {
  display: inline-flex;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.no-posts-message {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.no-posts-message p {
  font-size: 1.1rem;
}

/* ── Floating Menu ────────────────────────────── */

.floating-menu {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0.75rem;
}

.floating-menu-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(37, 99, 235, 0.35);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.floating-menu-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(37, 99, 235, 0.45);
}

.floating-icon-close {
  display: none;
}

.floating-menu.open .floating-icon-menu {
  display: none;
}

.floating-menu.open .floating-icon-close {
  display: block;
}

.floating-menu.open .floating-menu-toggle {
  background: #ef4444;
  box-shadow: 0 8px 32px rgba(239, 68, 68, 0.35);
}

.floating-menu-items {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.9);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.floating-menu.open .floating-menu-items {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.floating-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.floating-menu-item:hover {
  transform: translateX(-4px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
  background: var(--primary);
  color: white;
}

.floating-menu-item svg {
  flex-shrink: 0;
}

/* ── Contact Page ─────────────────────────────── */

.contact-section {
  padding-bottom: 2rem;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
}

.contact-form {
  display: grid;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.75rem;
  padding: 2.5rem;
}

.contact-form label {
  display: grid;
  gap: 0.5rem;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.contact-form textarea {
  min-height: 160px;
  resize: vertical;
}

.contact-info {
  display: grid;
  gap: 1.25rem;
  align-content: start;
}

.contact-info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.75rem;
  padding: 1.75rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.contact-info-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.contact-info-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.contact-info-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.contact-info-card p {
  color: var(--muted);
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.contact-info-card .read-more {
  font-size: 0.9rem;
}

/* ── Social / Connect Section ─────────────────── */

.connect-section {
  padding-bottom: 3rem;
}

.grid-social {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.social-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.75rem;
  padding: 2rem;
  text-align: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.social-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.social-card svg {
  color: var(--primary);
  margin: 0 auto 1rem;
}

.social-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

.social-card p {
  color: var(--muted);
  margin: 0;
  font-size: 0.9rem;
}

/* ── Blog Post Page ───────────────────────────── */

.blog-post {
  padding: 3rem 0 4rem;
}

.blog-post-header {
  max-width: 720px;
  margin-bottom: 2.5rem;
}

.blog-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  transition: gap 0.2s ease;
}

.blog-back-link:hover {
  gap: 0.5rem;
}

.blog-post-meta-bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.blog-read-time {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  background: var(--surface-soft);
  border-radius: 999px;
}

.blog-post-title {
  font-size: clamp(2rem, 3.5vw, 3rem);
  line-height: 1.1;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}

.blog-post-subtitle {
  font-size: 1.2rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 2rem;
}

.blog-author {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.blog-author-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.blog-author-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.blog-author-date {
  font-size: 0.85rem;
  color: var(--muted);
}

.blog-post-cover {
  width: 100%;
  max-height: 450px;
  object-fit: cover;
  border-radius: 1.5rem;
  margin-bottom: 3rem;
}

.blog-content-grid {
  display: grid;
  grid-template-columns: 2.5fr 1fr;
  gap: 3rem;
  align-items: start;
}

.blog-post-content {
  max-width: 720px;
}

.blog-post-content h2 {
  font-size: 1.6rem;
  margin: 2.5rem 0 1rem;
  line-height: 1.2;
}

.blog-post-content h3 {
  font-size: 1.25rem;
  margin: 2rem 0 0.75rem;
  line-height: 1.3;
}

.blog-post-content p {
  color: var(--text);
  margin: 0 0 1.5rem;
  font-size: 1.05rem;
  line-height: 1.75;
}

.blog-post-content ul {
  margin: 0 0 1.5rem;
  padding-left: 1.5rem;
}

.blog-post-content li {
  margin-bottom: 0.6rem;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text);
}

.blog-post-content blockquote {
  margin: 2rem 0;
  padding: 1.5rem 2rem;
  border-left: 4px solid var(--primary);
  background: var(--primary-soft);
  border-radius: 0 1rem 1rem 0;
}

.blog-post-content blockquote p {
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text);
  margin: 0;
}

.blog-post-content code {
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, monospace;
  font-size: 0.9em;
  padding: 0.15rem 0.4rem;
  background: var(--surface-soft);
  border-radius: 0.3rem;
  border: 1px solid var(--border);
}

.blog-post-content pre {
  margin: 1.5rem 0 2rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  overflow-x: auto;
}

.blog-post-content pre code {
  padding: 0;
  background: none;
  border: none;
  font-size: 0.88rem;
  line-height: 1.7;
}

.blog-sidebar {
  position: sticky;
  top: 5rem;
}

.related-posts-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.related-posts-list li a {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s ease;
  line-height: 1.4;
}

.related-posts-list li a:hover {
  color: var(--primary);
}

/* ── Admin Post Controls ──────────────────────── */

.admin-post-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.btn.danger {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.btn.danger:hover {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

/* ── Edit Overlay ─────────────────────────────── */

.edit-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem;
  overflow-y: auto;
}

.edit-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.75rem;
  width: min(720px, 100%);
  padding: 2.5rem;
  margin-top: 2rem;
  box-shadow: var(--shadow-lg);
  animation: editSlideIn 0.3s ease;
}

@keyframes editSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.edit-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.edit-panel-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.edit-close-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.edit-close-btn:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: white;
}

.edit-panel .upload-form {
  border: none;
  padding: 0;
  background: transparent;
}

/* ── Login Modal ──────────────────────────────── */

.login-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.75rem;
  width: min(420px, 100%);
  padding: 2.5rem;
  margin-top: 6rem;
  box-shadow: var(--shadow-lg);
  animation: editSlideIn 0.3s ease;
}

.login-form {
  display: grid;
  gap: 1.25rem;
}

.login-form label {
  display: grid;
  gap: 0.5rem;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
}

.login-form input {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.login-error {
  padding: 0.75rem 1rem;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 0.75rem;
  color: #ef4444;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

/* ── Footer ───────────────────────────────────── */

.site-footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--muted);
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--primary);
}

/* ── Hamburger Button ─────────────────────────── */

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 0.7rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger.is-active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.is-active span:nth-child(2) {
  opacity: 0;
}

.hamburger.is-active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Responsive ───────────────────────────────── */

/* Large desktops & ultrawide (1400px+) */
@media (min-width: 1400px) {
  .container {
    width: min(1280px, calc(100% - 4rem));
  }

  .hero h1 {
    font-size: 4.5rem;
  }

  .featured-posts .grid-3,
  .latest-posts .grid-3 {
    gap: 2rem;
  }

  .blog-post-content {
    max-width: 780px;
  }
}

/* Tablet landscape / small desktop (961px – 1200px) */
@media (max-width: 1200px) {
  .hero-content {
    grid-template-columns: 1.2fr 1fr;
    gap: 2rem;
  }

  .content-grid {
    grid-template-columns: 2fr 1fr;
  }

  .contact-grid {
    grid-template-columns: 1.3fr 1fr;
  }
}

/* Tablet portrait (769px – 960px) */
@media (max-width: 960px) {
  .hero-content,
  .content-grid,
  .blog-content-grid {
    grid-template-columns: 1fr;
  }

  .latest-posts .grid-3,
  .featured-posts .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-trending {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .grid-social {
    grid-template-columns: repeat(3, 1fr);
  }

  .blog-sidebar {
    position: static;
  }

  .header-inner {
    position: relative;
    padding: 0.85rem 0;
  }

  .hamburger {
    display: flex;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 1rem 1rem;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.1);
    z-index: 200;
    padding: 0.5rem 0;
  }

  .main-nav.nav-open {
    display: flex;
  }

  .main-nav a {
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
  }

  .main-nav a:last-child {
    border-bottom: none;
  }

  .main-nav a:hover {
    background: var(--primary-soft);
  }

  .header-actions {
    margin-left: auto;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-card h2 {
    font-size: 1.4rem;
  }

  .trending-number {
    font-size: 2rem;
  }
}

/* Large phones / small tablets (481px – 768px) */
@media (max-width: 768px) {
  .latest-posts .grid-3,
  .featured-posts .grid-3 {
    grid-template-columns: 1fr;
  }

  .grid-social {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 3.5rem 0 2.5rem;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .hero-stats {
    gap: 2rem;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  .section-header {
    padding: 3rem 0 1.25rem;
  }

  .post-card {
    padding: 1.5rem;
  }

  .trending-card {
    padding: 1.5rem;
  }

  .sidebar-card {
    padding: 1.5rem;
  }

  .blog-post {
    padding: 2rem 0 3rem;
  }

  .blog-post-title {
    font-size: 1.8rem;
  }

  .blog-post-subtitle {
    font-size: 1.05rem;
  }

  .blog-post-content h2 {
    font-size: 1.4rem;
  }

  .blog-post-content p,
  .blog-post-content li {
    font-size: 1rem;
  }

  .upload-form {
    padding: 1.75rem;
  }

  .edit-panel,
  .login-panel {
    padding: 1.75rem;
    margin-top: 1rem;
  }

  .edit-overlay {
    padding: 1rem;
  }

  .admin-post-actions {
    flex-direction: column;
  }

  .admin-post-actions .btn {
    width: 100%;
  }
}

/* Phones (max-width: 480px) */
@media (max-width: 480px) {
  .container {
    width: calc(100% - 1.5rem);
  }

  .header-inner {
    padding: 0.75rem 0;
  }

  .brand {
    font-size: 1.05rem;
    gap: 0.4rem;
  }

  .brand-logo {
    height: 30px;
  }

  .admin-toggle {
    display: none;
  }

  .hero {
    padding: 2.5rem 0 2rem;
  }

  .hero h1 {
    font-size: 1.75rem;
    max-width: 100%;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .hero-stats {
    flex-wrap: wrap;
    gap: 1.25rem;
    padding: 1rem 0;
    margin: 1.25rem 0;
  }

  .stat-number {
    font-size: 1.35rem;
  }

  .stat-label {
    font-size: 0.7rem;
  }

  .hero-actions {
    margin-top: 1rem;
  }

  .btn {
    width: 100%;
    padding: 0.85rem 1.2rem;
    font-size: 0.9rem;
  }

  .section-action {
    width: auto;
  }

  .hero-card {
    padding: 1.5rem;
    border-radius: 1.5rem;
  }

  .hero-card h2 {
    font-size: 1.2rem;
  }

  .hero-card-badge {
    font-size: 0.6rem;
  }

  .section-header {
    padding: 2.5rem 0 1rem;
  }

  .section-header h2 {
    font-size: 1.35rem;
  }

  .post-card,
  .trending-card,
  .sidebar-card {
    padding: 1.25rem;
    border-radius: 1.25rem;
  }

  .post-card h3,
  .post-preview-body h3,
  .sidebar-card h3 {
    font-size: 1.1rem;
  }

  .post-card p,
  .post-preview-body p {
    font-size: 0.9rem;
  }

  .trending-number {
    font-size: 1.75rem;
    min-width: 2.25rem;
  }

  .trending-card {
    gap: 1rem;
  }

  .trending-body h3 {
    font-size: 1rem;
  }

  .trending-body p {
    font-size: 0.85rem;
  }

  .post-preview {
    border-radius: 1.25rem;
  }

  .post-preview-body {
    padding: 1.25rem;
  }

  .blog-post {
    padding: 1.5rem 0 2.5rem;
  }

  .blog-post-title {
    font-size: 1.5rem;
  }

  .blog-post-subtitle {
    font-size: 0.95rem;
  }

  .blog-post-cover {
    border-radius: 1rem;
    max-height: 280px;
    margin-bottom: 2rem;
  }

  .blog-post-content h2 {
    font-size: 1.25rem;
    margin: 2rem 0 0.75rem;
  }

  .blog-post-content h3 {
    font-size: 1.1rem;
  }

  .blog-post-content p,
  .blog-post-content li {
    font-size: 0.95rem;
    line-height: 1.7;
  }

  .blog-post-content blockquote {
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
  }

  .blog-post-content pre {
    padding: 1rem;
    border-radius: 0.75rem;
    font-size: 0.8rem;
  }

  .contact-form {
    padding: 1.75rem;
  }

  .contact-info-card {
    padding: 1.5rem;
  }

  .social-card {
    padding: 1.5rem;
    border-radius: 1.25rem;
  }

  .upload-form {
    padding: 1.5rem;
    border-radius: 1.25rem;
  }

  .upload-form-actions {
    flex-direction: column;
  }

  .upload-form-actions .btn {
    width: 100%;
  }

  .upload-toolbar {
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.4rem;
  }

  .toolbar-btn {
    padding: 0.35rem 0.5rem;
    font-size: 0.7rem;
  }

  .upload-image-area {
    padding: 1.5rem;
  }

  .tags-input-wrapper {
    padding: 0.5rem 0.65rem;
  }

  .tag-chip {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .footer-inner p {
    font-size: 0.85rem;
  }

  .floating-menu {
    bottom: 1rem;
    right: 1rem;
  }

  .floating-menu-toggle {
    width: 46px;
    height: 46px;
  }

  .floating-menu-item {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
  }

  .edit-panel {
    padding: 1.5rem;
    border-radius: 1.25rem;
    margin-top: 0.5rem;
  }

  .login-panel {
    padding: 1.75rem;
    border-radius: 1.25rem;
    margin-top: 3rem;
  }

  .edit-overlay {
    padding: 0.75rem;
  }
}

/* Very small phones (max-width: 360px) */
@media (max-width: 360px) {
  .container {
    width: calc(100% - 1rem);
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .hero-stats {
    gap: 1rem;
  }

  .stat-number {
    font-size: 1.2rem;
  }

  .brand {
    font-size: 0.95rem;
  }

  .brand-logo {
    height: 26px;
  }

  .post-card h3,
  .post-preview-body h3 {
    font-size: 1rem;
  }

  .blog-post-title {
    font-size: 1.3rem;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .post-card-latest:hover,
  .trending-card:hover,
  .post-preview:hover,
  .social-card:hover,
  .contact-info-card:hover {
    transform: none;
    box-shadow: var(--shadow);
  }

  .post-preview:hover img {
    transform: none;
  }

  .post-card-latest:active,
  .trending-card:active,
  .post-preview:active {
    transform: scale(0.98);
    transition-duration: 0.1s;
  }

  .btn:hover {
    transform: none;
  }

  .btn:active {
    transform: scale(0.97);
  }

  .main-nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .floating-menu-item {
    min-height: 44px;
  }

  .tag-chip button {
    width: 22px;
    height: 22px;
    font-size: 0.85rem;
  }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    padding: 2rem 0 1.5rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero-stats {
    margin: 1rem 0;
    padding: 0.75rem 0;
  }

  .section-header {
    padding: 2rem 0 1rem;
  }

  .edit-overlay {
    padding: 0.5rem;
    align-items: flex-start;
  }

  .edit-panel,
  .login-panel {
    margin-top: 0.5rem;
  }
}

/* Print styles */
@media print {
  .site-header,
  .floating-menu,
  .site-footer,
  .hamburger,
  .admin-toggle,
  .theme-toggle,
  .hero-actions,
  .upload-section,
  .newsletter-form,
  .admin-post-actions {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .blog-post-content {
    max-width: 100%;
  }

  .blog-content-grid {
    grid-template-columns: 1fr;
  }

  a {
    text-decoration: underline;
  }
}
