/* Ask Gambia: national colours (flag red #CE1126, blue #0C1C8C, green #3A7728).
   The variable names are shared with Ask Bangladesh's stylesheet: --green is
   this site's primary colour (flag blue), --red its accent (flag red).
   No web fonts and no outside requests. */
:root {
  --bg: #f7f8f6;
  --surface: #ffffff;
  --ink: #17221d;
  --muted: #4b5a53;
  --line: #d6ddd9;
  --green: #0c1c8c;        /* primary: flag blue */
  --green-ink: #ffffff;
  --green-soft: #e7e9f7;
  --green-deep: #070f4d;
  --red: #ce1126;          /* accent: flag red */
  --red-text: #b30f20;     /* red dark enough for text on white */
  --sand: #f4efe4;
  --warn-bg: #fff4d6;
  --warn-ink: #6b4a00;
  --radius: 14px;
  --focus: #f2b705;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1613; --surface: #17201c; --ink: #edf3f0; --muted: #b0bfb8;
    --line: #2b3832; --green: #9aa6ff; --green-ink: #0b1033; --green-soft: #1b2048; --green-deep: #0a0d26;
    --red: #ff5a6c; --red-text: #ff8090; --sand: #24221b; --warn-bg: #3a2f10; --warn-ink: #f5d98a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1613; --surface: #17201c; --ink: #edf3f0; --muted: #b0bfb8;
  --line: #2b3832; --green: #9aa6ff; --green-ink: #0b1033; --green-soft: #1b2048; --green-deep: #0a0d26;
  --red: #ff5a6c; --red-text: #ff8090; --sand: #24221b; --warn-bg: #3a2f10; --warn-ink: #f5d98a; color-scheme: dark;
}

/* ---- Language switch: both languages are in the page; one is shown ---- */
html[data-lang="en"] [data-l="bn"], html[data-lang="bn"] [data-l="en"] { display: none !important; }

* { box-sizing: border-box; }
html { font-size: 112.5%; }            /* 18px base */
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Bengali",
    "Nirmala UI", Vrinda, "SolaimanLipi", Arial, sans-serif;
  line-height: 1.6;
}
html[data-lang="bn"] body { line-height: 1.75; }
a { color: var(--green); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
img { max-width: 100%; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 720px; }

/* ---- Header ---- */
.flagbar { height: 6px; background: linear-gradient(90deg, #ce1126 0 33%, #0c1c8c 33% 67%, #3a7728 67% 100%); }
header.site { background: var(--surface); border-bottom: 1px solid var(--line); }
header.site .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.25rem; color: var(--ink); text-decoration: none; }
.brand svg { width: 44px; height: 30px; flex: none; border-radius: 3px; box-shadow: 0 0 0 1px rgb(0 0 0 / .08); }
.brand small { display: block; font-weight: 400; font-size: .8rem; color: var(--muted); }
nav.main { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
nav.main ul { list-style: none; display: flex; flex-wrap: wrap; gap: 2px 4px; margin: 0; padding: 0; }
nav.main a { display: block; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--ink); }
nav.main a:hover, nav.main a[aria-current="page"] { background: var(--green-soft); color: var(--green); }
.lang-switch {
  font: inherit; font-weight: 700; cursor: pointer; border: 2px solid var(--green); color: var(--green);
  background: var(--surface); border-radius: 999px; padding: 6px 14px; white-space: nowrap;
}
.lang-switch:hover { background: var(--green); color: var(--green-ink); }

/* ---- Hero (home): photo with a green wash so text stays readable ---- */
.hero { position: relative; color: #fff; padding: 56px 0 40px; background: var(--green-deep); overflow: hidden; }
.hero .photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.hero::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgb(0 64 47 / .35), rgb(0 64 47 / .85)); }
.hero .wrap { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.7rem); line-height: 1.2; margin: 0 0 10px; text-shadow: 0 2px 10px rgb(0 0 0 / .35); }
.hero p.lead { font-size: 1.15rem; margin: 0 0 22px; max-width: 44em; text-shadow: 0 1px 6px rgb(0 0 0 / .4); }
.hero .ask { color: var(--ink); }
.credit { position: absolute; right: 8px; z-index: 1; font-size: .7rem; line-height: 1.3; color: #fff;
  background: rgb(0 0 0 / .55); border-radius: 6px; padding: 2px 8px; max-width: calc(100% - 16px); }
.hero .credit { bottom: 6px; }
.hero .credit a { color: inherit; }

/* ---- Sector banner (sector pages) ---- */
.banner { position: relative; min-height: 260px; display: flex; align-items: flex-end; color: #fff; background: var(--green-deep); overflow: hidden; }
.banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgb(0 0 0 / 0) 30%, rgb(0 40 30 / .85)); }
.banner .wrap { position: relative; z-index: 1; width: 100%; padding-top: 80px; padding-bottom: 22px; }
.banner h1 { margin: 0; font-size: clamp(1.8rem, 5vw, 2.6rem); text-shadow: 0 2px 10px rgb(0 0 0 / .4); }
.banner p { margin: 4px 0 0; font-size: 1.1rem; max-width: 44em; text-shadow: 0 1px 6px rgb(0 0 0 / .5); }
.banner .credit { top: 8px; }
.banner .credit a { color: inherit; }

h1 { font-size: 2rem; line-height: 1.25; }
h2 { font-size: 1.45rem; line-height: 1.3; margin-top: 2.2rem; }
h3 { font-size: 1.15rem; }
main { padding-bottom: 48px; }
.page-head { padding: 28px 0 8px; }
.page-head p { color: var(--muted); max-width: 44em; }
.section-ask { margin-top: 24px; }

/* ---- Ask box ---- */
.ask { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--green); border-radius: var(--radius); padding: 16px; box-shadow: 0 4px 18px rgb(0 0 0 / .08); }
.ask label { font-weight: 600; display: block; margin-bottom: 8px; }
.ask .row { display: flex; gap: 8px; }
.ask textarea {
  flex: 1; min-height: 56px; resize: vertical; font: inherit; color: var(--ink);
  background: var(--bg); border: 2px solid var(--line); border-radius: 10px; padding: 12px;
}
.ask textarea:focus { border-color: var(--green); outline: none; }
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 10px;
  background: var(--green); color: var(--green-ink); padding: 12px 22px; text-decoration: none; display: inline-block;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--green-soft); color: var(--green); }
.btn.small { padding: 6px 12px; font-size: .9rem; }
.btn.danger { color: var(--warn-ink); }
.btn[disabled] { opacity: .6; cursor: wait; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  font: inherit; font-size: .9rem; cursor: pointer; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); border-radius: 999px; padding: 6px 14px; text-align: left;
}
.chip:hover { border-color: var(--green); color: var(--green); }
.answer { margin-top: 14px; }
.msg { border-radius: 12px; padding: 12px 14px; margin-top: 10px; white-space: pre-wrap; }
.msg.user { background: var(--green-soft); }
.msg.bot { background: var(--sand); }
/* "Thinking": a red sun rising over the river */
.working { display: flex; align-items: center; gap: 10px; white-space: normal; color: var(--muted); }
.working svg { width: 64px; height: 40px; flex: none; }
.working .sun { fill: var(--red); transform-box: fill-box; transform-origin: center; animation: sun-pulse 1.8s ease-in-out infinite; }
.working .water { stroke: var(--green); animation: water-roll 1.6s linear infinite; }
@keyframes sun-pulse { 0%, 100% { transform: translateY(2px) scale(.92); } 50% { transform: translateY(-2px) scale(1.04); } }
@keyframes water-roll { from { transform: translateX(0); } to { transform: translateX(16px); } }
.ask.busy textarea { border-color: var(--green); animation: ask-pulse 1.8s ease-in-out infinite; }
@keyframes ask-pulse {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 3px var(--green-soft), 0 0 0 4px var(--green); }
}
@media (prefers-reduced-motion: reduce) {
  .working .sun, .working .water, .ask.busy textarea { animation: none; }
}
/* Rendered markdown answers */
.msg .md { white-space: normal; overflow-wrap: anywhere; }
.msg .md > :first-child { margin-top: 0; }
.msg .md > :last-child { margin-bottom: 0; }
.msg .md p, .msg .md ul, .msg .md ol, .msg .md blockquote, .msg .md pre, .msg .md table { margin: 0 0 .7em; }
.msg .md ul, .msg .md ol { padding-left: 1.4em; }
.msg .md li { margin: .2em 0; }
.msg .md h1, .msg .md h2, .msg .md h3, .msg .md h4 { font-size: 1.05rem; margin: .9em 0 .4em; }
.msg .md blockquote { border-left: 3px solid var(--line); padding-left: 10px; color: var(--muted); }
.msg .md code { background: rgb(0 0 0 / .06); padding: 1px 4px; border-radius: 4px; font-size: .92em; }
.msg .md pre { background: rgb(0 0 0 / .06); padding: 10px; border-radius: 8px; overflow-x: auto; }
.msg .md pre code { background: none; padding: 0; }
.msg .md table { border-collapse: collapse; display: block; overflow-x: auto; }
.msg .md th, .msg .md td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; }
.msg .meta { display: block; font-size: .8rem; color: var(--muted); margin-top: 6px; white-space: normal; }
.ai-note { font-size: .85rem; color: var(--muted); margin: 10px 0 0; }

/* ---- Sector cards (home) ---- */
.sectors { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 16px; margin-top: 28px; }
.sector {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; color: var(--ink); text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.sector:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgb(0 0 0 / .1); border-color: var(--green); }
.sector img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.sector .body { padding: 12px 14px 16px; border-top: 4px solid var(--green); }
.sector h3 { margin: 0 0 4px; color: var(--green); }
.sector p { margin: 0; color: var(--muted); font-size: .92rem; }

/* ---- Trust cards ---- */
.doors { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; margin-top: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--ink); text-decoration: none; display: block; }
a.card:hover { border-color: var(--green); }
.card h3 { margin: 6px 0 4px; }
.card p { margin: 0; color: var(--muted); }
.card .icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: var(--green-ink); }
.card .icon svg { width: 22px; height: 22px; }

/* ---- Sources list (sector pages) ---- */
.sources { list-style: none; padding: 0; display: grid; gap: 8px; }
.sources li { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 10px; padding: 10px 14px; overflow-wrap: anywhere; }
.sources.empty li { border-left-color: var(--line); color: var(--muted); }

/* ---- Helplines, notices, credits ---- */
.notice { background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; }
.notice.ok { background: var(--green-soft); color: var(--ink); }
.notice.ok h2 { margin-top: 0; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.help { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--red); border-radius: var(--radius); padding: 14px 16px; }
.help strong { font-size: 1.6rem; display: block; color: var(--red-text); line-height: 1.2; }
ul.ticks { list-style: none; padding: 0; }
ul.ticks li { position: relative; padding-left: 30px; margin: 10px 0; }
ul.ticks li::before { content: ""; position: absolute; left: 4px; top: .55em; width: 12px; height: 12px; border-radius: 50%; background: var(--green); }
.credits { font-size: .9rem; color: var(--muted); }
.credits li { margin: 6px 0; }
.hint { font-size: .9rem; color: var(--muted); margin: 6px 0 0; }

/* ---- Forms (contact, admin) ---- */
form.contact fieldset, form.plain fieldset { border: 0; padding: 0; margin: 0; }
form.contact label, form.plain label { display: block; font-weight: 600; margin-top: 18px; }
form.contact input, form.contact select, form.contact textarea, form.plain input {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 6px;
}
form.contact textarea { min-height: 160px; resize: vertical; }
form.contact input:focus, form.contact select:focus, form.contact textarea:focus, form.plain input:focus { border-color: var(--green); outline: none; }
form.contact .btn, form.plain .btn { margin-top: 22px; }
form.contact .extra-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
/* Join / reset: the recovery code is shown once, big and easy to copy down. */
p.code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.3rem; letter-spacing: .06em;
  background: var(--surface); border: 2px dashed var(--green); border-radius: 10px; padding: 12px 14px;
  overflow-wrap: anywhere;
}

/* ---- Admin page (admin.html, shared with Community Boudica) ---- */
#admin-signin { max-width: 420px; }
.admin-bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
#admin h2 .count { font-size: .9rem; font-weight: 400; color: var(--muted); }
.admin-item { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
.admin-item.handled { border-left-color: var(--line); }
.admin-item p { margin: 6px 0; }
.admin-item .meta { font-size: .9rem; color: var(--muted); }
.admin-item .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-list { padding-left: 20px; }
.admin-list li { margin: 8px 0; }
form.plain.inline { max-width: 420px; }

/* ---- Footer ---- */
footer.site { border-top: 1px solid var(--line); background: var(--surface); padding: 24px 0; font-size: .9rem; color: var(--muted); }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
footer.site a { color: var(--muted); }

@media (max-width: 720px) {
  nav.main { margin-left: 0; width: 100%; flex-wrap: nowrap; }
  /* One scrolling row of topics, with the language switch kept in view. */
  nav.main ul { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  nav.main ul::-webkit-scrollbar { display: none; }
  nav.main a { white-space: nowrap; }
  .lang-switch { padding: 6px 10px; }
  .ask .row { flex-direction: column; }
  .banner { min-height: 200px; }
}

[hidden] { display: none !important; }

/* Demo notice (demoMode in site.config.js) */
.demo-watermark { position: fixed; inset: 0; z-index: 1000; pointer-events: none; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.demo-watermark span { display: inline-block; white-space: nowrap; font-weight: 800; line-height: 1; color: var(--warn-ink); opacity: .22; user-select: none; }

/* Admin: timetables and opening hours */
details.admin-form { margin: 12px 0; }
details.admin-form summary { cursor: pointer; font-weight: 600; }
form.plain select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--surface); color: var(--ink); }
.table-scroll { overflow-x: auto; max-width: 100%; }
table.sched-grid, table.hours-grid { border-collapse: collapse; font-size: .85rem; margin: 8px 0; }
table.sched-grid th, table.sched-grid td, table.hours-grid th, table.hours-grid td { border: 1px solid var(--line); padding: 3px 6px; text-align: left; white-space: nowrap; }
table.sched-grid td { font-variant-numeric: tabular-nums; }
table.hours-grid input[type=time] { width: auto; margin: 0; padding: 4px; }
table.hours-grid input[type=checkbox] { width: auto; margin: 0; }
button.linklike { border: 0; background: none; color: var(--sea-ink, inherit); text-decoration: underline; cursor: pointer; font-size: .8rem; padding: 0; }
.sched-detail h4 { margin: 14px 0 4px; }
