:root {
  --ink: #17324d;
  --ink-2: #284f6d;
  --charcoal: #26323a;
  --slate: #67757f;
  --ivory: #f7f1e7;
  --paper: #fffdf9;
  --line: #d8ddd9;
  --pale-blue: #dceaf0;
  --dusty-blue: #c9dde6;
  --teal: #4f766f;
  --teal-pale: #dfe9e3;
  --sage: #dfe6d5;
  --terracotta: #b66d48;
  --terracotta-pale: #f1ded2;
  --gold: #c49a52;
  --gold-pale: #efe3c5;
  --max: 1240px;
  --content: 900px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --shadow-soft: 0 10px 28px rgba(23,50,77,.07);
  --shadow-hover: 0 16px 36px rgba(23,50,77,.11);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
/* Keyboard access: the first Tab reveals a direct route past the header. */
.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 1000;
  transform: translateY(-200%); padding: 12px 18px;
  max-width: calc(100% - 24px); background: var(--ink); color: white;
  font-weight: 700; border-radius: 3px;
}
.skip-link:focus { transform: translateY(0); }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--ink); outline-offset: 4px;
  box-shadow: 0 0 0 4px var(--paper);
}
#main-content { scroll-margin-top: 110px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
body {
  margin: 0;
  color: var(--charcoal);
  background: var(--ivory);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}
a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }
.container { width: min(calc(100% - 40px), var(--max)); margin-inline: auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(250,246,239,.97);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #d6d9d6;
  box-shadow: 0 2px 12px rgba(23,50,77,.04);
}
.header-inner { min-height: 92px; display: flex; align-items: center; gap: 30px; justify-content: space-between; }
.brand { display: inline-flex; flex-direction: column; min-width: 270px; }
.brand:hover { text-decoration: none; }
.brand-name, h1, h2, h3, .footer-name {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
}
.brand-name { font-size: 1.62rem; font-weight: 700; line-height: 1.1; }
.brand-subtitle { margin-top: 5px; font-size: .72rem; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-2); }
.site-nav { display: flex; align-items: center; gap: 14px; font-size: .93rem; }
.site-nav a { color: #172b3a; white-space: nowrap; }
.site-nav a.active { padding-bottom: 8px; border-bottom: 2px solid var(--terracotta); }
.menu-toggle { display: none; border: 0; background: transparent; padding: 8px; min-width: 44px; min-height: 44px; }
.menu-toggle span { display: block; width: 25px; height: 2px; background: var(--ink); margin: 5px 0; }

.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(110deg, #faf6ef 0%, #f4ecdf 56%, #e9efe9 100%);
  border-bottom: 1px solid var(--line);
}
.hero::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 7px;
  background: linear-gradient(var(--terracotta), var(--gold), var(--teal));
}
.hero-grid {
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(420px, .94fr);
  gap: 54px;
  align-items: stretch;
  position: relative;
}
.hero-copy { max-width: 720px; padding: 84px 0 76px; display: flex; flex-direction: column; justify-content: center; }
.eyebrow { margin: 0 0 10px; color: var(--terracotta); text-transform: uppercase; letter-spacing: .13em; font-weight: 800; font-size: .78rem; }
.hero h1 { font-size: clamp(3rem, 5.4vw, 5.25rem); line-height: .98; margin: 0 0 30px; letter-spacing: -.025em; font-weight: 700; }
.hero-lead { font-size: 1.25rem; max-width: 670px; color: #304452; }
.hero-copy > p:not(.eyebrow) { max-width: 680px; }
.primary-link { display: inline-block; width: fit-content; margin-top: 18px; background: var(--ink); color: white; padding: 14px 22px; border-radius: 2px; font-weight: 700; box-shadow: 0 6px 16px rgba(23,50,77,.12); }
.primary-link:hover { background: var(--terracotta); text-decoration: none; }

.hero-visual {
  position: relative;
  overflow: hidden;
  min-height: 560px;
  border-left: 1px solid rgba(23,50,77,.14);
  background:
    linear-gradient(180deg, rgba(250,248,242,.06), rgba(23,50,77,.08)),
    linear-gradient(135deg, #e7eee7 0%, #d7e4e2 54%, #c9d7d8 100%);
}
.window-glow {
  position: absolute;
  inset: 0 0 auto auto;
  width: 78%;
  height: 68%;
  background:
    linear-gradient(90deg, rgba(255,255,255,.78), rgba(255,255,255,.15)),
    linear-gradient(180deg, rgba(255,255,255,.7), transparent);
  clip-path: polygon(20% 0, 100% 0, 100% 100%, 0 100%);
  opacity: .78;
}
.hero-visual::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 108px;
  background: linear-gradient(180deg, #b8946c, #9e7955);
  box-shadow: inset 0 5px 12px rgba(84,55,34,.12);
}
.book-stack {
  position: absolute;
  right: 42px;
  bottom: 70px;
  width: 330px;
  z-index: 4;
  filter: drop-shadow(0 16px 18px rgba(23,50,77,.24));
}
.book {
  height: 52px;
  margin-top: 3px;
  border-radius: 4px 7px 7px 4px;
  display: flex;
  align-items: center;
  padding-left: 48px;
  color: #e7c27a;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: .045em;
  font-size: .86rem;
  border-left: 10px solid rgba(255,255,255,.08);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05), inset -8px 0 0 rgba(0,0,0,.08);
  position: relative;
}
.book::before {
  content: "";
  position: absolute;
  left: 24px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: rgba(231,194,122,.65);
}
.book-1 { background: #17324d; transform: rotate(1.2deg); width: 94%; margin-left: 12px; }
.book-2 { background: #244760; transform: rotate(-.5deg); width: 100%; }
.book-3 { background: #203a4e; transform: rotate(.7deg); width: 96%; margin-left: 8px; }
.book-4 { background: #314d58; transform: rotate(-1deg); width: 92%; margin-left: 18px; }
.plant {
  position: absolute;
  right: 298px;
  bottom: 112px;
  width: 130px;
  height: 210px;
  z-index: 2;
}
.plant i {
  position: absolute;
  left: 58px;
  top: 65px;
  bottom: 0;
  width: 5px;
  background: #53715a;
  transform: rotate(7deg);
  border-radius: 5px;
}
.plant span {
  position: absolute;
  width: 64px;
  height: 34px;
  background: #6f8b67;
  border-radius: 100% 0 100% 0;
  transform-origin: bottom right;
  box-shadow: inset 0 -5px 12px rgba(35,71,51,.12);
}
.plant span:nth-child(1) { left: 10px; top: 36px; transform: rotate(28deg); }
.plant span:nth-child(2) { left: 55px; top: 18px; transform: scaleX(-1) rotate(28deg); background: #78946f; }
.plant span:nth-child(3) { left: 24px; top: 90px; transform: rotate(14deg); width: 72px; height: 38px; background: #5f7f61; }
.desk-line { position: absolute; left: 0; right: 0; bottom: 108px; height: 1px; background: rgba(23,50,77,.18); z-index: 3; }
.hero-motto {
  position: absolute;
  left: 32px;
  top: 76px;
  z-index: 5;
  padding: 19px 20px 17px;
  background: rgba(247,241,231,.78);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(23,50,77,.1);
  box-shadow: 0 8px 24px rgba(23,50,77,.06);
}
.hero-motto .rule { display: block; width: 40px; border-top: 3px solid var(--gold); margin-bottom: 14px; }
.hero-motto p { margin: 0; color: var(--ink); text-transform: uppercase; letter-spacing: .12em; font-size: .76rem; line-height: 1.95; font-weight: 700; }

.section { padding: 76px 0; }
.question-section {
  background:
    linear-gradient(180deg, rgba(255,255,255,.28), transparent 48%),
    #f8f1e4;
}
.section-heading-row { display: flex; align-items: end; justify-content: space-between; gap: 25px; margin-bottom: 32px; }
.section h2 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; margin: 0; }
.text-link { font-weight: 700; }
.card-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; }
.guide-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 6px solid var(--dusty-blue);
  padding: 26px 22px;
  min-height: 365px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-soft);
  border-radius: var(--radius-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.guide-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.guide-card:nth-child(1) { border-top-color: var(--terracotta); background: linear-gradient(180deg, #fffaf6, #fffdf9 45%); }
.guide-card:nth-child(2) { border-top-color: var(--gold); background: linear-gradient(180deg, #fffaf0, #fffdf9 45%); }
.guide-card:nth-child(3) { border-top-color: #648ca5; background: linear-gradient(180deg, #f6fbfd, #fffdf9 45%); }
.guide-card:nth-child(4) { border-top-color: #829a67; background: linear-gradient(180deg, #f7faf2, #fffdf9 45%); }
.guide-card:nth-child(5) { border-top-color: var(--teal); background: linear-gradient(180deg, #f3f8f5, #fffdf9 45%); }
.guide-card h3 { font-size: 1.42rem; line-height: 1.22; margin: 16px 0 12px; }
.guide-card p { color: #40515c; }
.guide-card a { margin-top: auto; font-weight: 700; }
.card-icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--pale-blue); color: var(--ink); font-size: 1.2rem; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(23,50,77,.04); }
.guide-card:nth-child(1) .card-icon { background: var(--terracotta-pale); color: #7b4028; }
.guide-card:nth-child(2) .card-icon { background: var(--gold-pale); color: #765b28; }
.guide-card:nth-child(3) .card-icon { background: var(--pale-blue); color: #355f79; }
.guide-card:nth-child(4) .card-icon { background: var(--sage); color: #4f693a; }
.guide-card:nth-child(5) .card-icon { background: var(--teal-pale); color: #355c57; }

.feature-section {
  padding-top: 34px;
  padding-bottom: 82px;
  background: linear-gradient(180deg, #fbf8f2 0%, #f5efe5 100%);
  border-top: 1px solid rgba(23,50,77,.06);
}
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.feature-panel {
  padding: 40px 36px;
  min-height: 320px;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  border-radius: var(--radius-sm);
}
.feature-panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
}
.feature-panel::after {
  content: "";
  position: absolute;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  right: -65px;
  bottom: -65px;
  opacity: .32;
}
.guides-panel { background: linear-gradient(135deg, #f3e3d8, #fbf1e9); border-color: #e5cfc0; }
.guides-panel::before { background: var(--terracotta); }
.guides-panel::after { background: #d9a58b; }
.guides-panel .eyebrow { color: #8b5745; }
.practice-panel { background: linear-gradient(135deg, #d8eaf1, #edf5f6); border-color: #c8dde5; }
.practice-panel::before { background: #648ca5; }
.practice-panel::after { background: #8eb5c8; }
.resolution-panel { background: linear-gradient(135deg, #dbe8dc, #eef4ed); border-color: #c9dccb; }
.resolution-panel::before { background: var(--teal); }
.resolution-panel::after { background: #8daf8f; }
.resolution-panel .eyebrow { color: #446a59; }
.pathway-heading { margin-bottom: 28px; }
.feature-panel h2 { font-size: 2rem; margin-bottom: 18px; }
.feature-panel p:not(.eyebrow) { max-width: 560px; }

.secondary-section { padding-top: 44px; background: linear-gradient(180deg, #f6efe4, #efe4d5); }
.secondary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; border-top: 1px solid #d3c8b9; padding-top: 40px; }
.secondary-grid article {
  padding: 28px 30px;
  background: rgba(255,253,249,.64);
  border: 1px solid rgba(23,50,77,.08);
  min-height: 190px;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 22px rgba(23,50,77,.04);
}
.secondary-grid article:nth-child(1) { border-top: 4px solid var(--terracotta); }
.secondary-grid article:nth-child(2) { border-top: 4px solid var(--gold); }
.secondary-grid article:nth-child(3) { border-top: 4px solid var(--teal); }
.secondary-grid h3 { font-size: 1.42rem; margin: 4px 0 8px; }
.secondary-grid p { color: #4f5d64; }
.secondary-grid a { font-weight: 700; }

.site-footer { margin-top: 0; background: linear-gradient(135deg, #17324d, #214765); color: #eaf0f3; padding: 50px 0; border-top: 5px solid var(--terracotta); }
.footer-grid { display: grid; grid-template-columns: .8fr 1.6fr; gap: 70px; align-items: start; }
.footer-name { color: white; font-size: 1.6rem; }
.footer-title { margin-top: 4px; }
.footer-tagline { color: #d6e1e6; margin-top: 26px; }
.disclaimer { border-left: 1px solid rgba(255,255,255,.24); padding-left: 40px; font-size: .92rem; color: #d3dde2; }
.disclaimer strong { color: white; }
.footer-links { display: flex; gap: 12px; margin-top: 24px; }
.site-footer a { color: #f3f7f9; }
.facebook-footer-link { display: inline-flex; align-items: center; gap: 4px; }
.facebook-footer-link svg { width: 17px; height: 17px; fill: currentColor; }

.facebook-follow { margin-top: 32px; padding: 28px 30px; display: flex; align-items: center; justify-content: space-between; gap: 28px; background: #edf5f8; border: 1px solid #c8dde5; border-left: 5px solid #1877f2; }
.facebook-follow h2 { margin: 4px 0 8px; }
.facebook-follow p { margin: 0; }
.facebook-button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; color: #fff; background: #17324d; border-radius: 4px; font-weight: 700; text-decoration: none; }
.facebook-button:hover, .facebook-button:focus-visible { background: #214765; }
.facebook-button svg { width: 21px; height: 21px; fill: currentColor; }

@media (max-width: 680px) {
  .footer-links { flex-wrap: wrap; }
  .facebook-follow { align-items: flex-start; flex-direction: column; padding: 24px; }
}

@media (max-width: 1280px) {
  .menu-toggle { display: block; margin-left: auto; }
  .site-nav { display: none; position: absolute; top: 92px; left: 0; right: 0; background: var(--ivory); padding: 22px 20px 30px; border-bottom: 1px solid var(--line); flex-direction: column; align-items: flex-start; gap: 16px; }
  .site-nav.open { display: flex; }
  .site-nav a { display: flex; align-items: center; width: 100%; min-height: 44px; white-space: normal; overflow-wrap: anywhere; }
  .site-nav a.active { border-bottom: 0; padding-bottom: 0; font-weight: 700; color: var(--terracotta); }
  .hero-grid { grid-template-columns: 1fr .9fr; }
  .book-stack { right: 24px; width: 290px; }
  .plant { right: 240px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .guide-card { min-height: 300px; }
}

@media (max-width: 820px) {
  .container { width: min(calc(100% - 28px), var(--max)); }
  .header-inner { min-height: 78px; }
  .brand { min-width: auto; }
  .brand-name { font-size: 1.2rem; }
  .brand-subtitle { font-size: .58rem; max-width: 220px; }
  .site-nav { top: 78px; }
  .hero-grid { min-height: auto; grid-template-columns: 1fr; gap: 0; }
  .hero-copy { padding: 58px 0 36px; }
  .hero h1 { font-size: clamp(2.7rem, 14vw, 4.2rem); }
  .hero-lead { font-size: 1.12rem; }
  .hero-visual { min-height: 390px; border-left: 0; border-top: 1px solid rgba(23,50,77,.15); }
  .hero-motto { top: 34px; left: 20px; }
  .book-stack { width: 250px; right: 18px; bottom: 58px; }
  .book { height: 45px; font-size: .72rem; padding-left: 42px; }
  .plant { right: 190px; bottom: 92px; transform: scale(.8); transform-origin: bottom center; }
  .section { padding: 54px 0; }
  .section-heading-row { align-items: flex-start; flex-direction: column; }
  .card-grid, .feature-grid, .secondary-grid, .footer-grid { grid-template-columns: 1fr; }
  .guide-card { min-height: auto; }
  .feature-panel { padding: 34px 28px; min-height: auto; }
  .secondary-grid { gap: 14px; }
  .secondary-grid article { min-height: auto; }
  .footer-grid { gap: 32px; }
  .disclaimer { border-left: 0; border-top: 1px solid rgba(255,255,255,.22); padding: 28px 0 0; }
}

/* Article search remains usable with grid cards and on narrow screens. */
#guide-results .library-guide[hidden], #guide-empty[hidden] { display: none !important; }
.article-search-panel { max-width: 800px; margin: 24px 0 0; padding: 22px; border: 1px solid var(--line); border-top: 4px solid var(--teal); background: var(--paper); }
.article-search-panel label { display: block; color: var(--ink); font-size: 1.1rem; font-weight: 700; }
.article-search-help { margin: 6px 0 14px; color: #43565f; font-size: .95rem; line-height: 1.7; }
.article-search-controls { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; }
.article-search-controls input { flex: 1 1 240px; min-width: 0; width: auto; max-width: none; }
.article-search-controls button { padding: 12px 18px; border: 1px solid var(--ink); border-radius: 3px; font: inherit; font-weight: 700; cursor: pointer; }
.article-search-submit { color: white; background: var(--ink); }
.article-search-clear { color: var(--ink); background: white; }
.article-search-controls input:focus-visible, .article-search-controls button:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
@media (max-width: 480px) {
  .article-search-panel { padding: 18px; }
  .article-search-controls input { flex-basis: 100%; }
}

/* Equal, optional analytics choices, with a persistent footer control. */
.analytics-choice{position:fixed;z-index:1000;bottom:16px;left:16px;right:16px;margin:auto;max-width:760px;max-height:70vh;overflow:auto;padding:20px 24px;background:#fffdf9;color:#17324d;border:1px solid #c8d4cd;border-radius:8px;box-shadow:0 5px 28px #17324d30}
.analytics-choice[hidden]{display:none}
.analytics-choice p{margin:0 0 14px;line-height:1.6}
.analytics-choice a{color:#17594f;text-decoration:underline}
.analytics-actions{display:flex;flex-wrap:wrap;gap:12px}
.analytics-actions button{font:inherit;font-weight:600;background:#f3f8f5;color:#17324d;border:1px solid #456b60;border-radius:4px;padding:10px 16px;cursor:pointer}
.analytics-actions button:hover{background:#e3ece7}
.analytics-actions button:focus-visible,.analytics-settings:focus-visible{outline:3px solid #a55d38;outline-offset:3px}
.analytics-settings{font:inherit;color:inherit;background:none;border:0;padding:0;text-decoration:underline;cursor:pointer}
@media(max-width:500px){.analytics-choice{bottom:8px;left:8px;right:8px;padding:16px}.analytics-actions button{flex:1}}


/* T08: narrow-screen safety and Sinhala readability */
img, svg, video { max-width: 100%; }
html[lang="si"] body { line-height: 1.75; }
html[lang="si"] h1, html[lang="si"] h2, html[lang="si"] h3 { letter-spacing: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .container { width: min(calc(100% - 24px), var(--max)); }
  .brand { max-width: calc(100% - 60px); }
  .brand-name, .brand-subtitle { overflow-wrap: anywhere; }
}


/* T08: preserve 200% text enlargement without horizontal page overflow. */
.library-page,
.contact-hero,
.contact-main { overflow-wrap: anywhere; }
.library-page .language-links { flex-wrap: wrap; }
.contact-hero h1,
.contact-name,
.contact-value,
.contact-value a { overflow-wrap: anywhere; word-break: break-word; }
@media (max-width: 480px) {
  .contact-card, .note-card { padding-left: 22px !important; padding-right: 22px !important; }
}


/* C08: shared UI refinement */
.section-heading-row > div { max-width: 760px; }
.text-link, .primary-link { text-underline-offset: 3px; }
.text-link:hover { text-decoration-thickness: 2px; }
.guide-card > a:last-child { margin-bottom: 0; }
.guide-card p:last-of-type { margin-bottom: 22px; }
.feature-panel .text-link { position: relative; z-index: 2; }
.secondary-grid article { transition: transform .18s ease, box-shadow .18s ease; }
.secondary-grid article:hover { transform: translateY(-3px); box-shadow: var(--shadow-soft); }
.library-note { border-radius: var(--radius-sm); }
@media (max-width: 820px) {
  .section-heading-row { gap: 14px; margin-bottom: 24px; }
  .feature-grid { gap: 16px; }
}
