/* Ain (আইনবন্ধু) - the public talk page. Mobile first; no external fonts (CSP: self only). */

:root {
  --bg: #f6f4ee;
  --surface: #ffffff;
  --ink: #1c2421;
  --ink-soft: #4c5a55;
  --line: #e2ddd1;
  --brand: #0f5c4d;
  --brand-ink: #ffffff;
  --brand-soft: #e3efe9;
  --accent: #c8862b;
  --sos: #b3261e;
  --sos-soft: #fbe9e7;
  --focus: #1d6fd6;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(15, 40, 33, 0.08);
  --font: "Noto Sans Bengali", "Hind Siliguri", "SolaimanLipi", "Nirmala UI", "Vrinda", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101614;
    --surface: #17201d;
    --ink: #e8efec;
    --ink-soft: #a8b8b2;
    --line: #2a3632;
    --brand: #3fae93;
    --brand-ink: #08130f;
    --brand-soft: #1d2d28;
    --accent: #e2a65a;
    --sos: #ff8a80;
    --sos-soft: #2d1a19;
    --focus: #7fb2ff;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
}

a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.nowrap { white-space: nowrap; }

.skip {
  position: absolute; left: -999px; top: 8px; z-index: 10;
  background: var(--surface); padding: 8px 12px; border-radius: 8px;
}
.skip:focus { left: 8px; }

/* ------------------------------------------------------------------ header */
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand__mark {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 20px;
}
.brand__name { font-weight: 700; font-size: 20px; }
.top__sos {
  text-decoration: none; font-weight: 700; color: var(--sos); background: var(--sos-soft);
  padding: 6px 12px; border-radius: 999px; font-size: 15px;
}

/* ------------------------------------------------------------------ hero + call */
.hero { padding: 28px 0 8px; }
.hero__grid { display: grid; gap: 24px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-weight: 700; font-size: 15px; letter-spacing: 0.02em; }
h1 { margin: 0 0 12px; font-size: clamp(28px, 7vw, 44px); line-height: 1.25; }
.lead { margin: 0 0 16px; color: var(--ink-soft); font-size: 18px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  background: var(--brand-soft); color: var(--ink); border-radius: 999px; padding: 4px 12px; font-size: 14px;
}

.call {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px 20px 22px; text-align: center; overflow: hidden;
}
.call__orb { position: relative; width: 168px; height: 168px; margin: 0 auto 18px; }
.call__orb span {
  position: absolute; inset: 0; border-radius: 50%; background: var(--brand); opacity: 0.12;
  transform: scale(0.72); transition: transform 0.4s ease, opacity 0.4s ease;
}
.call__orb span:nth-child(2) { opacity: 0.18; transform: scale(0.58); }
.call__orb span:nth-child(3) { opacity: 1; transform: scale(0.44); }
.call[data-state="live"][data-agent="speaking"] .call__orb span:nth-child(1) { animation: pulse 1.6s ease-in-out infinite; }
.call[data-state="live"][data-agent="speaking"] .call__orb span:nth-child(2) { animation: pulse 1.6s ease-in-out 0.25s infinite; }
.call[data-state="live"][data-agent="thinking"] .call__orb span:nth-child(3) { animation: breathe 1.2s ease-in-out infinite; }
.call[data-state="live"][data-agent="listening"] .call__orb span:nth-child(2) { transform: scale(0.64); }
.call[data-state="connecting"] .call__orb span:nth-child(3),
.call[data-state="waiting"] .call__orb span:nth-child(3),
.call[data-state="microphone"] .call__orb span:nth-child(3) { animation: breathe 1.4s ease-in-out infinite; }
.call[data-state="ended"] .call__orb span:nth-child(3),
.call[data-state="disabled"] .call__orb span:nth-child(3) { background: var(--ink-soft); }

@keyframes pulse {
  0%, 100% { transform: scale(0.72); opacity: 0.12; }
  50% { transform: scale(0.98); opacity: 0.2; }
}
@keyframes breathe {
  0%, 100% { transform: scale(0.44); }
  50% { transform: scale(0.5); }
}
@media (prefers-reduced-motion: reduce) {
  .call__orb span { animation: none !important; transition: none; }
}

.call__start {
  display: inline-flex; align-items: center; gap: 10px; border: 0; cursor: pointer;
  background: var(--brand); color: var(--brand-ink); font: inherit; font-size: 20px; font-weight: 700;
  padding: 14px 30px; border-radius: 999px; min-height: 56px; box-shadow: 0 6px 18px rgba(15, 92, 77, 0.3);
}
.call__start svg { width: 24px; height: 24px; fill: currentColor; }
.call__start:hover { filter: brightness(1.06); }
.call__start:disabled { opacity: 0.6; cursor: default; }
.call__controls { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.call__status { margin: 14px 0 0; font-weight: 600; min-height: 1.6em; }
.call__timer { margin: 2px 0 0; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.call__error {
  margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--sos-soft); color: var(--sos); font-size: 15px;
}
.call__hint { margin: 14px 0 0; color: var(--ink-soft); font-size: 14px; }
.call__off { margin: 0; font-weight: 600; }

.btn {
  font: inherit; font-weight: 600; border-radius: 999px; padding: 10px 20px; min-height: 46px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.btn--end { background: var(--sos); border-color: var(--sos); color: #fff; }
.btn--ghost { background: transparent; }
.btn--small { min-height: 36px; padding: 4px 14px; font-size: 14px; }
.btn[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); }

/* ------------------------------------------------------------------ captions */
.captions {
  margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px;
}
.captions__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.captions h2 { margin: 0; font-size: 20px; }
.captions__note { margin: 6px 0 12px; color: var(--ink-soft); font-size: 14px; }
.captions__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-height: 60vh; overflow-y: auto; }
.caption { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; max-width: 92%; }
.caption--agent { background: var(--brand-soft); justify-self: start; }
.caption--caller { background: var(--bg); border: 1px solid var(--line); justify-self: end; }
.caption--partial .caption__text { opacity: 0.75; }
.caption__who { font-size: 13px; font-weight: 700; color: var(--ink-soft); }

/* ------------------------------------------------------------------ sections */
.sos, .steps, .notes { margin-top: 28px; }
.sos h2, .steps h2, .notes h2 { font-size: 22px; margin: 0 0 8px; }
.sos {
  background: var(--sos-soft); border-radius: var(--radius); padding: 18px 16px; border: 1px solid transparent;
}
.sos p { margin: 0 0 12px; }
.sos__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sos__list a {
  display: flex; align-items: baseline; gap: 12px; text-decoration: none; color: var(--ink);
  background: var(--surface); border-radius: 12px; padding: 10px 14px;
}
.sos__list strong { color: var(--sos); font-size: 22px; min-width: 72px; }

.steps__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; counter-reset: step; }
.steps__list li {
  counter-increment: step; display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 14px 14px 58px; position: relative;
}
.steps__list li::before {
  content: counter(step, bengali); position: absolute; left: 14px; top: 14px; width: 32px; height: 32px;
  border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700;
}
.steps__list span { color: var(--ink-soft); }

.notes ul { margin: 0; padding-left: 20px; color: var(--ink-soft); }
.notes li { margin-bottom: 6px; }

.foot { margin-top: 36px; border-top: 1px solid var(--line); padding: 18px 0 28px; color: var(--ink-soft); font-size: 14px; }
.foot__inner { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; }

/* ------------------------------------------------------------------ wider screens */
@media (min-width: 880px) {
  .hero { padding-top: 48px; }
  .hero__grid { grid-template-columns: 1.15fr 0.85fr; align-items: center; gap: 40px; }
  .sos__list { grid-template-columns: 1fr 1fr; }
  .steps__list { grid-template-columns: repeat(3, 1fr); }
}
