/* ==========================================================================
   Ancile Academy — Family Financial Literacy Survey
   Design tokens follow the ApnaSIP brand: navy #002068, gold #FFBA20,
   crimson CTA #B9003F, Plus Jakarta Sans headings / Hanken Grotesk body.
   ========================================================================== */

:root {
  /* Brand */
  --navy:        #002068;
  --navy-900:    #0B1C30;
  --navy-700:    #123070;
  --navy-050:    #EEF2FB;
  --navy-100:    #DDE5F6;
  --gold:        #FFBA20;
  --gold-soft:   #FFF4DC;
  --crimson:     #B9003F;
  --crimson-dk:  #8E0031;
  --whatsapp:    #25D366;

  /* Neutrals */
  --ink:         #16203A;
  --ink-2:       #445;
  --ink-3:       #6B7590;
  --line:        #E3E7F0;
  --line-2:      #EDF0F6;
  --bg:          #F6F8FC;
  --surface:     #FFFFFF;

  /* Feedback */
  --err:         #C2261B;
  --err-bg:      #FEF2F1;
  --ok:          #0E7C50;

  /* Type */
  --f-head: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-body: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-te:   "Noto Sans Telugu", "Gautami", "Nirmala UI", sans-serif;

  /* Space & shape */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --shadow-1: 0 1px 2px rgba(16,32,68,.05), 0 2px 8px rgba(16,32,68,.04);
  --shadow-2: 0 4px 12px rgba(16,32,68,.07), 0 12px 32px rgba(16,32,68,.07);
  --shadow-3: 0 18px 48px rgba(0,32,104,.16);
  --wrap: 760px;
}

/* Telugu gets the Telugu face first, and a touch more line-height:
   the script has tall matras that collide at Latin leading. */
html[lang="te"] {
  --f-head: "Noto Sans Telugu", "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --f-body: "Noto Sans Telugu", "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  --te-lh: 1.85;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html[lang="te"] body { line-height: var(--te-lh); font-size: 16.5px; }
h1, h2, h3, h4 { font-family: var(--f-head); font-weight: 800; line-height: 1.2; margin: 0; letter-spacing: -.02em; }
html[lang="te"] h1, html[lang="te"] h2, html[lang="te"] h3 { line-height: 1.45; letter-spacing: 0; }
p { margin: 0 0 1em; }
button { font: inherit; color: inherit; }
input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 20px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   Top bar + progress
   ========================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__in {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 62px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand__mark {
  font-family: var(--f-head); font-weight: 800; font-size: 19px;
  color: var(--navy); letter-spacing: -.03em; white-space: nowrap;
}
.brand__mark em { font-style: normal; color: var(--gold); }
.brand__div { width: 1px; height: 22px; background: var(--line); flex: none; }
.brand__sub {
  font-size: 13px; color: var(--ink-3); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 560px) { .brand__div, .brand__sub { display: none; } }

/* Language toggle — a two-state segmented switch */
.langtog {
  display: inline-flex; align-items: center; gap: 2px; flex: none;
  background: var(--navy-050); border: 1px solid var(--navy-100);
  border-radius: 999px; padding: 3px;
}
.langtog button {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
  color: var(--navy); white-space: nowrap; transition: background .18s, color .18s;
}
.langtog button[aria-pressed="true"] {
  background: var(--navy); color: #fff; box-shadow: 0 1px 3px rgba(0,32,104,.3);
}
.langtog button:not([aria-pressed="true"]):hover { background: var(--navy-100); }

.progress { height: 3px; background: var(--line-2); position: relative; overflow: hidden; }
.progress__bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-700) 60%, var(--gold) 100%);
  border-radius: 0 3px 3px 0;
  transition: width .45s cubic-bezier(.22,.9,.3,1);
}

/* ==========================================================================
   Screens
   ========================================================================== */
.screen { display: none; animation: rise .38s cubic-bezier(.22,.9,.3,1) both; }
.screen.is-active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .screen, .progress__bar, .opt { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Welcome hero ---------- */
.hero {
  background:
    radial-gradient(1100px 420px at 82% -12%, rgba(255,186,32,.22), transparent 62%),
    radial-gradient(760px 380px at 8% 108%, rgba(37,211,102,.10), transparent 60%),
    linear-gradient(158deg, var(--navy) 0%, #041946 52%, var(--navy-900) 100%);
  color: #fff; padding: 56px 0 64px; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: auto 0 -1px 0; height: 40px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--gold); background: rgba(255,186,32,.12);
  border: 1px solid rgba(255,186,32,.32); border-radius: 999px; padding: 6px 14px;
  margin-bottom: 22px;
}
html[lang="te"] .hero__eyebrow { text-transform: none; letter-spacing: 0; }
.hero h1 { font-size: clamp(34px, 6.4vw, 56px); color: #fff; margin-bottom: 18px; }
.hero h1 span { display: block; color: var(--gold); }
.hero__tag { font-size: clamp(16px, 2.2vw, 19px); color: rgba(255,255,255,.82); max-width: 54ch; margin: 0; }

/* Stat pills */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 36px; }
.stat {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.16);
  border-radius: var(--r-md); padding: 16px 18px; backdrop-filter: blur(6px);
}
.stat__big { font-family: var(--f-head); font-weight: 800; font-size: 18px; color: #fff; }
.stat__sub { font-size: 13px; color: rgba(255,255,255,.68); line-height: 1.4; }
@media (max-width: 620px) {
  .stats { grid-template-columns: 1fr; gap: 8px; }
  .stat { display: flex; align-items: baseline; gap: 10px; padding: 12px 16px; }
  .stat__sub { margin: 0; }
}

/* ---------- Letter ---------- */
.letter { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-2);
  padding: 40px; margin: -28px 0 28px; position: relative; z-index: 1; }
.letter__hi { font-family: var(--f-head); font-weight: 800; font-size: 24px; color: var(--navy); margin-bottom: 4px; }
.letter__lede { font-size: 18px; color: var(--ink-2); margin-bottom: 22px; }
.letter p { color: var(--ink-2); }
.letter p:last-of-type { margin-bottom: 0; }
.letter strong { color: var(--navy); font-weight: 700; }
@media (max-width: 560px) { .letter { padding: 26px 22px; border-radius: var(--r-lg); } }

/* ==========================================================================
   Section header
   ========================================================================== */
.shead { padding: 36px 0 6px; }
.shead__eyebrow {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.shead__num {
  flex: none; width: 34px; height: 34px; border-radius: 10px;
  background: var(--navy); color: #fff; font-family: var(--f-head); font-weight: 800;
  font-size: 15px; display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0,32,104,.25);
}
.shead__of { font-size: 13.5px; font-weight: 600; color: var(--ink-3); letter-spacing: .02em; }
.shead__dots { display: flex; gap: 5px; margin-inline-start: auto; }
.shead__dot { width: 22px; height: 4px; border-radius: 999px; background: var(--line); transition: background .3s; }
.shead__dot.is-done { background: var(--navy); }
.shead__dot.is-now  { background: var(--gold); }
.shead h2 { font-size: clamp(24px, 4vw, 31px); color: var(--navy); margin-bottom: 10px; }
.shead__sub { color: var(--ink-3); font-size: 16px; margin: 0; max-width: 62ch; }
.shead__optional {
  display: inline-block; font-size: 12.5px; font-weight: 700; color: var(--ok);
  background: #E9F7F0; border: 1px solid #C7EBDA; border-radius: 999px;
  padding: 3px 11px; margin-inline-start: 8px; vertical-align: middle;
}

/* ==========================================================================
   Question card
   ========================================================================== */
.q {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  padding: 26px 28px; margin-top: 18px; scroll-margin-top: 90px;
  transition: border-color .2s, box-shadow .2s;
}
.q:focus-within { border-color: var(--navy-100); box-shadow: var(--shadow-2); }
.q.has-error { border-color: #F0BDB8; background: linear-gradient(var(--err-bg), var(--surface) 78px); }
@media (max-width: 560px) { .q { padding: 20px 18px; border-radius: var(--r-md); } }

.q__head { display: flex; gap: 12px; margin-bottom: 4px; }
.q__num {
  flex: none; font-family: var(--f-head); font-weight: 800; font-size: 13px;
  color: var(--navy); background: var(--gold-soft); border: 1px solid #F6E3B8;
  border-radius: 8px; padding: 3px 8px; height: fit-content; margin-top: 3px;
  letter-spacing: -.01em;
}
.q__label { font-family: var(--f-head); font-weight: 700; font-size: 18.5px; color: var(--ink); line-height: 1.4; }
html[lang="te"] .q__label { line-height: 1.6; font-weight: 600; }
.q__req { color: var(--crimson); margin-inline-start: 3px; font-weight: 700; }
.q__hint { font-size: 14.5px; color: var(--ink-3); margin: 6px 0 0; padding-inline-start: 44px; }
@media (max-width: 560px) { .q__hint { padding-inline-start: 0; } }

/* ---------- Options ---------- */
.opts { display: grid; gap: 10px; margin-top: 16px; list-style: none; padding: 0; }
.opts.cols-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 660px) { .opts.cols-2 { grid-template-columns: 1fr; } }

.opt { position: relative; margin: 0; }
.opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.opt label {
  display: flex; align-items: flex-start; gap: 12px; height: 100%;
  min-height: 54px; padding: 13px 16px; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--r-md); font-size: 16px; line-height: 1.45;
  transition: border-color .16s, background .16s, box-shadow .16s, transform .16s;
  -webkit-tap-highlight-color: transparent;
}
html[lang="te"] .opt label { line-height: 1.7; }
.opt label:hover { border-color: var(--navy-100); background: var(--navy-050); }
.opt label:active { transform: scale(.99); }

/* Custom control */
.opt .box {
  flex: none; width: 22px; height: 22px; margin-top: 1px;
  border: 2px solid #C3CCE0; background: #fff;
  display: grid; place-items: center;
  transition: border-color .16s, background .16s;
}
.opt input[type="radio"] ~ label .box { border-radius: 50%; }
.opt input[type="checkbox"] ~ label .box { border-radius: 6px; }
.opt .box::after {
  content: ""; opacity: 0; transition: opacity .14s, transform .14s;
}
.opt input[type="radio"] ~ label .box::after {
  width: 10px; height: 10px; border-radius: 50%; background: #fff; transform: scale(.4);
}
.opt input[type="checkbox"] ~ label .box::after {
  width: 11px; height: 6px; border-inline-start: 2.5px solid #fff; border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) translate(1px, -1.5px) scale(.6);
}

/* Checked state */
.opt input:checked ~ label {
  border-color: var(--navy); background: var(--navy-050);
  box-shadow: 0 0 0 1px var(--navy), 0 2px 10px rgba(0,32,104,.10);
  font-weight: 600;
}
.opt input:checked ~ label .box { border-color: var(--navy); background: var(--navy); }
.opt input:checked ~ label .box::after { opacity: 1; transform: scale(1); }
.opt input[type="checkbox"]:checked ~ label .box::after { transform: rotate(-45deg) translate(1px, -1.5px) scale(1); }
.opt input:focus-visible ~ label { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Disabled by max-selection cap */
.opt input:disabled ~ label { opacity: .45; cursor: not-allowed; }
.opt input:disabled ~ label:hover { border-color: var(--line); background: var(--surface); }

/* "Other" free-text reveal */
.other-box { grid-column: 1 / -1; margin-top: -2px; }
.other-box input {
  width: 100%; padding: 12px 15px; border: 1.5px solid var(--navy-100);
  border-radius: var(--r-sm); background: var(--navy-050);
}
.other-box input:focus { outline: none; border-color: var(--navy); background: #fff; }

/* ---------- Text inputs ---------- */
.field { margin-top: 14px; }
.field input, .field textarea {
  width: 100%; padding: 14px 16px; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  transition: border-color .16s, box-shadow .16s;
}
.field textarea { min-height: 130px; resize: vertical; line-height: 1.6; }
.field input::placeholder, .field textarea::placeholder { color: #A6AEC2; }
.field input:hover, .field textarea:hover { border-color: var(--navy-100); }
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(0,32,104,.10);
}
.field--tel { position: relative; }
.field--tel .cc {
  position: absolute; inset-inline-start: 1.5px; top: 1.5px; bottom: 1.5px;
  display: flex; align-items: center; gap: 6px; padding: 0 13px;
  color: var(--ink-3); font-size: 15.5px; border-inline-end: 1px solid var(--line);
  background: var(--bg); border-start-start-radius: 12px; border-end-start-radius: 12px;
  pointer-events: none;
}
.field--tel input { padding-inline-start: 74px; letter-spacing: .04em; }

/* ---------- Scale (Q13) ---------- */
.scale { margin-top: 20px; }
.scale__row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.scale__opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.scale__opt label {
  display: grid; place-items: center; height: 66px; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  font-family: var(--f-head); font-weight: 800; font-size: 22px; color: var(--ink-3);
  transition: all .16s; -webkit-tap-highlight-color: transparent;
}
.scale__opt label:hover { border-color: var(--navy-100); background: var(--navy-050); color: var(--navy); }
.scale__opt input:checked ~ label {
  border-color: var(--navy); background: var(--navy); color: #fff;
  box-shadow: 0 4px 14px rgba(0,32,104,.28); transform: translateY(-2px);
}
.scale__opt input:focus-visible ~ label { outline: 3px solid var(--gold); outline-offset: 2px; }
.scale__legend {
  display: flex; justify-content: space-between; gap: 10px; margin-top: 10px;
  font-size: 13px; color: var(--ink-3);
}
.scale__legend span { flex: 1 1 0; }
.scale__legend span:nth-child(2) { text-align: center; }
.scale__legend span:last-child { text-align: end; }
@media (max-width: 460px) {
  .scale__row { gap: 6px; }
  .scale__opt label { height: 56px; font-size: 19px; }
  .scale__legend { font-size: 11.5px; }
}

/* ---------- Counter + errors ---------- */
.counter {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 12px;
  font-size: 13.5px; font-weight: 600; color: var(--navy);
  background: var(--navy-050); border: 1px solid var(--navy-100);
  border-radius: 999px; padding: 5px 13px;
}
.counter.is-full { background: var(--gold-soft); border-color: #F6E3B8; color: #8A6100; }

.err {
  display: none; align-items: flex-start; gap: 8px; margin-top: 12px;
  font-size: 14.5px; font-weight: 600; color: var(--err);
}
.err.is-on { display: flex; }
.err svg { flex: none; margin-top: 2px; }

/* ==========================================================================
   Navigation
   ========================================================================== */
.nav {
  display: flex; align-items: center; gap: 12px;
  margin: 26px 0 8px; padding-top: 22px; border-top: 1px solid var(--line);
}
.btn {
  appearance: none; border: 0; cursor: pointer; border-radius: 12px;
  font-family: var(--f-head); font-weight: 700; font-size: 16px;
  padding: 15px 28px; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  transition: background .18s, transform .12s, box-shadow .18s, opacity .18s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--crimson); color: #fff; box-shadow: 0 4px 14px rgba(185,0,63,.28); }
.btn--primary:hover { background: var(--crimson-dk); box-shadow: 0 6px 20px rgba(185,0,63,.34); }
.btn--ghost { background: transparent; color: var(--navy); border: 1.5px solid var(--line); }
.btn--ghost:hover { border-color: var(--navy-100); background: var(--navy-050); }
.btn--lg { padding: 17px 34px; font-size: 17px; }
.btn[disabled] { opacity: .6; cursor: not-allowed; transform: none; }
.nav__spacer { margin-inline-start: auto; }
@media (max-width: 520px) {
  .nav { flex-direction: column-reverse; align-items: stretch; }
  .nav__spacer { margin: 0; }
  .btn { width: 100%; }
}

.savenote {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  font-size: 13.5px; color: var(--ink-3); padding: 6px 0 30px;
}
.savenote svg { flex: none; color: var(--ok); }

/* Submit error banner */
.submit-err {
  display: none; gap: 10px; align-items: flex-start; margin-top: 16px;
  background: var(--err-bg); border: 1px solid #F0BDB8; border-radius: var(--r-md);
  padding: 14px 16px; color: var(--err); font-size: 15px; font-weight: 600;
}
.submit-err.is-on { display: flex; }

/* ==========================================================================
   Resume dialog
   ========================================================================== */
.resume {
  position: fixed; inset: 0; z-index: 100; display: none;
  place-items: center; padding: 20px; background: rgba(11,28,48,.55);
  backdrop-filter: blur(4px);
}
.resume.is-on { display: grid; }
.resume__card {
  background: #fff; border-radius: var(--r-xl); box-shadow: var(--shadow-3);
  padding: 32px; max-width: 420px; width: 100%; text-align: center;
}
.resume__card h3 { font-size: 22px; color: var(--navy); margin-bottom: 8px; }
.resume__card p { color: var(--ink-3); font-size: 15.5px; }
.resume__btns { display: grid; gap: 10px; margin-top: 22px; }

/* ==========================================================================
   Thank you
   ========================================================================== */
.thanks { text-align: center; padding: 70px 0 40px; }
.thanks__tick {
  width: 84px; height: 84px; margin: 0 auto 26px; border-radius: 50%;
  background: linear-gradient(150deg, var(--navy), var(--navy-700));
  display: grid; place-items: center; color: var(--gold);
  box-shadow: 0 12px 34px rgba(0,32,104,.28);
  animation: pop .5s cubic-bezier(.2,1.3,.4,1) both;
}
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: none; opacity: 1; } }
.thanks h2 { font-size: clamp(30px, 5.5vw, 42px); color: var(--navy); margin-bottom: 16px; }
.thanks p { color: var(--ink-2); max-width: 56ch; margin-inline: auto; }
.thanks__sign { font-family: var(--f-head); font-weight: 700; color: var(--navy); margin-top: 26px; }
.thanks__tag { font-size: 14.5px; color: var(--ink-3); }
.thanks__gift {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 26px;
  background: var(--gold-soft); border: 1px solid #F6E3B8; border-radius: var(--r-md);
  padding: 14px 20px; color: #7A5600; font-weight: 600; font-size: 15px; text-align: start;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.foot {
  border-top: 1px solid var(--line); margin-top: 40px; padding: 22px 0 40px;
  text-align: center; font-size: 13.5px; color: var(--ink-3);
}
.foot__lock { display: inline-flex; align-items: center; gap: 6px; }

/* Print — lets a family fill it on paper if they prefer */
@media print {
  .topbar, .nav, .savenote, .resume, .hero__eyebrow { display: none !important; }
  .screen { display: block !important; }
  body { background: #fff; font-size: 12pt; }
  .q { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
  .hero { background: var(--navy) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
