/* Ask AIRisks: styled after airisks.net (Human-Ai.Institute): navy #213e60,
   blue #0065b3, orange #f78419, ink #263545 on paper #f8fafc, thin #dce4eb
   rules, small uppercase blue eyebrows, Inter. Inter is self-hosted
   (assets/fonts, SIL Open Font Licence): no outside requests.
   Class names are the ones the shared site.js / admin.js expect. */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  --paper: #f8fafc;
  --surface: #ffffff;
  --ink: #263545;
  --muted: #5c6b7b;
  --line: #dce4eb;
  --navy: #213e60;
  --blue: #0065b3;
  --blue-soft: #eaf1f7;
  --orange: #f78419;
  --orange-text: #b85a05;   /* orange dark enough for text on white */
  --warn-bg: #fff4e6;
  --warn-ink: #7a3d00;
  --radius: 10px;
  --focus: #f78419;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1720; --surface: #16212d; --ink: #e6edf4; --muted: #a9b7c6; --line: #2a3a4b;
    --navy: #cfe0f2; --blue: #6fb4f0; --blue-soft: #19324a; --orange: #ff9a3d; --orange-text: #ffb15e;
    --warn-bg: #3a2a12; --warn-ink: #f8d49a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1720; --surface: #16212d; --ink: #e6edf4; --muted: #a9b7c6; --line: #2a3a4b;
  --navy: #cfe0f2; --blue: #6fb4f0; --blue-soft: #19324a; --orange: #ff9a3d; --orange-text: #ffb15e;
  --warn-bg: #3a2a12; --warn-ink: #f8d49a; color-scheme: dark;
}

/* English only: site.js also writes Bangla spans for some lists; never shown. */
[data-l]:not([data-l="en"]) { display: none !important; }

* { box-sizing: border-box; }
html { font-size: 106.25%; }            /* 17px base */
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.65; -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--orange-text); }
: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: 760px; }

h1, h2, h3 { color: var(--navy); letter-spacing: -.02em; }
h1 { font-size: clamp(2rem, 5.5vw, 3.1rem); line-height: 1.12; font-weight: 700; margin: 0 0 14px; }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); line-height: 1.25; font-weight: 700; margin: 2.4rem 0 .8rem; }
h3 { font-size: 1.08rem; font-weight: 700; }
.eyebrow { margin: 0 0 10px; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--blue); display: block; }
main { padding-bottom: 56px; }
.page-head { padding: 40px 0 8px; }
.page-head p { color: var(--muted); max-width: 44em; }
.section-ask { margin-top: 28px; }

/* ---- Header ---- */
header.site { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
header.site .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); }
.brand svg.ar { width: 46px; height: 38px; flex: none; }
/* The AR mark's two colours (header and waiting animation) */
svg.ar .ar-n { fill: var(--navy); }
svg.ar .ar-o { fill: var(--orange); }
.wordmark { display: flex; flex-direction: column; line-height: 1.05; }
.wordmark .name { font-weight: 700; font-size: 1.3rem; letter-spacing: -.03em; color: var(--navy); }
.wordmark .tld { color: var(--orange); }
.wordmark .tagline { margin-top: 3px; font-size: .62rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
nav.main { margin-left: auto; display: flex; align-items: center; }
nav.main ul { list-style: none; display: flex; flex-wrap: wrap; gap: 2px 6px; margin: 0; padding: 0; }
nav.main a { display: block; padding: 8px 10px; text-decoration: none; color: var(--ink); font-size: .9rem; font-weight: 500; border-bottom: 2px solid transparent; }
nav.main a:hover { color: var(--orange-text); }
nav.main a[aria-current="page"] { color: var(--orange-text); border-bottom-color: var(--orange); }

/* ---- Hero ---- */
.hero { padding: 64px 0 48px; border-bottom: 1px solid var(--line); background: var(--paper); }
.hero.small { padding: 44px 0 28px; }
.hero p.lead { font-size: 1.15rem; color: var(--ink); max-width: 40em; margin: 0 0 28px; }
.hero.small p.lead { margin-bottom: 0; }
.section { padding: 8px 0 24px; }
.section.alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 32px; padding-bottom: 40px; }
.section > .wrap > .eyebrow { margin-top: 40px; }
.section h2 { margin-top: 0; }

/* ---- Ask box ---- */
.ask { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 3px rgb(0 0 0 / .06), 0 8px 24px rgb(33 62 96 / .06); max-width: 860px; }
.ask label { font-weight: 600; display: block; margin-bottom: 8px; color: var(--navy); }
.ask .row { display: flex; gap: 8px; }
.ask textarea {
  flex: 1; min-height: 56px; resize: vertical; font: inherit; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 12px;
}
.ask textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-soft); }
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 8px;
  background: var(--navy); color: var(--surface); padding: 12px 24px; text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--blue); color: var(--surface); }
.btn.secondary { background: var(--blue-soft); color: var(--blue); }
.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: 14px; }
.chip {
  font: inherit; font-size: .88rem; cursor: pointer; border: 1px solid var(--line);
  background: var(--surface); color: var(--blue); border-radius: 999px; padding: 6px 14px; text-align: left;
}
.chip:hover { border-color: var(--orange); color: var(--orange-text); }
.answer { margin-top: 14px; }
.msg { border-radius: 8px; padding: 12px 14px; margin-top: 10px; white-space: pre-wrap; }
.msg.user { background: var(--blue-soft); }
.msg.bot { background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--orange); }
/* "Thinking": the AR mark builds itself, stroke by stroke, then the
   diamond turns; the whole cycle repeats until the answer is ready. */
.working { display: flex; align-items: center; gap: 12px; white-space: normal; color: var(--muted); }
.working svg.ar { width: 52px; height: 43px; flex: none; overflow: visible; }
.working svg.ar g { opacity: .12; animation: ar-build 2.4s ease-in-out infinite; }
.working svg.ar g:nth-child(2) { animation-delay: .15s; }
.working svg.ar g:nth-child(3) { animation-delay: .3s; }
.working svg.ar g:nth-child(4) { animation-delay: .45s; }
.working svg.ar g:nth-child(5) { animation-delay: .6s; }
.working svg.ar g:nth-child(6) { animation: ar-build 2.4s ease-in-out .75s infinite, ar-turn 2.4s ease-in-out .75s infinite;
  transform-box: fill-box; transform-origin: center; }
@keyframes ar-build { 0%, 100% { opacity: .12; } 25%, 75% { opacity: 1; } }
@keyframes ar-turn { 0%, 30% { transform: rotate(0) scale(1); } 50% { transform: rotate(90deg) scale(1.25); } 70%, 100% { transform: rotate(180deg) scale(1); } }
.ask.busy textarea { border-color: var(--blue); 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(--blue-soft), 0 0 0 4px var(--blue); }
}
.wait { display: flex; flex-direction: column; gap: 2px; }
.wait-word { font-style: italic; animation: wait-pulse 1.6s ease-in-out infinite; }
.wait-meaning, .wait-note { font-size: .8rem; }
.wait-note:empty { display: none; }
@keyframes wait-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) {
  .working svg.ar g, .ask.busy textarea, .wait-word { animation: none !important; opacity: 1; }
}
/* 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: .82rem; color: var(--muted); margin: 10px 0 0; }

/* ---- Topic grid (home) ---- */
.topics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 16px; }
.topic {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 18px 20px; color: var(--ink); text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.topic:hover { border-color: var(--blue); box-shadow: 0 6px 18px rgb(33 62 96 / .08); transform: translateY(-2px); color: var(--ink); }
.topic .eyebrow { margin-bottom: 6px; }
.topic h3 { margin: 0 0 6px; }
.topic p { margin: 0; color: var(--muted); font-size: .92rem; }
.topic.ask-card { border-top: 3px solid var(--orange); }

/* ---- Trust strip ---- */
.doors { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 16px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--ink); display: block; }
.card h3 { margin: 10px 0 4px; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.card .icon { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); }
.card .icon svg { width: 22px; height: 22px; }

/* ---- Topic pages ---- */
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 8px 40px; }
ul.terms { list-style: none; padding: 0; margin: 0; }
ul.terms li { border-bottom: 1px solid var(--line); }
ul.terms a { display: block; padding: 12px 0; text-decoration: none; }
ul.terms strong { display: block; color: var(--navy); }
ul.terms span { display: block; color: var(--muted); font-size: .9rem; }
ul.terms a:hover strong { color: var(--orange-text); }

/* ---- Sources ---- */
.sources { list-style: none; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.sources li { border-bottom: 1px solid var(--line); padding: 10px 2px; overflow-wrap: anywhere; }
.sources.empty li { color: var(--muted); }

/* ---- Lists, notices ---- */
.notice { background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--radius); padding: 14px 16px; margin: 20px 0; max-width: 860px; }
.notice.ok { background: var(--blue-soft); color: var(--ink); }
.notice.ok h2 { margin-top: 0; }
ul.ticks { list-style: none; padding: 0; }
ul.ticks li { position: relative; padding-left: 26px; margin: 10px 0; }
ul.ticks li::before { content: ""; position: absolute; left: 4px; top: .6em; width: 9px; height: 9px; border-radius: 50%; background: var(--orange); }
.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; color: var(--navy); }
form.contact input, form.contact select, form.contact textarea, form.plain input {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; 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(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-soft); }
form.contact .btn, form.plain .btn { margin-top: 22px; }
form.contact .extra-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
p.code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.3rem; letter-spacing: .06em;
  background: var(--surface); border: 2px dashed var(--blue); border-radius: 8px; 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: 3px solid var(--blue); 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; }
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(--blue); text-decoration: underline; cursor: pointer; font-size: .8rem; padding: 0; }
.sched-detail h4 { margin: 14px 0 4px; }

/* ---- Footer ---- */
footer.site { border-top: 1px solid var(--line); background: var(--surface); padding: 28px 0; font-size: .88rem; color: var(--muted); }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
footer.site a { color: var(--navy); text-decoration: none; font-weight: 500; }
footer.site a:hover { color: var(--orange-text); }

@media (max-width: 760px) {
  nav.main { margin-left: 0; width: 100%; }
  nav.main ul { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0; width: 100%;
    -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; }
  .ask .row { flex-direction: column; }
  .hero { padding: 40px 0 32px; }
}

[hidden] { display: none !important; }

/* Demo notice (demoMode in community.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; }
