/* Jay AI Sinhala — warm, calm, elder-friendly */
:root {
  --bg: #f7f3eb;
  --bg-card: #ffffff;
  --ink: #1a2e28;
  --ink-soft: #3d554c;
  --teal: #1a7a6d;
  --teal-dark: #0f5a50;
  --teal-light: #e6f4f1;
  --gold: #c4a35a;
  --gold-soft: #f5edd8;
  --coral: #c45c4a;
  --border: #d4cfc4;
  --shadow: 0 4px 20px rgba(26, 46, 40, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Noto Sans Sinhala", "Iskoola Pota", "Nirmala UI", system-ui, sans-serif;
  --fs: 1.25rem;
  --fs-lg: 1.5rem;
  --fs-xl: 1.85rem;
  --fs-sm: 1.05rem;
  --tap: 48px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

img, svg { max-width: 100%; height: auto; display: block; }

a {
  color: var(--teal-dark);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
a:hover { color: var(--teal); }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--teal);
  color: #fff;
  padding: 0.75rem 1.25rem;
  z-index: 1000;
  border-radius: var(--radius-sm);
}
.skip:focus { left: 1rem; top: 1rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 243, 235, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 2px 12px rgba(26, 46, 40, 0.06);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.65rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: var(--fs-lg);
  color: var(--teal-dark);
  text-decoration: none;
}
.brand svg { width: 40px; height: 40px; flex-shrink: 0; }

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-weight: 600;
  border: 2px solid transparent;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] {
  background: var(--teal-light);
  color: var(--teal-dark);
  border-color: var(--teal);
}

.nav-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: var(--tap);
  padding: 0.55rem 1.25rem;
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 4px 14px rgba(26, 122, 109, 0.35);
}
.btn-primary:hover { background: var(--teal-dark); color: #fff; }

.btn-secondary {
  background: var(--gold-soft);
  color: var(--ink);
  border-color: var(--gold);
}
.btn-secondary:hover { background: #efe2c0; }

.btn-listen {
  background: var(--teal-light);
  color: var(--teal-dark);
  border-color: var(--teal);
}
.btn-listen:hover { background: #d0ebe6; }
.btn-listen.is-playing {
  background: var(--coral);
  color: #fff;
  border-color: var(--coral);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--border);
}
.btn-ghost:hover { background: #fff; }

.btn-lg {
  min-height: 56px;
  padding: 0.75rem 1.75rem;
  font-size: var(--fs);
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.hero {
  background: linear-gradient(145deg, var(--teal-light) 0%, var(--gold-soft) 100%);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
}
.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.35;
  color: var(--teal-dark);
}
.hero .lead {
  font-size: var(--fs-lg);
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
  max-width: 40em;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
}
.card h2, .card h3 {
  margin: 0.5rem 0 0.6rem;
  font-size: var(--fs-lg);
  color: var(--teal-dark);
}
.card p { margin: 0; color: var(--ink-soft); }
.card .icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--teal-light);
  display: flex;
  align-items: center;
  justify-content: center;
}
.card .icon-wrap svg { width: 32px; height: 32px; }

.section {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.section h2 {
  margin: 0 0 1rem;
  font-size: var(--fs-xl);
  color: var(--teal-dark);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.section h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: var(--fs-lg);
  color: var(--ink);
}

.listen-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}
.steps > li {
  position: relative;
  padding: 1.25rem 1.25rem 1.25rem 4.5rem;
  margin-bottom: 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  counter-increment: step;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 1rem;
  top: 1.25rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}
.steps > li h3 {
  margin: 0 0 0.4rem;
  font-size: var(--fs-lg);
}
.steps > li p { margin: 0; color: var(--ink-soft); }

.safety {
  background: #fff5f3;
  border: 2px solid #e8a99f;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.safety strong { color: var(--coral); }

.note {
  background: var(--gold-soft);
  border: 2px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}


.faq details {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.15rem;
  margin-bottom: 0.75rem;
}
.faq summary {
  cursor: pointer;
  font-weight: 700;
  font-size: var(--fs);
  color: var(--teal-dark);
  min-height: var(--tap);
  display: flex;
  align-items: center;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: "▸ ";
  margin-right: 0.35rem;
  color: var(--teal);
}
.faq details[open] summary::before { content: "▾ "; }
.faq details p { margin: 0.5rem 0 0.25rem; color: var(--ink-soft); }

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.check-list li {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs);
}
.check-list li:last-child { border-bottom: none; }
.check-list .mark {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--teal-light);
  color: var(--teal-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  margin-top: 0.15rem;
}

.demo-frame {
  border: 3px dashed var(--teal);
  border-radius: var(--radius);
  padding: 1rem;
  background: #fff;
  margin: 1rem 0;
}
.demo-frame iframe {
  width: 100%;
  min-height: 420px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
}

.placeholder-slot {
  border: 2px dashed #9ab5ae;
  border-radius: var(--radius-sm);
  background: #f0f7f5;
  padding: 1.5rem;
  text-align: center;
  color: var(--ink-soft);
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.placeholder-slot .label {
  font-weight: 700;
  color: var(--teal-dark);
  font-size: var(--fs-sm);
}

.site-footer {
  background: var(--teal-dark);
  color: #e6f4f1;
  padding: 2rem 1rem;
  margin-top: 2rem;
}
.site-footer .wrap { padding-top: 0; padding-bottom: 0; }
.site-footer a { color: #b8e0d8; }
.site-footer p { margin: 0.4rem 0; font-size: var(--fs-sm); }

.tts-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 0.85rem 1.35rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  max-width: 90vw;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  display: none;
}
.tts-toast.show { display: block; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  min-height: var(--tap);
  padding: 0 0.5rem;
}
.toggle input {
  width: 1.35rem;
  height: 1.35rem;
  accent-color: var(--teal);
}

@media (max-width: 720px) {
  .nav-links { width: 100%; order: 3; }
  .nav-links a { font-size: 0.95rem; padding: 0.35rem 0.65rem; }
  .steps > li { padding-left: 1.25rem; padding-top: 4rem; }
  .steps > li::before { top: 0.85rem; left: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}


/* English tech terms in quotes + Sinhala pronunciation */
.term {
  font-weight: 700;
  color: var(--teal-dark);
  font-family: var(--font), ui-monospace, monospace;
  background: var(--teal-light);
  padding: 0.05em 0.28em;
  border-radius: 6px;
  white-space: nowrap;
}
.pron {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.95em;
  white-space: nowrap;
}

.glossary-lead {
  margin: 0 0 1rem;
  color: var(--ink-soft);
}
.glossary-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem 1rem;
  margin: 0;
}
.glossary-list > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.6rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
}
.glossary-list dt {
  margin: 0;
  font-size: var(--fs);
}
.glossary-list dd {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 600;
}
