:root {
  --bg: #f8f7f4;
  --surface: #ffffff;
  --surface2: #f0eeea;
  --text: #1a1814;
  --text2: #5a564f;
  --text3: #8a867e;
  --accent: #c8401a;
  --accent2: #e8550a;
  --border: #e2dfd8;
  --shadow: rgba(0,0,0,0.08);
  --shadow2: rgba(0,0,0,0.14);
  --nav-h: 64px;
  --tag-bg: #e8f4e8;
  --tag-color: #2a6e2a;
}
[data-theme="dark"] {
  --bg: #121110;
  --surface: #1e1c1a;
  --surface2: #272420;
  --text: #f0ede8;
  --text2: #b8b4ac;
  --text3: #7a766e;
  --accent: #e85a2a;
  --accent2: #ff7040;
  --border: #2e2b27;
  --shadow: rgba(0,0,0,0.3);
  --shadow2: rgba(0,0,0,0.5);
  --tag-bg: #1a2e1a;
  --tag-color: #6ec46e;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Source Sans 3', sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
}

/* ── LOADER ── */
#page-loader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.4s, visibility 0.4s;
}
#page-loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-ring {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── NAV ── */
nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 32px;
  gap: 16px;
  backdrop-filter: blur(8px);
  transition: background 0.3s, border-color 0.3s;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem; font-weight: 900;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1rem; font-weight: 900;
}
.nav-spacer { flex: 1; }
.nav-btn {
  width: 38px; height: 38px;
  border: none; background: none; cursor: pointer;
  color: var(--text2);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  transition: background 0.2s, color 0.2s;
}
.nav-btn:hover { background: var(--surface2); color: var(--text); }
.lang-btn {
  height: 32px; padding: 0 12px;
  border: 1.5px solid var(--border);
  background: none; cursor: pointer;
  color: var(--text2);
  border-radius: 6px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.5px;
  transition: all 0.2s;
}
.lang-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── SEARCH OVERLAY ── */
#search-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 80px;
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
#search-overlay.open { opacity: 1; visibility: visible; }
.search-box {
  background: var(--surface);
  border-radius: 16px;
  width: min(600px, 90vw);
  padding: 20px;
  box-shadow: 0 24px 64px var(--shadow2);
  transform: translateY(-20px);
  transition: transform 0.25s;
}
#search-overlay.open .search-box { transform: translateY(0); }
.search-input-row {
  display: flex; align-items: center; gap: 12px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 12px; margin-bottom: 16px;
}
.search-input-row svg { color: var(--text3); flex-shrink: 0; }
.search-input-row input {
  flex: 1; border: none; background: none; outline: none;
  font-size: 1.1rem; color: var(--text);
  font-family: 'Source Sans 3', sans-serif;
}
.search-input-row input::placeholder { color: var(--text3); }
#search-results { max-height: 320px; overflow-y: auto; }
.search-result-item {
  padding: 10px 8px; border-radius: 8px; cursor: pointer;
  display: flex; gap: 12px; align-items: center;
  transition: background 0.15s;
}
.search-result-item:hover { background: var(--surface2); }
.search-result-cat {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--accent); white-space: nowrap;
}
.search-result-title { font-size: 0.9rem; color: var(--text); line-height: 1.3; }
.search-no-results { color: var(--text3); font-size: 0.9rem; padding: 8px; text-align: center; }

/* ── PAGES ── */
.page { display: none; animation: fadeUp 0.4s ease; }
.page.active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── HOME ── */
.home-grid {
  max-width: 1200px; margin: 0 auto;
  padding: 40px 24px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
}
@media(max-width: 900px) {
  .home-grid { grid-template-columns: 1fr; }
  .sidebar { order: -1; }
}

/* Hero card */
.hero-card {
  position: relative; border-radius: 16px; overflow: hidden;
  aspect-ratio: 16/9; cursor: pointer;
  box-shadow: 0 8px 32px var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
}
.hero-card:hover { transform: translateY(-4px); box-shadow: 0 16px 48px var(--shadow2); }
.hero-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 40%, transparent 100%);
  padding: 28px;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.hero-cat {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--accent2);
  margin-bottom: 8px;
}
.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.3rem, 3vw, 1.9rem); font-weight: 700;
  color: white; line-height: 1.3; margin-bottom: 10px;
}
.hero-meta { font-size: 0.78rem; color: rgba(255,255,255,0.6); }

/* Post list */
.post-list { display: flex; flex-direction: column; gap: 0; }
.post-item {
  display: grid; grid-template-columns: 1fr 120px;
  gap: 20px; align-items: start;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: opacity 0.2s;
}
.post-item:hover { opacity: 0.75; }
.post-item:last-child { border-bottom: none; }
.post-item-cat {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--accent); margin-bottom: 6px;
}
.post-item-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem; font-weight: 700; color: var(--text);
  line-height: 1.4; margin-bottom: 8px;
}
.post-item-excerpt { font-size: 0.88rem; color: var(--text2); line-height: 1.6; margin-bottom: 10px; }
.post-item-meta { font-size: 0.75rem; color: var(--text3); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tag {
  background: var(--tag-bg); color: var(--tag-color);
  padding: 2px 8px; border-radius: 4px;
  font-size: 0.7rem; font-weight: 600;
}
.post-item-thumb {
  border-radius: 10px; overflow: hidden; aspect-ratio: 1;
}
.post-item-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: 32px; }
.sidebar-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem; font-weight: 700; color: var(--text);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.sidebar-section-title::before {
  content: ''; width: 4px; height: 18px;
  background: var(--accent); border-radius: 2px;
}
.featured-list { display: flex; flex-direction: column; gap: 0; }
.featured-item {
  display: grid; grid-template-columns: 72px 1fr;
  gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: opacity 0.2s;
}
.featured-item:hover { opacity: 0.7; }
.featured-item:last-child { border-bottom: none; }
.featured-item-img {
  width: 72px; height: 56px; border-radius: 8px; overflow: hidden;
}
.featured-item-img img { width: 100%; height: 100%; object-fit: cover; }
.featured-item-cat {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--accent); margin-bottom: 4px;
}
.featured-item-title { font-size: 0.85rem; color: var(--text); line-height: 1.35; font-weight: 600; }
.team-list { display: flex; flex-direction: column; gap: 16px; }
.team-item { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.team-item:hover .team-item-title { color: var(--accent); }
.team-avatar {
  width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: var(--surface2); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem; color: var(--text2);
}
.team-author { font-size: 0.75rem; color: var(--text3); margin-bottom: 3px; }
.team-item-title { font-size: 0.85rem; color: var(--text); line-height: 1.35; font-weight: 600; transition: color 0.2s; }

/* ── BLOG POST PAGE ── */
.post-page { max-width: 1100px; margin: 0 auto; padding: 40px 24px; }
.post-page-cat {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--accent); margin-bottom: 16px;
}
.post-page-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 900;
  line-height: 1.25; margin-bottom: 24px;
  color: var(--text);
}
.post-hero-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 40px; margin-bottom: 40px; align-items: start;
}
@media(max-width: 768px) { .post-hero-grid { grid-template-columns: 1fr; } }
.post-meta-col { display: flex; flex-direction: column; justify-content: flex-end; }
.post-author-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.author-avatar {
  width: 44px; height: 44px; border-radius: 50%; overflow: hidden;
  background: var(--surface2); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--text2);
}
.author-name { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.author-date { font-size: 0.8rem; color: var(--text3); margin-top: 2px; }
.post-actions { display: flex; gap: 10px; margin-top: 16px; }
.btn-action {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: 8px;
  border: 1.5px solid var(--border);
  background: none; cursor: pointer;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem; font-weight: 600;
  color: var(--text2);
  transition: all 0.2s;
}
.btn-action:hover { border-color: var(--accent); color: var(--accent); background: var(--surface2); }
.btn-action.saved { border-color: var(--accent); color: var(--accent); background: var(--surface2); }
.btn-action svg { width: 16px; height: 16px; }
.post-cover {
  border-radius: 16px; overflow: hidden;
  aspect-ratio: 4/3;
}
.post-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-body {
  max-width: 720px; margin: 0 auto;
  font-size: 1.05rem; line-height: 1.85;
  color: var(--text2);
}
.post-body p { margin-bottom: 1.4em; }
.post-body h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem; color: var(--text);
  margin: 2em 0 0.6em;
}
.post-body strong { color: var(--text); font-weight: 700; }
.post-divider {
  border: none; border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* Audio player */
.audio-player {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 40px;
  max-width: 720px; margin-left: auto; margin-right: auto;
}
.audio-play-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: white; flex-shrink: 0;
  transition: transform 0.2s, background 0.2s;
}
.audio-play-btn:hover { background: var(--accent2); transform: scale(1.08); }
.audio-info { flex: 1; }
.audio-label { font-size: 0.8rem; color: var(--text3); margin-bottom: 4px; }
.audio-title { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.audio-progress {
  flex: 1; height: 4px; background: var(--border); border-radius: 2px;
  cursor: pointer; position: relative; min-width: 80px;
}
.audio-progress-fill {
  height: 100%; background: var(--accent);
  border-radius: 2px; width: 0%; transition: width 0.1s;
}
.audio-time { font-size: 0.78rem; color: var(--text3); white-space: nowrap; }

/* Related posts */
.related-section { padding: 40px 0 0; }
.related-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem; font-weight: 700; color: var(--text);
  margin-bottom: 28px;
  padding-bottom: 16px; border-bottom: 2px solid var(--border);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}
.related-card {
  cursor: pointer; transition: transform 0.25s, box-shadow 0.25s;
  border-radius: 12px; overflow: hidden;
  background: var(--surface);
  box-shadow: 0 2px 12px var(--shadow);
}
.related-card:hover { transform: translateY(-6px); box-shadow: 0 12px 32px var(--shadow2); }
.related-card-img { aspect-ratio: 16/10; overflow: hidden; }
.related-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s; }
.related-card:hover .related-card-img img { transform: scale(1.05); }
.related-card-body { padding: 14px 16px 16px; }
.related-card-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.related-card-cat {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--accent);
}
.related-card-read { font-size: 0.7rem; color: var(--text3); }
.related-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem; font-weight: 700; color: var(--text);
  line-height: 1.4; margin-bottom: 6px;
}
.related-card-date { font-size: 0.75rem; color: var(--text3); }

/* ── TRANSITION OVERLAY ── */
#transition-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s;
}
#transition-overlay.show { opacity: 1; pointer-events: all; }
.t-spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }

/* Utility */
.dot { width: 4px; height: 4px; border-radius: 50%; background: var(--text3); display: inline-block; }
