/* ==========================================================================
   Perne Kshetra forms: screen UI.
   Type: Anek (Ek Type) - one design for Latin, Kannada and Malayalam.
   Colour: neutral zinc + one accent (the site's red, deepened for contrast).
   Radius rule: controls 10px, panels 16px. Nothing else.
   The A4 sheet and print rules live in sheet.css.
   ========================================================================== */

@font-face {
  font-family: "Anek";
  font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("fonts/anek-kannada-latin-wght-normal.woff2") format("woff2-variations"), url("fonts/anek-kannada-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Anek";
  font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("fonts/anek-kannada-kannada-wght-normal.woff2") format("woff2-variations"), url("fonts/anek-kannada-kannada-wght-normal.woff2") format("woff2");
  unicode-range: U+0951-0952, U+0964-0965, U+0C80-0CF3, U+1CD0, U+1CD2-1CD3, U+1CDA, U+1CF2, U+1CF4, U+200C-200D, U+20B9, U+25CC, U+A830-A835;
}
@font-face {
  font-family: "Anek";
  font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("fonts/anek-malayalam-malayalam-wght-normal.woff2") format("woff2-variations"), url("fonts/anek-malayalam-malayalam-wght-normal.woff2") format("woff2");
  unicode-range: U+0307, U+0323, U+0951-0952, U+0964-0965, U+0D00-0D7F, U+1CDA, U+1CF2, U+200C-200D, U+20B9, U+25CC, U+A830-A832;
}

:root {
  --nav-h: 70px;
  --bg: #f4f4f5;
  --surface: #ffffff;
  --ink: #18181b;
  --ink-2: #52525b;
  --ink-3: #6b6b74;
  --line: #e4e4e7;
  --field: #c9c9d1;
  --accent: #b91c1c;
  --accent-hover: #991b1b;
  --accent-soft: #fef2f2;
  --ok: #15803d;
  --error: #b42318;
  --error-soft: #fef3f2;
  --r-control: 10px;
  --r-panel: 16px;
  --ui: "Anek", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Page ---------- */

body.forms-page {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  padding-top: var(--nav-h);
  -webkit-font-smoothing: antialiased;
}
/* Reset site-wide rules from css/custom.css (p padding, Acme headings, h2 red rule). */
body.forms-page p { padding-bottom: 0; }
body.forms-page h1, body.forms-page h2, body.forms-page h3 {
  font-family: var(--ui); text-transform: none; text-align: left; padding-top: 0; font-style: normal; color: var(--ink);
}
.fp-wrap.narrow { max-width: 800px; }
body.forms-page h2::after { content: none; display: none; }

.fp-wrap { max-width: 1240px; margin: 0 auto; padding: 28px 16px 40px; }

.fp-header { margin-bottom: 24px; max-width: 640px; }
.fp-back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-2); font-size: 15px; text-decoration: none; margin-bottom: 10px;
}
.fp-back:hover, .fp-back:focus { color: var(--accent); text-decoration: none; }
.fp-header h1 {
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 6px;
  text-align: left;
}
.fp-header .fp-sub { font-size: 18px; color: var(--ink-2); margin: 0 0 14px; }
.fp-privacy { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.5; color: var(--ink-2); margin: 0; }
.fp-privacy i { color: var(--ok); margin-top: 3px; }

/* Notice: the form maker does not register; the signed paper form must be submitted. */
.fp-notice {
  display: flex; gap: 12px; align-items: flex-start; margin: 0 0 16px; padding: 14px 16px;
  background: var(--accent-soft); border: 1px solid #fecaca; border-radius: 10px; color: var(--ink);
}
.fp-notice > i { color: var(--accent); font-size: 18px; margin-top: 2px; }
.fp-notice p { margin: 0; padding: 0; font-size: 15px; line-height: 1.55; }
.fp-notice p + p { margin-top: 8px; }
.fp-notice .kn { color: var(--ink-2); }
.fp-item .fp-notice { margin: 4px 0 16px; }

.fp-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; align-items: start; }
@media (min-width: 1100px) {
  .fp-layout { grid-template-columns: minmax(0, 580px) minmax(0, 1fr); gap: 40px; }
}

/* ---------- Language switch (Pandal Mangalam) ---------- */

.fp-lang { display: inline-grid; grid-auto-flow: column; gap: 4px; padding: 4px; background: #e4e4e7; border-radius: var(--r-control); margin-bottom: 20px; }
.fp-lang a {
  min-height: 40px; display: inline-flex; align-items: center; padding: 0 16px;
  border-radius: 7px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 16px;
}
.fp-lang a:hover { color: var(--ink); text-decoration: none; }
.fp-lang a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(24,24,27,.12); }

/* ---------- Section progress chips (marriage form) ---------- */

.fp-chips {
  position: sticky; top: var(--nav-h); z-index: 20;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -16px 16px; padding: 10px 16px;
  background: rgba(244, 244, 245, 0.92);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.fp-chips::-webkit-scrollbar { display: none; }
.fp-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px; border-radius: var(--r-control);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
  font-size: 15px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.fp-chip:hover, .fp-chip:focus { text-decoration: none; color: var(--ink); }
.fp-chip .n { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 14px; }
.fp-chip .ic { display: none; color: var(--ok); }
.fp-chip.is-done .ic { display: inline; }
.fp-chip.is-done .n { display: none; }
.fp-chip.is-bad { border-color: var(--error); }
.fp-chip.is-bad .n { color: var(--error); }
.fp-chip.is-active { border-color: var(--ink); color: var(--ink); }

/* ---------- Sections and fields ---------- */

.fp-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: 22px 20px 4px;
  margin-bottom: 16px;
  scroll-margin-top: calc(var(--nav-h) + 72px);
}
@media (min-width: 640px) { .fp-section { padding: 28px 28px 8px; } }
.fp-section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 18px; }
.fp-section-head h2 { font-size: 22px; font-weight: 650; margin: 0; color: var(--ink); }
.fp-section-head .tr { font-size: 17px; color: var(--ink-3); }
/* body.forms-page raises specificity over the reset above, which zeroes heading padding. */
body.forms-page .fp-subhead { font-size: 17px; font-weight: 600; margin: 32px 0 14px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--ink); }

.f { margin-bottom: 20px; min-width: 0; }
.f-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0 0 7px; font-weight: 400; }
.f-label .en { font-size: 16px; font-weight: 600; color: var(--ink); }
.f-label .req { color: var(--accent); margin-left: -6px; }
.f-label .tr { font-size: 15px; color: var(--ink-3); }
.f-control { position: relative; }

.f input, .f textarea, .f select {
  display: block; width: 100%;
  min-height: 52px; padding: 12px 42px 12px 14px;
  font-family: var(--ui); font-size: 18px; font-weight: 500; line-height: 1.3;
  color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--field); border-radius: var(--r-control);
  box-shadow: none; -webkit-appearance: none; appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.f textarea { resize: none; overflow: hidden; min-height: 84px; }
.f input::placeholder, .f textarea::placeholder { color: #8b8b94; font-weight: 400; letter-spacing: 0.02em; }
.f input[data-upper], .f textarea[data-upper] { text-transform: uppercase; letter-spacing: 0.03em; }
.f input[data-upper]::placeholder { text-transform: none; }
.f input[data-mask] { font-variant-numeric: tabular-nums; letter-spacing: 0.06em; }
.f select {
  cursor: pointer; padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2352525b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
.f select:has(option[value=""]:checked) { color: #8b8b94; font-weight: 400; }
.f select option { color: var(--ink); }
.f input:hover, .f textarea:hover, .f select:hover { border-color: #a1a1aa; }
.f input:focus, .f textarea:focus, .f select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.14);
}
.f input[readonly] {
  background: #f4f4f5; border-color: transparent; color: var(--ink-2);
}
.f-control select ~ .f-ok { right: 40px; }
.f-ok {
  position: absolute; right: 14px; top: 17px; color: var(--ok);
  opacity: 0; transform: scale(.6); pointer-events: none;
}
.f.is-valid .f-ok { opacity: 1; transform: none; }
@media (prefers-reduced-motion: no-preference) { .f-ok { transition: opacity .2s var(--ease), transform .25s var(--ease); } }

.f-hint { font-size: 14px; line-height: 1.45; color: var(--ink-3); margin: 6px 0 0; }
.f-error { display: none; align-items: flex-start; gap: 6px; font-size: 14.5px; line-height: 1.4; color: var(--error); margin: 6px 0 0; font-weight: 500; }
.f.is-invalid input, .f.is-invalid textarea, .f.is-invalid select { border-color: var(--error); background: var(--error-soft); }
.f.is-invalid input:focus, .f.is-invalid textarea:focus { box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.14); }
.f.is-invalid .f-error { display: flex; }
.f.is-invalid .f-hint { display: none; }

.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.f-row.dob { grid-template-columns: minmax(0, 1fr) 112px; }
/* Line up the inputs in a row when one label wraps to two lines:
   label, control, hint and error share the row's grid tracks. */
@supports (grid-template-rows: subgrid) {
  .f-row .f { display: grid; grid-row: span 4; grid-template-rows: subgrid; align-content: start; }
  .f-row .f-label { align-self: end; }
}
@media (max-width: 420px) {
  .f-row { grid-template-columns: 1fr; }
  .f-row.dob { grid-template-columns: minmax(0, 1fr) 96px; }
}

.fp-note { font-size: 15px; color: var(--ink-2); line-height: 1.5; margin: 0 0 20px; }

/* ---------- Finish panel (end of form) ---------- */

.fp-finish { padding-bottom: 22px; }
.fp-finish h2 { font-size: 22px; font-weight: 650; margin: 0 0 8px; }
.fp-steps { margin: 0 0 18px; padding-left: 22px; color: var(--ink-2); font-size: 16px; line-height: 1.55; }
.fp-steps li { margin-bottom: 4px; }
.fp-help { border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 18px; }
.fp-help summary { cursor: pointer; font-weight: 600; color: var(--ink); font-size: 16px; list-style-position: outside; }
.fp-help ul { margin: 10px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 15px; line-height: 1.55; }
.fp-finish .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Buttons ---------- */

.btn-x {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: var(--r-control);
  font-family: var(--ui); font-size: 17px; font-weight: 600; white-space: nowrap;
  border: 1.5px solid transparent; cursor: pointer; text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
.btn-x:active { transform: scale(0.98); }
.btn-x:focus-visible { outline: 3px solid rgba(185, 28, 28, 0.35); outline-offset: 2px; }
.btn-primary-x { background: var(--accent); color: #fff; }
.btn-primary-x:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary-x { background: var(--surface); color: var(--ink); border-color: var(--field); }
.btn-secondary-x:hover { border-color: var(--ink-2); }
.btn-quiet-x { background: transparent; color: var(--ink-2); padding: 0 12px; font-weight: 500; }
.btn-quiet-x:hover { color: var(--error); }
.btn-quiet-x.confirm { color: #fff; background: var(--error); }
/* Preview / Print while a date rule fails: looks off, but a tap still explains why. */
.btn-x.is-disabled { opacity: 0.45; cursor: not-allowed; }
.btn-x.is-disabled:active { transform: none; }
.btn-primary-x.is-disabled:hover { background: var(--accent); }
.btn-secondary-x.is-disabled:hover { border-color: var(--field); }

/* ---------- Error summary ---------- */

.fp-errors {
  display: none; border: 1.5px solid var(--error); background: var(--error-soft);
  border-radius: var(--r-panel); padding: 16px 18px; margin-bottom: 16px; color: var(--ink);
}
.fp-errors.show { display: block; }
.fp-errors strong { display: block; font-size: 17px; margin-bottom: 6px; color: var(--error); }
.fp-errors ul { margin: 0; padding-left: 20px; }
.fp-errors a { color: var(--error); text-decoration: underline; font-weight: 500; }

/* ---------- Blocked by a date rule ---------- */

.fp-block[hidden] { display: none !important; }
.fp-block-list {
  border: 1.5px solid var(--error); background: var(--error-soft); color: var(--ink);
  border-radius: var(--r-control); padding: 12px 16px; margin: 0 0 14px; font-size: 15px; line-height: 1.5;
}
.fp-block-list strong { display: block; color: var(--error); margin-bottom: 4px; }
.fp-block-list ul { margin: 0; padding-left: 20px; }
.fp-block-bar {
  flex: 1 0 100%; display: flex; gap: 8px; align-items: center; margin: 0;
  font-size: 14.5px; font-weight: 500; line-height: 1.35; color: var(--error);
}
.fp-preview.is-blocked .sheets { filter: blur(2px); opacity: 0.35; pointer-events: none; user-select: none; }
.fp-print-block { display: none; }

/* ---------- Preview ---------- */

.fp-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.fp-preview-head h2 { font-size: 18px; font-weight: 600; margin: 0; color: var(--ink); }
.fp-preview-head h2 small { font-size: 15px; font-weight: 400; color: var(--ink-3); margin-left: 6px; }
.fp-preview .sheets { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.fp-close { display: none; }

@media (min-width: 1100px) {
  .fp-preview {
    position: sticky; top: calc(var(--nav-h) + 16px);
    max-height: calc(100vh - var(--nav-h) - 32px); overflow: auto;
    padding: 0 6px 16px; scrollbar-width: thin;
  }
  .fp-preview-head { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 2px 0 12px; margin-bottom: 0; }
}

/* Below 1100px the preview is a full-screen overlay opened from the bar. */
@media (max-width: 1099.98px) {
  .fp-preview { display: none; }
  .fp-preview.fp-measure { display: block; position: absolute; left: -10000px; top: 0; width: 900px; visibility: hidden; }
  .fp-preview.is-open {
    display: block; position: fixed; inset: 0; z-index: 1100;
    background: #d4d4d8; overflow: auto; padding: 0 12px 96px;
    overscroll-behavior: contain;
  }
  .fp-preview.is-open .fp-preview-head {
    position: sticky; top: 0; z-index: 2; margin: 0 -12px 14px; padding: 10px 12px;
    background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .fp-preview-head h2 { margin-right: auto; }
  .fp-close { display: inline-flex; width: 48px; padding: 0; }
  .fp-close .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  @media (max-width: 420px) { .fp-preview-head h2 small { display: none; } .fp-preview-head .btn-primary-x { padding: 0 14px; } }
  body.fp-lock { overflow: hidden; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 1099.98px) {
  .fp-preview.is-open { animation: fp-rise .28s var(--ease); }
  @keyframes fp-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
}

/* ---------- Mobile action bar ---------- */

.fp-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1050;
  display: flex; gap: 10px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.fp-bar { flex-wrap: wrap; }
.fp-bar .btn-x { flex: 1 1 0; }
.fp-bar .btn-primary-x { flex-grow: 1.6; }
.fp-bar-spacer { height: 84px; }
@media (min-width: 1100px) { .fp-bar, .fp-bar-spacer { display: none; } }

/* ---------- Status toast ---------- */

.fp-status {
  position: fixed; left: 50%; bottom: 96px; z-index: 1200;
  transform: translate(-50%, 8px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; font-size: 15px; padding: 10px 16px; border-radius: var(--r-control);
  transition: opacity .2s ease, transform .2s var(--ease);
}
.fp-status.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 1100px) { .fp-status { bottom: 24px; } }

/* ---------- Landing page ---------- */

.fp-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); max-width: 760px; }
.fp-item { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 4px 18px; padding: 24px; }
.fp-item + .fp-item { border-top: 1px solid var(--line); }
.fp-item .ic { width: 48px; height: 48px; border-radius: var(--r-control); background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 20px; }
.fp-item h2 { font-size: 22px; font-weight: 650; margin: 2px 0 2px; }
.fp-item .tr { font-size: 16px; color: var(--ink-3); margin: 0 0 8px; }
.fp-item .desc { font-size: 16px; color: var(--ink-2); line-height: 1.5; margin: 0 0 16px; max-width: 52ch; }
.fp-item .links { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 480px) {
  .fp-item { grid-template-columns: 1fr; padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
