/* ============================================================
   MotaDev — Redesigned Stylesheet
   Muted dark · Editorial · Sharp · No-nonsense developer feel
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,600;1,400&family=Fraunces:ital,opsz,wght@0,9..144,300..900;1,9..144,300..900&family=Inter:wght@300;400;500;600;700&display=swap');

/* ── VARIABLES ─────────────────────────────────────────────── */
:root {
  /* Backgrounds — warm charcoal, not blue-black */
  --bg-base:     #0f0f0f;
  --bg-raised:   #161616;
  --bg-overlay:  #1e1e1e;
  --bg-muted:    #262626;
  --bg-subtle:   #2e2e2e;

  /* Borders */
  --border:      rgba(255,255,255,0.08);
  --border-mid:  rgba(255,255,255,0.12);
  --border-hi:   rgba(255,255,255,0.2);

  /* Accent — amber/orange. Warm, deliberate, editorial */
  --accent:      #e8935a;
  --accent-2:    #c97a3d;
  --accent-dim:  rgba(232,147,90,0.1);
  --accent-glow: rgba(232,147,90,0.2);

  /* Semantic */
  --green:   #4ade80;
  --red:     #f87171;
  --amber:   #fbbf24;
  --blue:    #60a5fa;

  /* Text */
  --text-hi:   #f5f5f5;
  --text-md:   #a3a3a3;
  --text-lo:   #525252;

  /* Type */
  --ff-sans:    'Inter', system-ui, sans-serif;
  --ff-serif:   'Fraunces', Georgia, serif;
  --ff-mono:    'IBM Plex Mono', 'Fira Code', monospace;

  /* Radii — sharp but not harsh */
  --r-xs:  3px;
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  16px;
  --r-xl:  22px;

  /* Shadows */
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:  0 12px 48px rgba(0,0,0,0.6);

  --ease: cubic-bezier(0.4,0,0.2,1);
  --t:    0.2s;
  --t-md: 0.35s;

  --nav-h:     60px;
  --sidebar-w: 240px;
}

/* ── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; font-size: 16px; }
body {
  font-family: var(--ff-sans);
  background: var(--bg-base);
  color: var(--text-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar            { width: 5px; height: 5px; }
::-webkit-scrollbar-track      { background: var(--bg-base); }
::-webkit-scrollbar-thumb      { background: var(--bg-muted); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover{ background: var(--accent); }
::selection { background: var(--accent-dim); color: var(--accent); }

/* ── TYPE ──────────────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 {
  font-family: var(--ff-serif);
  color: var(--text-hi);
  line-height: 1.15;
  font-weight: 400;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.55rem); }
h4 { font-size: 1.1rem; font-family: var(--ff-sans); font-weight: 600; }
p  { margin-bottom: 1rem; }
a  { color: var(--accent); text-decoration: none; transition: color var(--t) var(--ease); }
a:hover { color: var(--text-hi); }
img { max-width: 100%; display: block; }
ul, ol { padding-left: 1.4rem; }
strong { color: var(--text-hi); font-weight: 600; }

/* ── LAYOUT ────────────────────────────────────────────────── */
.container      { max-width: 1180px; margin: 0 auto; padding: 0 1.25rem; }
.container-wide { max-width: 1440px; margin: 0 auto; padding: 0 1.25rem; }
.sr-only { position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap; }

/* ── UTILITIES ─────────────────────────────────────────────── */
.text-accent   { color: var(--accent); }
.text-hi       { color: var(--text-hi); }
.text-lo       { color: var(--text-lo); }
.text-mono     { font-family: var(--ff-mono); }
.text-serif    { font-family: var(--ff-serif); }

.label {
  font-family: var(--ff-mono);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-lo);
}

.dot-sep { color: var(--text-lo); margin: 0 .35rem; }

/* ── BADGE ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--r-xs);
  font-size: .65rem; font-weight: 600; font-family: var(--ff-mono);
  letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  border: 1px solid transparent;
}
.badge-accent  { background: var(--accent-dim); color: var(--accent); border-color: rgba(232,147,90,.2); }
.badge-green   { background: rgba(74,222,128,.08); color: var(--green); border-color: rgba(74,222,128,.2); }
.badge-red     { background: rgba(248,113,113,.08); color: var(--red);  border-color: rgba(248,113,113,.2); }
.badge-amber   { background: rgba(251,191,36,.08);  color: var(--amber);border-color: rgba(251,191,36,.2); }
.badge-blue    { background: rgba(96,165,250,.08);  color: var(--blue); border-color: rgba(96,165,250,.2); }
.badge-muted   { background: var(--bg-muted); color: var(--text-lo); border-color: var(--border); }

/* ── CARD ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--t) var(--ease), transform var(--t) var(--ease);
  overflow: hidden;
}
.card:hover { border-color: var(--border-mid); }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

/* ── DIVIDER ───────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 1.5rem 0; }

/* ── BUTTONS ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: .55rem 1.25rem;
  border-radius: var(--r-sm);
  font-family: var(--ff-sans); font-size: .875rem; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: all var(--t) var(--ease);
  white-space: nowrap; text-decoration: none; line-height: 1;
  -webkit-appearance: none;
}
.btn-primary {
  background: var(--accent); color: #0f0f0f; border-color: var(--accent); font-weight: 600;
}
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #0f0f0f; }
.btn-outline {
  background: transparent; border-color: var(--border-mid); color: var(--text-md);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn-ghost {
  background: transparent; border-color: transparent; color: var(--text-md);
}
.btn-ghost:hover { color: var(--text-hi); background: var(--bg-overlay); }
.btn-danger {
  background: rgba(248,113,113,.1); color: var(--red); border-color: rgba(248,113,113,.2);
}
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn-sm  { padding: .38rem .85rem; font-size: .8rem; }
.btn-lg  { padding: .75rem 1.75rem; font-size: .95rem; }
.btn-icon{ padding: .5rem; border-radius: var(--r-sm); }
.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ── FORMS ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
label {
  display: block; margin-bottom: .35rem;
  font-size: .8rem; font-weight: 500; color: var(--text-md);
}
.form-control {
  width: 100%; padding: .6rem .9rem;
  background: var(--bg-overlay); border: 1px solid var(--border-mid);
  border-radius: var(--r-sm); color: var(--text-hi);
  font-family: var(--ff-sans); font-size: .875rem;
  transition: border-color var(--t) var(--ease);
  outline: none; -webkit-appearance: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-control::placeholder { color: var(--text-lo); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23525252' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .75rem center;
  padding-right: 2.2rem; cursor: pointer;
}
.form-hint  { font-size: .74rem; color: var(--text-lo); margin-top: .3rem; }
.form-error { font-size: .74rem; color: var(--red);     margin-top: .3rem; }
.input-group { display: flex; }
.input-group .form-control { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group .btn { border-radius: 0 var(--r-sm) var(--r-sm) 0; flex-shrink: 0; }
.checkbox-group { display: flex; align-items: flex-start; gap: .65rem; cursor: pointer; }
.checkbox-group input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; margin-top: 3px; }

/* ── NAVBAR ────────────────────────────────────────────────── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--nav-h);
  background: rgba(15,15,15,.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  transition: border-color var(--t) var(--ease);
}
.navbar.scrolled { border-bottom-color: var(--border-mid); }
.navbar-inner {
  display: flex; align-items: center; gap: 1rem;
  height: 100%; max-width: 1440px; margin: 0 auto; padding: 0 1.25rem;
}
.navbar-brand {
  display: flex; align-items: center; gap: .55rem;
  font-family: var(--ff-mono); font-weight: 600; font-size: 1rem;
  color: var(--text-hi); text-decoration: none; flex-shrink: 0;
  letter-spacing: -.01em;
}
.navbar-brand .brand-mark {
  width: 28px; height: 28px; border-radius: var(--r-xs);
  background: var(--accent); color: #0f0f0f;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; flex-shrink: 0;
}
.navbar-brand .brand-text { color: var(--text-hi); }
.navbar-brand .brand-text span { color: var(--accent); }

.navbar-nav {
  display: flex; align-items: center; gap: .15rem;
  list-style: none; margin: 0 auto;
}
.navbar-nav a {
  display: flex; align-items: center; gap: .35rem;
  padding: .35rem .7rem; border-radius: var(--r-sm);
  color: var(--text-md); font-size: .85rem; font-weight: 450;
  transition: all var(--t) var(--ease); text-decoration: none;
}
.navbar-nav a:hover, .navbar-nav a.active {
  color: var(--text-hi); background: var(--bg-overlay);
}
.navbar-nav a.active { color: var(--accent); }

/* Dropdown */
.nav-dropdown { position: relative; }
.dropdown-toggle .caret { font-size: .55rem; opacity: .5; transition: transform var(--t) var(--ease); }
.nav-dropdown:hover .caret { transform: rotate(180deg); opacity: 1; }
.dropdown-menu {
  position: absolute; top: calc(100% + .4rem); left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 190px; background: var(--bg-overlay);
  border: 1px solid var(--border-mid); border-radius: var(--r-md);
  padding: .4rem; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: all var(--t) var(--ease); z-index: 100;
}
.nav-dropdown:hover .dropdown-menu {
  opacity: 1; pointer-events: all; transform: translateX(-50%) translateY(0);
}
.dropdown-menu a {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .75rem; border-radius: var(--r-sm);
  color: var(--text-md); font-size: .84rem;
  transition: all var(--t) var(--ease);
}
.dropdown-menu a:hover { color: var(--text-hi); background: var(--bg-muted); }
.cat-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dropdown-divider { height: 1px; background: var(--border); margin: .35rem 0; }

.navbar-actions { display: flex; align-items: center; gap: .4rem; margin-left: auto; flex-shrink: 0; }

/* Search */
.navbar-search { position: relative; display: flex; align-items: center; }
.search-input {
  width: 180px; padding: .38rem .8rem .38rem 2rem;
  background: var(--bg-overlay); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text-hi);
  font-size: .82rem; font-family: var(--ff-sans);
  transition: all var(--t) var(--ease); outline: none;
}
.search-input:focus { width: 240px; border-color: var(--accent); }
.search-icon { position: absolute; left: .65rem; color: var(--text-lo); font-size: .75rem; pointer-events: none; }
.search-results {
  position: absolute; top: calc(100% + .4rem); left: 0;
  min-width: 300px; background: var(--bg-overlay);
  border: 1px solid var(--border-mid); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); overflow: hidden;
  display: none; z-index: 200;
}
.search-results.show { display: block; }
.search-result-item {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .65rem 1rem; transition: background var(--t);
  cursor: pointer; text-decoration: none;
}
.search-result-item:hover { background: var(--bg-muted); }
.search-result-item .title { font-size: .85rem; color: var(--text-hi); font-weight: 500; }
.search-result-item .meta  { font-size: .72rem; color: var(--text-lo); margin-top: 2px; }

/* User menu */
.user-menu { position: relative; }
.user-avatar-btn {
  width: 32px; height: 32px; border-radius: 50%;
  overflow: hidden; cursor: pointer; border: 1.5px solid var(--border-mid);
  transition: border-color var(--t);
}
.user-avatar-btn:hover { border-color: var(--accent); }
.user-avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.user-dropdown {
  position: absolute; top: calc(100% + .4rem); right: 0;
  width: 210px; background: var(--bg-overlay);
  border: 1px solid var(--border-mid); border-radius: var(--r-md);
  padding: .4rem; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transform: translateY(-6px);
  transition: all var(--t) var(--ease); z-index: 200;
}
.user-menu.open .user-dropdown { opacity: 1; pointer-events: all; transform: translateY(0); }
.user-info { padding: .6rem .75rem .8rem; border-bottom: 1px solid var(--border); margin-bottom: .4rem; }
.user-info .name { font-weight: 600; color: var(--text-hi); font-size: .875rem; }
.user-info .role { font-size: .7rem; color: var(--text-lo); font-family: var(--ff-mono); margin-top: .1rem; }
.user-dropdown a {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .75rem; border-radius: var(--r-sm);
  color: var(--text-md); font-size: .84rem;
  transition: all var(--t); text-decoration: none;
}
.user-dropdown a:hover { color: var(--text-hi); background: var(--bg-muted); }
.user-dropdown .danger { color: var(--red); }
.user-dropdown .danger:hover { background: rgba(248,113,113,.08); }
.notif-badge {
  position: absolute; top: -3px; right: -3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: .58rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--bg-base);
}

/* Mobile toggle */
.mobile-toggle {
  display: none; flex-direction: column; gap: 4px;
  cursor: pointer; padding: .4rem; border: none;
  background: transparent;
}
.mobile-toggle span {
  display: block; width: 20px; height: 1.5px;
  background: var(--text-md); border-radius: 2px;
  transition: all var(--t) var(--ease);
}
.mobile-toggle.open span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.mobile-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.mobile-toggle.open span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* Mobile nav drawer */
.mobile-nav {
  display: flex;
  position: fixed; top: var(--nav-h); left: 0; right: 0; bottom: 0;
  background: var(--bg-base); border-top: 1px solid var(--border);
  z-index: 999; overflow-y: auto; padding: 1rem;
  flex-direction: column; gap: .2rem;
  transform: translateX(-100%); transition: transform var(--t-md) var(--ease);
  pointer-events: none;
  visibility: hidden;
}
.mobile-nav.open {
  transform: translateX(0);
  pointer-events: all;
  visibility: visible;
}
.mobile-nav .nav-section {
  font-family: var(--ff-mono); font-size: .62rem; color: var(--text-lo);
  letter-spacing: .12em; text-transform: uppercase;
  padding: .85rem .75rem .3rem; margin-top: .4rem;
}
.mobile-nav a {
  display: flex; align-items: center; gap: .65rem;
  padding: .7rem .75rem; border-radius: var(--r-sm);
  color: var(--text-md); font-size: .92rem; font-weight: 450;
  transition: all var(--t); text-decoration: none;
}
.mobile-nav a:hover, .mobile-nav a.active-mob { color: var(--text-hi); background: var(--bg-overlay); }
.mobile-nav a i { width: 16px; text-align: center; font-size: .85rem; }
.mobile-nav .danger { color: var(--red); }

/* ── HERO ──────────────────────────────────────────────────── */
.hero {
  min-height: 90vh; display: flex; align-items: center;
  padding: calc(var(--nav-h) + 5rem) 0 5rem;
  position: relative; overflow: hidden;
}
.hero-noise {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  background-repeat: repeat;
}
.hero-glow-a {
  position: absolute; top: -10%; right: 5%; width: 500px; height: 500px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(232,147,90,.06) 0%, transparent 65%);
}
.hero-glow-b {
  position: absolute; bottom: 0%; left: -5%; width: 400px; height: 400px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(96,165,250,.04) 0%, transparent 65%);
}
.hero-content { position: relative; z-index: 1; max-width: 720px; }
.hero-kicker {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--ff-mono); font-size: .72rem; color: var(--accent);
  letter-spacing: .1em; text-transform: uppercase; margin-bottom: 1.25rem;
}
.hero-kicker::before { content: '//'; opacity: .5; }
.hero-title { margin-bottom: 1.1rem; font-size: clamp(2.2rem, 5.5vw, 4rem); font-weight: 600; }
.hero-title em { font-style: italic; color: var(--accent); font-weight: 500; }
.hero-sub {
  font-size: 1.05rem; color: var(--text-md); line-height: 1.75;
  max-width: 540px; margin-bottom: 2rem;
}
.hero-cta { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-bottom: 3rem; }
.hero-stats {
  display: flex; gap: 2rem; flex-wrap: wrap;
  padding-top: 2rem; border-top: 1px solid var(--border);
}
.hero-stat .num {
  font-family: var(--ff-mono); font-size: 1.5rem; font-weight: 600;
  color: var(--text-hi); line-height: 1;
}
.hero-stat .lbl { font-size: .72rem; color: var(--text-lo); margin-top: .3rem; font-family: var(--ff-mono); letter-spacing: .06em; }

/* ── SECTION ───────────────────────────────────────────────── */
.section    { padding: 5rem 0; }
.section-sm { padding: 3rem 0; }
.section-header { margin-bottom: 2.25rem; }
.section-header .kicker {
  font-family: var(--ff-mono); font-size: .68rem; color: var(--accent);
  letter-spacing: .12em; text-transform: uppercase; margin-bottom: .5rem;
}
.section-header h2 { margin-bottom: .4rem; }
.section-header p { color: var(--text-md); max-width: 520px; }
.section-header.center { text-align: center; }
.section-header.center p { margin: 0 auto; }
.section-header.row {
  display: flex; align-items: flex-end;
  justify-content: space-between; flex-wrap: wrap; gap: 1rem;
}

/* ── POST CARDS ────────────────────────────────────────────── */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}
.post-card { display: flex; flex-direction: column; }
.post-card-thumb {
  aspect-ratio: 16/9; overflow: hidden;
  background: var(--bg-overlay); position: relative;
}
.post-card-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s var(--ease);
}
.post-card:hover .post-card-thumb img { transform: scale(1.04); }
.no-thumb {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: var(--bg-overlay); color: var(--text-lo); font-size: 2rem;
}
.post-card-body { padding: 1.1rem 1.1rem 1rem; flex: 1; display: flex; flex-direction: column; gap: .6rem; }
.post-card-cat {
  font-family: var(--ff-mono); font-size: .65rem; letter-spacing: .08em;
  text-transform: uppercase; font-weight: 600;
}
.post-card-title {
  font-family: var(--ff-serif); font-size: 1.1rem; font-weight: 400;
  color: var(--text-hi); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card-title a { color: inherit; text-decoration: none; }
.post-card-title a:hover { color: var(--accent); }
.post-card-excerpt {
  font-size: .84rem; color: var(--text-md); line-height: 1.65; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card-meta {
  display: flex; align-items: center; gap: .5rem;
  font-size: .74rem; color: var(--text-lo); flex-wrap: wrap;
  padding-top: .65rem; border-top: 1px solid var(--border);
}
.post-card-meta .author { color: var(--text-md); font-weight: 500; }
.post-card-meta .author:hover { color: var(--accent); }
.post-card-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-lo); flex-shrink: 0; }

/* Featured card — spans 2 cols on wide screens */
.post-card-featured {
  grid-column: span 2;
  flex-direction: row;
}
.post-card-featured .post-card-thumb { aspect-ratio: unset; min-height: 260px; flex: 1; }
.post-card-featured .post-card-body { flex: 1; padding: 1.75rem; justify-content: center; }
.post-card-featured .post-card-title { font-size: 1.35rem; -webkit-line-clamp: 3; }

/* ── TRENDING LIST ──────────────────────────────────────────── */
.trending-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.trending-item {
  display: flex; align-items: flex-start; gap: .85rem;
  padding: .8rem; border-radius: var(--r-sm);
  border: 1px solid var(--border);
  transition: all var(--t); text-decoration: none;
  background: var(--bg-raised);
}
.trending-item:hover { border-color: var(--border-mid); background: var(--bg-overlay); }
.trending-num {
  font-family: var(--ff-mono); font-size: 1.1rem; font-weight: 600;
  color: var(--text-lo); line-height: 1; flex-shrink: 0;
  min-width: 2rem;
}
.trending-item:hover .trending-num { color: var(--accent); }
.trending-title { font-size: .84rem; font-weight: 500; color: var(--text-hi); line-height: 1.4; margin-bottom: .25rem; }
.trending-meta  { font-size: .7rem; color: var(--text-lo); font-family: var(--ff-mono); }

/* ── CATEGORY GRID ──────────────────────────────────────────── */
.cats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .75rem;
}
.cat-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: .6rem;
  padding: 1.1rem; border-radius: var(--r-md);
  background: var(--bg-raised); border: 1px solid var(--border);
  text-decoration: none; transition: all var(--t);
}
.cat-card:hover { border-color: var(--border-mid); background: var(--bg-overlay); transform: translateY(-2px); }
.cat-icon {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; color: #fff;
}
.cat-name  { font-weight: 600; color: var(--text-hi); font-size: .875rem; }
.cat-count { font-family: var(--ff-mono); font-size: .65rem; color: var(--text-lo); }

/* ── NEWSLETTER ─────────────────────────────────────────────── */
.newsletter-block {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 2.5rem 2rem;
  display: flex; align-items: center; gap: 2.5rem; flex-wrap: wrap;
}
.newsletter-block .nl-text { flex: 1; min-width: 200px; }
.newsletter-block .nl-text h3 { margin-bottom: .4rem; }
.newsletter-block .nl-text p  { color: var(--text-md); font-size: .875rem; margin: 0; }
.newsletter-block form { display: flex; gap: .5rem; flex: 1; min-width: 240px; }
.newsletter-block form .form-control { flex: 1; }

/* ── TAG CLOUD ──────────────────────────────────────────────── */
.tag-cloud { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-pill {
  padding: .25rem .7rem; border-radius: var(--r-xs);
  background: var(--bg-muted); border: 1px solid var(--border);
  color: var(--text-md); font-size: .75rem;
  font-family: var(--ff-mono);
  transition: all var(--t); text-decoration: none;
}
.tag-pill:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }

/* ── ARTICLE PAGE ───────────────────────────────────────────── */
.article-layout {
  display: grid; grid-template-columns: 1fr 280px; gap: 3rem;
  padding-top: calc(var(--nav-h) + 2.5rem); padding-bottom: 5rem;
  align-items: start;
  min-width: 0;
}
/* Prevent ANY child from overflowing the article column */
.article-layout > article {
  min-width: 0;
  overflow-x: hidden;
  max-width: 100%;
}
.article-header { margin-bottom: 2rem; }
.article-meta {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  font-size: .77rem; color: var(--text-lo); margin-bottom: 1.1rem;
  font-family: var(--ff-mono);
}
.article-title { font-size: clamp(1.75rem, 4vw, 2.8rem); margin-bottom: 1rem; }
.article-excerpt { font-size: 1.05rem; color: var(--text-md); line-height: 1.75; }
.article-thumb {
  width: 100%; aspect-ratio: 16/8; object-fit: cover;
  border-radius: var(--r-md); margin-bottom: 2.5rem;
}
/* toolbar — see .post-toolbar and .tb-btn below */

/* Article typography */
.article-body {
  font-size: 1rem; line-height: 1.85; color: var(--text-md);
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  max-width: 100%;
}
.article-body h2 { font-size: 1.6rem; margin: 2.25rem 0 .75rem; color: var(--text-hi); }
.article-body h3 { font-size: 1.25rem; margin: 1.75rem 0 .6rem; color: var(--text-hi); }
.article-body h4 { font-size: 1rem; margin: 1.5rem 0 .5rem; color: var(--text-hi); font-family: var(--ff-sans); font-weight: 600; }
.article-body p { margin-bottom: 1.35rem; }
.article-body a { color: var(--accent); border-bottom: 1px solid var(--accent-dim); }
.article-body a:hover { border-bottom-color: var(--accent); }
.article-body ul, .article-body ol { margin-bottom: 1.25rem; }
.article-body li { margin-bottom: .35rem; }
.article-body blockquote {
  border-left: 2px solid var(--accent); margin: 1.75rem 0;
  padding: .9rem 1.4rem; background: var(--accent-dim);
  border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--text-md);
  font-style: italic; font-family: var(--ff-serif); font-size: 1.05rem;
}
.article-body img {
  border-radius: var(--r-sm); margin: 1.5rem 0;
  max-width: 100%; height: auto; display: block;
}
.article-body .table-wrap,
.article-body table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; font-size: .875rem; }
.article-body table { display: block; overflow-x: auto; white-space: nowrap; max-width: 100%; }
.article-body th { background: var(--bg-muted); padding: .65rem .9rem; border: 1px solid var(--border-mid); text-align: left; font-weight: 600; color: var(--text-hi); }
.article-body td { padding: .55rem .9rem; border: 1px solid var(--border); }
.article-body tr:nth-child(even) td { background: rgba(255,255,255,.02); }
.article-body hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* Inline code */
.article-body code {
  font-family: var(--ff-mono); font-size: .82em;
  background: var(--bg-muted); color: var(--accent);
  padding: .15em .45em; border-radius: var(--r-xs);
  border: 1px solid var(--border);
}

/* Code blocks */
.article-body pre,
.code-block-wrapper { position: relative; margin: 1.75rem 0; border-radius: var(--r-md); overflow: hidden; }
.article-body pre {
  background: #111; border: 1px solid var(--border-mid);
}
.code-block-header {
  display: flex; align-items: center; padding: .5rem 1rem;
  background: rgba(0,0,0,.4); border-bottom: 1px solid var(--border);
}
.code-lang { font-family: var(--ff-mono); font-size: .65rem; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; }
.code-copy-btn {
  margin-left: auto; display: flex; align-items: center; gap: .4rem;
  padding: .25rem .6rem; border-radius: var(--r-xs);
  background: var(--bg-muted); border: 1px solid var(--border);
  color: var(--text-lo); cursor: pointer; font-size: .68rem; font-family: var(--ff-mono);
  transition: all var(--t);
}
.code-copy-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.code-copy-btn.copied { color: var(--green); border-color: var(--green); }
.article-body pre code {
  background: transparent; border: none; color: #d4d4d4;
  font-size: .83rem; padding: 1.1rem 1.25rem; display: block;
  overflow-x: auto; line-height: 1.7;
  white-space: pre; word-break: normal; word-wrap: normal;
}

/* ── SIDEBAR ────────────────────────────────────────────────── */
.sidebar { position: sticky; top: calc(var(--nav-h) + 1.5rem); }
.sidebar-widget { margin-bottom: 1.5rem; }
.sidebar-label {
  font-family: var(--ff-mono); font-size: .65rem; color: var(--text-lo);
  letter-spacing: .1em; text-transform: uppercase; margin-bottom: .75rem;
  display: flex; align-items: center; gap: .5rem;
}
.sidebar-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* TOC */
.toc-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .15rem; }
.toc-item a {
  display: block; padding: .3rem .65rem; border-radius: var(--r-xs);
  color: var(--text-lo); font-size: .8rem;
  border-left: 2px solid transparent; transition: all var(--t);
}
.toc-item a:hover, .toc-item.active a {
  color: var(--accent); border-left-color: var(--accent); background: var(--accent-dim);
}
.toc-item-h3 a { padding-left: 1.25rem; font-size: .76rem; }

/* Author card */
.author-card { text-align: center; padding: 1.25rem; }
.author-avatar {
  width: 60px; height: 60px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border-mid); margin: 0 auto .85rem;
}
.author-name { font-weight: 600; color: var(--text-hi); font-size: .95rem; margin-bottom: .3rem; }
.author-bio  { font-size: .8rem; color: var(--text-md); margin-bottom: .85rem; }
.author-links { display: flex; justify-content: center; gap: .4rem; }
.author-links a {
  width: 30px; height: 30px; border-radius: var(--r-xs);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-overlay); border: 1px solid var(--border);
  color: var(--text-lo); font-size: .8rem; transition: all var(--t);
}
.author-links a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }

/* ── COMMENTS ────────────────────────────────────────────────── */
.comments-section { margin-top: 3.5rem; padding-top: 2.5rem; border-top: 1px solid var(--border); }
.comment-list { display: flex; flex-direction: column; gap: .85rem; }
.comment-item {
  padding: 1.1rem 1.1rem .85rem;
  border-radius: var(--r-md); background: var(--bg-raised);
  border: 1px solid var(--border);
}
.comment-header { display: flex; align-items: center; gap: .65rem; margin-bottom: .65rem; }
.comment-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.comment-author { font-weight: 600; color: var(--text-hi); font-size: .85rem; }
.comment-time   { font-size: .7rem; color: var(--text-lo); font-family: var(--ff-mono); margin-top: .1rem; }
.comment-content{ font-size: .875rem; color: var(--text-md); line-height: 1.7; }
.comment-actions{ margin-top: .6rem; display: flex; gap: .4rem; }
.reply-thread   { margin-left: 1.5rem; margin-top: .65rem; display: flex; flex-direction: column; gap: .6rem; }
.reply-item     { border-left: 2px solid var(--border-mid); padding-left: .85rem; }

/* ── AUTH PAGES ─────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
  background: var(--bg-base);
}
.auth-card {
  width: 100%; max-width: 420px;
  padding: 2.25rem 2rem; border-radius: var(--r-lg);
  background: var(--bg-raised); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.auth-brand {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--ff-mono); font-weight: 600; font-size: .95rem;
  margin-bottom: 2rem; color: var(--text-hi);
}
.auth-brand .mark { width: 26px; height: 26px; background: var(--accent); border-radius: var(--r-xs); display: flex; align-items: center; justify-content: center; color: #0f0f0f; font-weight: 700; font-size: .75rem; }
.auth-brand span { color: var(--accent); }
.auth-title    { font-size: 1.5rem; margin-bottom: .3rem; }
.auth-subtitle { color: var(--text-md); font-size: .875rem; margin-bottom: 1.75rem; }
.auth-footer   { text-align: center; margin-top: 1.1rem; font-size: .84rem; color: var(--text-lo); }

/* ── ADMIN ───────────────────────────────────────────────────── */
.admin-layout {
  display: grid; grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh; padding-top: var(--nav-h);
}
.admin-sidebar {
  position: fixed; top: var(--nav-h); left: 0;
  width: var(--sidebar-w); height: calc(100vh - var(--nav-h));
  background: var(--bg-raised); border-right: 1px solid var(--border);
  overflow-y: auto; z-index: 100; display: flex; flex-direction: column;
}
.admin-sidebar-header {
  padding: 1.1rem 1rem .7rem;
  border-bottom: 1px solid var(--border);
}
.admin-sidebar-header .admin-lbl {
  font-family: var(--ff-mono); font-size: .62rem; color: var(--text-lo);
  letter-spacing: .12em; text-transform: uppercase;
}
.admin-sidebar-header .back-link { font-size: .75rem; color: var(--accent); margin-top: .25rem; display: block; text-decoration: none; }
.admin-sidebar-header .back-link:hover { color: var(--text-hi); }
.admin-nav { padding: .6rem; flex: 1; }
.admin-nav-section { margin-bottom: 1.1rem; }
.admin-nav-lbl {
  font-family: var(--ff-mono); font-size: .6rem; color: var(--text-lo);
  letter-spacing: .12em; text-transform: uppercase; padding: 0 .6rem; margin-bottom: .3rem;
}
.admin-nav a {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .7rem; border-radius: var(--r-sm);
  color: var(--text-md); font-size: .84rem; font-weight: 450;
  transition: all var(--t); text-decoration: none; margin-bottom: .1rem;
}
.admin-nav a:hover, .admin-nav a.active { color: var(--text-hi); background: var(--bg-overlay); }
.admin-nav a.active { color: var(--accent); }
.admin-nav a i { width: 15px; text-align: center; font-size: .82rem; }
.admin-nav-badge {
  margin-left: auto; font-family: var(--ff-mono); font-size: .6rem;
  background: var(--accent-dim); color: var(--accent);
  padding: 1px 6px; border-radius: 99px; border: 1px solid rgba(232,147,90,.2);
}
.admin-main { margin-left: var(--sidebar-w); padding: 2rem; min-width: 0; }
.admin-page-header { margin-bottom: 2rem; }
.admin-page-header h1 { font-size: 1.5rem; margin-bottom: .25rem; font-family: var(--ff-sans); font-weight: 700; color: var(--text-hi); }
.admin-page-header p { color: var(--text-lo); font-size: .85rem; }
.admin-topbar { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }

/* Stats cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.stat-card {
  padding: 1.25rem; border-radius: var(--r-md);
  background: var(--bg-raised); border: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent);
}
.stat-card.c-green::before  { background: var(--green); }
.stat-card.c-blue::before   { background: var(--blue);  }
.stat-card.c-amber::before  { background: var(--amber); }
.stat-icon { font-size: 1.1rem; color: var(--text-lo); margin-bottom: .6rem; }
.stat-value { font-family: var(--ff-mono); font-size: 1.75rem; font-weight: 600; color: var(--text-hi); line-height: 1; }
.stat-label { font-size: .72rem; color: var(--text-lo); margin-top: .3rem; font-family: var(--ff-mono); letter-spacing: .04em; }

/* Admin table */
.admin-table-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--border); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.admin-table thead tr { background: var(--bg-overlay); }
.admin-table th {
  padding: .7rem .9rem; text-align: left; font-weight: 500;
  color: var(--text-lo); font-family: var(--ff-mono); font-size: .68rem;
  letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: .65rem .9rem; border-bottom: 1px solid rgba(255,255,255,.04);
  color: var(--text-md); vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: var(--bg-overlay); }
.td-title { font-weight: 500; color: var(--text-hi); max-width: 260px; }
.td-title small { display: block; color: var(--text-lo); font-size: .72rem; font-family: var(--ff-mono); margin-top: .15rem; }

/* Editor */
.editor-layout { display: grid; grid-template-columns: 1fr 280px; gap: 1.25rem; }
.editor-sidebar { position: sticky; top: calc(var(--nav-h) + 1rem); display: flex; flex-direction: column; gap: 1rem; }
.editor-sidebar .card { padding: 1.1rem; }
.editor-sidebar h4 { font-size: .72rem; font-family: var(--ff-mono); color: var(--text-lo); letter-spacing: .1em; text-transform: uppercase; margin-bottom: .85rem; }
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: .3rem;
  padding: .5rem; background: var(--bg-overlay);
  border: 1px solid var(--border); border-bottom: none;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.editor-btn {
  padding: .3rem .6rem; border-radius: var(--r-xs);
  background: transparent; border: 1px solid transparent;
  color: var(--text-lo); cursor: pointer; font-size: .78rem; font-family: var(--ff-mono);
  transition: all var(--t);
}
.editor-btn:hover { color: var(--accent); background: var(--accent-dim); border-color: rgba(232,147,90,.2); }
#editor-textarea {
  width: 100%; min-height: 480px; padding: 1.1rem;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  color: var(--text-hi); font-family: var(--ff-mono); font-size: .84rem;
  line-height: 1.8; outline: none; resize: vertical;
}
.preview-pane {
  display: none; padding: 1.25rem;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 0 0 var(--r-sm) var(--r-sm); min-height: 480px;
}
.preview-pane.show { display: block; }

/* ── TOASTS ──────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 9999;
  display: flex; flex-direction: column; gap: .5rem;
  max-width: 340px; width: calc(100% - 2.5rem);
}
.toast {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .85rem 1rem; border-radius: var(--r-md);
  background: var(--bg-overlay); border: 1px solid var(--border-mid);
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s var(--ease);
}
.toast.removing { animation: toastOut .25s var(--ease) forwards; }
.toast-icon    { font-size: 1rem; flex-shrink: 0; padding-top: 1px; }
.toast-title   { font-weight: 600; font-size: .84rem; color: var(--text-hi); }
.toast-msg     { font-size: .79rem; color: var(--text-md); margin-top: .15rem; }
.toast-close   { margin-left: auto; cursor: pointer; color: var(--text-lo); font-size: .75rem; flex-shrink: 0; padding: 2px; }
.toast-close:hover { color: var(--text-md); }
.toast-success { border-left: 2px solid var(--green);  }
.toast-success .toast-icon { color: var(--green); }
.toast-danger  { border-left: 2px solid var(--red);    }
.toast-danger  .toast-icon { color: var(--red); }
.toast-info    { border-left: 2px solid var(--accent);  }
.toast-info    .toast-icon { color: var(--accent); }
.toast-warning { border-left: 2px solid var(--amber);   }
.toast-warning .toast-icon { color: var(--amber); }

/* Flash (hidden — converted to toasts) */
.flash-container { display: none !important; }

/* ── MODALS ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; opacity: 0; pointer-events: none; transition: opacity var(--t);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  width: 100%; max-width: 520px; background: var(--bg-overlay);
  border: 1px solid var(--border-mid); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  transform: scale(.96) translateY(8px); transition: transform var(--t);
  overflow: hidden; max-height: 90vh; display: flex; flex-direction: column;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header {
  display: flex; align-items: center; gap: .75rem;
  padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; flex: 1; font-family: var(--ff-sans); font-weight: 600; }
.modal-close {
  width: 28px; height: 28px; border-radius: var(--r-xs);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-muted); border: none; color: var(--text-md);
  cursor: pointer; transition: all var(--t);
}
.modal-close:hover { color: var(--red); }
.modal-body   { padding: 1.25rem; overflow-y: auto; flex: 1; }
.modal-footer { padding: .9rem 1.25rem; border-top: 1px solid var(--border); display: flex; gap: .6rem; justify-content: flex-end; }

/* ── PAGINATION ──────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: .3rem; margin-top: 2.5rem; flex-wrap: wrap;
}
.page-btn {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-raised); border: 1px solid var(--border);
  color: var(--text-md); font-size: .82rem; font-weight: 500;
  cursor: pointer; transition: all var(--t); text-decoration: none;
}
.page-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.page-btn.active { background: var(--accent); color: #0f0f0f; border-color: var(--accent); font-weight: 700; }
.page-btn.disabled { opacity: .3; pointer-events: none; }

/* ── SKELETON ────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-overlay) 25%, var(--bg-muted) 50%, var(--bg-overlay) 75%);
  background-size: 400% 100%; animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 4rem 2rem;
  display: flex; flex-direction: column; align-items: center; gap: .85rem;
}
.empty-icon {
  width: 64px; height: 64px; border-radius: var(--r-md);
  background: var(--bg-overlay); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: var(--text-lo);
}
.empty-state h3 { color: var(--text-hi); font-family: var(--ff-sans); font-weight: 600; font-size: 1.1rem; }
.empty-state p  { color: var(--text-lo); max-width: 300px; font-size: .875rem; }

/* ── FOOTER ──────────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-raised); border-top: 1px solid var(--border);
  padding: 3.5rem 0 2rem; margin-top: 5rem;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2.5rem; }
.footer-brand-name {
  font-family: var(--ff-mono); font-weight: 600; font-size: 1rem;
  color: var(--text-hi); margin-bottom: .65rem;
  display: flex; align-items: center; gap: .45rem;
}
.footer-brand-name .mark { width: 22px; height: 22px; background: var(--accent); border-radius: var(--r-xs); display: flex; align-items: center; justify-content: center; color: #0f0f0f; font-weight: 700; font-size: .7rem; }
.footer-desc { font-size: .82rem; color: var(--text-lo); line-height: 1.7; max-width: 280px; margin-bottom: 1.1rem; }
.footer-social { display: flex; gap: .4rem; }
.footer-social a {
  width: 32px; height: 32px; border-radius: var(--r-xs);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-overlay); border: 1px solid var(--border);
  color: var(--text-lo); font-size: .8rem; transition: all var(--t);
}
.footer-social a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.footer-col h4 { font-size: .78rem; font-family: var(--ff-mono); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-md); margin-bottom: .85rem; font-style: normal; }
.footer-links { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.footer-links a { color: var(--text-lo); font-size: .84rem; transition: color var(--t); }
.footer-links a:hover { color: var(--accent); }
.footer-bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 1.5rem; border-top: 1px solid var(--border);
  font-size: .76rem; color: var(--text-lo); flex-wrap: wrap; gap: .75rem;
}

/* ── USER PROFILE ────────────────────────────────────────────── */
.profile-header {
  padding: 3rem 0 2rem; margin-top: var(--nav-h);
  border-bottom: 1px solid var(--border); background: var(--bg-raised);
}
.profile-header-inner { display: flex; align-items: flex-start; gap: 1.75rem; flex-wrap: wrap; }
.profile-avatar {
  width: 88px; height: 88px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border-mid); flex-shrink: 0;
}
.profile-username { font-size: 1.75rem; margin-bottom: .25rem; }
.profile-bio { color: var(--text-md); font-size: .875rem; max-width: 480px; margin-bottom: .85rem; }
.profile-social { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .85rem; }
.profile-stats { display: flex; gap: 2rem; flex-wrap: wrap; }
.profile-stat .n { font-family: var(--ff-mono); font-size: 1.25rem; font-weight: 600; color: var(--text-hi); }
.profile-stat .l { font-size: .7rem; color: var(--text-lo); font-family: var(--ff-mono); margin-top: .15rem; }

/* ── SCROLL REVEAL ───────────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-d1 { transition-delay: .08s; }
.reveal-d2 { transition-delay: .16s; }
.reveal-d3 { transition-delay: .24s; }
.reveal-d4 { transition-delay: .32s; }

/* ── ERROR PAGES ─────────────────────────────────────────────── */
.error-page {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 2rem; padding-top: calc(var(--nav-h) + 2rem);
}
.error-code {
  font-family: var(--ff-mono); font-size: clamp(6rem, 18vw, 10rem);
  font-weight: 600; line-height: 1; color: var(--accent); margin-bottom: .75rem;
  opacity: .8;
}
.error-page h2 { font-family: var(--ff-sans); font-weight: 600; margin-bottom: .6rem; }
.error-page p  { color: var(--text-lo); margin-bottom: 2rem; }

/* ── ANIMATIONS ──────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400% 0; }
  100% { background-position:  400% 0; }
}
@keyframes toastIn  { from { opacity:0; transform:translateX(16px); } to { opacity:1; transform:none; } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; transform:translateX(16px); max-height:0; padding:0; margin:0; } }
@keyframes fadeIn   { from { opacity:0; } to   { opacity:1; } }

/* ── RESPONSIVE: TABLET ──────────────────────────────────────── */
@media (max-width: 1100px) {
  .article-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .post-card-featured { grid-column: span 1; flex-direction: column; }
  .post-card-featured .post-card-thumb { min-height: 220px; aspect-ratio: 16/9; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-sidebar { position: static; }
}

@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: fixed; left: -100%; top: var(--nav-h);
    width: var(--sidebar-w); height: calc(100vh - var(--nav-h));
    transition: left var(--t-md) var(--ease); z-index: 500;
  }
  .admin-sidebar.open { left: 0; box-shadow: var(--shadow-lg); }
  .admin-main { margin-left: 0; }
}

/* ── RESPONSIVE: MOBILE ──────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --nav-h: 56px; }

  /* Navbar */
  .navbar-nav   { display: none; }
  .navbar-search{ display: none; }
  .mobile-toggle{ display: flex; }

  /* Content */
  .posts-grid { grid-template-columns: 1fr; gap: 1rem; }
  .cats-grid  { grid-template-columns: repeat(auto-fill, minmax(130px,1fr)); gap: .6rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .newsletter-block { flex-direction: column; padding: 1.5rem; gap: 1.25rem; }
  .newsletter-block form { flex-direction: column; }

  /* Hero */
  .hero { min-height: auto; padding: calc(var(--nav-h) + 3rem) 0 3rem; }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-stats { gap: 1.25rem; }

  /* Auth */
  .auth-card { padding: 1.75rem 1.25rem; }

  /* Profile */
  .profile-header-inner { flex-direction: column; align-items: flex-start; }
  .profile-stats { gap: 1.25rem; }

  /* Admin */
  .admin-main { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .admin-table { font-size: .78rem; }
  .admin-table th, .admin-table td { padding: .55rem .65rem; }

  /* Article */
  .article-layout {
    padding-top: calc(var(--nav-h) + 1.5rem);
    padding-bottom: 3rem;
    gap: 0;
  }
  .article-layout > article { padding: 0; }
  .article-meta { gap: .4rem; row-gap: .3rem; }
  .article-title { font-size: clamp(1.5rem, 7vw, 2.2rem); }
  .article-excerpt { font-size: .95rem; }
  .article-thumb { aspect-ratio: 16/9; margin-bottom: 1.5rem; }
  .article-body { font-size: .95rem; line-height: 1.8; }
  .article-body h2 { font-size: 1.35rem; }
  .article-body h3 { font-size: 1.1rem; }
  .post-toolbar { padding: .5rem .6rem; gap: .3rem; }
  .tb-btn { padding: .38rem .55rem; font-size: .75rem; }
  .written-by { padding: .85rem 1rem; gap: .75rem; }
  .written-by img { width: 38px; height: 38px; }
  .written-by-name { font-size: .88rem; }

  /* Toasts */
  .toast-container { left: 1rem; right: 1rem; bottom: 1rem; max-width: none; }

  /* Sidebar widget full-width on mobile */
  .article-layout .sidebar { display: none; }
}

@media (max-width: 480px) {
  .container { padding: 0 1rem; }
  .stats-grid { grid-template-columns: 1fr; }
  .hero-stats { flex-direction: row; flex-wrap: wrap; }
  .btn-lg { padding: .7rem 1.4rem; font-size: .9rem; }
  .post-card-body { padding: .9rem .9rem .75rem; }
  .comment-item { padding: .85rem .85rem .7rem; }
  .admin-page-header h1 { font-size: 1.25rem; }
  .auth-card { border-radius: var(--r-md); }
  .article-body { font-size: .9rem; }
  .article-body h2 { font-size: 1.2rem; }
  .article-body pre code { font-size: .78rem; padding: .85rem 1rem; }
  .post-toolbar { gap: .25rem; }
  .tb-btn { padding: .35rem .5rem; font-size: .72rem; }
  .written-by { flex-wrap: wrap; }
}


/* ── SYNTAX HIGHLIGHTING (Pygments — Monokai) ──────────────── */
.article-body .highlight,
.preview-pane .highlight { background: #1a1a1a !important; border-radius: 0; }
.article-body pre .highlight,
.preview-pane pre .highlight { padding: 0; }
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.article-body .highlight, .preview-pane .highlight .hll { background-color: #49483e }
.article-body .highlight, .preview-pane .highlight { background: #272822; color: #F8F8F2 }
.article-body .highlight, .preview-pane .highlight .c { color: #959077 } /* Comment */
.article-body .highlight, .preview-pane .highlight .err { color: #ED007E; background-color: #1E0010 } /* Error */
.article-body .highlight, .preview-pane .highlight .esc { color: #F8F8F2 } /* Escape */
.article-body .highlight, .preview-pane .highlight .g { color: #F8F8F2 } /* Generic */
.article-body .highlight, .preview-pane .highlight .k { color: #66D9EF } /* Keyword */
.article-body .highlight, .preview-pane .highlight .l { color: #AE81FF } /* Literal */
.article-body .highlight, .preview-pane .highlight .n { color: #F8F8F2 } /* Name */
.article-body .highlight, .preview-pane .highlight .o { color: #FF4689 } /* Operator */
.article-body .highlight, .preview-pane .highlight .x { color: #F8F8F2 } /* Other */
.article-body .highlight, .preview-pane .highlight .p { color: #F8F8F2 } /* Punctuation */
.article-body .highlight, .preview-pane .highlight .ch { color: #959077 } /* Comment.Hashbang */
.article-body .highlight, .preview-pane .highlight .cm { color: #959077 } /* Comment.Multiline */
.article-body .highlight, .preview-pane .highlight .cp { color: #959077 } /* Comment.Preproc */
.article-body .highlight, .preview-pane .highlight .cpf { color: #959077 } /* Comment.PreprocFile */
.article-body .highlight, .preview-pane .highlight .c1 { color: #959077 } /* Comment.Single */
.article-body .highlight, .preview-pane .highlight .cs { color: #959077 } /* Comment.Special */
.article-body .highlight, .preview-pane .highlight .gd { color: #FF4689 } /* Generic.Deleted */
.article-body .highlight, .preview-pane .highlight .ge { color: #F8F8F2; font-style: italic } /* Generic.Emph */
.article-body .highlight, .preview-pane .highlight .ges { color: #F8F8F2; font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.article-body .highlight, .preview-pane .highlight .gr { color: #F8F8F2 } /* Generic.Error */
.article-body .highlight, .preview-pane .highlight .gh { color: #F8F8F2 } /* Generic.Heading */
.article-body .highlight, .preview-pane .highlight .gi { color: #A6E22E } /* Generic.Inserted */
.article-body .highlight, .preview-pane .highlight .go { color: #66D9EF } /* Generic.Output */
.article-body .highlight, .preview-pane .highlight .gp { color: #FF4689; font-weight: bold } /* Generic.Prompt */
.article-body .highlight, .preview-pane .highlight .gs { color: #F8F8F2; font-weight: bold } /* Generic.Strong */
.article-body .highlight, .preview-pane .highlight .gu { color: #959077 } /* Generic.Subheading */
.article-body .highlight, .preview-pane .highlight .gt { color: #F8F8F2 } /* Generic.Traceback */
.article-body .highlight, .preview-pane .highlight .kc { color: #66D9EF } /* Keyword.Constant */
.article-body .highlight, .preview-pane .highlight .kd { color: #66D9EF } /* Keyword.Declaration */
.article-body .highlight, .preview-pane .highlight .kn { color: #FF4689 } /* Keyword.Namespace */
.article-body .highlight, .preview-pane .highlight .kp { color: #66D9EF } /* Keyword.Pseudo */
.article-body .highlight, .preview-pane .highlight .kr { color: #66D9EF } /* Keyword.Reserved */
.article-body .highlight, .preview-pane .highlight .kt { color: #66D9EF } /* Keyword.Type */
.article-body .highlight, .preview-pane .highlight .ld { color: #E6DB74 } /* Literal.Date */
.article-body .highlight, .preview-pane .highlight .m { color: #AE81FF } /* Literal.Number */
.article-body .highlight, .preview-pane .highlight .s { color: #E6DB74 } /* Literal.String */
.article-body .highlight, .preview-pane .highlight .na { color: #A6E22E } /* Name.Attribute */
.article-body .highlight, .preview-pane .highlight .nb { color: #F8F8F2 } /* Name.Builtin */
.article-body .highlight, .preview-pane .highlight .nc { color: #A6E22E } /* Name.Class */
.article-body .highlight, .preview-pane .highlight .no { color: #66D9EF } /* Name.Constant */
.article-body .highlight, .preview-pane .highlight .nd { color: #A6E22E } /* Name.Decorator */
.article-body .highlight, .preview-pane .highlight .ni { color: #F8F8F2 } /* Name.Entity */
.article-body .highlight, .preview-pane .highlight .ne { color: #A6E22E } /* Name.Exception */
.article-body .highlight, .preview-pane .highlight .nf { color: #A6E22E } /* Name.Function */
.article-body .highlight, .preview-pane .highlight .nl { color: #F8F8F2 } /* Name.Label */
.article-body .highlight, .preview-pane .highlight .nn { color: #F8F8F2 } /* Name.Namespace */
.article-body .highlight, .preview-pane .highlight .nx { color: #A6E22E } /* Name.Other */
.article-body .highlight, .preview-pane .highlight .py { color: #F8F8F2 } /* Name.Property */
.article-body .highlight, .preview-pane .highlight .nt { color: #FF4689 } /* Name.Tag */
.article-body .highlight, .preview-pane .highlight .nv { color: #F8F8F2 } /* Name.Variable */
.article-body .highlight, .preview-pane .highlight .ow { color: #FF4689 } /* Operator.Word */
.article-body .highlight, .preview-pane .highlight .pm { color: #F8F8F2 } /* Punctuation.Marker */
.article-body .highlight, .preview-pane .highlight .w { color: #F8F8F2 } /* Text.Whitespace */
.article-body .highlight, .preview-pane .highlight .mb { color: #AE81FF } /* Literal.Number.Bin */
.article-body .highlight, .preview-pane .highlight .mf { color: #AE81FF } /* Literal.Number.Float */
.article-body .highlight, .preview-pane .highlight .mh { color: #AE81FF } /* Literal.Number.Hex */
.article-body .highlight, .preview-pane .highlight .mi { color: #AE81FF } /* Literal.Number.Integer */
.article-body .highlight, .preview-pane .highlight .mo { color: #AE81FF } /* Literal.Number.Oct */
.article-body .highlight, .preview-pane .highlight .sa { color: #E6DB74 } /* Literal.String.Affix */
.article-body .highlight, .preview-pane .highlight .sb { color: #E6DB74 } /* Literal.String.Backtick */
.article-body .highlight, .preview-pane .highlight .sc { color: #E6DB74 } /* Literal.String.Char */
.article-body .highlight, .preview-pane .highlight .dl { color: #E6DB74 } /* Literal.String.Delimiter */
.article-body .highlight, .preview-pane .highlight .sd { color: #E6DB74 } /* Literal.String.Doc */
.article-body .highlight, .preview-pane .highlight .s2 { color: #E6DB74 } /* Literal.String.Double */
.article-body .highlight, .preview-pane .highlight .se { color: #AE81FF } /* Literal.String.Escape */
.article-body .highlight, .preview-pane .highlight .sh { color: #E6DB74 } /* Literal.String.Heredoc */
.article-body .highlight, .preview-pane .highlight .si { color: #E6DB74 } /* Literal.String.Interpol */
.article-body .highlight, .preview-pane .highlight .sx { color: #E6DB74 } /* Literal.String.Other */
.article-body .highlight, .preview-pane .highlight .sr { color: #E6DB74 } /* Literal.String.Regex */
.article-body .highlight, .preview-pane .highlight .s1 { color: #E6DB74 } /* Literal.String.Single */
.article-body .highlight, .preview-pane .highlight .ss { color: #E6DB74 } /* Literal.String.Symbol */
.article-body .highlight, .preview-pane .highlight .bp { color: #F8F8F2 } /* Name.Builtin.Pseudo */
.article-body .highlight, .preview-pane .highlight .fm { color: #A6E22E } /* Name.Function.Magic */
.article-body .highlight, .preview-pane .highlight .vc { color: #F8F8F2 } /* Name.Variable.Class */
.article-body .highlight, .preview-pane .highlight .vg { color: #F8F8F2 } /* Name.Variable.Global */
.article-body .highlight, .preview-pane .highlight .vi { color: #F8F8F2 } /* Name.Variable.Instance */
.article-body .highlight, .preview-pane .highlight .vm { color: #F8F8F2 } /* Name.Variable.Magic */
.article-body .highlight, .preview-pane .highlight .il { color: #AE81FF } /* Literal.Number.Integer.Long */
/* ── POST ACTION TOOLBAR (redesigned) ────────────────────────── */
.post-toolbar {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: 2rem;
  padding: .65rem .75rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  flex-wrap: nowrap;
  overflow-x: auto;
}
.post-toolbar::-webkit-scrollbar { display: none; }

.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .42rem .65rem;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-lo);
  cursor: pointer;
  font-size: .8rem;
  font-family: var(--ff-mono);
  font-weight: 400;
  white-space: nowrap;
  text-decoration: none;
  transition: all var(--t) var(--ease);
  flex-shrink: 0;
  line-height: 1;
}
.tb-btn i { font-size: .85rem; }
.tb-btn:hover { color: var(--text-hi); border-color: var(--border-mid); background: var(--bg-overlay); }

/* Like — red when active */
.tb-btn.tb-like.liked { color: #f87171; border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.08); }
.tb-btn.tb-like:hover { color: #f87171; border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.08); }

/* Bookmark — amber when saved */
.tb-btn.tb-save.saved { color: #fbbf24; border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.08); }
.tb-btn.tb-save:hover { color: #fbbf24; border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.08); }

/* Comment count — static */
.tb-btn.tb-comment { cursor: default; }
.tb-btn.tb-comment:hover { color: var(--text-lo); border-color: var(--border); background: transparent; }

/* Share icons */
.tb-btn.tb-share:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }

/* Spacer pushes share to the right */
.tb-spacer { flex: 1; }

/* Written-by strip */
.written-by {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-top: 2.5rem;
}
.written-by img {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; border: 1.5px solid var(--border-mid);
  flex-shrink: 0;
}
.written-by-meta { flex: 1; min-width: 0; }
.written-by-label {
  font-family: var(--ff-mono); font-size: .62rem;
  color: var(--text-lo); letter-spacing: .1em;
  text-transform: uppercase; margin-bottom: .2rem;
}
.written-by-name {
  font-weight: 600; color: var(--text-hi);
  font-size: .95rem; text-decoration: none;
}
.written-by-name:hover { color: var(--accent); }
