/* Braintree Community Food Pantry — warm, readable, phone-first.
   Brand palette drawn from the pantry logo: navy #1f3d85, red #bc3338. */

:root {
  --navy: #1f3d85;
  --navy-dark: #16295f;
  --navy-tint: #e8ecf6;
  --red: #bc3338;
  --red-dark: #992a2e;
  --cream: #faf6ef;
  --cream-dark: #f1e9db;
  --photo-bg: #e1e4eb; /* matches the hero photo background */
  --ink: #2b2e36;
  --ink-soft: #5c6270;
  --green: #3e7a52;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(22, 41, 95, 0.14);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.6;
}
h1, h2, h3 { line-height: 1.25; color: var(--navy-dark); }
a { color: var(--red); }
a:hover { color: var(--red-dark); }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--navy); outline-offset: 2px;
}
img { max-width: 100%; }
code { font-size: 0.85em; word-break: break-all; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 10; }

/* Header */
.site-header { background: #fff; border-bottom: 3px solid var(--navy); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 10px 20px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--navy-dark); }
.brand-logo { display: block; width: 54px; height: 54px; }
.brand-text { font-weight: bold; font-size: 1.05rem; line-height: 1.15; }
.brand-text small { font-weight: normal; color: var(--ink-soft); font-size: 0.78rem; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; }
.site-nav a:not(.btn) { text-decoration: none; color: var(--ink); padding: 6px 2px; }
.site-nav a:not(.btn):hover { color: var(--navy); }
.site-nav .btn { padding: 13px 30px; }

/* Small phones: brand on its own row, links wrap cleanly beneath it,
   Donate becomes a full-width bar (no JS, no hamburger). */
@media (max-width: 640px) {
  .header-inner { padding: 10px 16px 12px; }
  .site-nav { width: 100%; justify-content: center; gap: 0 4px; font-size: 0.95rem; }
  .site-nav a:not(.btn) { padding: 11px 8px; }
  .site-nav .btn { width: 100%; text-align: center; order: 10; margin-top: 6px; }
}

/* Buttons */
.btn {
  display: inline-block; padding: 10px 20px; border-radius: var(--radius);
  text-decoration: none; border: 2px solid var(--red); cursor: pointer;
  font-family: inherit; font-size: 1rem; line-height: 1.4; background: none;
}
.btn-primary { background: var(--red); color: #fff !important; }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-outline { color: var(--navy-dark); background: #fff; border-color: var(--navy); }
.btn-outline:hover { background: var(--navy-tint); }
.btn-lg { padding: 14px 28px; font-size: 1.1rem; }
.btn-small { padding: 4px 12px; font-size: 0.85rem; }
.linklike { background: none; border: none; color: var(--red); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

/* Hero — split: copy left, basket photo right; photo bg matches --photo-bg */
.hero { background: var(--photo-bg); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: stretch; max-width: 1200px; margin: 0 auto; }
.hero-copy { padding: 56px 24px 48px 20px; align-self: center; }
.hero h1 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); margin: 0 0 12px; }
.lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 620px; margin: 0 0 8px; }
.hero-media { min-height: 100%; }
.hero-media img { display: block; width: 100%; height: 100%; min-height: 360px; object-fit: cover; object-position: right center; }
.hero-actions { margin-top: 28px; display: flex; gap: 14px; flex-wrap: wrap; }

@media (max-width: 700px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-copy { text-align: center; padding: 44px 20px 32px; }
  .lede { margin: 0 auto 8px; }
  .hero-actions { justify-content: center; }
  .hero-media img { min-height: 0; height: 230px; }
}
@media (max-width: 480px) {
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; text-align: center; }
}

/* Cards */
.cards-3 { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); padding: 40px 20px; }
.card { background: #fff; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); border-top: 3px solid var(--navy); }
.card h2 { margin-top: 0; font-size: 1.2rem; }

/* Bands & callouts */
.band { background: var(--navy-tint); padding: 36px 0; text-align: center; }
.callout { background: #fff; border-left: 4px solid var(--navy); border-radius: var(--radius); padding: 18px 22px; margin: 24px 0; box-shadow: var(--shadow); }
.callout h2 { margin-top: 0; font-size: 1.1rem; }

/* Photos */
.photo { display: block; width: 100%; height: auto; border-radius: var(--radius); box-shadow: var(--shadow); margin: 20px 0 28px; }
.photo-banner { aspect-ratio: 5 / 2; object-fit: cover; object-position: right center; }
@media (max-width: 600px) {
  .photo-banner { aspect-ratio: 16 / 10; }
}

/* Pages */
.page { padding: 40px 20px 64px; }
.page-narrow { max-width: 640px; }
.center { text-align: center; }
.steps { padding-left: 0; counter-reset: step; list-style: none; }
.steps li { position: relative; padding: 0 0 8px 56px; margin-bottom: 20px; counter-increment: step; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 2px;
  width: 38px; height: 38px; border-radius: 50%; background: var(--navy);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 1.1rem;
}
.steps h2 { font-size: 1.15rem; margin: 0 0 6px; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 16px; margin: 24px 0; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: bold; color: var(--navy-dark); }
.form input, .form textarea, .form select {
  font: inherit; padding: 10px 12px; border: 1px solid #c4c9d6;
  border-radius: 6px; background: #fff; font-weight: normal;
}
.form input:focus, .form textarea:focus, .form select:focus { outline: 2px solid var(--navy); }
.form-row { flex-direction: row; flex-wrap: wrap; align-items: end; }
@media (max-width: 480px) {
  .form-row { flex-direction: column; align-items: stretch; }
  .form-row .btn { width: 100%; text-align: center; }
}
.hp { position: absolute; left: -9999px; }
.fine-print { font-size: 0.85rem; color: var(--ink-soft); }
.radio-row { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: normal !important; }
fieldset { border: 1px solid #ccd1de; border-radius: var(--radius); padding: 14px 16px; }
legend { font-weight: bold; color: var(--navy-dark); padding: 0 6px; }

/* Donate amounts */
.amount-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; }
.amount-option { position: relative; }
.amount-option input[type="radio"] { position: absolute; opacity: 0; }
.amount-option span {
  display: flex; align-items: center; justify-content: center; padding: 12px 8px;
  border: 2px solid #c4c9d6; border-radius: var(--radius); background: #fff;
  font-weight: bold; cursor: pointer;
}
.amount-option input[type="radio"]:checked + span { border-color: var(--navy); background: var(--navy-tint); }
.amount-option input[type="radio"]:focus-visible + span { outline: 2px solid var(--navy-dark); }
.amount-option input[type="radio"]:disabled + span {
  background: var(--cream-dark); border-color: #d8dbe4; color: var(--ink-soft);
  cursor: not-allowed; font-weight: normal;
}
.amount-custom { grid-column: span 2; }
.amount-custom span { gap: 4px; }
.amount-custom input[type="number"] {
  flex: 1 1 60px; width: 60px; min-width: 0; max-width: 110px;
  border: none; border-bottom: 1px solid #c4c9d6; font: inherit; font-size: 1rem;
  background: transparent;
}
.paypal-alt, .contact-alt { margin-top: 32px; }
.signout { margin-top: 40px; }

/* Flash messages */
.flash { padding: 12px 16px; border-radius: var(--radius); margin: 14px 0; background: #fff; box-shadow: var(--shadow); }
.flash-error { border-left: 4px solid var(--red); }
.flash-success { border-left: 4px solid var(--green); }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--navy-tint); }
.table th { background: var(--navy-tint); color: var(--navy-dark); }
.inline-form { display: inline; }

/* Admin */
.admin-layout { padding: 28px 20px 64px; }
.admin-nav { display: flex; gap: 2px 20px; flex-wrap: wrap; align-items: center; border-bottom: 2px solid var(--navy-tint); padding-bottom: 12px; margin-bottom: 24px; }
.admin-nav a { text-decoration: none; font-weight: bold; padding: 8px 2px; display: inline-block; }
.stat-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin: 20px 0 32px; }
.stat { background: #fff; border-radius: var(--radius); padding: 18px; text-align: center; box-shadow: var(--shadow); }
.stat-num { display: block; font-size: 1.9rem; font-weight: bold; color: var(--navy-dark); }
.stat-label { color: var(--ink-soft); font-size: 0.9rem; }
.invite-link { font-size: 0.75rem; }

/* Footer */
.site-footer { background: var(--navy); color: #eef1f9; margin-top: 48px; padding: 40px 0 24px; }
.site-footer h3 { color: #fff; font-size: 1rem; margin-top: 0; }
.site-footer a { color: #fff; }
.site-footer a:hover { color: #d9deee; }
.footer-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); padding-bottom: 20px; }
.footer-legal { border-top: 1px solid rgba(255,255,255,0.3); padding-top: 18px; font-size: 0.85rem; }
.credit { font-size: 0.8rem; }
.social-links { display: flex; gap: 18px; flex-wrap: wrap; }
.social-links a { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; }
.social-links a:hover { text-decoration: underline; }
.social-links svg { flex: none; }

/* Wishlist progress (public "Most Needed" page) + receiving */
.need-list { list-style: none; margin: 24px 0; padding: 0; display: grid; gap: 20px; }
.need-item { margin: 24px 0; }
.need-list .need-item { margin: 0; }
.need-item h2 { margin: 0 0 4px; }
.need-item progress { width: 100%; height: 14px; accent-color: var(--green); }
.progress-meta { margin: 4px 0 8px; font-size: 0.9rem; color: var(--ink-soft); }
.need-item details summary { cursor: pointer; color: var(--red); font-weight: bold; margin-top: 10px; padding: 8px 0; }
.receive-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.receive-form input[type="number"], .receive-form select {
  font: inherit; padding: 8px 10px; border: 1px solid #c9c2b4;
  border-radius: 6px; background: #fff;
}
.receive-form input[type="number"] { width: 90px; }

/* Big tap targets on phones (volunteers in a church hall) */
@media (max-width: 600px) {
  .btn { padding: 12px 22px; }
  .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .receive-form input[type="number"], .receive-form select { padding: 12px 10px; }
  .site-footer { padding-bottom: 96px; } /* keep chat toggle off the legal text */
}

/* Check-in roster (admin/event_detail) — cards, one big action per line on phones */
.roster { list-style: none; margin: 12px 0 28px; padding: 0; display: grid; gap: 12px; }
.roster-row { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.roster-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 10px; }
.roster-who small { color: var(--ink-soft); }
.roster-status { font-size: 0.85rem; color: var(--navy-dark); background: var(--navy-tint); border-radius: 999px; padding: 2px 12px; }
.roster-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.roster-actions .inline-form { display: block; }
.roster-actions .btn { min-height: 44px; padding: 12px 16px; }
.complete-details summary { list-style: none; }
.complete-details summary::-webkit-details-marker { display: none; }
.complete-details[open] { flex-basis: 100%; }
.complete-details .form { background: var(--navy-tint); border-radius: var(--radius); padding: 14px 16px; margin: 8px 0 0; }
@media (max-width: 600px) {
  .roster-actions { flex-direction: column; align-items: stretch; }
  .roster-actions .inline-form, .roster-actions .complete-details { width: 100%; }
  .roster-actions .btn { display: block; width: 100%; text-align: center; }
}

/* Stacked tables: rows become cards on phones, headers become inline labels
   (used where a row carries actions/forms, e.g. admin receiving). */
@media (max-width: 640px) {
  .table-stack { display: block; overflow: visible; background: none; box-shadow: none; }
  .table-stack thead { display: none; }
  .table-stack tbody, .table-stack tr, .table-stack td { display: block; }
  .table-stack tr { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; margin-bottom: 12px; }
  .table-stack td { border-bottom: none; padding: 4px 0; }
  .table-stack td[data-label]::before { content: attr(data-label) ": "; font-weight: bold; color: var(--navy-dark); }
}

/* Chat widget */
#chat-widget { position: fixed; right: 24px; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); z-index: 50; font-size: 0.95rem; }
#chat-toggle {
  display: flex; align-items: center; gap: 8px; padding: 12px 18px;
  border-radius: 999px; border: none; background: var(--red); color: #fff;
  font: inherit; font-weight: bold; cursor: pointer; box-shadow: 0 4px 14px rgba(153, 42, 46, 0.35);
}
#chat-toggle:hover { background: var(--red-dark); }
#chat-panel[hidden] { display: none; }
#chat-panel {
  position: absolute; right: 0; bottom: 62px; width: min(340px, calc(100vw - 36px));
  background: #fff; border-radius: var(--radius); box-shadow: 0 8px 30px rgba(22, 41, 95, 0.3);
  display: flex; flex-direction: column; overflow: hidden;
}
#chat-head { display: flex; justify-content: space-between; align-items: center; background: var(--navy); color: #fff; padding: 10px 14px; }
#chat-close { background: none; border: none; color: #fff; font-size: 1.3rem; cursor: pointer; line-height: 1; }
#chat-log { max-height: 320px; max-height: min(320px, calc(100dvh - 240px)); overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { padding: 8px 12px; border-radius: 12px; max-width: 85%; white-space: pre-wrap; }
.chat-assistant { background: var(--navy-tint); align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-user { background: var(--cream-dark); align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-links { display: flex; flex-wrap: wrap; gap: 6px; }
#chat-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--navy-tint); }
#chat-form input { flex: 1; min-width: 0; font: inherit; font-size: 1rem; padding: 8px 10px; border: 1px solid #c4c9d6; border-radius: 6px; }
#chat-note { margin: 0; padding: 0 12px 10px; font-size: 0.75rem; color: var(--ink-soft); }

/* Near-full-width chat panel on small phones */
@media (max-width: 480px) {
  #chat-panel {
    position: fixed; left: 12px; right: 12px; width: auto;
    bottom: calc(94px + env(safe-area-inset-bottom, 0px));
  }
}
