/* =======================================================
   CheMentor Blog — Advanced Modern CSS
   Mobile-first, Responsive, White Background
======================================================= */

/* ---- CUSTOM PROPERTIES ---- */
:root {
  --bg:      #ffffff;
  --surface: #f8fafc;
  --border:  #e5e7eb;
  --ink:     #0f172a;
  --ink-2:   #1e293b;
  --muted:   #64748b;
  --muted-2: #94a3b8;

  --blue:   #2563eb;
  --cyan:   #06b6d4;
  --violet: #7c3aed;
  --orange: #f97316;
  --green:  #22c55e;
  --indigo: #4f46e5;
  --teal:   #0d9488;
  --rose:   #e11d48;
  --amber:  #d97706;

  --shadow-xs: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-sm: 0 4px 12px rgba(15,23,42,.07), 0 2px 6px rgba(15,23,42,.04);
  --shadow-md: 0 10px 28px rgba(15,23,42,.10), 0 4px 12px rgba(15,23,42,.06);
  --shadow-lg: 0 20px 48px rgba(15,23,42,.14), 0 8px 20px rgba(15,23,42,.08);

  --r-sm:  10px;
  --r-md:  16px;
  --r-lg:  22px;
  --r-xl:  28px;
  --r-full: 9999px;

  --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --trans: .22s cubic-bezier(.4,0,.2,1);
  --max-w: 1120px;
}

/* ---- RESET & BASE ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a  { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ---- SKIP LINK ---- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  z-index: 9999;
  background: var(--blue);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  transition: top .2s;
}
.skip-link:focus { top: 12px; }

/* ---- WRAP ---- */
.wrap {
  width: min(var(--max-w), calc(100% - 40px));
  margin-inline: auto;
}

/* ======================================================
   TOPBAR
====================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--trans);
}
.topbar.scrolled { box-shadow: var(--shadow-sm); }

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  flex-shrink: 0;
}
.brand__mark {
  width: 42px; height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue), var(--cyan) 50%, var(--violet));
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px rgba(37,99,235,.28);
  flex-shrink: 0;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-weight: 800; font-size: 16px; letter-spacing: -.3px; color: var(--ink); }
.brand__tag  { font-size: 11px; color: var(--muted); }

/* Nav */
.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: var(--r-full);
  transition: background var(--trans), color var(--trans), transform var(--trans);
}
.nav__link:hover {
  background: var(--surface);
  color: var(--ink);
  transform: translateY(-1px);
}
.nav__link--pill {
  background: linear-gradient(135deg, rgba(37,99,235,.10), rgba(124,58,237,.08));
  border: 1px solid rgba(37,99,235,.16);
  color: var(--ink-2);
}
.nav__link--pill:hover { background: linear-gradient(135deg, rgba(37,99,235,.18), rgba(124,58,237,.14)); }

/* Mobile toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px; height: 38px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform var(--trans), opacity var(--trans);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile Nav */
.mobile-nav {
  display: none;
  flex-direction: column;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 10px 20px 16px;
  gap: 4px;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  padding: 12px 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
}
.mobile-nav a:last-child { border-bottom: none; }

/* ======================================================
   HERO FEATURED (INDEX)
====================================================== */
.hero-featured {
  margin: 20px 0;
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.hero-featured__media {
  position: relative;
  aspect-ratio: 16/7;
  background: linear-gradient(135deg, #0f172a, #1e3a5f);
}
@media (max-width: 600px) { .hero-featured__media { aspect-ratio: 4/3; } }

.hero-featured__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.hero-featured__placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, rgba(37,99,235,.6), rgba(124,58,237,.5));
}
.hero-featured__overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(10,15,30,.88) 40%, rgba(10,15,30,.15) 100%);
}
.hero-featured__content {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: clamp(18px, 4vw, 48px);
  color: #fff;
}
.hero-featured__badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
}
.badge--white { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.26); color: #fff; }

.hero-featured__title {
  font-size: clamp(22px, 3.5vw, 42px);
  font-weight: 800;
  letter-spacing: -.5px;
  line-height: 1.12;
  margin-bottom: 12px;
  text-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.hero-featured__excerpt {
  font-size: clamp(13px, 1.5vw, 16px);
  opacity: .85;
  line-height: 1.7;
  margin-bottom: 20px;
  max-width: 560px;
}
.hero-featured__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  opacity: .75;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* ======================================================
   BLOG HEADER / SEARCH
====================================================== */
.blog-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0 12px;
  flex-wrap: wrap;
}
.section-title {
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--ink);
  margin-bottom: 4px;
}
.section-title em { font-style: normal; color: var(--blue); }
.section-sub { font-size: 14px; color: var(--muted); }

.search-form {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  overflow: hidden;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.search-form:focus-within {
  border-color: rgba(37,99,235,.4);
  box-shadow: 0 0 0 3px rgba(37,99,235,.10);
}
.search-input {
  border: none;
  background: transparent;
  padding: 10px 16px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  min-width: 180px;
}
.search-input::placeholder { color: var(--muted-2); }
.search-btn {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  background: none;
  border: none;
  color: var(--muted);
  transition: color var(--trans);
}
.search-btn:hover { color: var(--blue); }

/* ======================================================
   CATEGORY CHIPS
====================================================== */
.cat-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-strip::-webkit-scrollbar { display: none; }
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: background var(--trans), color var(--trans), border-color var(--trans), transform var(--trans);
}
.cat-chip:hover {
  background: rgba(37,99,235,.08);
  border-color: rgba(37,99,235,.22);
  color: var(--blue);
  transform: translateY(-1px);
}
.cat-chip--active {
  background: linear-gradient(135deg, rgba(37,99,235,.12), rgba(124,58,237,.08));
  border-color: rgba(37,99,235,.25);
  color: var(--blue);
  font-weight: 600;
}
.cat-chip sup { font-size: 10px; opacity: .7; }

/* ======================================================
   TAGS
====================================================== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .2px;
  border: 1px solid transparent;
  text-decoration: none;
  transition: opacity var(--trans), transform var(--trans);
}
.tag:hover { opacity: .85; transform: translateY(-1px); }
.tag--blue   { background: rgba(37,99,235,.10);  border-color: rgba(37,99,235,.22);  color: #1d4ed8; }
.tag--violet { background: rgba(124,58,237,.10); border-color: rgba(124,58,237,.22); color: #6d28d9; }
.tag--cyan   { background: rgba(6,182,212,.10);  border-color: rgba(6,182,212,.22);  color: #0e7490; }
.tag--orange { background: rgba(249,115,22,.10); border-color: rgba(249,115,22,.22); color: #c2410c; }
.tag--green  { background: rgba(34,197,94,.10);  border-color: rgba(34,197,94,.22);  color: #15803d; }
.tag--indigo { background: rgba(79,70,229,.10);  border-color: rgba(79,70,229,.22);  color: #4338ca; }
.tag--teal   { background: rgba(13,148,136,.10); border-color: rgba(13,148,136,.22); color: #0f766e; }
.tag--rose   { background: rgba(225,29,72,.10);  border-color: rgba(225,29,72,.22);  color: #be123c; }
.tag--amber  { background: rgba(217,119,6,.10);  border-color: rgba(217,119,6,.22);  color: #b45309; }

/* ======================================================
   POSTS GRID
====================================================== */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding-bottom: 32px;
}

/* Post Card */
.post-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xs);
  transition: transform var(--trans), box-shadow var(--trans), border-color var(--trans);
}
.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(37,99,235,.15);
}

.post-card--wide {
  grid-column: span 3;
  flex-direction: row;
}
.post-card--wide .post-card__thumb {
  aspect-ratio: auto;
  flex: 0 0 45%;
  max-height: 320px;
}
.post-card--wide .post-card__body {
  flex: 1;
  padding: 28px;
}

.post-card__thumb {
  display: block;
  aspect-ratio: 16/9;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, rgba(37,99,235,.10), rgba(124,58,237,.08));
  flex-shrink: 0;
}
.post-card__thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.post-card:hover .post-card__thumb img { transform: scale(1.04); }
.post-card__thumb-placeholder {
  width: 100%; height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(37,99,235,.06), rgba(124,58,237,.05));
}
.post-card__thumb-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(15,23,42,.05), transparent 60%);
}

.post-card__body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
}
.post-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.read-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.post-card__title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.3px;
  line-height: 1.3;
  margin: 0;
}
.post-card__title a {
  color: var(--ink);
  transition: color var(--trans);
}
.post-card__title a:hover { color: var(--blue); }
.post-card__excerpt {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
  flex: 1;
}
.post-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.post-card__meta {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--blue), var(--violet));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.avatar--md { width: 44px; height: 44px; font-size: 17px; }
.post-card__author { font-size: 13px; font-weight: 600; color: var(--ink); }
.post-card__date   { font-size: 12px; color: var(--muted); }
.post-card__actions { display: flex; gap: 8px; align-items: center; }

/* ======================================================
   BUTTONS
====================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--trans), box-shadow var(--trans), background var(--trans), border-color var(--trans);
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(0); }

.btn--primary {
  background: linear-gradient(135deg, rgba(37,99,235,.14), rgba(6,182,212,.10));
  border-color: rgba(37,99,235,.22);
  color: var(--blue);
}
.btn--primary:hover {
  background: linear-gradient(135deg, rgba(37,99,235,.22), rgba(6,182,212,.16));
}
.btn--ghost  { background: var(--bg); }
.btn--white  { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.28); color: #fff; backdrop-filter: blur(6px); }
.btn--white:hover { background: rgba(255,255,255,.28); }
.btn--danger { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.22); color: #dc2626; }
.btn--danger:hover { background: rgba(239,68,68,.14); }
.btn--sm  { padding: 7px 12px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn--lg  { padding: 13px 24px; font-size: 15px; }
.btn--icon { padding: 7px; aspect-ratio: 1; }

/* ======================================================
   PAGINATION
====================================================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 16px 0 32px;
  flex-wrap: wrap;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: all var(--trans);
}
.page-btn:hover {
  background: var(--surface);
  color: var(--ink);
  transform: translateY(-1px);
}
.page-btn--active {
  background: linear-gradient(135deg, rgba(37,99,235,.12), rgba(124,58,237,.08));
  border-color: rgba(37,99,235,.24);
  color: var(--blue);
  font-weight: 700;
}

/* ======================================================
   EMPTY STATE
====================================================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-state__icon { font-size: 48px; margin-bottom: 14px; }
.empty-state h3 { font-size: 20px; margin-bottom: 8px; }
.empty-state p { color: var(--muted); font-size: 15px; }
.empty-state a { color: var(--blue); }

/* ======================================================
   SINGLE POST
====================================================== */
.single-post {
  max-width: 800px;
  margin-inline: auto;
  padding: 32px 0 48px;
}

.post-header { margin-bottom: 24px; }
.post-header__badge { margin-bottom: 14px; }
.post-header__title {
  font-size: clamp(26px, 4vw, 44px);
  font-weight: 800;
  letter-spacing: -.7px;
  line-height: 1.12;
  color: var(--ink);
  margin-bottom: 18px;
}
.post-header__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.post-header__author { font-size: 15px; font-weight: 600; }
.post-header__details { font-size: 13.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.post-hero-img {
  margin: 0 0 28px;
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.post-hero-img img { width: 100%; object-fit: cover; max-height: 480px; }

/* Reading Progress */
.reading-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 200;
  background: var(--border);
}
.reading-progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan), var(--violet));
  width: 0%;
  transition: width .1s linear;
  border-radius: 0 var(--r-full) var(--r-full) 0;
}

/* Post Content */
.post-content {
  font-size: 17px;
  line-height: 1.88;
  color: #1e293b;
  margin-bottom: 40px;
}
.post-content p     { margin-bottom: 18px; }
.post-content h2    { font-size: 26px; font-weight: 800; letter-spacing: -.4px; margin: 36px 0 14px; color: var(--ink); }
.post-content h3    { font-size: 20px; font-weight: 700; letter-spacing: -.3px; margin: 30px 0 12px; color: var(--ink); }
.post-content h4    { font-size: 17px; font-weight: 700; margin: 24px 0 10px; }
.post-content strong { font-weight: 700; color: var(--ink); }
.post-content em    { font-style: italic; }
.post-content a     { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.post-content ul, .post-content ol { margin: 12px 0 20px 22px; }
.post-content li    { margin-bottom: 7px; line-height: 1.7; }
.post-content blockquote {
  margin: 24px 0;
  padding: 18px 22px;
  border-left: 4px solid var(--blue);
  background: rgba(37,99,235,.04);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--ink-2);
  font-style: italic;
}
.post-content code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: .88em;
  color: var(--rose);
}
.post-content pre {
  background: var(--ink);
  color: #e2e8f0;
  border-radius: var(--r-md);
  padding: 20px;
  overflow-x: auto;
  margin: 20px 0;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.65;
}

/* Post Footer */
.post-footer {
  border-top: 1px solid var(--border);
  padding-top: 28px;
}
.post-footer__category {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 22px;
}

/* Share Bar */
.share-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.share-bar__label {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 14px;
}
.share-bar__buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transition: all var(--trans);
  text-decoration: none;
  box-shadow: var(--shadow-xs);
}
.share-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.share-btn--fb  { border-color: rgba(24,119,242,.22); color: #1877f2; background: rgba(24,119,242,.06); }
.share-btn--x   { border-color: rgba(0,0,0,.15); color: #000; background: rgba(0,0,0,.04); }
.share-btn--li  { border-color: rgba(0,119,181,.22); color: #0077b5; background: rgba(0,119,181,.06); }
.share-btn--wa  { border-color: rgba(37,211,102,.25); color: #25d366; background: rgba(37,211,102,.07); }
.share-btn--copy { border-color: rgba(37,99,235,.22); color: var(--blue); background: rgba(37,99,235,.06); }

.post-footer__admin {
  font-size: 13px;
  color: var(--muted);
  padding-top: 14px;
}
.post-footer__admin a { color: var(--blue); }

/* Related Posts */
.related-posts { padding: 10px 0 48px; }
.related-posts .section-title { margin-bottom: 18px; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.related-card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg);
  box-shadow: var(--shadow-xs);
  transition: transform var(--trans), box-shadow var(--trans);
}
.related-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.related-card__thumb {
  display: block;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(37,99,235,.08), rgba(124,58,237,.06));
}
.related-card__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.related-card:hover .related-card__thumb img { transform: scale(1.05); }
.related-card__thumb-placeholder { width: 100%; height: 100%; background: var(--surface); }
.related-card__body { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.related-card__title { font-size: 15px; font-weight: 700; line-height: 1.35; }
.related-card__title a { color: var(--ink); transition: color var(--trans); }
.related-card__title a:hover { color: var(--blue); }
.related-card__meta { font-size: 12.5px; color: var(--muted); }

/* Error Page */
.error-page {
  min-height: 60vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 40px 20px;
}
.error-code { font-size: 80px; font-weight: 900; color: var(--border); line-height: 1; margin-bottom: 12px; }
.error-page h1 { font-size: 28px; margin-bottom: 10px; }
.error-page p  { color: var(--muted); margin-bottom: 24px; }

/* ======================================================
   FOOTER
====================================================== */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.footer__inner {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.2fr;
  gap: 32px;
  padding: 48px 0 40px;
  align-items: start;
}
.footer__col--brand {}
.footer__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.footer__logoMark {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue), var(--cyan) 50%, var(--violet));
  display: grid;
  place-items: center;
}
.footer__brandName { font-weight: 800; font-size: 17px; }
.footer__desc { font-size: 14px; color: var(--muted); line-height: 1.7; margin-bottom: 16px; max-width: 280px; }
.footer__social { display: flex; gap: 8px; }
.social-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg);
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: all var(--trans);
}
.social-btn:hover { color: var(--blue); border-color: rgba(37,99,235,.25); transform: translateY(-2px); }

.footer__colTitle { font-weight: 700; font-size: 13.5px; margin-bottom: 12px; color: var(--ink); }
.footer__links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer__links a { font-size: 14px; color: var(--muted); transition: color var(--trans); }
.footer__links a:hover { color: var(--blue); }

.footer__adminCard {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
}
.footer__adminLabel { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; font-weight: 500; }

.footer__bottom {
  border-top: 1px solid var(--border);
  padding: 16px 0;
}
.footer__bottomInner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}

/* ======================================================
   ADMIN PANEL
====================================================== */
.admin-wrap { padding: 24px 0 48px; }

.admin-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.admin-page-header__actions { display: flex; gap: 10px; flex-shrink: 0; }
.admin-badge {
  display: inline-flex;
  padding: 5px 12px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, rgba(37,99,235,.10), rgba(124,58,237,.08));
  border: 1px solid rgba(37,99,235,.18);
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
  margin-bottom: 8px;
}
.admin-page-title { font-size: 26px; font-weight: 800; letter-spacing: -.4px; margin-bottom: 4px; }
.admin-page-sub   { font-size: 14px; color: var(--muted); }

/* Stats */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  transition: transform var(--trans), box-shadow var(--trans);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.stat-card--green { background: rgba(34,197,94,.04); border-color: rgba(34,197,94,.18); }
.stat-card--blue  { background: rgba(37,99,235,.04); border-color: rgba(37,99,235,.18); }
.stat-card--violet{ background: rgba(124,58,237,.04); border-color: rgba(124,58,237,.18); }
.stat-card__num { font-size: 32px; font-weight: 900; letter-spacing: -.5px; margin-bottom: 4px; }
.stat-card__label { font-size: 13px; color: var(--muted); }
.stat-card__label a { color: var(--blue); }

/* Table */
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  font-size: 13.5px;
}
.admin-table th, .admin-table td {
  padding: 13px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.admin-table thead th { background: var(--surface); font-weight: 700; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: rgba(37,99,235,.025); }
.admin-table__sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.admin-table__actions { display: flex; gap: 6px; }
.muted { color: var(--muted); }
.mono  { font-family: var(--font-mono); font-size: 12.5px; }

.status-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}
.status-badge--published { background: rgba(34,197,94,.10); border-color: rgba(34,197,94,.25); color: #15803d; }
.status-badge--draft      { background: rgba(37,99,235,.08); border-color: rgba(37,99,235,.20); color: var(--blue); }

/* Edit Grid */
.edit-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 20px;
  align-items: start;
  margin-top: 20px;
}
.edit-form { display: flex; flex-direction: column; gap: 0; }
.form-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}
.form-section--row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}
.field__label small { font-weight: 400; }
.req { color: var(--rose); }
.field__input {
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 13px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
  width: 100%;
}
.field__input:focus {
  border-color: rgba(37,99,235,.45);
  box-shadow: 0 0 0 3px rgba(37,99,235,.10);
}
.field__input--mono { font-family: var(--font-mono); font-size: 13px; }
.field__input--code { font-family: var(--font-mono); font-size: 13px; resize: vertical; }
.field__input--file { padding: 8px; cursor: pointer; }
.field__hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* Image Box */
.image-box {
  background: var(--surface);
  border-style: dashed;
  border-color: rgba(15,23,42,.15);
}
.image-box__header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
}
.image-box__sub { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.img-preview { margin-top: 14px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); }
.img-preview img { width: 100%; max-height: 220px; object-fit: cover; display: block; }
.img-preview__label { font-size: 12px; color: var(--muted); padding: 6px 10px; background: var(--surface); }
.img-preview--empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px;
  color: var(--muted);
  font-size: 13px;
}

/* Toolbar */
.toolbar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-bottom: none;
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.toolbar + .field__input { border-radius: 0 0 var(--r-md) var(--r-md); border-top-color: var(--border); }
.toolbar-btn {
  padding: 5px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 12.5px;
  font-family: var(--font);
  color: var(--ink-2);
  cursor: pointer;
  transition: all var(--trans);
}
.toolbar-btn:hover { background: var(--blue); color: #fff; border-color: transparent; }
.toolbar-divider { width: 1px; background: var(--border); margin: 0 4px; }
.char-counter { font-size: 12px; color: var(--muted); text-align: right; margin-top: 4px; }

/* Live Preview */
.live-preview {
  position: sticky;
  top: 80px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
}
.live-preview__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.live-preview__title { font-weight: 700; font-size: 14px; }
.live-preview__controls { display: flex; gap: 8px; }
.live-preview__canvas {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}
.preview-badge {
  display: inline-flex;
  padding: 5px 12px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, rgba(37,99,235,.10), rgba(6,182,212,.08));
  border: 1px solid rgba(37,99,235,.18);
  font-size: 12px;
  color: var(--blue);
  font-weight: 600;
  margin-bottom: 10px;
}
.preview-title { font-size: 18px; font-weight: 800; letter-spacing: -.3px; line-height: 1.25; margin-bottom: 8px; }
.preview-meta  { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.preview-body  { font-size: 14px; line-height: 1.8; color: var(--ink-2); }
.preview-body p  { margin-bottom: 10px; }
.preview-body h2, .preview-body h3 { font-weight: 700; margin: 16px 0 8px; }
.preview-body strong { font-weight: 700; }
.live-preview__url {
  padding: 10px 14px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 20px;
}

/* Alerts */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 14px;
  margin-bottom: 16px;
}
.alert--ok  { background: rgba(34,197,94,.08); border-color: rgba(34,197,94,.25); color: #15803d; }
.alert--bad { background: rgba(239,68,68,.07); border-color: rgba(239,68,68,.22); color: #dc2626; }
.alert a { color: inherit; text-decoration: underline; }

/* ======================================================
   TOAST
====================================================== */
#toast {
  position: fixed;
  left: 50%; bottom: 20px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15,23,42,.94);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--r-full);
  font-size: 13.5px;
  font-family: var(--font);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  white-space: nowrap;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ======================================================
   AOS - SIMPLE ANIMATIONS
====================================================== */
[data-aos] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .55s ease, transform .55s ease;
}
[data-aos].aos-in {
  opacity: 1;
  transform: translateY(0);
}

/* ======================================================
   DOT SEPARATOR
====================================================== */
.dot { opacity: .5; }

/* ======================================================
   RESPONSIVE
====================================================== */
@media (max-width: 1060px) {
  .footer__inner { grid-template-columns: 1fr 1fr; }
  .admin-stats   { grid-template-columns: repeat(2, 1fr); }
  .posts-grid    { grid-template-columns: repeat(2, 1fr); }
  .post-card--wide { grid-column: span 2; }
}

@media (max-width: 860px) {
  .edit-grid       { grid-template-columns: 1fr; }
  .live-preview    { position: static; max-height: none; }
  .related-grid    { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .wrap { width: calc(100% - 28px); }
  .nav  { display: none; }
  .nav-toggle { display: flex; }

  .posts-grid { grid-template-columns: 1fr; }
  .post-card--wide { grid-column: span 1; flex-direction: column; }
  .post-card--wide .post-card__thumb { flex: none; aspect-ratio: 16/9; max-height: none; }

  .footer__inner { grid-template-columns: 1fr; gap: 20px; padding: 28px 0 24px; }
  .admin-stats   { grid-template-columns: repeat(2, 1fr); }
  .form-section--row { grid-template-columns: 1fr; }
  .blog-header   { flex-direction: column; align-items: flex-start; }
  .search-form   { width: 100%; }
  .search-input  { min-width: 0; flex: 1; }
  .related-grid  { grid-template-columns: 1fr; }

  .post-header__title { font-size: 28px; }
  .post-content { font-size: 16px; }

  .share-bar__buttons { gap: 8px; }
  .share-btn { padding: 7px 10px; font-size: 12px; }
}

@media (max-width: 480px) {
  .admin-stats { grid-template-columns: 1fr 1fr; }
  .hero-featured__title { font-size: 20px; }
  .hero-featured__excerpt { display: none; }
}

/* ======================================================
   PRINT
====================================================== */
@media print {
  .topbar, .footer, .share-bar, .related-posts, .cat-strip,
  .blog-header, .reading-progress, .post-footer__admin { display: none !important; }
  .post-content { font-size: 12pt; line-height: 1.6; }
  .post-header__title { font-size: 22pt; }
  a { color: inherit !important; text-decoration: none; }
}
