:root {
  --bg: #f8f7f4;
  --panel: rgba(255, 255, 255, 0.85);
  --panel-strong: #ffffff;
  --text: #1a1b1e;
  --muted: #646b79;
  --line: rgba(0, 0, 0, 0.08);
  --accent: #876532;
  --accent-soft: rgba(135, 101, 50, 0.08);
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.02);
  --shadow-hover: 0 24px 48px rgba(135, 101, 50, 0.08), 0 8px 16px rgba(0, 0, 0, 0.04);
  --shadow-strong: 0 32px 64px rgba(0, 0, 0, 0.12), 0 12px 24px rgba(0, 0, 0, 0.08);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --max: 1240px;
  --ease-elastic: cubic-bezier(0.175, 0.885, 0.32, 1.05);
  --ease-smooth: cubic-bezier(0.2, 0, 0, 1);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: inherit; /* Handled in app.js or specific fonts */
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Noto Sans SC", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(135,101,50,0.06) 0%, transparent 40%),
    radial-gradient(100% 100% at 100% 100%, rgba(20, 30, 45, 0.03) 0%, transparent 35%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.lightbox-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; }
.container { width: min(calc(100% - 40px), var(--max)); margin: 0 auto; }
.site-header {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(16px);
  background: rgba(247,245,239,0.82);
  border-bottom: 1px solid var(--line);
}
.nav-row { display:flex; align-items:center; justify-content:space-between; gap:16px; min-height:72px; }
.brand { display:flex; align-items:center; gap: 14px; text-decoration: none; transition: opacity 0.2s ease; }
.brand:hover { opacity: 0.85; }
.brand-logoWrap { 
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; 
  background: linear-gradient(135deg, var(--accent), #6b4c20);
  border-radius: 12px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(135, 101, 50, 0.25);
}
.brand-logo { width: 22px; height: 22px; }
.brand-text { display:flex; flex-direction:column; gap:2px; }
.brand-kicker { font-size:11px; letter-spacing:0.18em; text-transform:uppercase; color:var(--accent); font-weight:700; line-height: 1; }
.brand-title { font-size:20px; font-weight:800; letter-spacing:-0.02em; color: var(--text); line-height: 1.1; }
.nav-tools { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.lang-btn, .filter-chip {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.7);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: all .18s ease;
}
.lang-btn:hover, .filter-chip:hover { transform: translateY(-1px); }
.lang-btn.active, .filter-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.hero { padding: 72px 0 28px; }
.hero-main, .panel {
  background: var(--panel);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
  transition: box-shadow 0.4s var(--ease-smooth), transform 0.4s var(--ease-smooth);
}
.panel:hover {
  box-shadow: var(--shadow-hover);
}
.hero-single { 
  padding: 80px 40px; 
  text-align: center;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(248,247,244,0.7));
}
.hero-single::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 30%, rgba(135, 101, 50, 0.05) 0%, transparent 40%),
              radial-gradient(circle at 70% 70%, rgba(31, 41, 55, 0.03) 0%, transparent 40%);
  z-index: -1;
  animation: bgFloat 15s ease-in-out infinite alternate;
}
@keyframes bgFloat {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-2%, -2%) rotate(1deg); }
}

.eyebrow { 
  color: var(--accent); 
  font-size: 13px; 
  letter-spacing: 0.18em; 
  text-transform: uppercase; 
  font-weight: 700;
  display: inline-block;
  padding: 6px 16px;
  background: var(--accent-soft);
  border-radius: 999px;
  margin-bottom: 24px;
}
.hero-title { 
  margin: 0 auto 24px; 
  font-size: clamp(34px, 8vw, 72px); 
  font-weight: 800;
  line-height: 1.25; 
  letter-spacing: -0.04em; 
  max-width: 24ch; 
  text-wrap: balance;
  word-break: break-word;
  background: linear-gradient(90deg, #1a1b1e, #4a4d55); 
  -webkit-background-clip: text; 
  background-clip: text;
  -webkit-text-fill-color: transparent; 
}
.hero-subtitle { 
  font-size: 20px; 
  color: var(--muted); 
  max-width: 60ch; 
  margin: 0 auto 36px; 
  line-height: 1.6;
}
.hero-actions { display:flex; gap:16px; justify-content: center; flex-wrap: wrap; width: 100%; }
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding: 12px 24px; border-radius:999px; border:1px solid transparent; cursor:pointer; font-weight:600; font-size: 15px;
  transition: transform 0.25s var(--ease-elastic), background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(1px); transition: transform 0.1s ease; }
.btn-primary { background: var(--text); color:#fff; border-color: var(--text); }
.btn-secondary { background: rgba(255,255,255,0.7); }
.section { padding: 24px 0 12px; }
.section-head { display:flex; justify-content:space-between; gap:16px; align-items:end; margin-bottom:16px; }
.section-head-stack { align-items:flex-start; flex-direction:column; }
.compact-head { margin-bottom: 18px; }
.section-title { font-size: 30px; letter-spacing:-0.03em; margin: 0; }
.section-desc { color: var(--muted); max-width: 70ch; margin: 6px 0 0; }
.filters { 
  display: flex; 
  gap: 10px; 
  margin: 8px 0 22px; 
  overflow-x: auto; 
  padding-bottom: 8px; /* Room for scrollbar if visible */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}
.filters::-webkit-scrollbar { display: none; }
.filter-chip { flex-shrink: 0; }
.grid { display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.related-grid { display:grid; gap: 18px; }
.related-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.related-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  background: var(--panel-strong);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.4s var(--ease-elastic), box-shadow 0.4s var(--ease-smooth), border-color 0.4s ease;
  will-change: transform;
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(135,101,50,0.3);
}
.card-link { display:block; height:100%; }
.card-image-wrap { aspect-ratio: 4 / 5; background:#f1ede4; overflow:hidden; position: relative; }
.card-image-wrap::after {
  content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 60%, rgba(0,0,0,0.03) 100%); pointer-events: none;
}
.card-image { width:100%; height:100%; object-fit:cover; object-position:center top; transition: transform 0.6s var(--ease-smooth), filter 0.6s var(--ease-smooth); filter: brightness(0.98); }
.card:hover .card-image { transform: scale(1.05); filter: brightness(1.02); }
.card-body { padding: 18px; }
.card-meta { display:flex; justify-content:space-between; gap:10px; align-items:center; margin-bottom:10px; }
.badge { display: inline-flex; align-items: center; justify-content: center; height: 24px; box-sizing: border-box; padding: 0 10px; font-size: 12px; font-weight: 500; color: var(--accent); background: var(--accent-soft); border-radius:999px; line-height: 1; white-space: nowrap; }
.card-title { font-size: 22px; line-height:1.25; margin: 0 0 10px; letter-spacing:-0.03em; }
.card-text { color: var(--muted); font-size: 15px; min-height: 76px; }
.card-footer { display:flex; justify-content:space-between; gap:12px; align-items:center; margin-top: 14px; font-size: 14px; }
.detail-layout { display:grid; grid-template-columns: minmax(320px, 0.86fr) minmax(0, 1.14fr); gap: 32px; padding: 34px 0 64px; }
.detail-image-panel { position: sticky; top: 96px; align-self:start; padding:20px; }
.detail-content { display:grid; gap:18px; }
.detail-block { padding:24px; }
.detail-hero { padding-bottom: 28px; }
.kicker-row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:12px; }
.detail-title { font-size: clamp(34px, 5vw, 52px); line-height:1.08; margin: 10px 0; letter-spacing:-0.04em; }
.detail-subtitle { color: var(--muted); font-size:18px; max-width: 48ch; }
.bullets, .module-list, .meta-list { display:grid; gap:12px; padding:0; margin:0; list-style:none; }
.bullet-item, .module-item {
  padding: 14px 16px; border-radius: 16px; background: rgba(142,108,58,0.06); border:1px solid rgba(142,108,58,0.08);
}
.module-list-rich { gap: 14px; }
.module-item { background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(142,108,58,0.05)); }
.module-name { font-weight:700; margin-bottom:6px; }
.two-col { display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap:16px; }
.reading-progress { position: fixed; left:0; top:0; height:3px; background: var(--accent); width:0; z-index:40; transition: width .08s linear; }
.footer { padding: 28px 0 48px; color: var(--muted); font-size:14px; }
.empty { padding: 40px 20px; text-align:center; color: var(--muted); border:1px dashed var(--line); border-radius: 20px; }
.search {
  width:min(100%, 360px); border-radius:999px; border:1px solid var(--line); background:#fff; padding: 12px 16px; font-size:14px;
}
.back-link {
  display:inline-flex; gap:8px; align-items:center; font-size:14px; color:var(--muted); margin-bottom: 12px;
}
.back-link-button {
  background: transparent; border: none; padding: 0; cursor: pointer;
}
.back-link-button:hover { color: var(--text); }
.info-pair { display:grid; gap:4px; }
.info-label { color: var(--muted); font-size:13px; }
.image-frame {
  position: relative; display:block; width:100%; border:none; background:#f1ede4; border-radius: 18px; overflow:hidden; cursor: zoom-in; padding:0;
}
.image-frame img { width:100%; height:auto; }
.image-frame-tip {
  position:absolute; right:14px; bottom:14px; background: rgba(31,41,55,0.68); color:#fff; padding:8px 10px; border-radius:999px; font-size: 12px;
}
.side-note { color: var(--muted); font-size: 14px; margin-top: 16px; }
.detail-side-meta { display:grid; gap:10px; margin-top: 16px; }
.fade-up {
  opacity: 0;
  transform: translateY(24px) scale(0.98);
  transition: opacity 0.8s var(--ease-smooth), transform 0.8s var(--ease-elastic);
  will-change: opacity, transform;
}
.fade-up.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Page load animation wrapper */
.page-enter {
  animation: pageEnter 0.6s var(--ease-smooth) forwards;
}
@keyframes pageEnter {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}
.lightbox {
  position: fixed; inset: 0; z-index: 80; display:grid; place-items:center;
}
.lightbox[hidden] {
  display: none !important;
}
.lightbox-backdrop {
  position:absolute; inset:0; background: rgba(15,23,42,0.72); backdrop-filter: blur(8px);
}
.lightbox-dialog {
  position: relative; z-index: 1; width:min(calc(100% - 40px), 1280px); max-height: calc(100vh - 56px);
  opacity: 0; transform: scale(.98); transition: opacity .18s ease, transform .18s ease;
}
.lightbox.is-visible .lightbox-dialog { opacity: 1; transform: scale(1); }
.lightbox-image {
  width:100%; max-height: calc(100vh - 56px); object-fit: contain; border-radius: 20px; box-shadow: var(--shadow-strong); background:#fff;
}
.lightbox-close {
  position:absolute; top: 14px; right: 14px; z-index: 2; border:none; border-radius:999px; padding: 10px 14px; cursor:pointer;
  background: rgba(255,255,255,0.92); box-shadow: 0 8px 30px rgba(0,0,0,.15);
}
@media (max-width: 1160px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .related-grid { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-image-panel { position: relative; top: auto; }
}
@media (max-width: 720px) {
  .container { width: min(calc(100% - 32px), var(--max)); }
  .grid, .two-col, .related-grid { grid-template-columns: 1fr; }
  .hero-single { padding: 48px 24px; }
  .nav-row { flex-wrap: wrap; justify-content: center; gap: 16px; padding: 16px 0; }
  .nav-tools { width: 100%; justify-content: center; }
  .detail-title { font-size: clamp(28px, 8vw, 38px); }
  .section-title { font-size: 24px; }
  .card-body { padding: 16px; }
  .card-title { font-size: 20px; }
  .hero-actions .btn { width: 100%; } /* Full width buttons on very small screens */
}

/* --- Premium Language Segmented Control --- */
.lang-switcher {
  display: inline-flex;
  background: var(--surface2);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
  align-items: center;
}
.lang-sw-btn {
  background: transparent;
  border: none;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.3s var(--ease-smooth);
}
.lang-sw-btn:hover { color: var(--text); }
.lang-sw-btn.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* --- Dark Mode System Sync --- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #1e1e1e;
    --surface2: #2a2a2a;
    --text: #e0e0e0;
    --muted: #a0a0a0;
    --line: #333333;
    --accent: #d4a373;
    --shadow-sm: 0 4px 12px rgba(0,0,0,0.6);
    --shadow-md: 0 12px 32px rgba(0,0,0,0.6);
  }
  .hero-title {
    background: linear-gradient(90deg, #f0f0f0, #a0a0a0);
    -webkit-background-clip: text;
    background-clip: text;
  }
  .lang-switcher { background: rgba(255,255,255,0.08); }
  .lang-sw-btn.active { background: #444; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
}

/* --- Skeleton Screens --- */
.skeleton-screen { padding: 40px; max-width: var(--max); margin: 0 auto; width: 100%; box-sizing: border-box; }
.skeleton-header { width: 100%; height: 60px; background: var(--surface2); border-radius: 8px; margin-bottom: 20px; animation: pulse 1.5s infinite ease-in-out; }
.skeleton-hero { width: 100%; height: 360px; background: var(--surface2); border-radius: 24px; margin-bottom: 40px; animation: pulse 1.5s infinite ease-in-out; }
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.skeleton-card { height: 280px; background: var(--surface2); border-radius: 16px; animation: pulse 1.5s infinite ease-in-out; }
@keyframes pulse { 0% { opacity: 0.6; } 50% { opacity: 0.3; } 100% { opacity: 0.6; } }
