/* YesEarth Engagement Portal — theme
   Brand colours and type follow www.yeseartheco.com (guideline 8.3).
   Mobile first: works from 360 px wide. Fonts are self-hosted. */

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/fraunces-600-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/manrope-latin-var.woff2") format("woff2");
}

:root {
  --ye-teal: #069494;
  --ye-teal-dark: #057576;
  --ye-teal-deep: #033b3c;
  --ye-teal-ink: #022a2b;
  --ye-orange: #be5103;
  --ye-gold: #ffce1b;
  --ye-rust: #b7410e;
  --ye-ink: #14201d;
  --ye-body: #2c3a36;
  --ye-muted: #5d6b66;
  --ye-line: #e3ddd0;
  --ye-line-soft: #efe9dd;
  --ye-paper: #fbf9f3;
  --ye-cream: #f4efe4;
  --ye-white: #ffffff;
  --ye-danger: #a3260f;
  --ye-danger-bg: #fdeee9;
  --ye-ok: #1d6b3a;
  --ye-ok-bg: #e9f6ee;
  --ye-font-head: "Fraunces", Georgia, "Times New Roman", serif;
  --ye-font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Devanagari", "Nirmala UI", Helvetica, Arial, sans-serif;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 32, 29, .06), 0 6px 18px rgba(20, 32, 29, .06);
  --focus: 0 0 0 3px #ffce1b, 0 0 0 5px #033b3c;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ye-paper);
  color: var(--ye-body);
  font-family: var(--ye-font-body);
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
html[lang="hi"] body { line-height: 1.75; }
img { max-width: 100%; height: auto; }
a { color: var(--ye-teal-dark); text-underline-offset: 3px; }
a:hover { color: var(--ye-teal-deep); }
h1, h2, h3 { font-family: var(--ye-font-head); color: var(--ye-ink); line-height: 1.2; font-weight: 600; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.3rem); margin: 0 0 .5rem; }
h2 { font-size: clamp(1.25rem, 3.2vw, 1.55rem); margin: 1.8rem 0 .6rem; }
h3 { font-size: 1.1rem; margin: 1.2rem 0 .4rem; }
html[lang="hi"] h1, html[lang="hi"] h2, html[lang="hi"] h3 { font-family: var(--ye-font-body); font-weight: 700; }
p { margin: 0 0 1rem; }
small, .muted { color: var(--ye-muted); }
code { font-size: .92em; background: var(--ye-cream); padding: .05em .35em; border-radius: 4px; word-break: break-all; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--ye-gold); color: var(--ye-ink); padding: .6rem 1rem; z-index: 100; font-weight: 700; }
.skip-link:focus { left: 1rem; top: 1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.wrap-narrow { max-width: 560px; }
.wrap-mid { max-width: 820px; }

/* ---------- Header ---------- */
.site-header { background: var(--ye-white); border-bottom: 1px solid var(--ye-line); }
.site-header .wrap { display: flex; align-items: center; gap: .75rem; padding-top: .55rem; padding-bottom: .55rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ye-ink); }
.brand img { width: 92px; height: auto; display: block; }
.brand-tag { font-family: var(--ye-font-head); font-size: 1rem; line-height: 1.1; border-left: 1px solid var(--ye-line); padding-left: .6rem; color: var(--ye-teal-deep); }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: .5rem .9rem; flex-wrap: wrap; justify-content: flex-end; font-size: .92rem; }
.header-tools form { margin: 0; }
.lang-switch { display: inline-flex; border: 1px solid var(--ye-line); border-radius: 999px; overflow: hidden; }
.lang-switch button { border: 0; background: transparent; padding: .3rem .7rem; font: inherit; font-size: .85rem; cursor: pointer; color: var(--ye-body); min-height: 34px; }
.lang-switch button[aria-pressed="true"] { background: var(--ye-teal-deep); color: #fff; }
.who { color: var(--ye-muted); }
.who strong { color: var(--ye-ink); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--ye-teal-dark); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 34px; }
.main-site-link { white-space: nowrap; }

.app-nav { background: var(--ye-teal-deep); }
.app-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; }
.app-nav a { display: block; color: #d9f0ee; text-decoration: none; padding: .7rem .8rem; white-space: nowrap; font-weight: 600; font-size: .93rem; }
.app-nav a:hover, .app-nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -3px 0 var(--ye-gold); }

/* ---------- Main ---------- */
main { flex: 1; padding: 1.6rem 0 3rem; }
.page-head { margin-bottom: 1.2rem; }
.page-head p { color: var(--ye-muted); max-width: 62ch; }
.crumbs { font-size: .88rem; color: var(--ye-muted); margin-bottom: .4rem; }
.crumbs a { color: var(--ye-muted); }

.card { background: var(--ye-white); border: 1px solid var(--ye-line); border-radius: var(--radius); padding: 1.15rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card > :last-child { margin-bottom: 0; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.section-card { display: flex; flex-direction: column; gap: .5rem; border-top: 4px solid var(--ye-teal); }
.section-card h2 { margin: 0; font-size: 1.2rem; }
.section-card .actions { margin-top: auto; }

/* ---------- Landing ---------- */
.hero { background: var(--ye-teal-deep); color: #e8f6f4; padding: 2.6rem 0 2.8rem; margin: -1.6rem 0 2rem; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -80px; bottom: -120px; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(255,206,27,.18), rgba(255,206,27,0) 70%); }
.hero h1 { color: #fff; font-size: clamp(1.9rem, 6vw, 2.9rem); max-width: 18ch; }
.hero .lede { font-size: clamp(1.02rem, 2.4vw, 1.18rem); max-width: 60ch; color: #d9f0ee; }
.hero .eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; color: var(--ye-gold); font-weight: 700; margin-bottom: .6rem; }
.hero .btn-row { margin-top: 1.4rem; }
.hero .btn-ghost { color: #fff; border-color: rgba(255,255,255,.55); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }
.landing-note { max-width: 62ch; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .55rem 1.1rem; border-radius: 999px; border: 2px solid var(--ye-teal-dark); background: var(--ye-teal-dark); color: #fff; font: inherit; font-weight: 700; font-size: .96rem; text-decoration: none; cursor: pointer; line-height: 1.2; }
.btn:hover { background: var(--ye-teal-deep); border-color: var(--ye-teal-deep); color: #fff; }
.btn-ghost { background: transparent; color: var(--ye-teal-dark); }
.btn-ghost:hover { background: var(--ye-cream); color: var(--ye-teal-deep); }
.btn-gold { background: var(--ye-gold); border-color: var(--ye-gold); color: var(--ye-ink); }
.btn-gold:hover { background: #f2c200; border-color: #f2c200; color: var(--ye-ink); }
.btn-danger { background: var(--ye-danger); border-color: var(--ye-danger); }
.btn-danger:hover { background: #7f1d0b; border-color: #7f1d0b; }
.btn-sm { min-height: 36px; padding: .3rem .8rem; font-size: .88rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.inline-form { display: inline; margin: 0; }

/* ---------- Forms ---------- */
.field { margin-bottom: 1.1rem; }
.field > label, .field > .label, fieldset > legend { display: block; font-weight: 700; color: var(--ye-ink); margin-bottom: .3rem; }
.req { color: var(--ye-danger); font-weight: 700; }
.hint { display: block; font-size: .9rem; color: var(--ye-muted); margin: -.1rem 0 .4rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="tel"], input[type="search"], select, textarea {
  width: 100%; font: inherit; color: var(--ye-ink); background: #fff; border: 1.5px solid #b9b2a3; border-radius: 8px; padding: .6rem .7rem; min-height: 46px;
}
textarea { min-height: 120px; resize: vertical; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; min-height: 360px; }
input:focus, select:focus, textarea:focus { border-color: var(--ye-teal-deep); box-shadow: var(--focus); outline: none; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--ye-danger); }
.error-text { color: var(--ye-danger); font-weight: 600; font-size: .92rem; margin: .3rem 0 0; }
fieldset { border: 0; padding: 0; margin: 0 0 1.1rem; min-width: 0; }
.choice { display: flex; align-items: flex-start; gap: .55rem; padding: .45rem .2rem; cursor: pointer; }
.choice input { width: 22px; height: 22px; margin: .1rem 0 0; accent-color: var(--ye-teal-dark); flex: none; }
.choices-inline { display: flex; flex-wrap: wrap; gap: .2rem 1.2rem; }
.checkbox-row { display: flex; gap: .6rem; align-items: flex-start; }
.checkbox-row input { width: 22px; height: 22px; margin-top: .15rem; flex: none; accent-color: var(--ye-teal-dark); }
.with-unit { display: flex; align-items: stretch; }
.with-unit input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.with-unit .unit { display: flex; align-items: center; padding: 0 .8rem; background: var(--ye-cream); border: 1.5px solid #b9b2a3; border-left: 0; border-radius: 0 8px 8px 0; font-weight: 700; color: var(--ye-body); }
.unit-helper { font-size: .9rem; color: var(--ye-teal-deep); margin-top: .3rem; min-height: 1.3em; }
.rating { display: flex; flex-wrap: wrap; gap: .4rem; }
.rating label { display: flex; align-items: center; justify-content: center; min-width: 46px; min-height: 46px; border: 1.5px solid #b9b2a3; border-radius: 8px; cursor: pointer; font-weight: 700; background: #fff; }
.rating input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rating input:checked + span { color: #fff; }
.rating label:has(input:checked) { background: var(--ye-teal-dark); border-color: var(--ye-teal-dark); color: #fff; }
.rating label:has(input:focus-visible) { box-shadow: var(--focus); }
.matrix-wrap { overflow-x: auto; }
.matrix { border-collapse: collapse; width: 100%; min-width: 420px; }
.matrix th, .matrix td { border-bottom: 1px solid var(--ye-line-soft); padding: .45rem; text-align: center; }
.matrix th[scope="row"] { text-align: left; font-weight: 600; }
.matrix input { width: 22px; height: 22px; accent-color: var(--ye-teal-dark); }
/* Table questions: typed cells in a grid, or one card per added row. */
.grid-table { min-width: 560px; }
.grid-table th[scope="col"] { font-size: .85rem; font-weight: 600; vertical-align: bottom; }
.grid-table td { padding: .3rem; }
.grid-table input, .grid-table select { width: 100%; min-width: 5.5rem; height: auto; padding: .4rem .45rem; font-size: .95rem; }
.grid-table tfoot th, .grid-table tfoot td { border-top: 2px solid var(--ye-line); font-weight: 600; }
.grid-table output { display: block; text-align: right; padding-right: .45rem; }
.col-unit { display: block; font-weight: 400; color: var(--ye-muted, #5b6b66); font-size: .8rem; }
.row-card-field .col-unit { display: inline; }
.row-cards { display: grid; gap: .8rem; }
.row-card { border: 1px solid var(--ye-line); border-radius: var(--radius); padding: .6rem .9rem .3rem; background: #fff; }
.row-card legend { font-weight: 600; padding: 0 .3rem; }
.row-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .2rem .9rem; }
.row-card-field label { font-size: .9rem; margin-top: .3rem; }
.row-card-actions { margin: .2rem 0 .4rem; text-align: right; }
.location-row { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.file-list { list-style: none; padding: 0; margin: .4rem 0; }
.file-list li { display: flex; gap: .6rem; align-items: center; padding: .3rem 0; border-bottom: 1px dashed var(--ye-line); flex-wrap: wrap; }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.turnstile-box { margin: .6rem 0 1rem; min-height: 65px; }

/* ---------- Questionnaire ---------- */
.form-progress { display: flex; gap: .35rem; margin: .4rem 0 1rem; }
.form-progress span { flex: 1; height: 6px; border-radius: 3px; background: var(--ye-line); }
.form-progress span.done { background: var(--ye-teal); }
.form-progress span.current { background: var(--ye-gold); }
.q-page[hidden], .question[hidden] { display: none !important; }
.js .q-page:not(.active) { display: none; }
.question { padding: .9rem 0; border-bottom: 1px solid var(--ye-line-soft); }
.question:last-child { border-bottom: 0; }
.question .personal-tag { font-size: .75rem; font-weight: 700; color: var(--ye-orange); border: 1px solid currentColor; border-radius: 999px; padding: 0 .45rem; margin-left: .3rem; vertical-align: middle; white-space: nowrap; }
.save-state { font-size: .88rem; color: var(--ye-muted); min-height: 1.3em; }
.save-state.error { color: var(--ye-danger); font-weight: 600; }
.sticky-actions { position: sticky; bottom: 0; background: rgba(251,249,243,.96); border-top: 1px solid var(--ye-line); padding: .7rem 0; margin-top: 1rem; z-index: 5; }
.answers dt { font-weight: 700; color: var(--ye-ink); margin-top: .8rem; }
.answers dd { margin: .15rem 0 0; white-space: pre-wrap; }
.answers dd .table-wrap { white-space: normal; margin-top: .3rem; }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.alert p:last-child, .alert ul:last-child { margin-bottom: 0; }
.alert-ok { background: var(--ye-ok-bg); border-color: #b7dfc5; color: var(--ye-ok); }
.alert-error { background: var(--ye-danger-bg); border-color: #f1b9a9; color: var(--ye-danger); }
.alert-info { background: #eef7f6; border-color: #b9dedb; color: var(--ye-teal-deep); }
.alert-warn { background: #fff7db; border-color: #f1dc8f; color: #6b4e00; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--ye-line); border-radius: var(--radius); background: #fff; }
table.data { border-collapse: collapse; width: 100%; font-size: .93rem; }
table.data th, table.data td { padding: .6rem .7rem; border-bottom: 1px solid var(--ye-line-soft); text-align: left; vertical-align: top; }
table.data thead th { background: var(--ye-teal-deep); color: #fff; font-weight: 700; white-space: nowrap; }
table.data tbody tr:hover { background: #fdfcf8; }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; background: var(--ye-cream); color: var(--ye-body); white-space: nowrap; }
.badge-live, .badge-active, .badge-submitted, .badge-pending { background: #dff3f1; color: var(--ye-teal-deep); }
.badge-approved { background: var(--ye-ok-bg); color: var(--ye-ok); }
.badge-paused, .badge-invited, .badge-draft, .badge-reopened { background: #fff3c9; color: #6b4e00; }
.badge-archived, .badge-locked, .badge-deleted, .badge-expired, .badge-cancelled { background: var(--ye-danger-bg); color: var(--ye-danger); }
.counts { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.counts > a, .counts > span { display: flex; flex-direction: column; min-width: 110px; padding: .6rem .8rem; background: #fff; border: 1px solid var(--ye-line); border-radius: var(--radius); text-decoration: none; color: var(--ye-body); }
.counts strong { font-family: var(--ye-font-head); font-size: 1.5rem; color: var(--ye-teal-deep); line-height: 1.1; }
.filters { display: grid; gap: .6rem; grid-template-columns: 1fr 1fr; align-items: end; margin-bottom: 1rem; }
.filters .field { margin: 0; }
@media (min-width: 760px) { .filters { grid-template-columns: repeat(5, 1fr); } }
.pagination { display: flex; gap: .4rem; flex-wrap: wrap; margin: 1rem 0; list-style: none; padding: 0; }
.pagination a, .pagination span { display: inline-block; padding: .35rem .7rem; border: 1px solid var(--ye-line); border-radius: 6px; background: #fff; text-decoration: none; }
.pagination .active span { background: var(--ye-teal-deep); color: #fff; border-color: var(--ye-teal-deep); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.kv dt { font-weight: 700; color: var(--ye-ink); }
.kv dd { margin: 0; }
.codes { columns: 2; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.05rem; padding-left: 1.2rem; }
.qr { background: #fff; padding: .6rem; border: 1px solid var(--ye-line); border-radius: 8px; width: 220px; max-width: 100%; }
details.json summary { cursor: pointer; font-weight: 700; color: var(--ye-teal-dark); }
pre.json { white-space: pre-wrap; word-break: break-word; background: var(--ye-cream); padding: .8rem; border-radius: 8px; font-size: .82rem; max-height: 420px; overflow: auto; }

/* ---------- Form builder ---------- */
.builder-page { border: 1px solid var(--ye-line); border-radius: var(--radius); padding: .9rem; margin-bottom: 1rem; background: #fff; }
.builder-page > header { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.builder-q { border: 1px dashed #c9c1b0; border-radius: 8px; padding: .8rem; margin: .6rem 0; background: var(--ye-paper); }
.builder-q .row { display: grid; gap: .5rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .builder-q .row { grid-template-columns: repeat(3, 1fr); } }
.builder-q label { font-size: .85rem; font-weight: 700; display: block; margin-bottom: .15rem; }
.builder-q input, .builder-q select, .builder-q textarea { min-height: 38px; padding: .35rem .5rem; font-size: .92rem; }
.builder-q textarea { min-height: 70px; }
.builder-q .tools { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .5rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ye-teal-ink); color: #b9d4d1; font-size: .9rem; padding: 1.6rem 0; }
.site-footer a { color: #fff; }
.site-footer .wrap { display: grid; gap: .8rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; list-style: none; padding: 0; margin: 0; }
@media (min-width: 760px) { .site-footer .wrap { grid-template-columns: 1fr auto; align-items: center; } }

/* ---------- Error pages ---------- */
.error-page { text-align: center; padding: 2rem 0; }
.error-page .code { font-family: var(--ye-font-head); font-size: 4rem; color: var(--ye-teal); line-height: 1; }

/* ---------- Idle warning ---------- */
.idle-warning { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 520px; margin: 0 auto; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.2); }

@media print {
  .site-header, .app-nav, .site-footer, .sticky-actions, .btn { display: none !important; }
  body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.error-page .btn-row { justify-content: center; }
/* One-time password shown to an admin */
.password-reveal code { font-size: 1.2rem; letter-spacing: .04em; background: #fff; border: 1px solid var(--ye-line); border-radius: 6px; padding: .25rem .6rem; user-select: all; }
.password-reveal .reveal-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.access-choice { border: 0; padding: 0; margin: 0 0 .6rem; }
