:root {
  --turmeric: #f3c443;
  --turmeric-wash: #fdf4d6;
  --leaf: #1f5a37;
  --leaf-deep: #123a24;
  --leaf-soft: #e3eedf;
  --kumkum: #b3261e;
  --marigold: #e8892b;
  --surface: #ffffff;
  --line: #d9d2b8;
  --muted: #4f5d48;
  --radius-field: 10px;
  --radius-panel: 18px;
  font-family: 'Anek Telugu', 'Noto Sans Telugu', system-ui, sans-serif;
  font-variation-settings: 'wdth' 100;
  color: var(--leaf-deep);
  background: var(--turmeric-wash);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--turmeric-wash); }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--leaf); outline-offset: 2px; }
[hidden] { display: none !important; }

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important; clip-path: inset(50%) !important; overflow: hidden !important;
  width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; border: 0 !important; white-space: nowrap !important;
}

.skip { position: absolute; left: 12px; top: -60px; z-index: 5; background: var(--leaf-deep); color: #fff; padding: 10px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }

/* ---------- Hero: turmeric field with a mango-leaf thoranam ---------- */
.hero {
  background: var(--turmeric);
  position: relative;
  padding: 58px 16px 64px;
  overflow: hidden;
}
.thoranam {
  position: absolute; inset: 0 0 auto 0; height: 46px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='46' viewBox='0 0 80 46'%3E%3Cpath d='M0 5 Q40 10 80 5' fill='none' stroke='%238a5a1c' stroke-width='2'/%3E%3Cpath d='M20 7 C31 17 29 33 20 44 C11 33 9 17 20 7Z' fill='%231f5a37'/%3E%3Cpath d='M20 10 L20 41' stroke='%23f3c443' stroke-width='1'/%3E%3Ccircle cx='60' cy='15' r='8.5' fill='%23e8892b'/%3E%3Ccircle cx='60' cy='15' r='4' fill='%23b3261e'/%3E%3C/svg%3E")
    repeat-x left top / 80px 46px;
}
@media (prefers-reduced-motion: no-preference) {
  .thoranam { animation: hang 900ms cubic-bezier(.2, .9, .3, 1.2) both; transform-origin: top; }
  @keyframes hang { from { transform: translateY(-100%); } to { transform: translateY(0); } }
}
.hero-inner { max-width: 1080px; margin: 0 auto; }

.brand { display: flex; align-items: center; gap: 12px; margin: 0 0 20px; }
.brand img { width: 56px; height: 56px; border-radius: 50%; box-shadow: 0 0 0 3px var(--surface); }
.brand > span { display: grid; line-height: 1.15; }
.brand-te { font-size: 1.25rem; font-weight: 700; }
.brand-en { font-size: .9rem; color: var(--leaf); }

.hero h1 {
  margin: 0;
  font-size: clamp(2.1rem, 8.4vw, 4.4rem);
  line-height: 1.12;
  font-weight: 800;
  font-variation-settings: 'wdth' 80;
  max-width: 14ch;
  color: var(--leaf-deep);
  text-wrap: balance;
}
.lede { font-size: 1.08rem; max-width: 46ch; margin: 14px 0 0; color: var(--leaf-deep); }

.steps { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; counter-reset: step; max-width: 46ch; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 34px 1fr; column-gap: 12px; font-size: .98rem; }
.steps li::before {
  content: counter(step); grid-row: span 2;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700;
  background: var(--leaf); color: var(--turmeric);
}
.steps strong { display: block; font-weight: 700; }

/* ---------- Form sheet ---------- */
.sheet { max-width: 1080px; margin: -40px auto 0; padding: 0 16px 48px; position: relative; outline: none; }
.panel {
  background: var(--surface);
  border-radius: var(--radius-panel);
  padding: 24px 18px 28px;
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -24px rgba(18, 58, 36, .45);
  max-width: 640px;
}
.panel h2 { margin: 0 0 6px; font-size: 1.6rem; line-height: 1.2; font-weight: 750; outline: none; }
.panel h2 span { display: block; font-size: 1rem; font-weight: 500; color: var(--muted); }
.note { margin: 0 0 20px; color: var(--muted); font-size: .95rem; }
.req { color: var(--kumkum); font-weight: 700; }

.field, .who { margin: 0 0 20px; }
.who { border: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.who legend { font-weight: 650; margin-bottom: 8px; padding: 0; }
.who .error-msg { grid-column: 1 / -1; }
label, .label { display: block; font-weight: 650; margin-bottom: 6px; }
label span[lang="te"], .label span[lang="te"] { font-weight: 450; color: var(--muted); }

.choice { margin: 0; position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice > span {
  display: block; text-align: center; padding: 14px 10px; border-radius: var(--radius-field);
  border: 2px solid var(--line); background: var(--surface); font-weight: 500;
}
.choice > span strong { display: block; font-size: 1.1rem; }
.choice input:checked + span { border-color: var(--leaf); background: var(--leaf-soft); }
.choice input:focus-visible + span { outline: 3px solid var(--leaf); outline-offset: 2px; }

input[type="text"], input[type="tel"], textarea, select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-field);
  background: var(--surface);
  padding: 12px 14px;
  font-size: 1.05rem; /* ≥16px stops iOS zooming on focus */
  min-height: 48px;
}
input:focus, textarea:focus, select:focus { border-color: var(--leaf); }
textarea {
  field-sizing: content;
  min-block-size: 8lh;
  max-block-size: 22lh;
  resize: vertical;
  line-height: 1.5;
}
.phone-wrap { display: flex; align-items: stretch; }
.prefix { display: grid; place-items: center; padding: 0 12px; border: 1.5px solid var(--line); border-right: 0; border-radius: var(--radius-field) 0 0 var(--radius-field); background: var(--turmeric-wash); font-weight: 600; }
.phone-wrap input { border-radius: 0 var(--radius-field) var(--radius-field) 0; }
.hint { margin: 6px 0 0; font-size: .9rem; color: var(--muted); }

.photo-drop {
  display: flex; align-items: center; gap: 14px; cursor: pointer; font-weight: 400;
  width: 100%; text-align: left;
  border: 2px dashed var(--line); border-radius: var(--radius-field); padding: 14px; background: var(--turmeric-wash);
}
.photo-drop:hover { border-color: var(--leaf); }
.photo-drop img { width: 72px; height: 90px; object-fit: cover; border-radius: 8px; flex: none; }
.photo-copy { display: grid; gap: 2px; font-size: .92rem; color: var(--muted); }
.photo-copy strong { color: var(--leaf); font-size: 1.02rem; }

/* Validation: only after interaction (:user-invalid) or a failed submit (.show-errors) */
.error-msg { display: none; margin: 6px 0 0; color: var(--kumkum); font-size: .92rem; font-weight: 600; }
.error-msg [role="img"] { display: inline-grid; place-items: center; width: 1.2em; height: 1.2em; border-radius: 50%; background: var(--kumkum); color: #fff; font-size: .8em; margin-right: 4px; }
:is(input, textarea, select):user-invalid { border-color: var(--kumkum); }
.field:has(:user-invalid) .error-msg,
.who:has(:user-invalid) .error-msg,
.consent:has(:user-invalid) + .error-msg,
.field.has-error .error-msg,
.who.has-error .error-msg,
.consent.has-error + .error-msg { display: block; }
.field.has-error :is(input, textarea, select) { border-color: var(--kumkum); }
.who.has-error .choice > span { border-color: var(--kumkum); }
.field.has-error .photo-drop { border-color: var(--kumkum); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 8px; }
.primary {
  border: 0; border-radius: 999px; padding: 15px 28px; min-height: 52px;
  background: var(--leaf); color: #fff; font-size: 1.08rem; font-weight: 700; cursor: pointer;
}
.primary:hover { background: var(--leaf-deep); }
.primary[aria-disabled="true"] { opacity: .7; cursor: progress; }
.link { border: 0; background: none; padding: 8px 2px; color: var(--leaf); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 1rem; }
.status { margin: 14px 0 0; min-height: 1.5em; color: var(--muted); }
.status.is-error { color: var(--kumkum); font-weight: 600; }

/* Missing-details screen */
.subhead { font-size: 1.1rem; font-weight: 750; margin: 22px 0 2px; }
.subhead + .hint { margin: 0 0 12px; }
#missingRequired .grid, #missingOptional .grid { margin-top: 12px; }
.saved { color: var(--leaf); }

/* Review screen */
.missing { border-left: 5px solid var(--turmeric); background: var(--turmeric-wash); padding: 14px 16px; border-radius: 0 var(--radius-field) var(--radius-field) 0; margin: 14px 0 22px; }
.missing p { margin: 0 0 6px; font-weight: 650; }
.missing ul { margin: 0; padding-left: 1.2em; }
.missing a { color: var(--leaf-deep); }
.found { margin: 10px 0 18px; color: var(--muted); }

.group { border: 0; padding: 0; margin: 0 0 22px; }
.group legend { font-size: 1.15rem; font-weight: 750; padding: 0; margin-bottom: 4px; }
.group legend span { font-weight: 450; color: var(--muted); font-size: .95rem; margin-left: 6px; }
.group .private-note { margin: 0 0 12px; font-size: .9rem; color: var(--muted); }
.grid { display: grid; gap: 0 16px; margin-top: 10px; }
.grid .field { margin-bottom: 16px; }
.field.is-missing label::after { content: 'Missing'; margin-left: 8px; font-size: .78rem; font-weight: 700; color: var(--leaf-deep); background: var(--turmeric); padding: 1px 8px; border-radius: 999px; vertical-align: 2px; }
.field.is-missing :is(input, select) { border-color: #d9a91f; background: #fffbea; }

.consent { display: grid; grid-template-columns: 26px 1fr; gap: 10px; font-weight: 450; margin: 8px 0 0; font-size: .95rem; }
.consent input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--leaf); }

/* Done */
.done p { font-size: 1.05rem; max-width: 52ch; }
.done .ref { font-size: 2.2rem; font-weight: 800; letter-spacing: .04em; color: var(--leaf); margin: 0; font-variation-settings: 'wdth' 85; }

.foot { max-width: 1080px; margin: 0 auto; padding: 8px 16px 40px; color: var(--muted); font-size: .92rem; }
.foot p { max-width: 64ch; }
.foot .small { font-size: .82rem; }

@media (min-width: 640px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .panel { padding: 32px 32px 34px; }
}

@media (min-width: 960px) {
  /* Hero and form share one grid row: the form sits in the hero's right half,
     and the turmeric field grows to whatever height the form needs. */
  body { display: grid; grid-template-columns: 100%; }
  .hero { grid-row: 1; grid-column: 1; padding: 88px 32px 64px; }
  .hero-inner > * { max-width: 470px; }
  .sheet { grid-row: 1; grid-column: 1; width: 100%; margin: 0 auto; padding: 88px 32px 64px; align-self: start; }
  .sheet .panel { margin-left: auto; width: min(100%, 540px); }
  .foot { grid-row: 2; padding-inline: 32px; width: 100%; }
  /* Review and done screens are longer: give them the full width below the hero */
  body:has(#pasteForm[hidden]) .sheet { grid-row: 2; margin-top: -48px; padding-top: 0; }
  body:has(#pasteForm[hidden]) .sheet .panel:not([hidden]) { margin-inline: auto; width: min(100%, 820px); max-width: none; }
  body:has(#pasteForm[hidden]) .foot { grid-row: 3; }
}
