/* ==========================================================================
   Shivganga — Donate
   Page-specific components only; tokens, resets, utilities, the page hero
   and the closing CTA band come from page.css, which must load first.
   Scoped under .sg-dn.

   Note on specificity: page.css sets .sg-page p / li / h2 / a, all (0,1,1).
   Any rule here that targets one of those elements is prefixed .sg-page so it
   wins; a bare single class would silently lose.
   ========================================================================== */

.sg-dn-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}

/* ==========================================================================
   THE FORM
   ========================================================================== */
.sg-dn-form {
  background: var(--sg-white);
  border: 1px solid var(--sg-cream-2);
  border-radius: var(--sg-radius-lg);
  box-shadow: var(--sg-shadow);
  padding: clamp(22px, 3vw, 40px);
}

/* Numbered steps, so it is obvious how much is left to do. */
.sg-dn-step + .sg-dn-step {
  margin-top: clamp(26px, 3.4vw, 40px);
  padding-top: clamp(26px, 3.4vw, 40px);
  border-top: 1px solid var(--sg-cream-2);
}
.sg-page .sg-dn-step > h2 {
  display: flex; align-items: center; gap: .7rem;
  font-size: clamp(1.1rem, 1.7vw, 1.3rem);
  margin-bottom: .9em;
}
.sg-dn-step__n {
  flex: none;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--sg-green); color: #fff;
  font-family: var(--sg-font-head); font-weight: 700; font-size: .85rem;
  display: grid; place-items: center;
}
.sg-page .sg-dn-step__hint {
  font-size: .9rem; color: var(--sg-muted-2);
  margin-top: -.5rem; margin-bottom: 1rem;
}

/* ---------- causes: radio cards ---------- */
.sg-dn-causes { display: grid; gap: .6rem; }
.sg-dn-cause { position: relative; display: block; cursor: pointer; }
.sg-dn-cause input {
  position: absolute; opacity: 0;
  width: 1px; height: 1px; margin: 0;
}
.sg-dn-cause__box {
  display: flex; align-items: center; gap: .85rem;
  border: 1.5px solid var(--sg-cream-2);
  border-radius: 12px;
  padding: .9rem 1.1rem;
  background: var(--sg-paper);
  transition: border-color .18s ease, background .18s ease;
}
.sg-dn-cause__box::before {
  content: "";
  flex: none;
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--sg-green-soft);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.sg-dn-cause:hover .sg-dn-cause__box { border-color: var(--sg-green-soft); }
.sg-dn-cause input:checked + .sg-dn-cause__box {
  border-color: var(--sg-green);
  background: var(--sg-green-tint);
}
.sg-dn-cause input:checked + .sg-dn-cause__box::before {
  border-color: var(--sg-green);
  box-shadow: inset 0 0 0 4px var(--sg-green);
}
/* Keyboard focus has to be visible: the real radio is off-screen. */
.sg-dn-cause input:focus-visible + .sg-dn-cause__box {
  outline: 3px solid var(--sg-orange); outline-offset: 2px;
}
.sg-dn-cause__name {
  font-family: var(--sg-font-head); font-weight: 600; font-size: 1rem;
  color: var(--sg-ink); line-height: 1.35;
}

/* ---------- amounts ---------- */
.sg-dn-amounts { display: flex; flex-wrap: wrap; gap: .6rem; }
.sg-dn-amt { position: relative; }
.sg-dn-amt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.sg-dn-amt__box {
  display: block; cursor: pointer;
  border: 1.5px solid var(--sg-cream-2);
  border-radius: 999px;
  padding: .62rem 1.3rem;
  background: var(--sg-paper);
  font-family: var(--sg-font-head); font-weight: 700; font-size: 1rem;
  color: var(--sg-ink);
  transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}
.sg-dn-amt:hover .sg-dn-amt__box { border-color: var(--sg-green-soft); }
.sg-dn-amt input:checked + .sg-dn-amt__box {
  background: var(--sg-green); border-color: var(--sg-green); color: #fff;
  transform: translateY(-1px);
}
.sg-dn-amt input:focus-visible + .sg-dn-amt__box {
  outline: 3px solid var(--sg-orange); outline-offset: 2px;
}

/* The free amount. A rupee sign sits inside the field rather than in the
   placeholder, so it stays visible once there is a number in the box. */
.sg-dn-other { margin-top: .9rem; max-width: 280px; }
.sg-dn-other__wrap { position: relative; }
.sg-dn-other__rs {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  font-family: var(--sg-font-head); font-weight: 700;
  color: var(--sg-muted-2); pointer-events: none;
}
.sg-dn-other input {
  width: 100%;
  font-family: var(--sg-font-head); font-weight: 700; font-size: 1rem;
  color: var(--sg-ink); background: var(--sg-paper);
  border: 1.5px solid var(--sg-cream-2); border-radius: 999px;
  padding: .62rem 1.2rem .62rem 2.2rem;
  transition: border-color .18s ease, background .18s ease;
}
.sg-dn-other input:focus {
  outline: none; background: var(--sg-white);
  border-color: var(--sg-green);
  box-shadow: 0 0 0 3px rgba(14,107,87,.14);
}
/* Number spinners crowd a short field and invite mis-clicks. */
.sg-dn-other input::-webkit-outer-spin-button,
.sg-dn-other input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sg-dn-other input { -moz-appearance: textfield; appearance: textfield; }

/* The running total, so nobody reaches Razorpay unsure what they are paying. */
.sg-dn-total {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem;
  margin-top: 1.2rem; padding: .9rem 1.2rem;
  background: var(--sg-green-tint); border-radius: 12px;
}
.sg-dn-total__label {
  font-family: var(--sg-font-head); font-weight: 600; font-size: .82rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--sg-green);
}
.sg-dn-total__value {
  font-family: var(--sg-font-head); font-weight: 800;
  font-size: clamp(1.4rem, 2.4vw, 1.85rem);
  color: var(--sg-green-dark); margin-left: auto;
}
.sg-dn-total.is-empty .sg-dn-total__value { color: var(--sg-muted-2); font-weight: 600; font-size: 1rem; }

/* ---------- fields ---------- */
.sg-dn-rows { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(14px, 1.8vw, 20px); }
.sg-dn-field { display: flex; flex-direction: column; }
.sg-dn-field--wide { grid-column: 1 / -1; }

.sg-dn-field label {
  font-family: var(--sg-font-head); font-weight: 600;
  font-size: .84rem; letter-spacing: .02em;
  color: var(--sg-ink); margin-bottom: .45rem;
}
.sg-dn-field label .req { color: var(--sg-orange-dark); margin-left: .15rem; }
.sg-dn-field input {
  font-family: var(--sg-font-body); font-size: .98rem;
  color: var(--sg-ink); background: var(--sg-paper);
  border: 1.5px solid var(--sg-cream-2); border-radius: 10px;
  padding: .78rem 1rem; width: 100%;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.sg-dn-field input:hover { border-color: var(--sg-green-soft); }
.sg-dn-field input:focus {
  outline: none; background: var(--sg-white);
  border-color: var(--sg-green);
  box-shadow: 0 0 0 3px rgba(14,107,87,.14);
}
.sg-dn-field input::placeholder { color: var(--sg-muted-2); opacity: .7; }
.sg-dn-field input#dn-pan { text-transform: uppercase; letter-spacing: .06em; }

.sg-dn-field.is-bad input { border-color: #C4551A; background: var(--sg-orange-pale); }
.sg-dn-field__err { font-size: .8rem; color: #A5450F; margin-top: .35rem; min-height: 1.1em; }
.sg-page .sg-dn-field__note { font-size: .8rem; color: var(--sg-muted-2); margin: .35rem 0 0; }

/* ---------- foot ---------- */
.sg-page .sg-dn-terms {
  font-size: .84rem; line-height: 1.65;
  color: var(--sg-muted-2);
  margin: 1.4rem 0 0;
}
.sg-page .sg-dn-terms a { color: var(--sg-green); font-weight: 600; text-decoration: underline; }
.sg-dn-submit { margin-top: 1.2rem; }
.sg-dn-submit .sg-btn { width: 100%; justify-content: center; font-size: 1.05rem; padding: 1rem 1.6rem; }
/* Disabled here means "nothing to donate yet", not "working" — the label
   changes to "Opening payment…" on its own when it really is busy. */
.sg-dn-form button[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.sg-dn-form button[disabled]:hover { transform: none; background: var(--sg-orange); }

/* The line under the button saying why it is inactive. */
.sg-page .sg-dn-gate {
  font-size: .84rem; color: var(--sg-muted-2);
  margin: .6rem 0 0; text-align: center;
}

.sg-dn-status {
  margin-top: 1.1rem; border-radius: 10px;
  padding: .9rem 1.1rem; font-size: .93rem;
  display: none;
}
.sg-dn-status.is-on { display: block; }
.sg-dn-status.is-err { background: var(--sg-orange-pale); color: #A5450F; border: 1px solid #F0C4A4; }

/* ==========================================================================
   ASIDE — the reassurance panel
   ========================================================================== */
.sg-dn-aside {
  position: sticky;
  top: calc(var(--sg-header-h) + 20px);
  display: grid; gap: clamp(14px, 1.8vw, 18px);
}
.sg-dn-card {
  background: var(--sg-white);
  border: 1px solid var(--sg-cream-2);
  border-radius: var(--sg-radius);
  padding: clamp(18px, 2.2vw, 26px);
}
.sg-dn-card--green {
  background: linear-gradient(135deg, var(--sg-green) 0%, var(--sg-green-dark) 100%);
  border-color: transparent; color: #fff;
}
.sg-page .sg-dn-card h3 {
  font-size: .76rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--sg-green);
  margin-bottom: .8em;
}
.sg-page .sg-dn-card--green h3 { color: #F6B98C; }
.sg-page .sg-dn-card p { font-size: .92rem; line-height: 1.65; margin-bottom: .8rem; }
.sg-page .sg-dn-card p:last-child { margin-bottom: 0; }
.sg-page .sg-dn-card--green p { color: rgba(255,255,255,.9); }
.sg-page .sg-dn-card a { color: var(--sg-green); font-weight: 600; text-decoration: underline; }
.sg-page .sg-dn-card--green a { color: #fff; }

.sg-dn-trust { display: grid; gap: .85rem; }
.sg-dn-trust li {
  display: grid; grid-template-columns: 20px minmax(0, 1fr);
  gap: .7rem; align-items: start;
  font-size: .92rem; line-height: 1.6; color: var(--sg-muted);
}
.sg-dn-trust svg { width: 18px; height: 18px; color: var(--sg-green); margin-top: .15rem; }
.sg-dn-trust b { color: var(--sg-ink); font-weight: 600; }

/* The registration and 80G block, set small — it is reference, not reading. */
.sg-page .sg-dn-reg {
  font-size: .78rem; line-height: 1.6; color: var(--sg-muted-2);
  margin: 0;
}
.sg-dn-reg b { color: var(--sg-ink-2); font-weight: 600; }

/* ==========================================================================
   WHAT A GIFT PAYS FOR
   ========================================================================== */
.sg-dn-does { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px, 3vw, 40px); }
.sg-dn-does figure {
  margin: 0;
  background: var(--sg-white);
  border: 1px solid var(--sg-cream-2);
  border-radius: var(--sg-radius);
  overflow: hidden;
}
.sg-dn-does__media { aspect-ratio: 3 / 2; overflow: hidden; background: var(--sg-green-tint); }
.sg-dn-does__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sg-dn-does figcaption { padding: clamp(18px, 2.2vw, 26px); }
.sg-page .sg-dn-does h3 { font-size: 1.2rem; margin-bottom: .4em; }
.sg-page .sg-dn-does p { font-size: .96rem; margin-bottom: 0; }

/* ==========================================================================
   LOADER — shown while the payment is being recorded
   Razorpay has closed by this point and money has moved, so it is important
   that nobody navigates away. It covers the page deliberately.
   ========================================================================== */
.sg-dn-loader {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(251,248,243,.94);
  display: none; place-items: center;
  text-align: center; padding: 24px;
}
.sg-dn-loader.is-on { display: grid; }
.sg-dn-loader__ring {
  width: 54px; height: 54px; margin: 0 auto 1.2rem;
  border: 5px solid var(--sg-green-pale);
  border-top-color: var(--sg-green);
  border-radius: 50%;
  animation: sgDnSpin 1s linear infinite;
}
@keyframes sgDnSpin { to { transform: rotate(360deg); } }
.sg-page .sg-dn-loader p {
  font-family: var(--sg-font-head); font-weight: 600;
  color: var(--sg-ink); margin: 0;
}
.sg-page .sg-dn-loader small { display: block; margin-top: .4rem; color: var(--sg-muted-2); font-size: .88rem; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 980px) {
  .sg-dn-grid { grid-template-columns: 1fr; }
  /* Below the form on a phone, so it is not a wall of text before the ask. */
  .sg-dn-aside { position: static; top: auto; }
}
@media (max-width: 760px) {
  .sg-dn-does { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .sg-dn-rows { grid-template-columns: 1fr; }
  .sg-dn-amounts { gap: .5rem; }
  .sg-dn-amt__box { padding: .58rem 1.05rem; font-size: .95rem; }
}

@media (prefers-reduced-motion: reduce) {
  .sg-dn-cause__box, .sg-dn-amt__box, .sg-dn-field input, .sg-dn-other input { transition: none; }
  .sg-dn-amt input:checked + .sg-dn-amt__box { transform: none; }
  .sg-dn-loader__ring { animation-duration: 3s; }
}

/* Appended after review: the label for the free-amount field, and the line
   that stands in for the amount chips before a cause has been chosen. */
.sg-dn-other__label {
  display: block;
  font-family: var(--sg-font-head); font-weight: 600;
  font-size: .84rem; color: var(--sg-ink);
  margin-bottom: .45rem;
}

/* Test-mode notice. Deliberately loud and unlike anything else on the page —
   it must be impossible to mistake a sandbox form for the live one. */
.sg-page .sg-dn-testbadge {
  grid-column: 1 / -1;
  background: #FFF4D6;
  border: 1.5px dashed #C08A1E;
  border-radius: var(--sg-radius);
  color: #6B4B08;
  padding: .85rem 1.1rem;
  font-size: .92rem; line-height: 1.6;
  margin: 0 0 clamp(14px, 2vw, 20px);
}
.sg-dn-testbadge b { color: #4A3405; }
