/* ============================================================
   BLOG PLATFORM — style.css
   Professional Blog Design with Accessibility & Responsiveness
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&display=swap');

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --max-w: 1200px;
  --header-h: 64px;
  --radius: 12px;
  --radius-sm: 6px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  /* Light theme (default) */
  --bg: #ffffff;
  --bg-alt: #f8f9fa;
  --bg-card: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #dbeafe;
  --accent-gradient: linear-gradient(135deg, #2563eb, #7c3aed);
  --header-bg: rgba(255,255,255,0.92);
  --footer-bg: #1a1a2e;
  --footer-text: #cbd5e1;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
  --overlay: rgba(0,0,0,0.5);
  --code-bg: #1e293b;
  --scrollbar-track: #f1f1f1;
  --scrollbar-thumb: #c1c1c1;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-alt: #1e293b;
  --bg-card: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border: #334155;
  --border-light: #1e293b;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-light: #1e3a5f;
  --header-bg: rgba(15,23,42,0.95);
  --footer-bg: #020617;
  --footer-text: #94a3b8;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.4);
  --code-bg: #0f172a;
  --scrollbar-track: #1e293b;
  --scrollbar-thumb: #475569;
}

[data-theme="sepia"] {
  --bg: #fbf7f0;
  --bg-alt: #f5efe6;
  --bg-card: #fdfaf5;
  --text: #5b4636;
  --text-muted: #8b7355;
  --text-light: #a0926e;
  --border: #e8dccc;
  --border-light: #f0e8d8;
  --accent: #8b4513;
  --accent-hover: #6b3410;
  --accent-light: #f0e0c0;
  --header-bg: rgba(251,247,240,0.95);
  --footer-bg: #3e2723;
  --footer-text: #d7ccc8;
  --shadow: 0 1px 3px rgba(91,70,54,0.1);
  --shadow-lg: 0 10px 40px rgba(91,70,54,0.12);
  --code-bg: #3e2723;
}

[data-size="small"] { --font-base: 15px; }
[data-size="medium"] { --font-base: 17px; }
[data-size="large"] { --font-base: 19px; }

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

html {
  font-size: var(--font-base, 17px);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

/* ── Selection ── */
::selection { background: var(--accent); color: #fff; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Focus ── */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-sm); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Skip Link ── */
.skip-link {
  position: fixed; top: -100%; left: 1rem; z-index: 10000;
  padding: 0.6rem 1.2rem;
  background: var(--accent); color: #fff;
  font-family: var(--font-sans); font-size: 0.85rem; font-weight: 500;
  border-radius: var(--radius-sm); text-decoration: none;
  transition: top 0.25s;
}
.skip-link:focus { top: 1rem; }

/* ── Screen Reader Only ── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ═══════════════════════════════════════════════════════════
   ACCESSIBILITY TOOLBAR
   ═══════════════════════════════════════════════════════════ */
.a11y-toolbar {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.a11y-toolbar::-webkit-scrollbar { display: none; }
.a11y-toolbar span { color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.a11y-toolbar button, .a11y-toolbar select {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.3rem 0.55rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-card);
  color: var(--text); font-size: 0.78rem; cursor: pointer;
  white-space: nowrap; transition: all var(--transition);
  font-family: var(--font-sans);
}
.a11y-toolbar button:hover, .a11y-toolbar select:hover { border-color: var(--accent); color: var(--accent); }
.a11y-toolbar select { padding-right: 1.5rem; }
.a11y-toolbar .a11y-divider { width: 1px; height: 20px; background: var(--border); margin: 0 0.15rem; }

/* ═══════════════════════════════════════════════════════════
   HEADER & NAVIGATION
   ═══════════════════════════════════════════════════════════ */
.header-wrap { position: static; }
@media (max-width: 768px) { .header-wrap { position: relative; } }

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

.site-header-inner {
  display: flex; align-items: center; gap: 0.5rem;
  max-width: var(--max-w); margin: 0 auto;
  padding: 0 1.5rem; height: var(--header-h);
}

.site-logo {
  font-family: var(--font-serif); font-size: 1.3rem; font-weight: 700;
  color: var(--text); text-decoration: none;
  display: flex; align-items: center; gap: 0.4rem;
  margin-right: auto; white-space: nowrap;
}
.site-logo i { color: var(--accent); font-size: 1.1em; }
.site-logo:hover { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 0.15rem; }

.nav-links a {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem; font-weight: 500;
  color: var(--text-muted); text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  white-space: nowrap;
}
.nav-links a:hover, .nav-links a:focus-visible { color: var(--accent); background: var(--accent-light); }
.nav-links a i { font-size: 0.9em; }

.nav-lang {
  display: inline-flex; align-items: center; gap: 0.2rem;
  padding: 0.35rem 0.6rem; margin-left: 0.25rem;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  color: var(--text-muted); text-decoration: none;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.nav-lang:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.nav-lang.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0;
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 1.2rem; cursor: pointer;
  transition: all var(--transition);
}
.nav-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ── Mobile Nav ── */
@media (max-width: 768px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem; box-shadow: var(--shadow-lg);
    transform: translateY(-110%); opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    max-height: 85vh; overflow-y: auto;
    z-index: 999;
  }
  .nav-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-links a { width: 100%; padding: 0.8rem 0.75rem; border-radius: var(--radius-sm); }
  .nav-links a:hover { background: var(--accent-light); }
  .nav-lang { margin-left: 0; }
}

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════ */
.site-main {
  max-width: var(--max-w); margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  min-height: 60vh;
  animation: fadeUp 0.5s ease both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ═══════════════════════════════════════════════════════════
   BLOG CONTAINER
   ═══════════════════════════════════════════════════════════ */
.blog-container { width: 100%; }

.blog-container > header {
  margin-bottom: 2rem; padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}
.blog-container > header h1 {
  font-family: var(--font-serif); font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700; color: var(--text); line-height: 1.2;
}

/* ── Search Form ── */
.search-form {
  display: flex; gap: 0.5rem; margin-bottom: 2rem;
  max-width: 540px;
}
.search-form .input-wrap {
  flex: 1; position: relative;
}
.search-form .input-wrap i {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  color: var(--text-light); pointer-events: none;
}
.search-form input[type="text"] {
  width: 100%; padding: 0.7rem 1rem 0.7rem 2.6rem;
  font-family: var(--font-sans); font-size: 0.9rem;
  color: var(--text); background: var(--bg-alt);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  transition: all var(--transition); outline: none;
  -webkit-appearance: none;
}
.search-form input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.search-form input[type="text"]::placeholder { color: var(--text-light); }
.search-form button {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.7rem 1.3rem;
  font-family: var(--font-sans); font-size: 0.9rem; font-weight: 500;
  color: #fff; background: var(--accent);
  border: none; border-radius: var(--radius); cursor: pointer;
  transition: all var(--transition); white-space: nowrap;
}
.search-form button:hover { background: var(--accent-hover); transform: translateY(-1px); }
.search-form button:active { transform: scale(0.97); }

/* ── Layout (sidebar + posts) ── */
.layout { display: grid; grid-template-columns: 280px 1fr; gap: 2rem; align-items: start; }

/* ── Sidebar ── */
.sidebar {
  position: sticky; top: calc(var(--header-h) + 1rem);
  padding: 1.5rem; background: var(--bg-alt);
  border: 1px solid var(--border); border-radius: var(--radius);
  animation: fadeIn 0.5s ease 0.15s both;
}
.sidebar h3 {
  font-family: var(--font-sans); font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.4rem;
}
.sidebar h3 i { color: var(--accent); }

.category-list { list-style: none; display: flex; flex-direction: column; gap: 0.1rem; }
.category-list li { animation: fadeUp 0.4s ease both; }
.category-list li:nth-child(1) { animation-delay: 0.05s; }
.category-list li:nth-child(2) { animation-delay: 0.1s; }
.category-list li:nth-child(3) { animation-delay: 0.15s; }
.category-list li:nth-child(4) { animation-delay: 0.2s; }
.category-list li:nth-child(n+5) { animation-delay: 0.25s; }

.category-list a {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  font-family: var(--font-sans); font-size: 0.85rem;
  color: var(--text-muted); text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.category-list a:hover, .category-list a:focus-visible { color: var(--accent); background: var(--accent-light); }
.category-list a .cat-icon { width: 20px; text-align: center; color: var(--text-light); font-size: 0.8rem; }
.category-list a .cat-count {
  margin-left: auto; font-size: 0.72rem; font-weight: 500;
  color: var(--text-light); background: var(--bg);
  padding: 0.1rem 0.45rem; border-radius: 99px;
  min-width: 1.5rem; text-align: center;
}
.category-list ul { list-style: none; margin: 0.15rem 0 0.15rem 1.2rem; padding-left: 0.6rem; border-left: 1.5px solid var(--border); }

/* ── Post Grid ── */
.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }

/* ── Post Card ── */
.post-card {
  display: flex; flex-direction: column;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: all var(--transition); animation: fadeUp 0.5s ease both;
}
.post-card:nth-child(1) { animation-delay: 0.05s; }
.post-card:nth-child(2) { animation-delay: 0.1s; }
.post-card:nth-child(3) { animation-delay: 0.15s; }
.post-card:nth-child(n+4) { animation-delay: 0.2s; }
.post-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); border-color: var(--accent); }

.post-card .card-img-wrap { overflow: hidden; display: block; position: relative; }
.post-card .card-img-wrap img {
  width: 100%; height: 210px; object-fit: cover; display: block;
  transition: transform 0.5s ease;
}
.post-card:hover .card-img-wrap img { transform: scale(1.06); }
.post-card .card-img-wrap .card-cat-overlay {
  position: absolute; bottom: 0.5rem; left: 0.5rem;
  display: flex; flex-wrap: wrap; gap: 0.25rem;
}
.post-card .card-img-wrap .card-cat-overlay span {
  font-size: 0.65rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem; background: rgba(0,0,0,0.65); color: #fff;
  border-radius: 99px; backdrop-filter: blur(4px);
}

.post-card h2 {
  font-family: var(--font-serif); font-size: 1.15rem; font-weight: 600;
  line-height: 1.35; padding: 1rem 1.2rem 0.3rem;
}
.post-card h2 a { color: var(--text); text-decoration: none; transition: color var(--transition); }
.post-card h2 a:hover { color: var(--accent); }

.post-card .card-excerpt {
  font-size: 0.88rem; color: var(--text-muted); line-height: 1.6;
  padding: 0 1.2rem; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.post-card .card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.8rem 1.2rem; border-top: 1px solid var(--border-light);
  margin-top: auto;
}
.post-card .card-footer .card-date {
  font-size: 0.78rem; color: var(--text-light); display: flex; align-items: center; gap: 0.3rem;
}
.post-card .card-footer a.read-more {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.82rem; font-weight: 500; color: var(--accent); text-decoration: none;
  transition: gap var(--transition);
}
.post-card .card-footer a.read-more:hover { gap: 0.6rem; }

/* ── Pagination ── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 0.35rem; margin-top: 3rem;
  font-family: var(--font-sans);
}
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.35rem; height: 2.35rem; padding: 0 0.65rem;
  font-size: 0.88rem; font-weight: 500;
  color: var(--text-muted); text-decoration: none;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.pagination a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-light); }
.pagination a.active { background: var(--accent); color: #fff; border-color: var(--accent); pointer-events: none; }
.pagination a[rel="prev"], .pagination a[rel="next"] { padding: 0 1rem; }

/* ═══════════════════════════════════════════════════════════
   BREADCRUMB
   ═══════════════════════════════════════════════════════════ */
.breadcrumb {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem;
  font-family: var(--font-sans); font-size: 0.82rem;
  color: var(--text-light); margin-bottom: 1.5rem;
  animation: fadeIn 0.4s ease both;
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; transition: color var(--transition); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span.sep { user-select: none; color: var(--text-light); }

/* ═══════════════════════════════════════════════════════════
   POST DETAIL
   ═══════════════════════════════════════════════════════════ */
.post-detail { max-width: 760px; margin: 0 auto; animation: fadeUp 0.5s ease 0.05s both; }
.post-detail h1 {
  font-family: var(--font-serif); font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700; line-height: 1.2; color: var(--text); margin-bottom: 1rem;
}
.post-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.5rem; font-size: 0.85rem; color: var(--text-muted); }
.post-meta span { display: inline-flex; align-items: center; gap: 0.35rem; }
.post-categories { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.25rem; }
.post-categories a {
  font-family: var(--font-sans); font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-light);
  border: 1px solid transparent; border-radius: 99px;
  padding: 0.25rem 0.85rem; text-decoration: none;
  transition: all var(--transition);
}
.post-categories a:hover { background: var(--accent); color: #fff; }
.post-detail > img {
  width: 100%; max-height: 460px; object-fit: cover;
  border-radius: var(--radius); margin-bottom: 2rem; display: block;
}
.post-content { font-size: 1.05rem; line-height: 1.8; color: var(--text); }
.post-content p { margin-bottom: 1.25rem; }
.post-content h2, .post-content h3, .post-content h4 {
  font-family: var(--font-serif); font-weight: 600;
  margin: 2rem 0 0.75rem; color: var(--text);
}
.post-content h2 { font-size: 1.6rem; }
.post-content h3 { font-size: 1.25rem; }
.post-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; transition: color var(--transition); }
.post-content a:hover { color: var(--accent-hover); }
.post-content blockquote {
  border-left: 3px solid var(--accent); margin: 1.5rem 0;
  padding: 0.75rem 1.25rem; background: var(--bg-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic; color: var(--text-muted);
}
.post-content code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 0.85em;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.15em 0.4em;
}
.post-content pre {
  background: var(--code-bg); color: #e2e8f0;
  border-radius: var(--radius); padding: 1.25rem;
  overflow-x: auto; margin: 1.5rem 0; font-size: 0.88rem; line-height: 1.6;
}
.post-content pre code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }
.post-content img { max-width: 100%; border-radius: var(--radius-sm); margin: 1rem 0; }

/* ── Comments ── */
.comments { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.comments h3 { font-family: var(--font-serif); font-size: 1.3rem; margin-bottom: 1.25rem; }
.comment-list { list-style: none; }
.comment { padding: 1rem 0; border-bottom: 1px solid var(--border-light); }
.comment:last-child { border-bottom: none; }
.comment .comment-author { font-weight: 600; font-size: 0.9rem; color: var(--text); display: flex; align-items: center; gap: 0.4rem; }
.comment .comment-author i { color: var(--accent); font-size: 0.8rem; }
.comment .comment-date { font-size: 0.75rem; color: var(--text-light); margin-left: 0.5rem; }
.comment .comment-text { font-size: 0.92rem; color: var(--text-muted); margin: 0.4rem 0 0.6rem; line-height: 1.6; }
.comment .btn-reply {
  font-size: 0.78rem; font-weight: 500; color: var(--accent);
  background: none; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0; transition: color var(--transition);
}
.comment .btn-reply:hover { color: var(--accent-hover); }
.comment ul { list-style: none; margin-left: 1.5rem; margin-top: 0.5rem; padding-left: 1rem; border-left: 2px solid var(--border); }
.comment-form { margin-top: 1.5rem; }
.comment-form input, .comment-form textarea {
  width: 100%; padding: 0.65rem 1rem; margin-bottom: 0.75rem;
  font-family: var(--font-sans); font-size: 0.9rem;
  color: var(--text); background: var(--bg-alt);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  transition: all var(--transition); outline: none;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.comment-form textarea { min-height: 100px; resize: vertical; }
.comment-form button {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.2rem; font-family: var(--font-sans); font-size: 0.88rem; font-weight: 500;
  color: #fff; background: var(--accent); border: none; border-radius: var(--radius-sm); cursor: pointer;
  transition: all var(--transition);
}
.comment-form button:hover { background: var(--accent-hover); }

/* ── Reply form (hidden toggle) ── */
[id^="reply-"] { margin-top: 0.75rem; padding-left: 1rem; border-left: 2px solid var(--border); animation: fadeUp 0.3s ease both; }
[id^="reply-"] input, [id^="reply-"] textarea { width: 100%; padding: 0.5rem 0.75rem; margin-bottom: 0.5rem; font-size: 0.88rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-alt); color: var(--text); }
[id^="reply-"] button { padding: 0.4rem 1rem; font-size: 0.82rem; }

/* ═══════════════════════════════════════════════════════════
   CATEGORY PAGE
   ═══════════════════════════════════════════════════════════ */
.category-header { margin-bottom: 2rem; }
.category-header h1 {
  font-family: var(--font-serif); font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 700; color: var(--text); margin-bottom: 0.5rem;
}
.category-header .cat-desc { color: var(--text-muted); font-size: 0.95rem; }
.subcategories { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2rem; }
.subcategories a {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.4rem 1rem; font-size: 0.85rem; font-weight: 500;
  color: var(--accent); background: var(--accent-light); text-decoration: none;
  border-radius: 99px; transition: all var(--transition);
}
.subcategories a:hover { background: var(--accent); color: #fff; }

/* ═══════════════════════════════════════════════════════════
   AUTH FORMS
   ═══════════════════════════════════════════════════════════ */
.auth-wrapper {
  max-width: 420px; margin: 2rem auto; padding: 2rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.auth-wrapper h1 {
  font-family: var(--font-serif); font-size: 1.6rem; font-weight: 700;
  color: var(--text); margin-bottom: 1.5rem; text-align: center;
}
.auth-wrapper .alert {
  padding: 0.65rem 1rem; border-radius: var(--radius-sm);
  font-size: 0.85rem; margin-bottom: 1rem;
}
.auth-wrapper .alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.auth-wrapper label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text); margin-bottom: 0.35rem; }
.auth-wrapper .input-group {
  position: relative; margin-bottom: 1rem;
}
.auth-wrapper .input-group i {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  color: var(--text-light); pointer-events: none;
}
.auth-wrapper input[type="email"], .auth-wrapper input[type="password"], .auth-wrapper input[type="text"] {
  width: 100%; padding: 0.7rem 1rem 0.7rem 2.6rem;
  font-family: var(--font-sans); font-size: 0.9rem;
  color: var(--text); background: var(--bg-alt);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  transition: all var(--transition); outline: none;
}
.auth-wrapper input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.auth-wrapper button[type="submit"] {
  width: 100%; padding: 0.75rem;
  font-family: var(--font-sans); font-size: 0.95rem; font-weight: 600;
  color: #fff; background: var(--accent); border: none;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: all var(--transition); margin-top: 0.5rem;
}
.auth-wrapper button[type="submit"]:hover { background: var(--accent-hover); transform: translateY(-1px); }
.auth-wrapper .auth-links { text-align: center; margin-top: 1rem; font-size: 0.85rem; }
.auth-wrapper .auth-links a { color: var(--accent); text-decoration: none; }
.auth-wrapper .auth-links a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════
   CONTACT FORM
   ═══════════════════════════════════════════════════════════ */
.contact-wrapper {
  max-width: 600px; margin: 2rem auto; padding: 2rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.contact-wrapper h1 {
  font-family: var(--font-serif); font-size: 1.8rem; font-weight: 700;
  color: var(--text); margin-bottom: 1.5rem;
}
.contact-wrapper label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text); margin-bottom: 0.35rem; }
.contact-wrapper input, .contact-wrapper textarea {
  width: 100%; padding: 0.7rem 1rem; margin-bottom: 1rem;
  font-family: var(--font-sans); font-size: 0.9rem;
  color: var(--text); background: var(--bg-alt);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  transition: all var(--transition); outline: none;
}
.contact-wrapper input:focus, .contact-wrapper textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.contact-wrapper textarea { min-height: 130px; resize: vertical; }
.contact-wrapper button {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.7rem 1.5rem; font-family: var(--font-sans); font-size: 0.92rem; font-weight: 500;
  color: #fff; background: var(--accent); border: none;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: all var(--transition);
}
.contact-wrapper button:hover { background: var(--accent-hover); transform: translateY(-1px); }

/* ═══════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════ */
.site-footer {
  background: var(--footer-bg); color: var(--footer-text);
  padding: 3rem 1.5rem 1.5rem;
  transition: background var(--transition);
}
.site-footer .footer-inner {
  max-width: var(--max-w); margin: 0 auto;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem;
}
.site-footer .footer-brand h3 {
  font-family: var(--font-serif); font-size: 1.2rem; color: #fff; margin-bottom: 0.75rem;
  display: flex; align-items: center; gap: 0.4rem;
}
.site-footer .footer-brand h3 i { color: var(--accent); }
.site-footer .footer-brand p { font-size: 0.85rem; line-height: 1.6; color: var(--footer-text); }
.site-footer h4 { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-light); margin-bottom: 1rem; }
.site-footer ul { list-style: none; }
.site-footer ul li { margin-bottom: 0.45rem; }
.site-footer ul a {
  color: var(--footer-text); text-decoration: none; font-size: 0.85rem;
  display: inline-flex; align-items: center; gap: 0.35rem;
  transition: color var(--transition);
}
.site-footer ul a:hover { color: #fff; }
.site-footer .footer-bottom {
  max-width: var(--max-w); margin: 2rem auto 0;
  padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center; font-size: 0.82rem; color: var(--text-light);
}

/* ═══════════════════════════════════════════════════════════
   SEARCH RESULTS
   ═══════════════════════════════════════════════════════════ */
.search-results { margin-top: 1.5rem; }
.search-results a {
  display: block; padding: 0.75rem 0;
  font-family: var(--font-serif); font-size: 1.1rem;
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid var(--border); transition: all var(--transition);
}
.search-results a:hover { color: var(--accent-hover); padding-left: 0.5rem; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 1024px) {
  .layout { grid-template-columns: 220px 1fr; gap: 1.5rem; }
  .site-footer .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --header-h: 58px; }
  html { font-size: 16px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .posts { grid-template-columns: 1fr; }
  .site-header-inner { padding: 0 1rem; }
  .site-main { padding: 1.5rem 1rem 3rem; }
  .site-footer .footer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
  .search-form { max-width: 100%; }
  .post-card .card-img-wrap img { height: 200px; }
  .auth-wrapper, .contact-wrapper { margin: 1.5rem 0.5rem; padding: 1.5rem; }
  .a11y-toolbar { gap: 0.25rem; padding: 0.3rem 0.5rem; }
  .a11y-toolbar .a11y-label { display: none; }
}

/* iPhone */
@media (max-width: 480px) {
  html { font-size: 15px; }
  :root { --header-h: 54px; }
  .site-logo { font-size: 1.1rem; }
  .post-card .card-img-wrap img { height: 180px; }
  .pagination { gap: 0.25rem; }
  .pagination a, .pagination span { min-width: 2.1rem; height: 2.1rem; font-size: 0.82rem; }
  .post-detail { margin: 0; }
  .comment ul { margin-left: 0.75rem; padding-left: 0.5rem; }
  .a11y-toolbar { font-size: 0.72rem; }
  .a11y-toolbar button, .a11y-toolbar select { font-size: 0.72rem; padding: 0.3rem 0.5rem; min-height: 36px; }
  .nav-toggle { min-width: 44px; min-height: 44px; }
  .nav-links a { padding: 0.8rem 0.75rem; min-height: 44px; }
}

/* ── Print ── */
@media print {
  header, footer, .sidebar, .search-form, .pagination, .breadcrumb,
  .a11y-toolbar, .comment-form, .no-print { display: none !important; }
  .layout { display: block; }
  .post-detail { max-width: 100%; margin: 0; }
  body { font-size: 12pt; color: #000; background: #fff; }
  .post-card { break-inside: avoid; page-break-inside: avoid; }
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Loading Shimmer ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-alt) 0%, var(--border) 50%, var(--bg-alt) 100%);
  background-size: 400px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }

/* ── RTL Support ── */
[dir="rtl"] { text-align: right; }
[dir="rtl"] .search-form .input-wrap i { left: auto; right: 1rem; }
[dir="rtl"] .search-form input[type="text"] { padding: 0.7rem 2.6rem 0.7rem 1rem; }
[dir="rtl"] .auth-wrapper .input-group i { left: auto; right: 1rem; }
[dir="rtl"] .auth-wrapper input { padding: 0.7rem 2.6rem 0.7rem 1rem; }
[dir="rtl"] .category-list ul { margin-left: 0; margin-right: 1.2rem; padding-left: 0; padding-right: 0.6rem; border-left: none; border-right: 1.5px solid var(--border); }
[dir="rtl"] .comment ul { margin-left: 0; margin-right: 1.5rem; padding-left: 0; padding-right: 1rem; border-left: none; border-right: 2px solid var(--border); }
[dir="rtl"] .site-logo { margin-right: 0; margin-left: auto; }
[dir="rtl"] .post-content blockquote { border-left: none; border-right: 3px solid var(--accent); border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
