/* Janta ka Mantar: the tricolour on top, the violet of the voting ink on the button. */

@font-face { font-family: "Mukta"; src: url("/mukta-devanagari-400.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0900-097F, U+200C-200D, U+25CC; }
@font-face { font-family: "Mukta"; src: url("/mukta-devanagari-800.woff2") format("woff2"); font-weight: 800; font-display: swap; unicode-range: U+0900-097F, U+200C-200D, U+25CC; }
@font-face { font-family: "Mukta"; src: url("/mukta-latin-400.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+2018-201D, U+2026, U+20B9; }
@font-face { font-family: "Mukta"; src: url("/mukta-latin-800.woff2") format("woff2"); font-weight: 800; font-display: swap; unicode-range: U+0000-00FF, U+2018-201D, U+2026, U+20B9; }

:root {
  --paper: #FBFAF8;
  --surface: #FFFFFF;
  --ink: #1D1730;
  --mute: #635C74;
  --line: #E4DFEA;
  --violet: #5A2D91;
  --head: #241640;
  --saffron: #FF9933;
  --green: #138808;
  --navy: #000080;
  --focus: #E8A33D;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #13101C;
    --surface: #1D182A;
    --ink: #EEEAF6;
    --mute: #A9A1BC;
    --line: #2F2840;
    --violet: #8B57D6;
    --head: #FFFFFF;
    --navy: #9DA6FF;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Mukta", "Noto Sans Devanagari", "Kohinoor Devanagari", "Nirmala UI", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
/* a thin tricolour ribbon along the top edge */
body::before {
  content: ""; display: block; height: 6px;
  background: linear-gradient(90deg, var(--saffron) 0 33.4%, #FFFFFF 33.4% 66.6%, var(--green) 66.6%);
  box-shadow: 0 1px 0 var(--line);
}
p { margin: 0; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

.page {
  max-width: 38rem;
  min-height: calc(100svh - 6px);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  text-align: center;
  container-type: inline-size;
}

/* ---- The tricolour on its pole, gently waving ---- */
.top { display: flex; align-items: center; justify-content: center; gap: 1.1rem; text-align: left; }
.name { display: flex; flex-direction: column; }
.flag {
  --w: 84px; --h: 56px;
  position: relative;
  width: var(--w);
  height: var(--h);
  flex: none;
  margin-left: 8px;
  display: flex;
  filter: drop-shadow(0 6px 10px rgba(30, 20, 60, .18));
}
.flag::before {
  content: "";
  position: absolute;
  left: -7px; top: -6px;
  width: 4px; height: calc(var(--h) + 22px);
  border-radius: 2px;
  background: linear-gradient(90deg, #9C8F7C, #D9CFC0 50%, #8A7E6C);
}
.flag i {
  flex: 1 0 0;
  height: 100%;
  background: url("/flag.svg") no-repeat;
  background-size: var(--w) var(--h);
  animation: wave 2.6s ease-in-out infinite;
  position: relative;
}
.flag i::after {
  content: "";
  position: absolute; inset: 0;
  background: #000;
  opacity: 0;
  animation: shade 2.6s ease-in-out infinite;
  animation-delay: inherit;
}
@keyframes wave { 0%, 100% { transform: translateY(-1.5px); } 50% { transform: translateY(2.5px); } }
@keyframes shade { 0%, 100% { opacity: 0; } 50% { opacity: .07; } }

.motto { font-weight: 800; font-size: .95rem; line-height: 1.2; color: var(--navy); letter-spacing: .02em; }
.title { font-weight: 800; font-size: clamp(1.9rem, 9cqi, 2.6rem); line-height: 1.1; color: var(--head); }
.sub { font-size: .95rem; line-height: 1.3; color: var(--mute); }

/* ---- Every pair of lines: Hindi and English at the same size, each on one line ---- */
.line { display: block; white-space: nowrap; }
.question .line + .line { font-weight: 400; color: var(--ink); }
.cause .hi { font-size: 1.1em; }
.question {
  margin: 0;
  padding-top: 1rem;
  border-top: 1.5px solid var(--line);
  font-weight: 800;
  line-height: 1.3;
  color: var(--head);
  font-size: min(2.4rem, 6.2vw);
  font-size: min(2.4rem, calc(100cqi / 14.8));
}
.cause {
  color: var(--ink);
  line-height: 1.4;
  font-size: min(1.5rem, 4.1vw);
  font-size: min(1.5rem, calc(100cqi / 22.4));
}

/* ---- The button: a fingertip that takes the ink ---- */
.act { display: flex; flex-direction: column; align-items: stretch; }
.stand {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  padding: .75rem 1.4rem;
  border: 0; border-radius: 999px;
  background: var(--violet); color: #fff;
  font: inherit; text-align: left; cursor: pointer;
  box-shadow: 0 12px 28px -14px rgba(58, 26, 102, .8);
  transition: transform .15s ease, background-color .3s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.stand:active { transform: scale(.98); }
.stand[disabled] { cursor: default; }
.finger { flex: none; width: 2.1rem; height: 3.1rem; fill: none; stroke: currentColor; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.finger .nail { stroke-width: 2.5; opacity: .85; }
.finger .ink { stroke: #2A0F52; stroke-width: 7; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .7s cubic-bezier(.6, 0, .2, 1); }
.stand-text { display: flex; flex-direction: column; font-size: 1.35rem; line-height: 1.2; }
.stand-text b { font-weight: 800; }
.stand-text b + b { font-weight: 400; }

.act[data-state="working"] .ink { stroke-dashoffset: 12; transition-duration: 2.5s; }
.act[data-state="done"] .ink { stroke-dashoffset: 0; stroke: var(--violet); }
.act[data-state="done"] .stand { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--violet); }

.status:empty { display: none; }
.status { min-height: 0; margin-top: .5rem; font-size: 1rem; line-height: 1.4; color: var(--mute); white-space: pre-line; }
.act[data-state="done"] .status { color: var(--ink); }

.share { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .6rem; }
.share[hidden] { display: none; }
.share-btn {
  padding: .8rem .9rem;
  border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 800; font-size: 1rem; cursor: pointer;
}
.share-wa { grid-column: 1 / -1; background: #1F7A4D; border-color: #1F7A4D; color: #fff; }
.share-btn:active { transform: scale(.98); }

/* ---- Tally ---- */
.tally {
  padding: .9rem 1rem .8rem;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 10px 30px -22px rgba(36, 22, 64, .35);
}
.count {
  font-weight: 800;
  font-size: clamp(2.8rem, 14cqi, 4.6rem);
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: var(--violet);
}
.count-label { margin-top: .25rem; font-size: min(1.1rem, calc(100cqi / 23)); font-weight: 400; color: var(--ink); line-height: 1.3; white-space: nowrap; }
.bar {
  display: flex; justify-content: flex-end;
  height: 8px; margin-top: .7rem; border-radius: 4px; overflow: hidden;
  background: linear-gradient(90deg, var(--saffron), #EDE6D6 50%, var(--green));
}
.bar-fill { height: 100%; width: 98%; background: var(--line); transition: width 1.2s ease; }
.meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0 1rem; margin-top: .4rem; font-size: .85rem; color: var(--mute); }

/* ---- Footer ---- */
.foot { margin-top: auto; font-size: .85rem; color: var(--mute); line-height: 1.45; }
.how { margin-top: .3rem; }
.how summary { cursor: pointer; color: var(--ink); padding: .25rem 0; }
.how p { margin-top: .4rem; text-align: left; }

@media (max-width: 480px) { .meta { justify-content: center; } }
@media (min-width: 720px) {
  .page { padding-top: 5vh; gap: 1.6rem; }
  .flag { --w: 108px; --h: 72px; }
  .stand { padding: 1rem 1.4rem; }
  .stand-text { font-size: 1.5rem; }
  .tally { padding: 1.3rem 1.2rem 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
