/*
Theme Name: Kompendium
Theme URI: 
Author: 
Author URI: 
Description: Motyw dla Kompendium Wiedzy Wiedźmińskiej.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: kompendium
*/

:root {
  /* AKCENTY: Skóra i Miedź (Zamiast Złota) */
  --leather: #9E6B42;
  --leather-light: #C48E60;
  --leather-dark: #633E24;

  /* SREBRO/STAL */
  --steel: #A9B3BD;
  --steel-dark: #636D78;

  /* TŁA: Ciepłe i naturalne */
  --bg-deep: #050000;
  --bg-main: #090001;
  --bg-sidebar: #0E0C0B;
  --bg-surface: #1C1A18;
  --bg-card: #201D1A;
  --bg-hover: #2A2622;
  --bg-parchment: #26221B;

  /* TEKST: Zoptymalizowany pod czytelność */
  --text-primary: #E8E0CC;
  --text-secondary: #A69D8C;
  --text-muted: #9E9585;

  /* OBRAMOWANIA: Skóra i srebro */
  --border: rgba(158, 107, 66, 0.2);
  --border-strong: rgba(158, 107, 66, 0.4);
  --border-subtle: rgba(169, 179, 189, 0.05);

  /* AKCENTY TEMATYCZNE */
  --red-accent: #911F1F;
  --green-accent: #4C8240;

  /* TYPOGRAFIA */
  --font-display: 'Cinzel Decorative', serif;
  --font-title: 'Cinzel', serif;
  --font-body: 'Crimson Text', serif;
  --font-prose: 'IM Fell English', serif;

  /* SIDEBAR WIDTH */
  --sidebar-w: 240px;

  /* ALIASY: backward compatibility */
  --gold: var(--leather);
  --gold-light: var(--leather-light);
  --gold-dark: #8B6B4A;

  /* MISSING VARIABLES FALLBACKS */
  --font-ui: var(--font-body);
  --text-tertiary: var(--text-muted);
  --bg-field: var(--bg-surface);
}

/* ═══════════════════════════════════════════════
   LOCAL FONTS (self-hosted, GDPR-compliant)
   Place .woff2 files in assets/fonts/
   Download via https://gwfh.mranftl.com/fonts
   ═══════════════════════════════════════════════ */

/* Cinzel */
@font-face { font-family: 'Cinzel'; font-style: normal; font-weight: 400; font-display: swap; size-adjust: 100%; src: local('Cinzel'), url('assets/fonts/cinzel-v19-latin-regular.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-style: normal; font-weight: 500; font-display: swap; size-adjust: 100%; src: local('Cinzel Medium'), local('Cinzel-Medium'), url('assets/fonts/cinzel-v19-latin-500.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-style: normal; font-weight: 600; font-display: swap; size-adjust: 100%; src: local('Cinzel SemiBold'), local('Cinzel-SemiBold'), url('assets/fonts/cinzel-v19-latin-600.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-style: normal; font-weight: 700; font-display: swap; size-adjust: 100%; src: local('Cinzel Bold'), local('Cinzel-Bold'), url('assets/fonts/cinzel-v19-latin-700.woff2') format('woff2'); }

/* Cinzel Decorative */
@font-face { font-family: 'Cinzel Decorative'; font-style: normal; font-weight: 400; font-display: swap; size-adjust: 100%; src: local('Cinzel Decorative'), local('CinzelDecorative-Regular'), url('assets/fonts/cinzel-decorative-v19-latin-regular.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel Decorative'; font-style: normal; font-weight: 700; font-display: swap; size-adjust: 100%; src: local('Cinzel Decorative Bold'), local('CinzelDecorative-Bold'), url('assets/fonts/cinzel-decorative-v19-latin-700.woff2') format('woff2'); }

/* Crimson Text */
@font-face { font-family: 'Crimson Text'; font-style: normal; font-weight: 400; font-display: swap; size-adjust: 100%; src: local('Crimson Text'), local('CrimsonText-Regular'), url('assets/fonts/crimson-text-v19-latin-regular.woff2') format('woff2'); }
@font-face { font-family: 'Crimson Text'; font-style: italic; font-weight: 400; font-display: swap; size-adjust: 100%; src: local('Crimson Text Italic'), local('CrimsonText-Italic'), url('assets/fonts/crimson-text-v19-latin-italic.woff2') format('woff2'); }
@font-face { font-family: 'Crimson Text'; font-style: normal; font-weight: 600; font-display: swap; size-adjust: 100%; src: local('Crimson Text SemiBold'), local('CrimsonText-SemiBold'), url('assets/fonts/crimson-text-v19-latin-600.woff2') format('woff2'); }
@font-face { font-family: 'Crimson Text'; font-style: italic; font-weight: 600; font-display: swap; size-adjust: 100%; src: local('Crimson Text SemiBold Italic'), local('CrimsonText-SemiBoldItalic'), url('assets/fonts/crimson-text-v19-latin-600italic.woff2') format('woff2'); }

/* IM Fell English */
@font-face { font-family: 'IM Fell English'; font-style: normal; font-weight: 400; font-display: swap; size-adjust: 100%; src: local('IM Fell English'), local('IMFellEnglish-Regular'), url('assets/fonts/im-fell-english-v14-latin-regular.woff2') format('woff2'); }
@font-face { font-family: 'IM Fell English'; font-style: italic; font-weight: 400; font-display: swap; size-adjust: 100%; src: local('IM Fell English Italic'), local('IMFellEnglish-Italic'), url('assets/fonts/im-fell-english-v14-latin-italic.woff2') format('woff2'); }

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

/* Skip Link — visible only on focus for screen readers */
.skip-link {
  position: absolute;
  top: -100%;
  left: 20px;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 72px;
  outline: 2px solid var(--leather);
  outline-offset: 2px;
}

body {
  font-family: var(--font-body);
  background: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

a {
  text-decoration: none;
  color: inherit;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 3px; }

/* ─── HEADER ─── */
#header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 58px;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
}

.header-logo {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; flex-shrink: 0;
}
.logo-medallion {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-image: url('assets/images/logo-geralt.jpg');
  background-size: cover;
  background-position: center;
  position: relative;
  border: 2px solid var(--leather);
  box-shadow: inset 0 0 0 1px var(--leather-dark), 0 0 0 1px var(--leather-dark);
}
.logo-text {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--gold);
  line-height: 1.2;
  letter-spacing: 0.5px;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.logo-text span {
  display: block;
  font-family: var(--font-title);
  font-size: 9px;
  color: var(--text-secondary);
  letter-spacing: 2px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#search-bar {
  flex: 1; max-width: 480px; min-width: 140px;
  margin-left: 20px;
  position: relative;
}
#search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 7px 36px 7px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}
#search-input:focus { border-color: var(--gold-dark); }
#search-input::placeholder { color: var(--text-muted); }
.search-icon {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 15px; pointer-events: none;
  width: 16px; height: 16px; display: block;
}

#search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  z-index: 200;
  display: none;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.search-result-item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s;
  color: inherit;
}
.search-result-item:hover {
  background: var(--bg-hover);
}
.search-result-title {
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--gold);
  margin-bottom: 2px;
}
.search-result-meta {
  font-size: 12px;
  color: var(--text-secondary);
}
.search-no-results {
  padding: 14px;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
}
.search-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg-hover); }
.search-item-title { font-family: var(--font-title); font-size: 13px; color: var(--gold); }
.search-item-cat { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.header-actions { margin-left: auto; display: flex; gap: 8px; flex-shrink: 0; }

.header-social { display: flex; gap: 12px; align-items: center; margin-right: 16px; }
.social-link { color: var(--text-muted); transition: color 0.2s; display: flex; align-items: center; justify-content: center; }
.social-link:hover { color: var(--gold); }
.btn {
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 18px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px;
}
.btn-primary {
  background: var(--gold-dark);
  border-color: var(--gold);
  color: var(--bg-deep);
  font-weight: 600;
}
.btn-primary:hover { background: var(--gold); }
.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-secondary);
}
.btn-ghost:hover { border-color: var(--gold-dark); color: var(--gold); }

/* ─── LAYOUT ─── */
#app {
  display: flex;
  margin-top: 58px;
  min-height: calc(100vh - 58px);
}

/* ─── SIDEBAR ─── */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: fixed;
  top: 58px; left: 0; bottom: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 50;
  padding: 20px 0 40px;
}

/* ─── ADS SIDEBAR (right column) ─── */
#ads-sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  padding: 24px 16px;
  box-sizing: border-box;
  overflow-y: auto;
}
#ads-sidebar .widget {
  margin-bottom: 24px;
}
#ads-sidebar .widget:last-child {
  margin-bottom: 0;
}

.sidebar-section { margin-bottom: 24px; }
.sidebar-section ul { list-style: none; padding: 0; margin: 0; }
.sidebar-section li { padding: 0; margin: 0; }
.sidebar-label {
  font-family: var(--font-title);
  font-size: 9px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 16px;
  margin-bottom: 6px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
  border-left: 2px solid transparent;
  user-select: none;
}
.sidebar-link:hover { color: var(--text-primary); background: var(--bg-hover); }
.sidebar-link.active { color: var(--gold); border-left-color: var(--gold); background: rgba(158,107,66,0.06); }
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }
.sidebar-link.active svg { opacity: 1; }

/* ─── SIDEBAR CATEGORY ACCORDION ─── */
.sidebar-cat-parent {
  cursor: pointer;
  position: relative;
  appearance: none;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  color: inherit;
  padding-right: 36px;
}
.sidebar-cat-parent .sidebar-cat-arrow {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
}
.sidebar-cat-parent[aria-expanded="true"] .sidebar-cat-arrow {
  transform: rotate(180deg);
}
.sidebar-cat-children {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s cubic-bezier(0.4,0,0.2,1);
}
.sidebar-cat-children.open {
  grid-template-rows: 1fr;
}
.sidebar-cat-children-inner {
  overflow: hidden;
}
.sidebar-cat-children-inner .sidebar-link {
  padding-left: 32px;
  font-size: 12px;
  min-height: 32px;
  gap: 8px;
}
.sidebar-cat-children-inner .sidebar-link svg,
.sidebar-cat-children-inner .sidebar-link span:first-child {
  font-size: 12px;
}

/* ─── AUTOLINKS ─── */
.autolink {
  color: var(--leather-light);
  border-bottom: 1px dashed var(--leather);
  text-decoration: none;
  transition: all 0.15s;
}
.autolink:hover {
  color: var(--leather);
  border-bottom-style: solid;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 16px;
}

/* ─── MAIN CONTENT ─── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  max-width: none;
}

/* ─── ARCHIVE / LIST VIEWS ─── */
.archive-wrap {
  padding: 36px clamp(48px, 6vw, 140px) 80px;
  width: 100%;
  max-width: none;
}

/* ─── SINGLE / PAGE VIEWS ─── */
.single-wrap {
  padding: 36px clamp(48px, 6vw, 140px) 80px;
  width: 100%;
  max-width: none;
}

/* ─── FRONT PAGE CONTENT ─── */
.home-container {
  padding: 0 clamp(48px, 6vw, 140px) 80px;
  width: 100%;
}

.home-hero {
  position: relative;
  width: 100%;
  height: 70vh;
  min-height: 400px;
  max-height: 700px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.home-hero .hero-bg {
  position: absolute;
  top: -10%;
  left: 0;
  width: 100%;
  height: 120%;
  background-size: cover;
  background-position: center 30%;
  will-change: transform, opacity;
}
.home-hero .hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(9,0,1,0.25) 0%, rgba(9,0,1,0.65) 100%);
  pointer-events: none;
  z-index: 1;
}
.home-hero .hero-content {
  position: relative;
  z-index: 2;
  padding: 60px clamp(20px, 5vw, 80px) 48px;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 52px);
  color: var(--gold);
  line-height: 1.15;
  margin-bottom: 12px;
  text-shadow: 0 0 60px rgba(158,107,66,0.2);
}
.hero-subtitle {
  font-family: var(--font-prose);
  font-size: 18px;
  font-style: italic;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 32px;
  line-height: 1.6;
}
.hero-divider {
  display: flex; align-items: center; gap: 12px;
  justify-content: center;
  color: var(--gold-dark);
  margin-bottom: 40px;
}
.hero-divider::before, .hero-divider::after {
  content: '';
  height: 1px;
  width: 80px;
  background: linear-gradient(to right, transparent, var(--gold-dark));
}
.hero-divider::after { background: linear-gradient(to left, transparent, var(--gold-dark)); }

.home-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 48px;
}
.stat-card {
  background: var(--bg-card);
  padding: 20px;
  text-align: center;
}
.stat-num {
  font-family: var(--font-title);
  font-size: 28px;
  color: var(--gold);
  display: block;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

.section-heading {
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.section-heading::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 48px;
  grid-auto-rows: 1fr;
}
.cat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100px;
}
.cat-card:hover {
  border-color: var(--gold-dark);
  background: var(--bg-hover);
  transform: translateY(-2px);
}
.cat-icon { font-size: 24px; margin-bottom: 10px; display: block; }
.cat-name {
  font-family: var(--font-title);
  font-size: 12px;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}
.cat-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.cat-parent {
  cursor: pointer;
  position: relative;
  appearance: none;
  border: none;
  background: var(--bg-card);
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  text-align: inherit;
  width: 100%;
  line-height: inherit;
}
.cat-expand {
  font-size: 10px;
  color: var(--gold-dark);
  margin-top: 6px;
  display: block;
  transition: transform 0.2s ease;
}
.cat-parent.open .cat-expand {
  transform: rotate(180deg);
}

.cat-children-row {
  grid-column: 1 / -1;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 12px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cat-children-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.cat-sub {
  min-height: 70px;
  padding: 14px 10px;
  font-size: 11px;
}
.cat-sub .cat-icon { font-size: 20px; margin-bottom: 6px; }
.cat-sub .cat-name { font-size: 11px; }
.cat-sub .cat-count { font-size: 10px; }

.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  grid-auto-rows: 1fr;
}
.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.article-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--gold-dark), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.article-card:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.article-card:hover::before { opacity: 1; }
.card-category {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-dark);
  font-family: var(--font-title);
  margin-bottom: 8px;
}
.card-title {
  font-family: var(--font-title);
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.3;
}
.card-excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  margin-top: 14px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex; gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ─── ENCYCLOPEDIA ─── */

.enc-header {
  margin-bottom: 32px;
  display: flex; align-items: flex-end; justify-content: space-between;
}
.page-title {
  font-family: var(--font-title);
  font-size: 26px;
  color: var(--gold);
  letter-spacing: 0.5px;
}
.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-style: italic;
}

.filter-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.filter-chip {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-chip:hover { border-color: var(--gold-dark); color: var(--text-primary); }
.filter-chip.active { border-color: var(--gold); color: var(--gold); background: rgba(158,107,66,0.08); }

.article-list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  display: flex; align-items: flex-start; gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.list-item:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.list-item-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 36px; text-align: center;
  margin-top: 2px;
}
.list-item-body { flex: 1; min-width: 0; }
.list-item-title {
  font-family: var(--font-title);
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.list-item-meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: 6px;
}
.tag {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: rgba(158,107,66,0.08);
  border: 1px solid rgba(158,107,66,0.2);
  color: var(--gold-dark);
  padding: 2px 8px;
  border-radius: 2px;
  font-family: var(--font-title);
}
.list-item-excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 40px; margin-bottom: 16px; }
.empty-state-title {
  font-family: var(--font-title);
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.empty-state p { font-size: 14px; line-height: 1.6; }

/* ─── ARTICLE VIEW ─── */

.article-breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 28px;
  font-family: var(--font-title);
  letter-spacing: 0.5px;
}
.breadcrumb-link { cursor: pointer; color: var(--gold-dark); }
.breadcrumb-link:hover { color: var(--gold); }
.breadcrumb-sep { opacity: 0.4; }

.article-infobox {
  float: right;
  width: 260px;
  margin: 0 0 24px 28px;
  background: var(--bg-parchment);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  overflow: hidden;
  font-size: 13px;
  max-width: 100%;
  box-sizing: border-box;
}
.article-sidebar .article-infobox {
  float: none;
  width: 100%;
  margin: 0 0 20px 0;
}
.infobox-header {
  background: rgba(158,107,66,0.12);
  border-bottom: 1px solid var(--border-strong);
  padding: 10px 14px;
  font-family: var(--font-title);
  font-size: 13px;
  color: var(--gold);
  text-align: center;
  letter-spacing: 0.5px;
}
.infobox-row {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  padding: 7px 12px;
}
.infobox-row:last-child { border-bottom: none; }
.infobox-key { color: var(--text-muted); width: 90px; flex-shrink: 0; }
.infobox-val { color: var(--text-primary); flex: 1; }

.article-meta-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.meta-item { font-size: 12px; color: var(--text-muted); font-family: var(--font-title); letter-spacing: 0.5px; }
.meta-sep { color: var(--border-strong); }
.article-actions { margin-left: auto; display: flex; gap: 8px; }

.article-title {
  font-family: var(--font-title);
  font-size: 34px;
  color: var(--gold);
  margin-bottom: 8px;
  line-height: 1.2;
  letter-spacing: 0.3px;
}
.article-subtitle {
  font-size: 17px;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 20px;
  font-family: var(--font-prose);
}

.article-body {
  font-family: var(--font-prose);
  font-size: 17px;
  line-height: 1.85;
  color: var(--text-primary);
  clear: both;
}
.article-body h2 {
  font-family: var(--font-title);
  font-size: 20px;
  color: var(--gold);
  margin: 36px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.3px;
}
.article-body h3 {
  font-family: var(--font-title);
  font-size: 16px;
  color: var(--text-primary);
  margin: 24px 0 10px;
}
.article-body p { margin-bottom: 16px; }
.article-body strong { color: var(--gold-light); font-weight: 600; }
.article-body em { color: var(--text-secondary); }
.article-body ul, .article-body ol {
  padding-left: 24px;
  margin-bottom: 16px;
}
.article-body li { margin-bottom: 6px; }
.article-body blockquote {
  border-left: 3px solid var(--gold-dark);
  margin: 20px 0;
  padding: 12px 20px;
  background: rgba(158,107,66,0.04);
  font-style: italic;
  color: var(--text-secondary);
}
.article-body hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 32px 0;
}
.article-body pre {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.article-body code {
  background: rgba(158,107,66,0.08);
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 0.92em;
  color: var(--gold-light);
}
.article-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* ─── PUBLICATIONS ─── */

.pub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 24px;
  grid-auto-rows: 1fr;
}
.pub-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
}
.pub-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--gold-dark), transparent);
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 1;
}
.pub-card:hover { border-color: var(--border-strong); background: var(--bg-hover); box-shadow: 0 4px 24px rgba(158,107,66,0.08); }
.pub-card:hover::before { opacity: 1; }
.pub-card-banner {
  height: 120px;
  background: var(--bg-parchment);
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--border);
  font-size: 40px;
  position: relative;
  overflow: hidden;
}
.pub-card-banner::before {
  content: '';
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 20px,
      rgba(158,107,66,0.03) 20px,
      rgba(158,107,66,0.03) 21px
    );
}
.pub-card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.pub-card-title {
  font-family: var(--font-title);
  font-size: 17px;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.3;
}
.pub-card-excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}
.pub-card-footer {
  display: flex; gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

/* ─── EDITOR ─── */

.editor-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}

.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 8px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: rgba(158,107,66,1);
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239E6B42' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
.form-select option { background: var(--bg-card); }
.form-textarea { resize: vertical; min-height: 120px; }

.editor-toolbar {
  display: flex; gap: 4px; flex-wrap: wrap;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  padding: 8px 10px;
}
.toolbar-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 6px 10px;
  cursor: pointer;
  font-family: monospace;
  transition: all 0.15s;
  font-weight: bold;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.toolbar-btn:hover { background: var(--bg-hover); border-color: var(--border); color: var(--gold); }
.toolbar-sep { width: 1px; background: var(--border); margin: 4px 4px; }

#editor-content {
  width: 100%;
  background: var(--bg-parchment);
  border: 1px solid var(--border);
  border-radius: 0 0 4px 4px;
  padding: 16px;
  font-family: var(--font-prose);
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-primary);
  outline: none;
  min-height: 400px;
  resize: vertical;
}

.editor-preview {
  margin-top: 24px;
  background: var(--bg-parchment);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
  display: none;
}
.editor-preview.visible { display: block; }
.preview-label {
  font-family: var(--font-title);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.infobox-editor {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 16px;
}
.infobox-field-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; margin-bottom: 8px;
}
.add-field-btn {
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: 3px;
  color: var(--text-muted);
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}
.add-field-btn:hover { border-color: var(--gold-dark); color: var(--gold-dark); }
.remove-field-btn {
  background: transparent; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 16px;
  padding: 4px; transition: color 0.15s;
}
.remove-field-btn:hover { color: #c0392b; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ─── MODAL ─── */
#modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.75);
  display: none; align-items: center; justify-content: center;
}
#modal-overlay.visible { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 28px;
  max-width: 420px; width: 90%;
}
.modal-title {
  font-family: var(--font-title);
  font-size: 18px;
  color: var(--gold);
  margin-bottom: 12px;
}
.modal-body { font-size: 15px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-danger { background: var(--red-accent); border-color: #c0392b; color: #fff; }
.btn-danger:hover { background: #c0392b; }

/* ─── TOAST ─── */
#toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 12px 20px;
  font-family: var(--font-title);
  font-size: 13px;
  color: var(--text-primary);
  z-index: 300;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { border-color: var(--green-accent); color: #6dbf6d; }
#toast.error { border-color: var(--red-accent); }

/* ─── MISC ─── */
.toc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 24px;
  max-width: 280px;
}
.toc-title {
  font-family: var(--font-title);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 10px;
}
.toc-list { list-style: none; }
.toc-item { padding: 3px 0; }
.toc-link {
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s;
}
.toc-link:hover { color: var(--gold); }

.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  border: none; background: none;
  transition: color 0.15s;
  margin-bottom: 20px;
}
.back-btn:hover { color: var(--gold); }

/* ─── ABOUT ─── */
.about-body { font-family: var(--font-prose); font-size: 17px; line-height: 1.85; color: var(--text-primary); }
.about-body h2 { font-family: var(--font-title); font-size: 20px; color: var(--gold); margin: 28px 0 12px; }
.about-body p { margin-bottom: 14px; }

/* ─── HAMBURGER BUTTON ─── */
#hamburger {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 15px 13px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
  flex-shrink: 0;
}
#hamburger:hover { border-color: var(--gold-dark); color: var(--gold); }
#hamburger svg { display: block; }

/* ─── MOBILE SIDEBAR OVERLAY ─── */
#sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 49;
  background: rgba(0,0,0,0.55);
  opacity: 0;
  transition: opacity 0.25s;
}
#sidebar-overlay.visible { opacity: 1; }

/* ═══════════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════════ */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(158,107,66,0); }
  50%       { box-shadow: 0 0 14px 2px rgba(158,107,66,0.18); }
}
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes hero-in {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes count-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes border-pulse {
  0%, 100% { border-color: var(--border); }
  50%       { border-color: var(--border-strong); }
}

/* ─── VIEW TRANSITIONS ─── */
.archive-wrap, .single-wrap { animation: fadeIn 0.28s ease; }

/* Hero entrance */
.home-hero { animation: hero-in 0.5s cubic-bezier(0.22,1,0.36,1) both; }
.hero-title { animation: hero-in 0.55s 0.05s cubic-bezier(0.22,1,0.36,1) both; }
.hero-subtitle { animation: hero-in 0.55s 0.1s cubic-bezier(0.22,1,0.36,1) both; }
.hero-divider { animation: fadeIn 0.4s 0.22s both; }

/* Stats counter */
.stat-card { animation: count-up 0.4s ease both; }
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.10s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.20s; }

/* Category grid stagger */
.cat-card { animation: fadeInUp 0.35s ease both; }
.cat-card:nth-child(1) { animation-delay: 0.04s; }
.cat-card:nth-child(2) { animation-delay: 0.08s; }
.cat-card:nth-child(3) { animation-delay: 0.12s; }
.cat-card:nth-child(4) { animation-delay: 0.16s; }
.cat-card:nth-child(5) { animation-delay: 0.20s; }
.cat-card:nth-child(6) { animation-delay: 0.24s; }
.cat-card:nth-child(7) { animation-delay: 0.28s; }
.cat-card:nth-child(8) { animation-delay: 0.32s; }

/* Article/pub cards stagger */
.article-card { animation: fadeInUp 0.35s ease both; }
.article-card:nth-child(1) { animation-delay: 0.05s; }
.article-card:nth-child(2) { animation-delay: 0.10s; }
.article-card:nth-child(3) { animation-delay: 0.15s; }
.article-card:nth-child(4) { animation-delay: 0.20s; }
.article-card:nth-child(5) { animation-delay: 0.25s; }
.article-card:nth-child(6) { animation-delay: 0.30s; }

.pub-card { animation: fadeInUp 0.35s ease both; }
.pub-card:nth-child(1) { animation-delay: 0.05s; }
.pub-card:nth-child(2) { animation-delay: 0.10s; }
.pub-card:nth-child(3) { animation-delay: 0.15s; }
.pub-card:nth-child(4) { animation-delay: 0.20s; }

/* List items */
.list-item { animation: slideInLeft 0.3s ease both; }

/* Article view */
.article-title { animation: fadeInUp 0.4s 0.05s ease both; }
.article-subtitle { animation: fadeInUp 0.4s 0.10s ease both; }
.article-meta-bar { animation: fadeIn 0.35s 0.15s ease both; }
.article-body { animation: fadeIn 0.4s 0.2s ease both; }
.article-infobox { animation: slideInRight 0.4s 0.1s ease both; }
.toc { animation: slideInRight 0.4s 0.18s ease both; }

/* Breadcrumb */
.article-breadcrumb { animation: fadeIn 0.3s ease both; }

/* Sidebar links */
.sidebar-link { animation: slideInLeft 0.25s ease both; }
#sidebar .sidebar-section:nth-child(1) .sidebar-link:nth-child(1),
#sidebar .sidebar-section:nth-child(1) li:nth-child(1) .sidebar-link { animation-delay: 0.02s; }
#sidebar .sidebar-section:nth-child(1) .sidebar-link:nth-child(2),
#sidebar .sidebar-section:nth-child(1) li:nth-child(2) .sidebar-link { animation-delay: 0.05s; }
#sidebar .sidebar-section:nth-child(1) .sidebar-link:nth-child(3),
#sidebar .sidebar-section:nth-child(1) li:nth-child(3) .sidebar-link { animation-delay: 0.08s; }
#sidebar .sidebar-section:nth-child(1) .sidebar-link:nth-child(4),
#sidebar .sidebar-section:nth-child(1) li:nth-child(4) .sidebar-link { animation-delay: 0.11s; }

/* Modal */
.modal { animation: scaleIn 0.22s cubic-bezier(0.34,1.56,0.64,1) both; }
#modal-overlay { animation: fadeIn 0.18s ease both; }

/* Search results */
#search-results { animation: fadeInUp 0.18s ease both; }
.search-item { animation: fadeIn 0.2s ease both; }

/* Medallion slow spin on hover */
.logo-medallion { transition: transform 0.6s ease; }
.header-logo:hover .logo-medallion { animation: spin-slow 4s linear infinite; }

/* Button press feedback */
.btn:active { transform: scale(0.97); }

/* Card glow on hover */
.article-card:hover { animation: none; box-shadow: 0 4px 24px rgba(158,107,66,0.08); }
.cat-card:hover { animation: none; }

/* Filter chip transition */
.filter-chip { transition: all 0.18s; }
.filter-chip.active { animation: pulse-glow 2.5s ease infinite; }

/* Sidebar active pulse */
.sidebar-link.active { animation: none !important; }

/* ─── ARTICLE LAYOUT WITH SIDEBAR ─── */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.5fr) minmax(260px, 1fr);
  gap: 32px;
  align-items: start;
}
.article-main { min-width: 0; }
.article-sidebar {
  position: sticky;
  top: 74px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}
.article-sidebar .article-infobox {
  float: none;
  width: 100%;
  margin: 0 0 20px 0;
}
.article-sidebar .toc {
  max-width: 100%;
  margin-bottom: 0;
}
.toc-link {
  display: block;
  padding: 4px 8px;
  border-radius: 3px;
  border-left: 2px solid transparent;
  text-decoration: none;
  transition: all 0.15s;
}
.toc-link:hover {
  color: var(--gold);
  background: rgba(158,107,66,0.06);
  border-left-color: var(--gold-dark);
}
.toc-link.active {
  color: var(--gold);
  background: rgba(158,107,66,0.1);
  border-left-color: var(--gold);
}
.toc-h2 { font-weight: 600; }
.toc-h3 { padding-left: 16px; font-size: 13px; }

@media (max-width: 1150px) {
  #ads-sidebar {
    display: none;
  }
}

@media (max-width: 992px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-sidebar { position: static; max-height: none; }
}

@media (max-width: 780px) {
  #hamburger { display: flex; align-items: center; }
  #sidebar { transform: translateX(-100%); transition: transform 0.28s cubic-bezier(0.4,0,0.2,1); }
  #sidebar.open { transform: translateX(0); }
  #sidebar-overlay.visible { display: block; }
  #main { margin-left: 0; }
  .archive-wrap, .single-wrap { padding: 20px 16px 60px; }
  .home-container { padding: 0 20px 60px; }
  .home-stats { grid-template-columns: repeat(2, 1fr); }
  .stat-label { font-size: 10px; letter-spacing: 0.5px; }
  .form-row { grid-template-columns: 1fr; }
  .article-infobox { float: none; width: 100%; margin: 0 0 20px; }
  .toc { display: none; }
  
  /* Auth modal mobile optimization */
  .auth-modal {
    padding: 20px 16px;
    max-height: 85vh;
    margin: 16px;
    width: calc(100% - 32px);
  }
  
  /* Comments section mobile optimization */
  .comments-area {
    padding: 20px 12px;
  }
  .comment-list .comment {
    padding: 12px;
  }
  .comment-form input[type="text"],
  .comment-form input[type="email"],
  .comment-form input[type="url"],
  .comment-form textarea {
    padding: 8px 10px;
  }
  .comments-login-hint {
    padding: 12px;
  }
}

/* ─── IMAGES ─── */
.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: block;
  margin: 12px auto;
}
.infobox-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-bottom: 1px solid var(--border-strong);
  display: block;
  max-width: 100%;
}
.pub-card-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pub-card-banner {
  padding: 0 !important;
  overflow: hidden;
}
.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: 4px;
  padding: 28px 24px;
  text-align: center;
  color: var(--text-muted);
  transition: all 0.2s;
  cursor: pointer;
}
.drop-zone.dragover {
  border-color: var(--gold);
  background: rgba(158,107,66,0.06);
}

/* ─── SETTINGS ─── */
.settings-tabs {
  display: flex; gap: 4px; margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.settings-tab {
  padding: 8px 16px;
  font-family: var(--font-title);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.settings-tab:hover { color: var(--text-primary); }
.settings-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.color-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
}
.color-row input[type="color"] {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: none;
  cursor: pointer;
  padding: 2px;
}
.font-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
.font-row select {
  flex: 1;
}
.cat-schema-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px;
  margin-bottom: 12px;
}
.schema-fields {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.schema-chip {
  background: rgba(158,107,66,0.08);
  border: 1px solid rgba(158,107,66,0.2);
  color: var(--gold-dark);
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 11px;
  font-family: var(--font-title);
  display: flex; align-items: center; gap: 4px;
}
.schema-chip button {
  background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 0;
}
.schema-chip button:hover { color: #c0392b; }

/* ─── FOCUS / KEYBOARD ACCESSIBILITY ─── */
.sidebar-link:focus-visible {
  outline: 2px solid var(--gold-dark);
  outline-offset: -2px;
  border-radius: 2px;
}
.btn:focus-visible, .filter-chip:focus-visible, .cat-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.tag-clickable { cursor: pointer; transition: all 0.15s; }
.tag-clickable:hover { background: rgba(158,107,66,0.18); border-color: var(--gold); color: var(--gold); }

/* unsaved indicator */
.unsaved-indicator {
  font-size: 11px;
  color: var(--gold-dark);
  margin-left: 12px;
  font-family: var(--font-title);
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity 0.3s;
}
.unsaved-indicator.show { opacity: 1; }

/* ─── CUSTOM BACKGROUND & LOGO ─── */
body.custom-bg {
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}
body.custom-bg::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(11,12,13,0.85);
  z-index: -1;
  pointer-events: none;
}
#header .logo-img {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--gold-dark);
}
.preview-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  margin-top: 8px;
  text-align: center;
}
.preview-box img {
  max-width: 100%;
  max-height: 160px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ─── BACKDROP FILTER ON HEADER (glass effect) ─── */
#header {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(11, 12, 13, 0.92);
}

/* ─── CUSTOM SELECTION COLOR ─── */
::selection {
  background: rgba(200, 168, 75, 0.3);
  color: var(--gold-light);
}
::-moz-selection {
  background: rgba(200, 168, 75, 0.3);
  color: var(--gold-light);
}

/* ─── TOUCH TARGETS (WCAG 44x44) ─── */
.filter-chip {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}
.sidebar-link {
  min-height: 40px;
}

/* ─── SCROLL TO TOP BUTTON ─── */
#scroll-top {
  position: fixed;
  bottom: 80px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--gold);
  font-size: 18px;
  cursor: pointer;
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  opacity: 0;
  transform: translateY(10px);
}
#scroll-top.visible {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}
#scroll-top:hover {
  border-color: var(--gold);
  background: var(--bg-hover);
  box-shadow: 0 0 14px rgba(158,107,66,0.15);
}

/* ─── PAGINATION ─── */
.pagination {
  margin-top: 32px;
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  font-family: var(--font-title);
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  text-decoration: none;
  transition: all 0.15s;
}
.pagination a:hover {
  color: var(--gold);
  border-color: var(--gold-dark);
  background: var(--bg-hover);
}
.pagination .current {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(158,107,66,0.08);
}
.pagination .prev,
.pagination .next {
  padding: 0 18px;
}

/* ─── POST PAGE LINKS (wp_link_pages) ─── */
.post-pagination {
  display: flex;
  gap: 6px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.post-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13px;
  padding: 0 10px;
}
.post-pagination > span:first-child {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(158,107,66,0.08);
  font-weight: 600;
}

/* ─── PROPOSAL FORM ─── */
.proposal-section { margin-top: 40px; border-top: 1px solid var(--border); padding-top: 28px; }
.proposal-toggle { margin-bottom: 12px; }
.proposal-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text-secondary);
  font-family: var(--font-title); font-size: 13px; padding: 8px 16px; border-radius: 4px;
  cursor: pointer; transition: all 0.15s; letter-spacing: 0.4px;
}
.proposal-btn:hover { border-color: var(--gold); color: var(--gold); background: var(--bg-hover); }
.proposal-form-wrap { animation: fadeIn 0.2s ease both; }
.proposal-title { font-family: var(--font-title); font-size: 16px; color: var(--gold); margin-bottom: 6px; }
.proposal-hint { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }

/* ─── WYSIWYG EDITOR ─── */
.wysiwyg-editor {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-deep);
}
.wysiwyg-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.wysiwyg-toolbar button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 13px;
  width: 32px; height: 28px;
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
  padding: 0;
  line-height: 1;
}
.wysiwyg-toolbar button:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-hover);
}
.wysiwyg-sep {
  width: 1px; height: 20px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}
.wysiwyg-area {
  min-height: 200px;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
  outline: none;
  background: var(--bg-deep);
  font-family: var(--font-prose);
}
.wysiwyg-area:empty:before {
  content: attr(data-placeholder);
  color: var(--text-tertiary);
  pointer-events: none;
}
.wysiwyg-area h2 {
  font-family: var(--font-title); font-size: 18px; color: var(--gold);
  margin: 18px 0 8px;
}
.wysiwyg-area h3 {
  font-family: var(--font-title); font-size: 15px; color: var(--text-primary);
  margin: 14px 0 6px;
}
.wysiwyg-area p { margin-bottom: 10px; }
.wysiwyg-area ul, .wysiwyg-area ol { padding-left: 24px; margin-bottom: 10px; }
.wysiwyg-area blockquote {
  border-left: 3px solid var(--gold-dark);
  margin: 10px 0; padding: 8px 16px;
  background: rgba(158,107,66,0.06);
  font-style: italic; color: var(--text-secondary);
}
.wysiwyg-area a { color: var(--gold-light); text-decoration: underline; }
.proposal-actions { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.proposal-msg { font-size: 13px; }

/* ─── RELATED POSTS ─── */
.related-posts {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

/* ─── FOOTER ─── */
.site-footer {
  margin-left: var(--sidebar-w);
  background: var(--bg-deep);
  border-top: 1px solid var(--border);
  padding: 24px 48px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font-title);
  letter-spacing: 0.5px;
}
.site-footer a {
  color: var(--gold-dark);
  text-decoration: none;
  transition: color 0.2s;
}
.site-footer a:hover {
  color: var(--gold);
}

/* ─── MOBILE HEADER FIX ─── */
@media (max-width: 500px) {
  .header-actions .btn-ghost,
  .header-actions .btn-primary {
    display: none;
  }
  #search-bar {
    max-width: none;
  }
  #search-input {
    padding: 7px 32px 7px 10px;
    font-size: 13px;
  }
  
  /* Further reduce auth modal padding on small screens */
  .auth-modal {
    padding: 16px 12px;
    margin: 12px;
    width: calc(100% - 24px);
  }
  
  /* Further reduce comments padding on small screens */
  .comments-area {
    padding: 16px 8px;
  }
  .comment-list .comment {
    padding: 10px;
  }
}

/* ─── MOBILE SEARCH RESULTS ─── */
@media (max-width: 780px) {
  #search-results {
    max-width: calc(100vw - 32px);
    left: 8px;
    right: 8px;
  }
}

/* ─── TABLET SIDEBAR ─── */
@media (max-width: 1024px) and (min-width: 781px) {
  :root {
    --sidebar-w: 200px;
  }
  #sidebar {
    width: var(--sidebar-w);
  }
  #main {
    margin-left: var(--sidebar-w);
  }
  .site-footer {
    margin-left: var(--sidebar-w);
  }
}

@media (max-width: 780px) {
  .site-footer {
    margin-left: 0;
  }
}

/* ─── PREFERS REDUCED MOTION ─── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .home-hero,
  .hero-title,
  .hero-subtitle,
  .hero-divider,
  .stat-card,
  .cat-card,
  .article-card,
  .pub-card,
  .list-item,
  .article-title,
  .article-subtitle,
  .article-meta-bar,
  .article-body,
  .article-infobox,
  .toc,
  .article-breadcrumb,
  .sidebar-link,
  .modal,
  #modal-overlay,
  #search-results,
  .search-item {
    animation: none !important;
  }
  #scroll-top {
    transition: none !important;
  }
}

/* ─── PRINT STYLES ─── */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
    font-family: Georgia, 'Times New Roman', serif !important;
  }
  #header, #sidebar, #hamburger, #sidebar-overlay,
  .article-actions, .btn, .filter-bar, .editor-toolbar,
  #scroll-top, .site-footer, #toast, #modal-overlay,
  #image-modal-overlay {
    display: none !important;
  }
  #main {
    margin-left: 0 !important;
    padding: 0 !important;
  }
  .article-body h2,
  .article-body h3 {
    color: #000 !important;
    border-bottom-color: #ccc !important;
  }
  .article-body strong {
    color: #000 !important;
  }
  .article-body blockquote {
    border-left-color: #999 !important;
    background: #f5f5f5 !important;
  }
  .article-infobox {
    border: 1px solid #ccc !important;
    background: #fafafa !important;
    page-break-inside: avoid;
  }
  .infobox-header {
    background: #eee !important;
    color: #000 !important;
    border-bottom-color: #ccc !important;
  }
  a {
    color: #000 !important;
    text-decoration: underline !important;
  }
  .toc {
    border: 1px solid #ccc !important;
    background: #fafafa !important;
  }
  .toc-title {
    color: #000 !important;
  }
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }
  .article-layout {
    grid-template-columns: 1fr !important;
  }
  .article-sidebar {
    position: static !important;
    order: -1 !important;
  }
  .article-title {
    color: #000 !important;
  }
  .article-subtitle {
    color: #444 !important;
  }
  @page {
    margin: 2cm;
  }
}

/* ═══════════════════════════════════════════════
   COMMENTS (dark-theme compatible)
   ═══════════════════════════════════════════════ */

.comments-area {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.comments-title {
  font-family: var(--font-title);
  font-size: 20px;
  margin-bottom: 16px;
  color: var(--text-primary);
}
.comment-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 16px;
}
.comment-list .comment {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-parchment);
}
.comment-author .avatar {
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}
.comment-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.comment-content p {
  margin-bottom: 8px;
  line-height: 1.6;
}
.comment-reply-link {
  font-size: 12px;
  color: var(--leather);
}

/* Comment form */
.comment-respond {
  margin-top: 24px;
}
.comment-form label {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--text-secondary);
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-field);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  margin-bottom: 12px;
}
.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--leather);
  box-shadow: 0 0 0 2px rgba(158,107,66,0.15);
}
.comment-form .form-submit input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: 1px solid var(--leather);
  border-radius: 4px;
  background: transparent;
  color: var(--leather);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 44px;
}
.comment-form .form-submit input[type="submit"]:hover {
  background: rgba(158,107,66,0.1);
}
.comment-form .form-submit input[type="submit"]:focus-visible {
  outline: 2px solid var(--leather);
  outline-offset: 2px;
}
.comment-reply-link {
  font-size: 12px;
  color: var(--leather);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 0;
}

/* Page links (<!--nextpage-->) */
.page-links {
  margin-top: 24px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-primary);
  text-decoration: none;
}
.page-link:hover {
  border-color: var(--leather);
  color: var(--leather);
}

/* ═══════════════════════════════════════════════
   AUTH MODAL
   ═══════════════════════════════════════════════ */

#auth-modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.75);
  display: none; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
#auth-modal-overlay.visible { opacity: 1; }
.auth-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 28px;
  max-width: 420px; width: 90%;
  position: relative;
  animation: scaleIn 0.22s cubic-bezier(0.34,1.56,0.64,1) both;
  max-height: 90vh;
  overflow-y: auto;
}
.auth-modal-tabs {
  display: flex; gap: 8px; margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.auth-tab {
  background: transparent; border: none;
  font-family: var(--font-title); font-size: 13px;
  color: var(--text-secondary); cursor: pointer;
  padding: 6px 10px; letter-spacing: 0.5px;
  transition: color 0.15s;
}
.auth-tab.active { color: var(--gold); border-bottom: 2px solid var(--gold); margin-bottom: -9px; }
.auth-tab:hover { color: var(--text-primary); }
.auth-modal-close {
  position: absolute; top: 12px; right: 14px;
  background: transparent; border: none; color: var(--text-muted);
  font-size: 22px; cursor: pointer; line-height: 1;
}
.auth-modal-close:hover { color: var(--text-primary); }
.auth-msg {
  margin-top: 10px; font-size: 13px; min-height: 18px;
}
.header-user {
  font-family: var(--font-title);
  font-size: 12px; color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-decoration: none;
}
.header-user:hover { color: var(--text); }

/* ═══════════════════════════════════════════════
   COMMENTS LOGIN HINT
   ═══════════════════════════════════════════════ */

.comments-login-hint {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-parchment);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: center;
  font-family: var(--font-prose);
  font-style: italic;
  color: var(--text-secondary);
}
.comments-login-hint a {
  color: var(--leather); text-decoration: underline;
}
.comments-login-hint a:hover { color: var(--leather-light); }

/* ═══════════════════════════════════════════════
   PROPOSAL INFOBOX EDITOR
   ═══════════════════════════════════════════════ */

.proposal-infobox-editor { display: flex; flex-direction: column; gap: 8px; }
.proposal-infobox-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.proposal-field-label {
  font-family: var(--font-title); font-size: 11px;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--gold-dark); margin-bottom: 6px;
}
.proposal-login-hint {
  font-family: var(--font-prose); font-style: italic;
  color: var(--text-secondary); font-size: 14px;
}
.proposal-login-hint a { color: var(--leather); text-decoration: underline; }

/* ═══════════════════════════════════════════════
   PROFILE PAGE
   ═══════════════════════════════════════════════ */

.profile-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px;
}
.profile-heading {
  font-family: var(--font-title);
  font-size: 24px;
  margin-bottom: 28px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.profile-guest {
  max-width: 640px;
  margin: 40px auto;
  text-align: center;
  color: var(--text-secondary);
}
.profile-guest a { color: var(--leather); text-decoration: underline; }

.profile-avatar-section {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}
.profile-avatar-preview {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.profile-avatar-actions { display: flex; flex-direction: column; gap: 6px; }
.profile-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

.profile-form .form-group { margin-bottom: 20px; }
.profile-form .form-label {
  display: block;
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 6px;
}
.profile-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}
.profile-msg {
  font-size: 14px;
  font-family: var(--font-prose);
}
