/* Kearsarge Lodge Donation Portal
   Calm, serious, no marketing puffery.
   Inherits the lodge palette: deep navy + antique gold + ivory + sage.
*/

:root {
  --navy: #14213d;
  --navy-deep: #0a142a;
  --gold: #b8860b;
  --gold-soft: #d4a949;
  --ivory: #f5f1e8;
  --ivory-soft: #fbf8f1;
  --sage: #7a8b6f;
  --cream: #efe9d8;

  --bg: var(--ivory-soft);
  --surface: #ffffff;
  --surface-alt: var(--ivory);
  --border: #d6cfba;
  --border-strong: #b8a878;
  --text: #1a1a1a;
  --text-muted: #5a5a55;
  --text-faint: #8a8580;

  --green: #437a22;
  --green-soft: #e3eed6;
  --yellow: #c08315;
  --yellow-soft: #faecd0;
  --red: #a13544;
  --red-soft: #f4dadf;
  --blue-soft: #dfe7f1;
  --blue: #2e4a7d;

  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Work Sans', system-ui, -apple-system, sans-serif;

  --container-max: 1100px;
  --container-narrow: 760px;
  --radius: 6px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(20,33,61,0.06);
  --shadow: 0 4px 16px rgba(20,33,61,0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--font-sans);
  font-size: 16px; line-height: 1.6;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 500; line-height: 1.2;
  margin: 0 0 1rem; color: var(--navy);
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.875rem, 4vw, 2.625rem); }
h2 { font-size: clamp(1.4rem, 2.5vw, 1.875rem); }
h3 { font-size: 1.125rem; font-family: var(--font-sans); font-weight: 600; letter-spacing: 0; }
h4 { font-size: 1rem; font-family: var(--font-sans); font-weight: 600; }

a { color: var(--gold); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .15s ease; }
a:hover { border-bottom-color: var(--gold); }

p { margin: 0 0 1rem; }
.muted { color: var(--text-muted); }
.hint { color: var(--text-faint); font-size: 0.875rem; font-weight: 400; }
.req { color: var(--red); margin-left: 2px; }

/* ---------- Layout ---------- */
.container { max-width: var(--container-max); margin: 0 auto; padding: 0 1.5rem; }

.portal-header {
  background: var(--navy); color: #fff; padding: 1rem 0;
  border-bottom: 3px solid var(--gold);
}
.portal-header__inner {
  max-width: var(--container-max); margin: 0 auto; padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
}
.portal-brand { display: flex; align-items: center; gap: 0.875rem; color: #fff; border-bottom: none; }
.portal-brand:hover { border-bottom: none; }
.portal-brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.portal-brand__title { font-family: var(--font-serif); font-size: 1.25rem; font-weight: 500; }
.portal-brand__sub { font-size: 0.75rem; color: var(--gold-soft); letter-spacing: 0.04em; text-transform: uppercase; }

.portal-main { min-height: calc(100vh - 200px); }

.portal-footer {
  background: var(--navy-deep); color: #b8b2a3; padding: 2rem 1.5rem; margin-top: 4rem;
  text-align: center; font-size: 0.875rem;
}
.portal-footer p { margin: 0.25rem 0; }
.portal-footer__small { color: #6e6960; font-size: 0.8125rem; }

/* ---------- Hero / Landing ---------- */
.hero { background: linear-gradient(180deg, var(--ivory) 0%, var(--ivory-soft) 100%); padding: 5rem 1.5rem 4rem; text-align: center; }
.hero--small { padding: 4rem 1.5rem 3rem; }
.hero__inner { max-width: var(--container-narrow); margin: 0 auto; }
.hero__eyebrow { font-size: 0.8125rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); margin-bottom: 1rem; font-weight: 500; }
.hero__title { font-size: clamp(2rem, 5vw, 3.25rem); margin-bottom: 1.25rem; }
.hero__lede { font-size: 1.125rem; color: var(--text-muted); max-width: 580px; margin: 0 auto 2rem; }
.check-mark { color: var(--green); margin-bottom: 1.5rem; display: flex; justify-content: center; }
.cta-row { display: flex; gap: 1rem; justify-content: center; margin-top: 2rem; flex-wrap: wrap; }

.process { padding: 4rem 0; background: var(--surface); }
.section-title { text-align: center; margin-bottom: 3rem; }
.process-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 2rem; }
.process-steps li { text-align: center; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--navy); color: #fff; font-family: var(--font-serif); font-size: 1.25rem; margin-bottom: 1rem; }
.process-steps h3 { color: var(--navy); margin-bottom: 0.5rem; }
.process-steps p { font-size: 0.9375rem; color: var(--text-muted); margin: 0; }

.categories { padding: 4rem 0; background: var(--ivory); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.cat-card { background: var(--surface); padding: 1.5rem; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.cat-tag { display: inline-block; font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); font-weight: 600; margin-bottom: 0.5rem; }
.cat-card h3 { margin-bottom: 0.5rem; color: var(--navy); }
.cat-card p { font-size: 0.9375rem; color: var(--text-muted); margin: 0; }

.cta-band { padding: 4rem 1.5rem; background: var(--navy); color: #fff; text-align: center; }
.cta-band h2 { color: #fff; }
.cta-band p { color: #c4c0b3; margin-bottom: 2rem; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.6875rem 1.5rem; border-radius: var(--radius); font-family: var(--font-sans); font-weight: 500; font-size: 0.9375rem; cursor: pointer; border: 1px solid transparent; transition: all .15s ease; text-decoration: none; line-height: 1; }
.btn--primary { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.btn--primary:hover { background: var(--gold-soft); border-color: var(--gold-soft); }
.btn--ghost { background: transparent; color: var(--navy); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface-alt); }
.btn--lg { padding: 0.875rem 2rem; font-size: 1rem; }
.btn--sm { padding: 0.5rem 1rem; font-size: 0.875rem; }
.btn--full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Form shell ---------- */
.form-shell { padding: 3rem 1.5rem; }
.form-shell__inner { max-width: 880px; margin: 0 auto; background: var(--surface); border-radius: var(--radius-lg); padding: 2.5rem; box-shadow: var(--shadow); border: 1px solid var(--border); }
.form-shell__header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.form-shell__header h1 { margin-bottom: 0.5rem; }
.form-shell__header p { color: var(--text-muted); margin: 0; }

.step-indicator { list-style: none; padding: 0; margin: 0 0 2.5rem; display: flex; gap: 0.25rem; align-items: stretch; counter-reset: step; flex-wrap: wrap; }
.step-indicator li { flex: 1; min-width: 80px; display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 0.5rem; font-size: 0.8125rem; color: var(--text-faint); border-bottom: 2px solid var(--border); transition: all .2s ease; }
.step-indicator li span { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--border); color: #fff; font-size: 0.75rem; font-weight: 600; }
.step-indicator li.active { color: var(--navy); border-bottom-color: var(--gold); font-weight: 500; }
.step-indicator li.active span { background: var(--gold); color: var(--navy); }
.step-indicator li.done { color: var(--navy); border-bottom-color: var(--green); }
.step-indicator li.done span { background: var(--green); color: #fff; }

.form-step { display: none; }
.form-step.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.form-section-title { font-family: var(--font-serif); font-size: 1.5rem; color: var(--navy); margin-bottom: 1.5rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); font-weight: 500; }
.subsection-title { font-family: var(--font-sans); font-size: 0.9375rem; font-weight: 600; color: var(--navy); margin: 1.75rem 0 0.875rem; text-transform: uppercase; letter-spacing: 0.06em; }

.field { margin-bottom: 1.125rem; }
.field label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--text); margin-bottom: 0.375rem; }
.field input[type=text], .field input[type=email], .field input[type=tel], .field input[type=url], .field input[type=date], .field input[type=password], .field select, .field textarea {
  width: 100%; padding: 0.625rem 0.75rem; font-family: inherit; font-size: 0.9375rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,134,11,0.15);
}
.field textarea { resize: vertical; min-height: 80px; }
.field .is-invalid, input.is-invalid { border-color: var(--red); background: var(--red-soft); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }
.span-2 { grid-column: span 2; }
@media (max-width: 600px) {
  .span-2 { grid-column: span 1; }
  .form-shell__inner { padding: 1.5rem; }
}

.checkbox-row { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.checkbox-row label { font-size: 0.9375rem; font-weight: 400; cursor: pointer; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0.5rem 1rem; margin-bottom: 1rem; }
.checkbox-grid label { font-size: 0.9375rem; cursor: pointer; padding: 0.5rem; border-radius: var(--radius); transition: background .15s; }
.checkbox-grid label:hover { background: var(--surface-alt); }
.checkbox-stack, .radio-stack { display: flex; flex-direction: column; gap: 0.5rem; }
.checkbox-inline { display: flex; align-items: flex-start; gap: 0.5rem; line-height: 1.4; cursor: pointer; }

.cat-radio-grid { display: flex; flex-direction: column; gap: 0.5rem; }
.cat-radio { display: flex; align-items: flex-start; gap: 0.875rem; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: all .15s ease; background: var(--surface); }
.cat-radio:hover { border-color: var(--gold); background: var(--ivory-soft); }
.cat-radio input { margin-top: 0.25rem; }
.cat-radio input:checked + div strong { color: var(--gold); }
.cat-radio:has(input:checked) { border-color: var(--gold); background: var(--ivory-soft); box-shadow: 0 0 0 2px rgba(184,134,11,0.1); }
.cat-radio div { display: flex; flex-direction: column; gap: 0.25rem; }
.cat-radio strong { font-size: 0.9375rem; color: var(--navy); }
.cat-radio span { font-size: 0.8125rem; color: var(--text-muted); }

.cat-panel { display: none; }
.cat-panel.active { display: block; }

.exec-rows { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.exec-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0.5rem; }
.exec-row input { padding: 0.5rem 0.625rem; font-size: 0.875rem; border: 1px solid var(--border); border-radius: var(--radius); }
@media (max-width: 600px) { .exec-row { grid-template-columns: 1fr; } }

/* ---------- Affirmation ---------- */
.affirmation { background: var(--ivory); padding: 1.25rem 1.5rem; border-radius: var(--radius); border-left: 3px solid var(--gold); margin-bottom: 1.5rem; }
.affirmation p { font-weight: 500; margin: 0 0 0.5rem; }
.affirmation ul { margin: 0; padding-left: 1.25rem; color: var(--text-muted); font-size: 0.9375rem; }

/* ---------- File upload ---------- */
.upload-zone { border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 2rem 1rem; text-align: center; cursor: pointer; transition: all .15s ease; background: var(--ivory-soft); position: relative; margin-top: 1rem; }
.upload-zone:hover, .upload-zone.is-drag { border-color: var(--gold); background: var(--ivory); }
.upload-zone input[type=file] { display: none; }
.upload-zone__inner { color: var(--text-muted); }
.upload-zone__inner svg { color: var(--gold); margin-bottom: 0.5rem; }
.upload-zone__inner p { margin: 0.25rem 0; }

.file-list { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-direction: column; gap: 0.375rem; }
.file-list li { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; background: var(--surface-alt); border-radius: var(--radius); font-size: 0.875rem; }
.file-list li span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.file-remove { background: none; border: none; color: var(--red); font-size: 1.25rem; cursor: pointer; padding: 0 0.5rem; line-height: 1; }

/* ---------- Form nav ---------- */
.form-nav { display: flex; justify-content: space-between; gap: 0.75rem; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.form-nav .btn--primary { margin-left: auto; }

/* ---------- Alerts ---------- */
.alert { padding: 0.875rem 1rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: 0.9375rem; }
.alert--info { background: var(--blue-soft); border-left: 3px solid var(--blue); color: #2e4a7d; }
.alert--error { background: var(--red-soft); border-left: 3px solid var(--red); color: #7a2230; }
.alert--success { background: var(--green-soft); border-left: 3px solid var(--green); color: #2c5615; }

/* ---------- Auth ---------- */
.auth-card { max-width: 380px; margin: 4rem auto; background: var(--surface); padding: 2rem; border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid var(--border); }
.auth-card h1 { margin-bottom: 0.5rem; }

/* ---------- Admin shell ---------- */
.admin-nav { display: flex; align-items: center; gap: 1.25rem; }
.admin-nav__user { color: #d4cfc0; font-size: 0.875rem; }
.admin-nav__link { color: var(--gold-soft); font-size: 0.875rem; border-bottom: none; }
.admin-nav__link:hover { border-bottom: 1px solid var(--gold-soft); }

.admin-shell { max-width: var(--container-max); margin: 0 auto; padding: 2rem 1.5rem; }
.admin-shell__header { margin-bottom: 1.5rem; }
.back-link { font-size: 0.875rem; color: var(--text-muted); border-bottom: none; }
.back-link:hover { color: var(--gold); }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-top: 0.5rem; flex-wrap: wrap; }
.detail-head h1 { margin-bottom: 0.25rem; }

.filter-row { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }
.filter-chip { padding: 0.375rem 0.875rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); font-size: 0.8125rem; transition: all .15s; }
.filter-chip:hover { color: var(--navy); border-bottom: 1px solid var(--border); }
.filter-chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Table ---------- */
.table-wrap { background: var(--surface); border-radius: var(--radius-lg); overflow-x: auto; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.data-table th { text-align: left; padding: 0.875rem 1rem; background: var(--ivory); color: var(--navy); font-weight: 600; font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
.data-table td { padding: 0.875rem 1rem; border-bottom: 1px solid var(--border); }
.data-table tbody tr { cursor: pointer; transition: background .1s; }
.data-table tbody tr:hover { background: var(--ivory-soft); }
.empty-row { text-align: center; color: var(--text-faint); padding: 3rem 1rem; }

/* ---------- Pills ---------- */
.cat-pill, .status-pill, .score-pill { display: inline-block; padding: 0.125rem 0.625rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.cat-pill { background: var(--ivory); color: var(--navy); }
.cat-pill--a { background: var(--blue-soft); color: var(--blue); }
.cat-pill--b, .cat-pill--d { background: var(--red-soft); color: var(--red); }
.cat-pill--c { background: #e6dffa; color: #5b3da5; }
.cat-pill--e { background: var(--green-soft); color: var(--green); }

.status-pill { background: var(--border); color: var(--text); }
.status-pill--submitted { background: var(--blue-soft); color: var(--blue); }
.status-pill--in_review { background: var(--yellow-soft); color: var(--yellow); }
.status-pill--more_info { background: #f0e2d4; color: #8a4a16; }
.status-pill--approved { background: var(--green-soft); color: var(--green); }
.status-pill--declined { background: var(--red-soft); color: var(--red); }

.score-pill { color: #fff; }
.score-pill--green { background: var(--green); }
.score-pill--yellow { background: var(--yellow); }
.score-pill--red { background: var(--red); }

/* ---------- Detail grid ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 360px; gap: 1.5rem; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-main, .detail-side { display: flex; flex-direction: column; gap: 1.25rem; }

.card { background: var(--surface); padding: 1.5rem; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.card h2 { font-size: 1.125rem; font-family: var(--font-sans); font-weight: 600; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.card h3 { font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 1.25rem 0 0.5rem; }
.card--confidential { border-left: 4px solid var(--red); }
.confidential-banner { background: var(--red-soft); color: var(--red); padding: 0.625rem 0.875rem; border-radius: var(--radius); font-size: 0.875rem; margin-bottom: 1rem; font-weight: 500; }

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 0.5rem 1rem; margin: 0; font-size: 0.9375rem; }
.kv dt { color: var(--text-muted); font-weight: 500; }
.kv dd { margin: 0; color: var(--text); }
.kv--compact { grid-template-columns: 140px 1fr; font-size: 0.875rem; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 0.5rem; } }

.quote { background: var(--ivory-soft); padding: 0.875rem 1rem; border-left: 3px solid var(--gold); font-style: italic; color: var(--text-muted); margin: 1rem 0; }

.doc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.375rem; }
.doc-list li { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; background: var(--surface-alt); border-radius: var(--radius); font-size: 0.875rem; }
.doc-list a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* Research card */
.card--research { position: relative; }
.card--research.is-loading::after { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.6); border-radius: var(--radius-lg); }
.score-banner { padding: 1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1rem; display: flex; align-items: center; gap: 1rem; }
.score-banner--green { background: var(--green-soft); border-left: 3px solid var(--green); }
.score-banner--yellow { background: var(--yellow-soft); border-left: 3px solid var(--yellow); }
.score-banner--red { background: var(--red-soft); border-left: 3px solid var(--red); }
.score-banner strong { font-family: var(--font-serif); font-size: 1.5rem; color: var(--navy); }
.score-banner span { font-size: 0.9375rem; color: var(--text); }

.research-body { font-size: 0.9375rem; color: var(--text); }
.research-body ul { padding-left: 1.25rem; margin: 0.5rem 0; }
.research-body li { margin-bottom: 0.375rem; }
.research-body .finding { padding: 0.5rem 0.75rem; border-radius: var(--radius); margin-bottom: 0.5rem; font-size: 0.875rem; }
.research-body .finding--good { background: var(--green-soft); }
.research-body .finding--warn { background: var(--yellow-soft); }
.research-body .finding--bad { background: var(--red-soft); }

@media (max-width: 700px) {
  .form-shell { padding: 1.5rem 0.75rem; }
  .form-shell__inner { padding: 1.25rem; border-radius: 0; }
  .portal-brand__sub { display: none; }
  .step-indicator li { font-size: 0; padding: 0.5rem; }
  .step-indicator li span { font-size: 0.75rem; }
}
