/* ═══════════════════════════════════════════════════════════════════════════
   Rerukane Chandawimala Maha Nahimi — Main Stylesheet
   Palette: warm cream, saffron/amber, deep earth, forest accent
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* ── Custom Properties ───────────────────────────────────────────────────── */
:root {
  --cream:         #FAF8F4;
  --cream-2:       #F3EFE6;
  --cream-3:       #EDE6D8;
  --saffron:       #9A6F1A;
  --saffron-light: #C89532;
  --saffron-pale:  #FDF3DC;
  --earth:         #2C1A0E;
  --earth-mid:     #5C3D22;
  --earth-light:   #8B6040;
  --forest:        #2D6A4F;
  --forest-light:  #52B788;
  --border:        #DFD4BE;
  --border-light:  #EDE6D8;
  --text:          #1E1208;
  --text-mid:      #4A3520;
  --text-muted:    #7A6050;
  --white:         #FFFFFF;
  --shadow-sm:     0 1px 4px rgba(44,26,14,.06);
  --shadow-md:     0 4px 16px rgba(44,26,14,.10);
  --shadow-lg:     0 8px 32px rgba(44,26,14,.14);
  --radius-sm:     6px;
  --radius-md:     12px;
  --radius-lg:     20px;
  --font-si:       'Abhaya Libre', 'Gemunu Libre', serif;
  --font-serif:    'Playfair Display', 'Abhaya Libre', Georgia, serif;
  --font-body:     'Inter', system-ui, sans-serif;
  --transition:    0.22s ease;
  --max-w:         1180px;
  --nav-h:         72px;
}

/* Dark mode */
[data-theme="dark"] {
  --cream:         #18120A;
  --cream-2:       #221A10;
  --cream-3:       #2C2015;
  --saffron:       #C89532;
  --saffron-light: #E8B84A;
  --saffron-pale:  #2C2215;
  --earth:         #F5ECD8;
  --earth-mid:     #D4BFA0;
  --earth-light:   #A88870;
  --border:        #3A2C1C;
  --border-light:  #2E2218;
  --text:          #F0E8D8;
  --text-mid:      #C8B090;
  --text-muted:    #907868;
  --shadow-sm:     0 1px 4px rgba(0,0,0,.3);
  --shadow-md:     0 4px 16px rgba(0,0,0,.4);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.5);
}

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--cream);
  transition: background var(--transition), color var(--transition);
}

img { max-width: 100%; height: auto; display: block; }
a   { color: var(--saffron); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--saffron-light); }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
ul, ol { list-style: none; }

.si { font-family: var(--font-si); }
.serif { font-family: var(--font-serif); }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; }
.section-sm { padding: 48px 0; }

/* ── Navigation ───────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--cream);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.nav-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.nav-brand-sep {
  width: 1px;
  height: 36px;
  background: var(--border);
  flex-shrink: 0;
}

.nav-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.nav-brand-en {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.nav-brand-si {
  font-family: var(--font-si);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--saffron);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-mid);
  letter-spacing: 0.02em;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--saffron);
  border-bottom-color: var(--saffron);
}

.nav-actions { display: flex; align-items: center; gap: 12px; }

.btn-theme {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--cream-2);
  border: 1px solid var(--border);
  color: var(--text-mid);
  font-size: 1rem;
  transition: background var(--transition), color var(--transition);
}
.btn-theme:hover { background: var(--cream-3); color: var(--saffron); }

.btn-menu {
  display: none;
  flex-direction: column;
  gap: 5px; padding: 6px;
}
.btn-menu span {
  display: block; width: 22px; height: 2px;
  background: var(--text-mid); border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* ── Site Masthead (home page top banner) ─────────────────────────────────── */
.site-masthead {
  background: var(--cream);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

.masthead-inner {
  display: flex;
  align-items: center;
  gap: 20px;
}

.masthead-logo {
  height: 72px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.masthead-logo-placeholder {
  height: 72px;
  width: 72px;
  background: var(--cream-2);
  border-radius: 50%;
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}

.masthead-divider {
  width: 2px;
  height: 56px;
  background: linear-gradient(to bottom, transparent, var(--saffron), transparent);
  flex-shrink: 0;
}

.masthead-text {}

.masthead-title-en {
  font-family: var(--font-serif);
  font-size: clamp(0.9rem, 2vw, 1.25rem);
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.masthead-title-si {
  font-family: var(--font-si);
  font-size: clamp(1rem, 2.2vw, 1.4rem);
  font-weight: 700;
  color: var(--saffron);
  line-height: 1.3;
  margin-top: 2px;
}

@media (max-width: 640px) {
  .masthead-logo { height: 52px; }
  .masthead-logo-placeholder { height: 52px; width: 52px; font-size: 1.4rem; }
  .masthead-divider { height: 40px; }
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--saffron);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--earth-mid);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  border: 1.5px solid var(--saffron);
  color: var(--saffron);
  background: transparent;
}
.btn-outline:hover {
  background: var(--saffron);
  color: var(--white);
}

.btn-ghost {
  color: var(--text-mid);
  background: transparent;
}
.btn-ghost:hover { color: var(--saffron); background: var(--cream-2); }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--cream) 0%, var(--cream-2) 50%, var(--saffron-pale) 100%);
  padding: 80px 0 60px;
  position: relative;
  overflow: hidden;
  min-height: 520px;
}

.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23C89532' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 2;
}

.hero-text {
  max-width: 50%;
}

.hero-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--saffron);
  margin-bottom: 16px;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 600;
  line-height: 1.15;
  color: var(--earth);
  margin-bottom: 8px;
}

.hero-title-si {
  font-family: var(--font-si);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--saffron);
  margin-bottom: 24px;
  display: block;
}

.hero-desc {
  font-size: 1rem;
  color: var(--text-mid);
  max-width: 560px;
  margin-bottom: 32px;
  line-height: 1.8;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-portrait {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 55%;
  z-index: 1;
  pointer-events: none;
}

/* Faded portrait — fills full right side, fades to left */
.hero-portrait-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.6) 30%, black 60%);
  mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.6) 30%, black 60%);
  filter: sepia(15%) brightness(0.97);
  display: block;
}

.hero-portrait-placeholder {
  width: 100%;
  height: 380px;
  background: linear-gradient(145deg, var(--cream-3), var(--saffron-pale));
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
}

.hero-portrait-placeholder svg { width: 64px; height: 64px; opacity: 0.4; }
.hero-portrait-placeholder p { font-size: 0.85rem; text-align: center; padding: 0 20px; }

/* ── Quote Banner ─────────────────────────────────────────────────────────── */
.quote-banner {
  background: var(--earth);
  padding: 48px 0;
}

.quote-inner {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.quote-mark { font-size: 4rem; color: var(--saffron); line-height: 0.5; opacity: 0.6; font-family: Georgia; }

.quote-text-si {
  font-family: var(--font-si);
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  font-weight: 500;
  color: var(--cream);
  line-height: 1.7;
  margin: 16px 0;
}

.quote-text-en {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--earth-light);
  margin-bottom: 12px;
}

.quote-source {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--saffron-light);
}

/* ── Section Headings ─────────────────────────────────────────────────────── */
.section-head { margin-bottom: 48px; }
.section-head-sm { margin-bottom: 32px; }

.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--saffron);
  margin-bottom: 10px;
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  color: var(--earth);
  line-height: 1.2;
}

.section-title-si {
  font-family: var(--font-si);
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  color: var(--text-mid);
}

.section-divider {
  width: 48px; height: 3px;
  background: var(--saffron);
  border-radius: 2px;
  margin: 16px 0;
}

/* ── Book Cards ───────────────────────────────────────────────────────────── */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 28px;
}

.book-card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  border: 1px solid var(--border-light);
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.book-cover {
  aspect-ratio: 2/3;
  overflow: hidden;
  background: linear-gradient(145deg, var(--cream-2), var(--saffron-pale));
}

.book-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.book-card:hover .book-cover img { transform: scale(1.04); }

.book-cover-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, var(--cream-3), var(--saffron-pale));
}

.book-cover-placeholder svg { width: 48px; opacity: 0.35; }

.book-info { padding: 16px; }

.book-category {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--saffron);
  margin-bottom: 6px;
}

.book-title {
  font-family: var(--font-si);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 4px;
}

.book-title-en {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-bottom: 10px;
}

.book-meta {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.book-actions {
  padding: 0 16px 16px;
  display: flex;
  gap: 8px;
}

.book-actions .btn { flex: 1; justify-content: center; padding: 8px; font-size: 0.8rem; }

/* ── Article Cards ────────────────────────────────────────────────────────── */
.articles-list { display: flex; flex-direction: column; gap: 1px; }

.article-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 24px;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  transition: box-shadow var(--transition), transform var(--transition);
}

.article-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.article-img {
  width: 120px; height: 90px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--cream-2);
  flex-shrink: 0;
}

.article-img-placeholder {
  width: 120px; height: 90px;
  background: linear-gradient(145deg, var(--cream-2), var(--saffron-pale));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}

.article-img-placeholder svg { width: 32px; opacity: 0.35; }

.article-body {}

.article-cat {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--saffron);
  margin-bottom: 6px;
}

.article-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 4px;
}

.article-title-si {
  font-family: var(--font-si);
  font-size: 0.95rem;
  color: var(--text-mid);
  margin-bottom: 8px;
}

.article-excerpt {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Timeline ─────────────────────────────────────────────────────────────── */
.timeline {
  position: relative;
  padding: 24px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--border), var(--saffron), var(--border), transparent);
  transform: translateX(-50%);
}

.timeline-item {
  display: grid;
  grid-template-columns: 1fr 60px 1fr;
  gap: 0;
  margin-bottom: 48px;
  position: relative;
}

.timeline-item:nth-child(even) .timeline-content { grid-column: 3; }
.timeline-item:nth-child(even) .timeline-year    { grid-column: 2; }
.timeline-item:nth-child(even) .timeline-empty   { grid-column: 1; }
.timeline-item:nth-child(odd)  .timeline-content { grid-column: 1; text-align: right; }
.timeline-item:nth-child(odd)  .timeline-year    { grid-column: 2; }
.timeline-item:nth-child(odd)  .timeline-empty   { grid-column: 3; }

.timeline-year {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
}

.timeline-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--saffron);
  border: 3px solid var(--cream);
  box-shadow: 0 0 0 2px var(--saffron);
  flex-shrink: 0;
}

.timeline-year-label {
  font-family: var(--font-serif);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--saffron);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.timeline-content {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  margin: 0 16px;
}

.timeline-content h3 {
  font-family: var(--font-si);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.timeline-content h3 span {
  display: block;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-mid);
}

.timeline-content p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-top: 8px;
}

.timeline-img {
  margin-top: 12px;
  width: 100%;
  border-radius: var(--radius-sm);
  object-fit: cover;
  max-height: 160px;
}

/* ── Filters / Search ─────────────────────────────────────────────────────── */
.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  align-items: center;
}

.search-box {
  flex: 1;
  min-width: 220px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--saffron);
}

.search-box svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 7px 16px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  color: var(--text-mid);
  background: var(--white);
  transition: all var(--transition);
  cursor: pointer;
}

.filter-tab:hover,
.filter-tab.active {
  background: var(--saffron);
  border-color: var(--saffron);
  color: var(--white);
}

/* ── Article / Book Reader ────────────────────────────────────────────────── */
.reader {
  max-width: 760px;
  margin: 0 auto;
}

.reader-header { margin-bottom: 40px; }
.reader-cat { margin-bottom: 12px; }
.reader-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 600;
  color: var(--earth);
  line-height: 1.2;
  margin-bottom: 8px;
}
.reader-title-si {
  font-family: var(--font-si);
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
  color: var(--text-mid);
  margin-bottom: 20px;
}
.reader-meta { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 24px; }
.reader-img {
  width: 100%;
  border-radius: var(--radius-md);
  object-fit: cover;
  max-height: 380px;
  margin-bottom: 40px;
}

.reader-body {
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text-mid);
}

.reader-body.si {
  font-family: var(--font-si);
  font-size: 1.15rem;
}

.reader-body h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--earth);
  margin: 2em 0 0.6em;
}

.reader-body h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--earth);
  margin: 1.5em 0 0.5em;
}

.reader-body p { margin-bottom: 1.2em; }

.reader-body blockquote {
  border-left: 3px solid var(--saffron);
  padding: 16px 24px;
  background: var(--saffron-pale);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1.5em 0;
  font-style: italic;
  color: var(--earth-mid);
}

.reader-body ul, .reader-body ol {
  list-style: disc;
  padding-left: 1.5em;
  margin-bottom: 1.2em;
}

/* ── PDF Viewer ───────────────────────────────────────────────────────────── */
.pdf-viewer {
  background: var(--cream-2);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-top: 32px;
}

.pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--cream-3);
  border-bottom: 1px solid var(--border);
}

.pdf-frame {
  width: 100%;
  height: 75vh;
  border: none;
}

/* ── Breadcrumb ───────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 16px 0;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--saffron); }
.breadcrumb-sep { color: var(--border); }
.breadcrumb-cur { color: var(--text); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.footer {
  background: var(--earth);
  color: var(--cream);
  padding: 48px 0 24px;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand-name {
  font-family: var(--font-si);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--saffron-light);
  margin-bottom: 4px;
}

.footer-brand-en {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  color: var(--earth-light);
  margin-bottom: 12px;
}

.footer-desc {
  font-size: 0.85rem;
  color: var(--earth-light);
  line-height: 1.7;
}

.footer-heading {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--saffron-light);
  margin-bottom: 16px;
}

.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links a {
  font-size: 0.875rem;
  color: var(--earth-light);
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--cream); }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--earth-light);
}

/* ── Loading & Empty States ───────────────────────────────────────────────── */
.loading {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px; gap: 16px;
  color: var(--text-muted);
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--saffron);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }
.empty p { font-size: 0.95rem; }

/* ── Toast notification ───────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--earth);
  color: var(--cream);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 320px;
}

.toast.success { border-left: 3px solid var(--forest-light); }
.toast.error   { border-left: 3px solid #E05555; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Featured badge ───────────────────────────────────────────────────────── */
.badge-featured {
  display: inline-block;
  background: var(--saffron);
  color: var(--white);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 100px;
}

/* ── Share buttons ────────────────────────────────────────────────────────── */
.share-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  margin-top: 40px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.share-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  color: var(--text-mid);
  transition: all var(--transition);
}

.share-btn:hover { border-color: var(--saffron); color: var(--saffron); background: var(--saffron-pale); }

/* ── Mobile Navigation ────────────────────────────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  background: var(--cream);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  box-shadow: var(--shadow-md);
  z-index: 99;
  flex-direction: column;
  gap: 4px;
}

.mobile-nav.open { display: flex; }
.mobile-nav a {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-mid);
  font-size: 0.95rem;
  font-weight: 500;
}
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a:hover { color: var(--saffron); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .btn-menu  { display: flex; }

  .hero-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  /* On tablet/mobile: fade portrait from top so text stays readable */
  .hero-text { max-width: 100%; }
  .hero-portrait { width: 100%; opacity: 0.25; }
  .hero-portrait-img {
    -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
  }

  .timeline::before { left: 28px; }
  .timeline-item {
    grid-template-columns: 56px 1fr;
    grid-template-rows: auto;
  }
  .timeline-item:nth-child(odd)  .timeline-content,
  .timeline-item:nth-child(even) .timeline-content {
    grid-column: 2; text-align: left;
  }
  .timeline-item:nth-child(odd)  .timeline-year,
  .timeline-item:nth-child(even) .timeline-year { grid-column: 1; }
  .timeline-item .timeline-empty { display: none; }
  .timeline-content { margin: 0 0 0 8px; }

  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
}

@media (max-width: 640px) {
  .section    { padding: 40px 0; }
  .section-sm { padding: 32px 0; }
  .container  { padding: 0 16px; }

  /* Nav — hide English name on very small screens */
  .nav-brand-en { display: none; }

  /* Hero */
  .hero { padding: 40px 0 32px; min-height: unset; }
  .hero-title { font-size: 1.8rem; }
  .hero-title-si { font-size: 1.3rem; }
  .hero-desc { font-size: 0.9rem; }
  .hero-actions { gap: 8px; }
  .hero-actions .btn { padding: 10px 16px; font-size: 0.85rem; }

  /* About grid — stack on mobile */
  .about-grid { grid-template-columns: 1fr !important; gap: 28px !important; }

  /* Stats box — 2 cols still fine, just smaller */
  .books-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }

  /* Articles */
  .article-card { grid-template-columns: 1fr; }
  .article-img, .article-img-placeholder { width: 100%; height: 160px; }

  /* Library page filters */
  .filters { flex-direction: column; align-items: stretch; }
  .search-box { min-width: unset; }

  /* Section headings */
  .section-title { font-size: 1.6rem; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr !important; }

  /* Milestone grid */
  .milestone-grid { grid-template-columns: repeat(2, 1fr); }

  /* Book detail page */
  #bookContent > div { grid-template-columns: 1fr !important; }
}
