/* Community Pantry & Closet: shared styles for the public page, message pages and staff pages. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2-variations"), url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
}

/* Portsmouth School Department palette (see BRANDING.md). */
:root {
  --bg: #f3f3f3;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --text: #1b1f24;
  --muted: #4f6175;
  --border: #d9dee4;
  --brand: #02365b;
  --brand-hover: #012741;
  --brand-ink: #ffffff;
  --brand-soft: #e6edf3;
  --accent: #8c1209;
  --danger: #a12a1f;
  --danger-soft: #fbe9e6;
  --focus: #1d6fd1;
  --bar-track: #e2e7ec;
  --bar-fill: #02365b;
  --bar-done: #8a97a5;
  --hero-text: #ffffff;
  --hero-muted: #d5e1ec;
  --shadow: 0 1px 2px rgb(2 54 91 / 6%), 0 4px 14px rgb(2 54 91 / 6%);
  --radius: 8px;
  --radius-sm: 5px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1620;
    --surface: #142130;
    --surface-2: #1b2a3b;
    --text: #e9eef3;
    --muted: #a9b7c6;
    --border: #2a3a4d;
    --brand: #8cbce6;
    --brand-hover: #a8cdee;
    --brand-ink: #04182a;
    --brand-soft: #17324b;
    --accent: #f08a7e;
    --danger: #ff8f80;
    --danger-soft: #3a1f1c;
    --focus: #9cc4ff;
    --bar-track: #24364a;
    --bar-fill: #8cbce6;
    --bar-done: #6c7d8f;
    --hero-text: #ffffff;
    --hero-muted: #c3d3e2;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 16px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
}

a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-hover); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5rem; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 640px; padding-top: 48px; padding-bottom: 48px; }
.muted { color: var(--muted); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 8px; top: -48px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip-link:focus { top: 8px; }

/* ---- buttons & fields ---- */

.btn, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover, .button:hover { background: var(--surface-2); color: var(--text); }
.btn-primary, .button { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.btn-primary:hover, .button:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--brand-ink); }
.btn-danger { color: var(--danger); }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 0.875rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field label, .label { font-weight: 600; font-size: 0.9375rem; }
.req { font-weight: 400; color: var(--muted); font-size: 0.875rem; }
input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="search"],
select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit;
}
textarea { min-height: 72px; resize: vertical; }
input[aria-invalid="true"] { border-color: var(--danger); }
.hint { margin: 0 0 12px; font-size: 0.875rem; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); }

/* ---- public page ---- */

.district-bar { background: var(--surface); border-top: 6px solid #02365b; border-bottom: 1px solid var(--border); }
.district-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 76px; }
.district { display: inline-flex; align-items: center; gap: 12px; color: var(--brand); text-decoration: none; }
.district:hover { color: var(--brand); }
.district img { width: 39px; height: 48px; flex: none; }
.district-name { display: block; font-size: 1.25rem; font-weight: 500; line-height: 1.2; }
.district-tag { display: block; font-size: 0.875rem; color: var(--text); }
.district-actions { display: flex; align-items: center; gap: 16px; }
.district-link { font-size: 0.875rem; }
.lang-toggle {
  min-height: 36px; padding: 0 14px; border: 1px solid var(--brand); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--brand); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer;
}
.lang-toggle:hover { background: var(--brand-soft); }
#paused-panel h2 { color: var(--accent); }

.eyebrow { margin: 0 0 6px; font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.site-header { background: #02365b; color: var(--hero-text); padding: 36px 0 32px; }
.site-header .eyebrow { color: var(--hero-muted); }
.site-header h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 600; color: var(--hero-text); }
.site-header .intro { max-width: 62ch; margin: 0 0 20px; font-size: 1.0625rem; color: var(--hero-muted); }
.steps { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 0; margin: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; display: flex; align-items: center; gap: 8px; }
.steps li::before {
  content: counter(step); display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: #ffffff; color: #02365b; font-weight: 700; font-size: 0.875rem;
}

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; padding-top: 32px; padding-bottom: 96px; align-items: start; }

.needs-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }
.needs-head h2, .panel h2, .category h3 { text-transform: uppercase; letter-spacing: 0.03em; font-weight: 500; }
.needs-head h2 { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; }
.chip {
  min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.875rem; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

.category { margin-bottom: 28px; }
.category h3 { font-size: 0.9375rem; margin-bottom: 10px; color: var(--muted); }
.items { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 20px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.item.is-picked { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow); }
.item.is-full { box-shadow: none; background: var(--surface-2); }
.item-name { font-size: 1.0625rem; margin: 0; }
.item-unit { font-weight: 400; color: var(--muted); font-size: 0.9375rem; }
.item-notes { margin: 2px 0 0; font-size: 0.875rem; color: var(--muted); }
.bar { height: 8px; margin: 10px 0 6px; border-radius: 999px; background: var(--bar-track); overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--bar-fill); transition: width 0.3s ease; }
.is-full .bar > span { background: var(--bar-done); }
.item-count { margin: 0; font-size: 0.875rem; color: var(--muted); }
.item-count strong { color: var(--text); }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.qty button {
  width: 44px; height: 44px; border: 0; background: transparent; color: var(--brand);
  font: inherit; font-size: 1.375rem; font-weight: 700; cursor: pointer;
}
.qty button:hover { background: var(--brand-soft); }
.qty button[disabled] { color: var(--muted); opacity: 0.45; cursor: not-allowed; background: transparent; }
.qty input {
  width: 56px; min-height: 44px; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  border-radius: 0; text-align: center; font-weight: 700; padding: 0 4px; -moz-appearance: textfield; appearance: textfield;
}
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.badge-done {
  display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--brand-soft);
  color: var(--brand); font-weight: 700; font-size: 0.875rem; white-space: nowrap;
}
.badge-done::before { content: "✓ "; }

.panel { position: sticky; top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel h2 { font-size: 1.25rem; }
.cart { margin: 0 0 16px; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.cart li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.9375rem; }
.cart .cart-qty { font-weight: 700; white-space: nowrap; }
.cart-remove { border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; font-size: 0.8125rem; text-decoration: underline; padding: 0 0 0 8px; }
fieldset { border: 0; margin: 0; padding: 0; }
legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.turnstile { min-height: 65px; margin: 4px 0 12px; }
.form-error { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.form-error ul { margin: 6px 0 0; padding-left: 20px; font-weight: 400; }
.fineprint { margin: 12px 0 0; font-size: 0.8125rem; color: var(--muted); }

.confirmation h2 { color: var(--brand); }
.ref-code { display: inline-block; margin: 4px 0 12px; padding: 6px 14px; border-radius: var(--radius-sm); background: var(--brand-soft); font: 700 1.5rem/1.3 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 0.08em; }
.dropoff { padding: 12px; border-radius: 10px; background: var(--surface-2); white-space: pre-line; }

.mobile-bar { display: none; }

.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 24px 0 40px; font-size: 0.875rem; color: var(--muted); }
.site-footer strong { color: var(--text); font-weight: 600; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }

.notice { padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .panel { position: static; }
  .mobile-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--surface);
    border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgb(0 0 0 / 8%);
  }
  .mobile-bar[hidden] { display: none; }
}

@media (max-width: 480px) {
  .district-link { display: none; }
  .district-name { font-size: 1.0625rem; }
  .item { grid-template-columns: minmax(0, 1fr); }
  .item > .qty, .item > .badge-done { justify-self: start; }
  .site-header { padding: 28px 0 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .bar > span { transition: none; }
}
