/* ==========================================================================
   සත්‍ය දහම — public design system
   Palette (project brief): white, ivory, saffron, gold, dark brown. No green.
   ========================================================================== */

@font-face { font-family: "Noto Sans Sinhala"; src: url("../fonts/noto-sans-sinhala-sinhala-wght-normal.woff2") format("woff2-variations"); font-weight: 100 900; font-display: swap; unicode-range: U+0D80-0DFF, U+200C-200D, U+25CC; }
@font-face { font-family: "Noto Serif Sinhala"; src: url("../fonts/noto-serif-sinhala-sinhala-wght-normal.woff2") format("woff2-variations"); font-weight: 100 900; font-display: swap; unicode-range: U+0D80-0DFF, U+200C-200D, U+25CC; }
@font-face { font-family: "Noto Sans Tamil"; src: url("../fonts/noto-sans-tamil-tamil-wght-normal.woff2") format("woff2-variations"); font-weight: 100 900; font-display: swap; unicode-range: U+0B80-0BFF, U+200C-200D, U+25CC; }
@font-face { font-family: "DM Sans"; src: url("../fonts/dm-sans-latin-wght-normal.woff2") format("woff2-variations"); font-weight: 100 1000; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "DM Sans"; src: url("../fonts/dm-sans-latin-ext-wght-normal.woff2") format("woff2-variations"); font-weight: 100 1000; font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --white: #ffffff;
  --ivory: #f8f4eb;
  --ivory-2: #f4ecdd;
  --saffron: #c58a36;
  --saffron-dark: #8a5520;  /* text-safe saffron: 5.6:1 on ivory (WCAG AA) */
  --gold: #d6a23e;
  --gold-soft: #e8c36f;
  --brown: #38291f;
  --brown-2: #49382a;
  --text: #332820;
  --muted: #766b60;
  --line: #e9dfcf;
  --line-gold: #d6bd8c;
  --cream-text: #f2e7d6;
  --shadow: 0 14px 30px rgba(56, 41, 31, .08);
  --shadow-lg: 0 24px 55px rgba(56, 41, 31, .14);
  --radius: 6px;
  --wrap: 1180px;
  --font: "Noto Sans Sinhala", "Noto Sans Tamil", "DM Sans", system-ui, sans-serif;
  --font-display: "Noto Serif Sinhala", "Noto Sans Sinhala", "Noto Sans Tamil", "DM Sans", serif;
  --font-latin: "DM Sans", system-ui, sans-serif;
  --header-h: 76px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { margin: 0; background: var(--ivory); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.85; overflow-x: clip; }
img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--saffron-dark); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3, h4 { color: var(--text); line-height: 1.5; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 22px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--brown); color: var(--white); padding: 10px 16px; z-index: 100; border-radius: var(--radius); }
.skip-link:focus { top: 12px; color: var(--white); }
.latin { font-family: var(--font-latin); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 12px 20px; border-radius: 4px; font-size: 14px; font-weight: 600; border: 1px solid transparent; cursor: pointer; transition: background .2s, color .2s, border-color .2s, transform .2s; line-height: 1.4; font-family: inherit; }
.btn-primary { background: var(--brown); color: var(--white); }
.btn-primary:hover { background: var(--saffron-dark); color: var(--white); }
.btn-gold { background: var(--saffron); color: var(--brown); }
.btn-gold:hover { background: var(--saffron-dark); color: var(--white); }
.btn-outline { border-color: #c9b88f; color: #645638; background: #fffdf7; }
.btn-outline:hover { border-color: var(--saffron); color: var(--saffron-dark); }
.btn .arrow { transition: transform .2s; }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- announcement bar ---------- */
.topline { background: var(--brown); color: #f5ead8; font-size: 13px; }
.topline .wrap { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding-top: 8px; padding-bottom: 8px; }
.topline .tagline { color: #e7bd68; white-space: nowrap; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: rgba(255, 254, 250, .97); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); transition: box-shadow .25s; }
.site-header.is-scrolled { box-shadow: 0 6px 24px rgba(56, 41, 31, .08); }
.header-main { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { width: 56px; height: 56px; border-radius: 50%; flex: none; }
.brand-text strong { display: block; font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.3; }
.brand-text small { display: block; font: 600 10.5px/1.3 var(--font-latin); letter-spacing: 2.6px; color: #8a6b3e; }
.header-tools { display: flex; align-items: center; gap: 6px; }
.icon-btn { width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid transparent; background: none; color: var(--text); cursor: pointer; }
.icon-btn:hover { border-color: var(--line-gold); color: var(--saffron-dark); }
.icon-btn svg { width: 20px; height: 20px; }
.lang-switch { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); }
.lang-switch a { padding: 3px 10px; border-radius: 999px; font-size: 12.5px; color: var(--muted); }
.lang-switch a[aria-current="true"] { background: var(--brown); color: var(--white); }
.menu-toggle { display: none; }

.main-nav { border-top: 1px solid var(--line); }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; justify-content: space-between; gap: 4px; }
.main-nav a { display: block; padding: 11px 8px; font-size: 14px; color: #55493c; position: relative; white-space: nowrap; }
.main-nav a::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 6px; height: 2px; background: var(--gold); transform: scaleX(0); transition: transform .25s; transform-origin: left; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--saffron-dark); }
.main-nav a:hover::after, .main-nav a[aria-current="page"]::after { transform: scaleX(1); }

.search-panel { display: none; border-top: 1px solid var(--line); background: var(--white); }
.search-panel.is-open { display: block; }
.search-panel form { display: flex; gap: 10px; padding: 14px 0; }
.search-panel input { flex: 1; min-width: 0; padding: 11px 14px; border: 1px solid var(--line-gold); border-radius: 4px; font: inherit; background: var(--ivory); color: var(--text); }

/* ---------- hero ---------- */
.hero { padding: 56px 0 50px; }
.hero .wrap { display: grid; grid-template-columns: 1.02fr .98fr; gap: 48px; align-items: center; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: var(--saffron-dark); font-size: 13px; font-weight: 700; letter-spacing: .4px; }
.eyebrow::before { content: ""; width: 31px; height: 1px; background: var(--gold); }
.hero h1 { font-family: var(--font-display); font-size: clamp(32px, 4.1vw, 52px); line-height: 1.5; letter-spacing: -.5px; margin: 18px 0 14px; font-weight: 800; white-space: pre-line; }
.hero p { color: var(--muted); line-height: 2; font-size: 15.5px; max-width: 540px; }
.hero .actions { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.hero-art { position: relative; aspect-ratio: 1 / 1; max-height: 440px; width: 100%; border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; isolation: isolate;
  background: radial-gradient(ellipse at 50% 35%, #8d6334 0%, #4b3020 42%, #201812 100%); box-shadow: var(--shadow-lg); }
.hero-art::before, .hero-art::after { content: ""; position: absolute; border: 1px solid rgba(230, 194, 119, .32); border-radius: 50%; width: 78%; aspect-ratio: 1; z-index: -1; }
.hero-art::after { width: 98%; }
.hero-art .glow { position: absolute; width: 60%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(255, 233, 180, .55) 0, rgba(214, 162, 62, .25) 45%, transparent 70%); filter: blur(6px); z-index: -1; }
.hero-art img.hero-logo { width: 62%; border-radius: 50%; box-shadow: 0 0 60px rgba(214, 162, 62, .35); }
.hero-art img.hero-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.hero-art .corner { position: absolute; top: 20px; font: 600 11px var(--font-latin); letter-spacing: 2.5px; color: #d5b77d; }
.hero-art .corner.left { left: 22px; } .hero-art .corner.right { right: 22px; }

/* ---------- quick access ---------- */
.quick { background: var(--white); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.quick .wrap { display: grid; grid-template-columns: repeat(4, 1fr); padding-top: 20px; padding-bottom: 20px; }
.quick-item { display: flex; gap: 13px; align-items: center; padding: 8px 16px; border-right: 1px solid var(--line); transition: background .2s; border-radius: 4px; }
.quick-item:last-child { border-right: 0; }
.quick-item:hover { background: var(--ivory); }
.qicon { width: 44px; height: 44px; border-radius: 50%; background: #fbf4e5; color: var(--saffron-dark); display: grid; place-items: center; flex: none; border: 1px solid #f0e2c4; }
.qicon svg { width: 21px; height: 21px; }
.quick-item b { font-size: 14.5px; display: block; color: var(--brown-2); line-height: 1.5; }
.quick-item small { font-size: 12px; color: var(--muted); display: block; }

/* ---------- sections & cards ---------- */
.section { padding: 70px 0; }
.section-alt { background: var(--ivory-2); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 28px; }
.section-head h2 { font-family: var(--font-display); font-size: 27px; margin: 8px 0 0; color: var(--text); }
.section-head p { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.more-link { font-size: 14px; color: var(--saffron-dark); border-bottom: 1px solid #c9b88f; padding-bottom: 4px; white-space: nowrap; }

.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .25s, box-shadow .25s, border-color .25s; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-gold); }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { font-size: 16.5px; line-height: 1.7; margin: 4px 0 0; }
.card p { font-size: 14px; color: var(--muted); margin: 0; }
.card-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid #eee9df; display: flex; justify-content: space-between; color: var(--saffron-dark); font-size: 13px; }
.tag { align-self: flex-start; font-size: 12px; color: var(--saffron-dark); background: #faf3e4; padding: 3px 10px; border-radius: 3px; }
.pub-cover { aspect-ratio: 254 / 185; background: linear-gradient(135deg, #e0bb68, #9c642b); overflow: hidden; }
.pub-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.card:hover .pub-cover img { transform: scale(1.03); }
.pub-date { font: 500 12.5px var(--font-latin); color: var(--muted); }

.cat-card { padding: 22px; border: 1px solid var(--line); background: var(--white); border-radius: var(--radius); display: flex; justify-content: space-between; align-items: center; gap: 12px; transition: border-color .2s, box-shadow .2s; }
.cat-card:hover { border-color: var(--line-gold); box-shadow: var(--shadow); }
.cat-card b { display: block; font-size: 16px; line-height: 1.6; }
.cat-count { font: 700 22px var(--font-latin); color: var(--saffron); }

.prose { max-width: 760px; font-size: 17px; line-height: 2.05; }
.prose p { margin-bottom: 1.2em; }
.page-head { padding: 54px 0 34px; background: linear-gradient(180deg, var(--white), var(--ivory)); border-bottom: 1px solid var(--line); }
.page-head h1 { font-family: var(--font-display); font-size: clamp(28px, 3.6vw, 42px); margin: 10px 0 0; }

.notice { padding: 14px 18px; border-radius: var(--radius); border: 1px solid var(--line-gold); background: #fffaf0; color: var(--brown-2); font-size: 14px; }
.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--line-gold); border-radius: var(--radius); background: var(--white); }

/* ---------- error pages ---------- */
.error-page { text-align: center; padding: 90px 0; }
.error-page .code { font: 800 72px/1 var(--font-latin); color: var(--gold); }
.error-page h1 { font-family: var(--font-display); margin-top: 18px; }
.error-page p { color: var(--muted); }

/* ---------- footer ---------- */
.site-footer { background: var(--brown); color: var(--cream-text); margin-top: 0; }
.footer-main { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 36px; padding: 56px 0 34px; }
.footer-main > div { min-width: 0; }
.footer-main.no-cats { grid-template-columns: 1.6fr repeat(3, 1fr); }
.footer-main .footer-h { padding-bottom: 10px; border-bottom: 1px solid rgba(214, 162, 62, .28); }
.footer-social { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.footer-social a { font-size: 13px; color: #d8cbb8; border: 1px solid rgba(214, 162, 62, .45); border-radius: 999px; padding: 5px 14px; }
.footer-social a:hover { color: var(--brown); background: var(--gold-soft); }
.footer-contact li span { line-height: 1.6; }
.site-footer li a { overflow-wrap: anywhere; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand img { width: 64px; height: 64px; border-radius: 50%; }
.footer-brand strong { font-size: 22px; color: var(--gold-soft); display: block; line-height: 1.3; }
.footer-brand small { font: 600 10px var(--font-latin); letter-spacing: 2.4px; color: #cdb88f; }
.site-footer p { font-size: 14px; color: #d8cbb8; margin-top: 14px; max-width: 360px; }
.site-footer h4, .site-footer .footer-h { font-size: 15px; color: var(--gold-soft); margin: 6px 0 14px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li a, .site-footer li span { display: inline-block; font-size: 14px; color: #d8cbb8; padding: 4px 0; }
.site-footer li a:hover { color: var(--gold-soft); }
.copyright { border-top: 1px solid rgba(255, 255, 255, .14); }
.copyright .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 16px; padding-bottom: 22px; color: #bdb3a2; font-size: 12.5px; }
.copyright a { color: #d8cbb8; }

/* ---------- reveal animation (respects reduced motion) ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .card, .card:hover, .pub-cover img { transition: none; transform: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 1120px) {
  .menu-toggle { display: inline-grid; }
  .main-nav { position: fixed; inset: 0 0 0 auto; width: min(340px, 86vw); background: var(--white); border-left: 1px solid var(--line); transform: translateX(100%); transition: transform .3s ease; z-index: 60; overflow-y: auto; padding: 18px 0 30px; box-shadow: var(--shadow-lg); visibility: hidden; }
  .main-nav.is-open { transform: none; visibility: visible; }
  .main-nav .wrap { padding: 0; }
  .main-nav ul { flex-direction: column; gap: 0; }
  .main-nav a { padding: 13px 26px; font-size: 16px; border-bottom: 1px solid #f1eadc; }
  .main-nav a::after { display: none; }
  .main-nav a[aria-current="page"] { background: var(--ivory); border-left: 3px solid var(--gold); }
  .nav-drawer-head { display: flex !important; }
  .nav-backdrop { position: fixed; inset: 0; background: rgba(32, 24, 18, .45); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .3s; }
  .nav-backdrop.is-open { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
}
.nav-drawer-head { display: none; justify-content: space-between; align-items: center; padding: 0 18px 12px 26px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.nav-drawer-head b { font-size: 15px; color: var(--muted); }

@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 30px; }
  .hero-art { max-height: 360px; aspect-ratio: 4 / 3; }
  .quick .wrap { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .quick-item:nth-child(2) { border-right: 0; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-main { grid-template-columns: repeat(4, 1fr); }
  .footer-main.no-cats { grid-template-columns: repeat(3, 1fr); }
  .footer-main > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  :root { --header-h: 66px; }
  body { font-size: 15.5px; }
  .wrap { padding: 0 16px; }
  .topline .tagline { display: none; }
  .topline .wrap { justify-content: center; text-align: center; font-size: 12.5px; }
  .brand img { width: 46px; height: 46px; }
  .brand-text strong { font-size: 18px; }
  .brand-text small { font-size: 9px; letter-spacing: 1.8px; }
  .lang-switch { display: none; }
  .hero { padding: 32px 0 38px; }
  .hero h1 { font-size: 31px; }
  .hero .actions .btn { width: 100%; justify-content: center; }
  .quick .wrap { padding: 12px 10px; }
  .quick-item { padding: 8px 6px; border: 0; }
  .qicon { width: 38px; height: 38px; }
  .quick-item b { font-size: 13.5px; }
  .section { padding: 48px 0; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .section-head h2 { font-size: 23px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-4.covers { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .grid-4.covers .card-body { padding: 12px; }
  .grid-4.covers .card h3 { font-size: 14.5px; }
  .footer-main { grid-template-columns: 1fr 1fr; gap: 26px 20px; }
  .copyright .wrap { flex-direction: column; }
}
.mobile-lang { display: none; }
@media (max-width: 600px) { .mobile-lang { display: flex; gap: 8px; padding: 16px 26px; } .mobile-lang a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; } .mobile-lang a[aria-current="true"] { background: var(--brown); color: var(--white); border-color: var(--brown); } }

/* ==========================================================================
   Phase 3 components
   ========================================================================== */
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.narrow { max-width: 820px; }
.small-note { font-size: 13px; color: var(--muted); margin-top: 12px; }
.muted-note, .muted { color: var(--muted); }
.lead { color: var(--muted); font-size: 16px; max-width: 680px; margin: 10px 0 0; }
.sub-head { font-family: var(--font-display); font-size: 20px; margin: 0 0 16px; }
.meta-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.meta-line svg { width: 16px; height: 16px; color: var(--saffron); flex: none; }
.btn svg { width: 18px; height: 18px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* breadcrumbs */
.crumbs ol { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: 13px; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 4px; color: var(--line-gold); }
.crumbs a:hover { color: var(--saffron-dark); }
.crumbs [aria-current] { color: var(--text); max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }

/* hero slides */
.hero-slide { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity 1s ease; }
.hero-slide.is-active { opacity: 1; z-index: 0; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; }
.hero-slide figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 22px 18px; color: #f5e8c9; background: linear-gradient(transparent, rgba(32,24,18,.8)); font-size: 15px; }
.hero-art img.hero-photo { z-index: 0; }

/* small banner slider */
.banner-strip { padding: 26px 0 0; }
.banner-slider { position: relative; width: 100%; border-radius: var(--radius); overflow: hidden; aspect-ratio: 1920 / 665; background: var(--ivory-2); border: 1px solid var(--line-gold); box-shadow: var(--shadow); margin: 0 auto; }
.banner-slider.h-800 { aspect-ratio: 1920 / 800; }
.banner-slider.h-900 { aspect-ratio: 1920 / 900; }
.banner-slide { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity .9s ease; }
.banner-slide.is-active { opacity: 1; z-index: 1; }
.banner-slide img { width: 100%; height: 100%; object-fit: cover; }
.slider-dots { position: absolute; z-index: 2; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 16px; }
.slider-dots button { width: 9px; height: 9px; padding: 0; position: relative; border-radius: 50%; border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.35); cursor: pointer; }
.slider-dots button[aria-selected="true"] { background: var(--gold); border-color: var(--gold); width: 22px; border-radius: 9px; }

/* library cards (homepage section 05) */
.lib-card { display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .25s, box-shadow .25s, border-color .25s; }
.lib-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-gold); color: inherit; }
.lib-visual { height: 172px; position: relative; overflow: hidden; display: grid; place-items: center; background: linear-gradient(135deg, #c38a3c, #704522); }
.lib-visual::before { content: ""; position: absolute; width: 180px; height: 180px; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; }
.lib-visual img { width: 46%; height: auto; transform: rotate(-4deg) translateY(18px); box-shadow: 0 10px 26px rgba(0,0,0,.35); border-radius: 2px; }
.lib-visual-icon svg { width: 64px; height: 64px; color: #fff4d6; stroke-width: 1.2; position: relative; }
.lib-card:nth-child(2) .lib-visual { background: linear-gradient(135deg, #e0bb68, #9c642b); }
.lib-card:nth-child(3) .lib-visual { background: linear-gradient(135deg, #c58b4a, #75432a); }
.lib-body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 6px; }
.lib-body b { font-size: 17px; line-height: 1.6; }
.lib-body small { color: var(--muted); font-size: 13.5px; }
.lib-split { display: grid; grid-template-columns: 1fr; gap: 34px; margin-top: 46px; }
.lib-split:has(.lib-aside) { grid-template-columns: 1fr 300px; }
.lib-aside { border-left: 1px solid var(--line); padding-left: 26px; }
.rank-list { list-style: none; margin: 0 0 26px; padding: 0; counter-reset: r; }
.rank-list li { border-bottom: 1px solid #efe7d8; }
.rank-list a { display: block; padding: 11px 0 11px 40px; position: relative; }
.rank-list:not(.plain) a::before { counter-increment: r; content: counter(r); position: absolute; left: 0; top: 10px; font: 700 20px var(--font-latin); color: var(--gold); }
.rank-list.plain a { padding-left: 0; }
.rank-list b { display: block; font-size: 15px; line-height: 1.6; font-weight: 600; }
.rank-list small { font-size: 12.5px; color: var(--muted); }

/* covers: page-1 covers are portrait (A4); legacy images landscape */
.covers .pub-cover { aspect-ratio: 3 / 4; background: #efe6d4; display: grid; place-items: center; }
.pub-cover img { object-position: top center; }
.pub-cover img.legacy-cover { object-fit: contain; object-position: center; background: #f7f1e4; }
.cover-fallback { font: 700 48px var(--font-display); color: #fff4d6; }
.pdf-badge { font: 700 11.5px var(--font-latin); letter-spacing: 1px; color: var(--saffron-dark); border: 1px solid var(--line-gold); border-radius: 3px; padding: 1px 6px; }
.pub-card h3 { font-size: 15.5px; }

/* tabs (homepage section 06) */
.tab-list { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.tab-list [role="tab"] { font: inherit; font-size: 14.5px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line-gold); background: var(--white); color: var(--brown-2); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.tab-list [role="tab"][aria-selected="true"] { background: var(--brown); color: var(--white); border-color: var(--brown); }
.tab-list .count { font-size: 12px; opacity: .75; }
.panel-more { margin: 24px 0 0; text-align: center; }

/* feature band (section 08) */
.feature { background: var(--ivory-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.feature-in { display: grid; grid-template-columns: .85fr 1.15fr; gap: 56px; align-items: center; padding-top: 62px; padding-bottom: 62px; }
.feature-visual { height: 300px; border-radius: var(--radius); background: linear-gradient(145deg, #efdba8, #b77a35); display: grid; place-items: center; position: relative; overflow: hidden; }
.feature-visual::before { content: ""; position: absolute; width: 240px; height: 240px; border: 1px solid rgba(255,255,255,.55); border-radius: 50%; }
.feature-visual > img { width: 100%; height: 100%; object-fit: cover; }
.feature-logo { width: 55% !important; height: auto !important; border-radius: 50%; }
.feature-stack { position: relative; width: 70%; height: 82%; }
.feature-stack > span { position: absolute; width: 46%; top: 8%; box-shadow: 0 14px 30px rgba(56,41,31,.35); background: #fff; }
.feature-stack img { width: 100%; height: auto; display: block; }
.feature-stack .stack-0 { left: 27%; top: 2%; z-index: 3; }
.feature-stack .stack-1 { left: 4%; transform: rotate(-8deg); z-index: 2; }
.feature-stack .stack-2 { right: 4%; transform: rotate(8deg); z-index: 1; }
.feature-text h2 { font-family: var(--font-display); font-size: clamp(24px, 2.8vw, 32px); line-height: 1.7; white-space: pre-line; margin: 12px 0; }
.feature-text p { color: var(--muted); line-height: 2.05; }

/* events */
.event-img, .card-img { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--ivory-2); }
.event-img img, .card-img img { width: 100%; height: 100%; object-fit: cover; }
.date-chip { align-self: flex-start; font-size: 12.5px; color: var(--saffron-dark); background: #faf3e4; border-radius: 3px; padding: 3px 9px; }
.date-chip b { font: 700 15px var(--font-latin); margin-right: 6px; }
.event-list { display: flex; flex-direction: column; gap: 14px; }
.event-row { display: grid; grid-template-columns: 96px 1fr 180px; gap: 20px; align-items: center; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.event-row img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 4px; }
.event-row:not(:has(img)) { grid-template-columns: 96px 1fr; }
.date-block { display: flex; flex-direction: column; align-items: center; border-right: 1px solid var(--line); padding-right: 14px; text-align: center; font-size: 12.5px; color: var(--muted); }
.date-block b { font-size: 34px; color: var(--saffron-dark); line-height: 1.1; }
.event-row h3 { font-size: 17px; margin: 0 0 4px; }

/* Poya */
.moon { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff7dc, #f0c96a 60%, #c58a36); box-shadow: 0 0 10px rgba(214,162,62,.6); flex: none; }
.moon.big { width: 54px; height: 54px; }
.poya-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
.poya-strip a { display: flex; flex-direction: column; gap: 6px; padding: 16px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); height: 100%; transition: border-color .2s, box-shadow .2s; }
.poya-strip a:hover { border-color: var(--line-gold); box-shadow: var(--shadow); }
.poya-strip time { font-size: 12.5px; color: var(--muted); }
.poya-strip time b { font-size: 26px; color: var(--saffron); display: block; line-height: 1.1; }
.poya-strip strong { font-size: 14.5px; line-height: 1.5; }
.poya-layout { display: grid; grid-template-columns: 420px 1fr; gap: 40px; align-items: start; }
.calendar { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: var(--shadow); position: sticky; top: calc(var(--header-h) + 60px); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head h2 { font-size: 18px; margin: 0; }
.cal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal-grid th { font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 6px 0; }
.cal-grid td { text-align: center; padding: 2px; height: 46px; font-size: 14px; }
.cal-grid td > span, .cal-grid td > a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 42px; border-radius: 6px; }
.cal-grid td.is-today > span, .cal-grid td.is-today > a { outline: 1px solid var(--line-gold); }
.cal-grid td.is-poya a { background: #fbf2de; color: var(--brown); font-weight: 700; }
.cal-grid td.is-poya a[aria-current="true"], .cal-grid td.is-poya a:hover { background: var(--brown); color: var(--white); }
.cal-grid .moon { width: 9px; height: 9px; }
.calendar .year-filter { margin-top: 12px; }
.poya-card { background: var(--white); border: 1px solid var(--line-gold); border-top: 3px solid var(--gold); border-radius: 8px; padding: 26px; margin-bottom: 30px; }
.poya-card time { display: block; margin-top: 12px; color: var(--saffron-dark); font-size: 14px; }
.poya-card h2 { font-family: var(--font-display); font-size: 26px; margin: 4px 0 12px; }
.poya-year { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 24px; }
.poya-year li { break-inside: avoid; border-bottom: 1px solid #efe7d8; }
.poya-year a { display: flex; flex-direction: column; padding: 9px 0; }
.poya-year time { font-size: 12.5px; color: var(--muted); }
.poya-year b { font-size: 14.5px; font-weight: 600; }
.poya-year li.past b { color: var(--muted); }

/* temples / cards */
.temple-card { display: flex; flex-direction: column; gap: 6px; padding: 20px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.temple-card small { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.temple-card svg { width: 15px; height: 15px; color: var(--saffron); }

/* about band (12) */
.about-band { background: var(--white); }
.about-in, .about-page { display: grid; grid-template-columns: 1.1fr .9fr; gap: 54px; align-items: start; }
.about-in h2 { font-family: var(--font-display); font-size: 27px; margin: 10px 0 14px; }
.about-excerpt { color: var(--muted); line-height: 2; margin-bottom: 18px; }
.about-cards { display: flex; flex-direction: column; gap: 18px; }
.quote-card { margin: 0; padding: 26px 26px 22px; background: var(--ivory); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: var(--radius); position: relative; }
.quote-card .mark { position: absolute; top: 4px; right: 18px; font: 60px Georgia, serif; color: #e2cb97; line-height: 1; }
.quote-card blockquote { margin: 0; font-size: 17px; line-height: 2; color: #4b4030; }
.quote-card figcaption { margin-top: 10px; font-size: 13px; color: var(--saffron-dark); font-weight: 600; }
.services-mini { padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius); }
.services-mini h3 { font-size: 16px; }
.services-mini ul { margin: 0 0 10px; padding-left: 18px; color: var(--muted); }
.about-logo { width: 180px; height: auto; border-radius: 50%; margin: 10px auto; box-shadow: var(--shadow); }

/* newsletter (13) */
.newsletter { background: linear-gradient(135deg, #4b3020, var(--brown)); color: var(--cream-text); }
.newsletter-in { display: grid; grid-template-columns: 1fr 1.1fr; gap: 40px; align-items: center; padding-top: 52px; padding-bottom: 52px; }
.newsletter h2 { color: var(--gold-soft); font-family: var(--font-display); font-size: 26px; margin: 8px 0; }
.newsletter p { color: #d8cbb8; margin: 0; }
.newsletter .eyebrow { color: var(--gold-soft); }
.nl-fields { display: flex; gap: 10px; flex-wrap: wrap; }
.nl-fields input { flex: 1 1 180px; min-width: 0; padding: 12px 14px; border-radius: 4px; border: 1px solid rgba(232,195,111,.4); background: rgba(255,255,255,.08); color: var(--white); font: inherit; }
.nl-fields input::placeholder { color: #cdbda6; }
.nl-form small { display: block; margin-top: 10px; color: #bdb3a2; font-size: 12.5px; }
.nl-form small a { color: var(--gold-soft); text-decoration: underline; }
.form-msg { padding: 10px 14px; border-radius: 4px; font-size: 14px; margin: 0 0 12px; }
.form-msg-success { background: #fbf4e5; color: #5f4410; border: 1px solid #e3cd99; }
.form-msg-info { background: #fffaf0; color: var(--brown-2); border: 1px solid var(--line-gold); }
.form-msg-error { background: #fbeeea; color: #7a2e17; border: 1px solid #e3b8a8; }

/* filters / chips / pagination */
.filters { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.filters .chips { margin-bottom: 0; }
.chips a { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-gold); background: var(--white); font-size: 14px; color: var(--brown-2); }
.chips a span { font-size: 12px; color: var(--muted); }
.chips a[aria-current="page"] { background: var(--brown); border-color: var(--brown); color: var(--white); }
.chips a[aria-current="page"] span { color: #e3d6c2; }
.year-filter { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.year-filter select { padding: 8px 12px; border: 1px solid var(--line-gold); border-radius: 4px; background: var(--white); font: inherit; color: var(--text); }
.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 40px; font-family: var(--font-latin); }
.pagination a, .pagination span { min-width: 40px; padding: 8px 12px; text-align: center; border-radius: 4px; border: 1px solid var(--line); background: var(--white); font-size: 14px; }
.pagination [aria-current] { background: var(--brown); color: var(--white); border-color: var(--brown); }
.pagination .gap { border: 0; background: none; }

/* category tiles (library) */
.cat-tile { display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: box-shadow .25s, border-color .25s; }
.cat-tile:hover { box-shadow: var(--shadow); border-color: var(--line-gold); color: inherit; }
.cat-tile-img { aspect-ratio: 4 / 3; overflow: hidden; background: linear-gradient(135deg, #e0bb68, #9c642b); display: grid; place-items: end center; padding-top: 18px; }
.cat-tile-img img { width: 62%; box-shadow: 0 8px 20px rgba(0,0,0,.3); }
.cat-tile-body { padding: 16px 18px 18px; }
.cat-tile-body b { display: block; font-size: 16px; line-height: 1.6; }
.cat-tile-body small { color: var(--muted); font-size: 13px; }
.lib-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; }

/* publication detail */
.pub-detail { display: grid; grid-template-columns: 380px 1fr; gap: 48px; align-items: start; }
.pub-detail-cover img { width: 100%; height: auto; border-radius: 3px; box-shadow: 0 18px 40px rgba(56,41,31,.22); background: var(--white); }
.pub-detail-cover a { display: block; transition: transform .25s; }
.pub-detail-cover a:hover { transform: translateY(-3px); }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 22px; padding: 16px 18px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.meta-grid dt { font-size: 12px; color: var(--muted); }
.meta-grid dd { margin: 0; font-weight: 600; font-size: 15px; }
.pub-headline { font-family: var(--font-display); font-size: 21px; line-height: 1.7; color: var(--brown-2); }
.pub-detail .actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 10px; }
.prev-next { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); }
.prev-next a { display: flex; flex-direction: column; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.prev-next a.next { text-align: right; grid-column: 2; }
.prev-next small { color: var(--saffron-dark); font-size: 12.5px; }
.prev-next b { font-size: 14.5px; font-weight: 600; line-height: 1.6; }

/* articles / media */
.article-meta { color: var(--muted); font-size: 14px; }
.article-hero { margin: 0 0 26px; }
.article-hero img { width: 100%; border-radius: var(--radius); }
.prose h2 { font-family: var(--font-display); font-size: 22px; margin-top: 1.6em; }
.prose h3 { font-size: 18px; margin-top: 1.4em; }
.prose blockquote { margin: 1.2em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--gold); color: var(--brown-2); }
.prose img { border-radius: 4px; margin: 1em 0; }
.prose a { color: var(--saffron-dark); text-decoration: underline; }
.prose.small { font-size: 14.5px; line-height: 1.9; }
.media-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #5a3a24, #2b1f17); overflow: hidden; }
.media-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .9; }
.media-thumb .play { position: relative; width: 58px; height: 58px; border-radius: 50%; background: rgba(255,255,255,.9); display: grid; place-items: center; color: var(--brown); box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.media-thumb .play svg { width: 30px; height: 30px; }
.player-box { margin-bottom: 20px; }
.player-box audio { width: 100%; }
.audio-art { width: 220px; border-radius: var(--radius); margin: 0 auto 16px; }
.video-frame { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); background: #000; display: block; }
.video-frame iframe { width: 100%; height: 100%; border: 0; border-radius: var(--radius); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 24px 0; }
.gallery figure { margin: 0; }
.gallery img { border-radius: 4px; aspect-ratio: 4/3; object-fit: cover; width: 100%; }

/* contact + forms */
.contact-layout { display: grid; grid-template-columns: .8fr 1.2fr; gap: 44px; align-items: start; }
.info-list { list-style: none; margin: 0 0 20px; padding: 0; }
.info-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.info-list svg { width: 22px; height: 22px; color: var(--saffron); flex: none; margin-top: 3px; }
.card-form { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 26px; box-shadow: var(--shadow); }
.form label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 6px; color: var(--brown-2); }
.form input, .form select, .form textarea { width: 100%; padding: 11px 13px; font: inherit; color: var(--text); border: 1px solid #dccfb6; border-radius: 4px; background: #fffdf8; }
.form input:focus, .form textarea:focus { border-color: var(--saffron); outline: 2px solid rgba(214,162,62,.25); outline-offset: 0; }
.form button[type="submit"] { margin-top: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* search */
.search-big { display: flex; gap: 10px; margin-bottom: 26px; }
.search-big input { flex: 1; min-width: 0; padding: 14px 16px; font: inherit; font-size: 17px; border: 1px solid var(--line-gold); border-radius: 4px; background: var(--white); }
.result-count { color: var(--muted); }
.result-group { margin: 30px 0; }

.empty-mark img { border-radius: 50%; margin: 0 auto 10px; opacity: .85; }
.empty p { margin-bottom: 14px; }

@media (max-width: 1000px) {
  .lib-split:has(.lib-aside) { grid-template-columns: 1fr; }
  .lib-aside { border-left: 0; padding-left: 0; }
  .poya-layout { grid-template-columns: 1fr; }
  .calendar { position: static; }
  .pub-detail { grid-template-columns: 300px 1fr; gap: 30px; }
  .about-in, .about-page, .contact-layout, .newsletter-in, .feature-in { grid-template-columns: 1fr; gap: 30px; }
  .event-row { grid-template-columns: 80px 1fr; }
  .event-row img { display: none; }
}
@media (max-width: 700px) {
  .pub-detail { grid-template-columns: 1fr; }
  .pub-detail-cover { max-width: 300px; margin: 0 auto; }
  .lib-columns, .form-row { grid-template-columns: 1fr; }
  .poya-year { columns: 1; }
  .prev-next { grid-template-columns: 1fr; }
  .prev-next a.next { grid-column: 1; }
  .banner-strip { padding-top: 16px; }
  .feature-visual { height: 240px; }
  .search-big { flex-direction: column; }
  .crumbs [aria-current] { max-width: 24ch; }
}
.icon-btn.is-disabled { opacity: .3; pointer-events: none; }
.section-alt, .feature { --muted: #6c6156; }  /* keeps muted text at 5:1 on the beige sections */
.site-footer .copyright a, .prose a { text-decoration: underline; text-underline-offset: 3px; }
.slider-dots button::before { content: ""; position: absolute; inset: -8px; }  /* 25px touch target */

/* Home: publications shown category by category (like the old site), latest 4 each */
.cat-row { margin-top: 34px; }
.cat-row:first-of-type { margin-top: 8px; }
.cat-row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 10px; margin-bottom: 18px; border-bottom: 1px solid var(--line-gold); }
.cat-row-head h3 { margin: 0; font-size: 20px; line-height: 1.45; }
.cat-row-head h3 a { color: var(--brown); }
.cat-row-head h3 a:hover { color: var(--saffron-dark); }
.cat-row-head .count { font-size: 12.5px; font-weight: 600; color: var(--saffron-dark); background: var(--ivory); border: 1px solid var(--line-gold); border-radius: 999px; padding: 1px 9px; vertical-align: middle; }
.cat-row-head .more-link { white-space: nowrap; font-size: 14px; }
/* category rows: cards the same size as the "latest publications" cards (6 across on a wide screen) */
.cat-row .grid-4.covers { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.cat-row .grid-4.covers .card-body { padding: 14px; }
.cat-row .grid-4.covers .card h3 { font-size: 16px; }
@media (min-width: 901px) and (max-width: 1120px) { .cat-row .grid-4.covers { grid-template-columns: repeat(4, minmax(0, 1fr)); } .cat-row .grid-4.covers > :nth-child(n+5) { display: none; } }
@media (min-width: 601px) and (max-width: 900px) { .cat-row .grid-4.covers { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cat-row .grid-4.covers > :nth-child(n+4) { display: none; } }
@media (max-width: 600px) {
  .cat-row-head h3 { font-size: 17px; }
  /* swipe sideways through the latest issues instead of a long stack */
  .cat-row .grid-4.covers { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; padding-bottom: 8px; margin-right: -20px; padding-right: 20px; }
  .cat-row .grid-4.covers > * { flex: 0 0 44%; scroll-snap-align: start; }
}
/* Cards inside a category row: the row itself fades in; cards stay visible even when swiped in sideways */
.js .cat-row .pub-card.reveal { opacity: 1; transform: none; }

/* ---------- Download choice (normal / ධර්මදානය පිණිස) ---------- */
.dl-choice { position: relative; display: inline-block; }
.dl-choice > summary { list-style: none; cursor: pointer; }
.dl-choice > summary::-webkit-details-marker { display: none; }
.dl-menu { position: absolute; z-index: 20; top: calc(100% + 8px); left: 0; min-width: 300px; background: #fff; border: 1px solid var(--line, #e8dcc4); border-radius: 10px; box-shadow: 0 14px 40px rgba(56, 41, 31, .14); padding: 6px; }
.dl-menu a { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; color: var(--brown, #38291F); text-decoration: none; }
.dl-menu a:hover, .dl-menu a:focus-visible { background: var(--ivory, #F8F4EB); }
.dl-menu a svg, .dl-lotus { flex: 0 0 22px; width: 22px; height: 22px; margin-top: 2px; color: var(--saffron-dark, #8a5520); font-size: 19px; line-height: 22px; text-align: center; }
.dl-menu b { display: block; font-weight: 700; }
.dl-menu small { display: block; color: var(--muted, #766B60); font-size: .86rem; line-height: 1.5; margin-top: 2px; }
@media (max-width: 600px) { .dl-menu { position: static; margin-top: 8px; min-width: 0; box-shadow: none; } .dl-choice { display: block; } }

/* ---------- Dhamma dāna page ---------- */
.dana-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 40px; align-items: start; }
.dana-form .field { margin-bottom: 16px; }
.dana-form label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--brown, #38291F); }
.dana-form input:not([type=radio]), .dana-form textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--line, #e3d3b4); border-radius: 8px; background: #fffdf8; font: inherit; color: inherit; }
.dana-form input:focus, .dana-form textarea:focus { outline: 2px solid var(--gold, #D6A23E); outline-offset: 1px; border-color: var(--gold, #D6A23E); }
.dana-form .req { color: #9b2c1c; }
.lead-sm { color: var(--muted, #766B60); line-height: 1.7; margin: 0 0 18px; }
.dana-langs { border: 0; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dana-langs legend { font-weight: 600; margin-bottom: 8px; float: left; width: 100%; }
.chip-radio { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--line, #e3d3b4); border-radius: 999px; cursor: pointer; background: #fff; }
.chip-radio:has(input:checked) { background: var(--brown, #38291F); color: #fff; border-color: var(--brown, #38291F); }
.chip-radio input { accent-color: var(--saffron, #C58A36); }
.dana-phrases { margin: 4px 0 20px; }
.phrase-list { display: flex; flex-wrap: wrap; gap: 8px; }
.phrase { border: 1px solid #e3cd99; background: #fbf4e5; color: #5a3e12; border-radius: 999px; padding: 7px 14px; font: inherit; font-size: .92rem; cursor: pointer; text-align: left; }
.phrase:hover, .phrase:focus-visible { background: #f5e6c4; border-color: var(--gold, #D6A23E); }
.dana-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.dana-actions .btn[disabled] { opacity: .6; cursor: progress; }
.dana-status { min-height: 1.6em; margin: 12px 0 4px; font-weight: 600; }
.dana-status.is-ok { color: #6a4a12; }
.dana-status.is-error { color: #9b2c1c; }
.dana-preview { position: sticky; top: 140px; }
.dana-preview canvas { width: 100%; height: auto; display: block; border-radius: 6px; background: transparent; }
@media (max-width: 900px) { .dana-grid { grid-template-columns: 1fr; gap: 24px; } .dana-preview { position: static; order: -1; width: 100%; } }
.dana-preview { background: #fff; border: 1px solid var(--line, #e3d3b4); border-radius: 10px; padding: 16px; box-shadow: 0 18px 50px rgba(56, 41, 31, .10); }
.dana-place-label { margin: 16px 0 8px; }
.dana-place { display: flex; justify-content: center; }
.dana-place-page { position: relative; width: 110px; height: 150px; background: #fff; border: 1px solid #d9ccb3; box-shadow: 0 4px 14px rgba(56, 41, 31, .12); }
.dana-place-lines { position: absolute; left: 12px; right: 12px; top: 12px; height: 92px; background: repeating-linear-gradient(#e9e1d2 0 3px, transparent 3px 9px); }
.dana-place-box { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 34px; border: 1.5px solid var(--saffron, #C58A36); background: #fbf4e5; border-radius: 3px; }
.dana-place-page b { position: absolute; right: -26px; top: 0; font: 700 13px var(--font-latin, sans-serif); color: var(--muted, #766B60); }
.dana-singlish { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; margin: 0 0 6px; }
.dana-singlish input { width: auto !important; }
.dana-singlish[hidden], .dana-after[hidden] { display: none !important; }
.dana-after { margin-top: 10px; padding: 14px 16px; border: 1px solid #e3cd99; background: #fbf4e5; border-radius: 10px; }
.dana-after .small-note { margin: 10px 0 0; }
.section.dana { padding-bottom: 72px; }
.subject-other { margin-top: 8px; }
/* Sinhala typing tool (assets/js/sinhala-input.js) */
.si-input { border: 1px solid #e3cd99; background: #fdf8ec; border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; }
.si-input-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.si-input-label { font-weight: 600; font-size: .9rem; color: #38291F; }
.si-input-modes { display: inline-flex; border: 1px solid #d9c49a; border-radius: 999px; overflow: hidden; background: #fff; }
.si-input-modes button { border: 0; background: transparent; padding: 6px 12px; font: inherit; font-size: .88rem; color: #38291F; cursor: pointer; }
.si-input-modes button[aria-checked="true"] { background: #38291F; color: #fff; }
.si-input-kbtn { border: 1px solid #d9c49a; background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .88rem; color: #38291F; cursor: pointer; }
.si-input-kbtn[aria-expanded="true"] { background: #C58A36; border-color: #C58A36; color: #fff; }
.si-input-help { margin: 8px 0 0; font-size: .82rem; color: #6b5f54; line-height: 1.5; }
.si-kb { margin-top: 10px; display: grid; gap: 5px; }
.si-kb[hidden] { display: none; }
.si-kb-row { display: flex; flex-wrap: wrap; gap: 4px; }
.si-kb-row button { min-width: 36px; height: 38px; padding: 0 6px; border: 1px solid #e0d2b4; background: #fff; border-radius: 6px; font-family: "Noto Sans Sinhala", sans-serif; font-size: 1.1rem; color: #332820; cursor: pointer; }
.si-kb-row button:hover, .si-kb-row button:focus-visible { border-color: #C58A36; background: #fbf1dc; }
.si-kb-tools button { font-size: .85rem; padding: 0 12px; }
.font-pick { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.font-pick label { font-weight: 600; }
.font-pick select { width: auto; padding: 7px 12px; border: 1px solid #d9c49a; border-radius: 8px; background: #fff; font: inherit; font-size: .92rem; color: #332820; }
/* fonts chosen in the article editor */
.f-serif { font-family: "Noto Serif Sinhala", "Noto Sans Tamil", serif; }
.f-sans { font-family: "Noto Sans Sinhala", "Noto Sans Tamil", "DM Sans", sans-serif; }
/* per-field Sinhala switch (අ / A) */
.si-fchip { position: absolute; z-index: 3; width: 30px; height: 30px; border-radius: 50%; border: 1px solid #d9c49a; background: #fff; color: #38291F; font: 600 .95rem/1 "Noto Sans Sinhala", sans-serif; cursor: pointer; display: grid; place-items: center; padding: 0; box-shadow: 0 1px 2px rgba(56,41,31,.12); }
.si-fchip.is-on { background: #C58A36; border-color: #C58A36; color: #fff; }
.si-fchip:focus-visible { outline: 2px solid #38291F; outline-offset: 2px; }
input.si-has-chip, textarea.si-has-chip { padding-right: 46px !important; }
.si-input.kb-open { position: sticky; top: 70px; z-index: 8; box-shadow: 0 6px 18px rgba(56,41,31,.12); }
.article-pdf { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 0; }

/* ---------------------------------------------------------------- share + QR */
.page-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-head-row h1 { min-width: 0; }
.share-btn { flex: none; display: inline-flex; align-items: center; gap: 7px; margin-top: 6px; padding: 8px 16px; border: 1px solid var(--gold); border-radius: 999px; background: var(--white); color: var(--brown); font: 600 14px var(--font-si, inherit); cursor: pointer; }
.share-btn svg { width: 17px; height: 17px; }
.share-btn:hover { background: var(--brown); color: var(--white); border-color: var(--brown); }
.share-dlg { border: 0; padding: 0; border-radius: 18px; max-width: min(440px, 94vw); width: 100%; box-shadow: 0 24px 70px rgba(56, 41, 31, .35); background: var(--ivory, #F8F4EB); color: var(--brown); }
.share-dlg::backdrop { background: rgba(30, 22, 16, .62); }
.share-box { position: relative; padding: 26px 24px 22px; text-align: center; }
.share-box h2 { font-size: 20px; margin: 0 0 4px; }
.share-name { font-size: 14px; color: var(--muted); margin: 0 26px 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.share-x { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border: 0; background: transparent; font-size: 28px; line-height: 1; color: var(--brown); cursor: pointer; border-radius: 50%; }
.share-x:hover { background: rgba(197, 138, 54, .15); }
.share-qr { width: min(260px, 70vw); margin: 0 auto; padding: 10px; background: #FFF; border: 1px solid rgba(197, 138, 54, .5); border-radius: 14px; }
.share-qr canvas { width: 100%; height: auto; display: block; }
.share-hint { font-size: 13px; color: var(--muted); margin: 10px 0 14px; }
.share-link { display: flex; gap: 8px; }
.share-link input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line, #e5dccb); border-radius: 10px; font: 13px var(--font-latin, sans-serif); background: #FFF; color: var(--brown); }
.share-link .btn { padding: 9px 14px; font-size: 14px; }
.share-apps { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px 0; }
.share-apps a, .share-apps button { padding: 7px 14px; border: 1px solid rgba(197, 138, 54, .55); border-radius: 999px; font-size: 13px; color: var(--brown); background: #FFF; text-decoration: none; cursor: pointer; }
.share-apps a:hover, .share-apps button:hover { background: var(--gold-soft, #D6A23E); }
.share-dl { width: 100%; justify-content: center; }
.footer-qr { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 8px 14px 8px 8px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(214, 162, 62, .4); border-radius: 12px; color: #d8cbb8; text-align: left; cursor: pointer; }
.footer-qr canvas { width: 82px; height: 82px; border-radius: 6px; background: #FFF; }
.footer-qr b { display: block; color: var(--gold-soft); font-size: 14px; }
.footer-qr small { font-size: 12px; }
.footer-qr:hover { border-color: var(--gold-soft); }
@media (max-width: 600px) { .page-head-row { flex-direction: column; gap: 10px; } .share-btn { margin-top: 0; } }
.nl-channels { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; color: #e8dcc8; font-size: 14px; }
.nl-channels label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.nl-channels input { width: 17px; height: 17px; accent-color: var(--gold-soft, #D6A23E); }
