/* Rachel's shopping list.
   Sage, forest and terracotta, as described in section 2 of the build definition.
   The original token values were never recorded, so these are chosen, not restored.
   Mobile first. Rachel submits from an iPhone. */

:root {
  --cream: #faf7f0;
  --card: #fffdf8;
  --ink: #2b2b27;
  --muted: #6f7268;
  --line: #e2ded2;
  --sage: #8c9a80;
  --sage-light: #e7ebe1;
  --forest: #2e4231;
  --terracotta: #c0674a;
  --terracotta-dark: #a2543a;
  --radius: 12px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 220px;
}

/* Header */

.head h1 {
  margin: 0 0 6px;
  color: var(--forest);
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.head h1 em { font-style: italic; color: var(--sage); }

.standfirst {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 15px;
}

/* Name and routing */

.who {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}

.who-label {
  display: block;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

#submitted_by {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
}

.send-note {
  margin: 0 0 18px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 13px;
}

/* Groups */

.group { margin: 26px 0 0; }

.group-title {
  margin: 0 0 4px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--sage);
  color: var(--forest);
  font-size: 20px;
}

.cat { margin-top: 14px; }

.cat-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.hint {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

/* Rows */

.row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 12px;
  margin-bottom: 8px;
}

.row.is-on {
  border-color: var(--terracotta);
  background: #fff;
  box-shadow: inset 3px 0 0 var(--terracotta);
}

.tick {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  cursor: pointer;
}

.check {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  accent-color: var(--terracotta);
  cursor: pointer;
}

.label {
  flex: 1 1 auto;
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
  cursor: pointer;
}

/* Quantity lives on the row itself, always visible, never hidden behind a tick. */

.qty-wrap { flex: 0 0 auto; }

.qty-inline {
  width: 58px;
  min-height: 40px;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.row.is-on .qty-inline {
  border-color: var(--sage);
  background: var(--sage-light);
}

.label-input {
  min-height: 44px;
  padding: 6px 10px;
  border: 1px dashed var(--sage);
  border-radius: 8px;
  background: #fff;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  width: 100%;
}

.line-total {
  flex: 0 0 auto;
  min-width: 54px;
  text-align: right;
  font-weight: 700;
  color: var(--forest);
  font-variant-numeric: tabular-nums;
}

/* Detail fields, hidden until the row is ticked. Thirty eight open rows of brand and
   note boxes is unusable on a phone. */

.meta { display: none; }

.row.is-on .meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 4px 0 12px;
}

.f { display: block; min-width: 0; }

.f span {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.f input {
  width: 100%;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
}

.f-brand, .f-notes { grid-column: 1 / -1; }

/* Sticky total bar */

.sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 18px rgba(46, 66, 49, 0.1);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}

.totals {
  max-width: 688px;
  margin: 0 auto 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: baseline;
  font-size: 14px;
  color: var(--muted);
}

.totals .sub { font-variant-numeric: tabular-nums; }

.totals .sub b { color: var(--forest); font-weight: 700; }

.totals .grand {
  margin-left: auto;
  font-size: 19px;
  font-weight: 800;
  color: var(--forest);
  font-variant-numeric: tabular-nums;
}

.totals .empty { color: var(--muted); font-style: italic; }

.guard {
  max-width: 688px;
  margin: 0 auto 8px;
  color: var(--terracotta-dark);
  font-size: 14px;
  font-weight: 600;
}

.send {
  display: block;
  max-width: 688px;
  width: 100%;
  margin: 0 auto;
  min-height: 54px;
  border: 0;
  border-radius: var(--radius);
  background: var(--terracotta);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}

.send:active { background: var(--terracotta-dark); }

.send:disabled { background: var(--sage); cursor: default; }

/* Thanks and error panels */

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--sage);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
}

.panel h2 {
  margin: 0 0 10px;
  color: var(--forest);
  font-size: 24px;
}

.panel h2 em { font-style: italic; color: var(--sage); }

.panel p { margin: 0 0 8px; color: var(--ink); }

.signoff { margin-top: 18px; color: var(--muted); font-style: italic; }

.panel-bad { border-top-color: var(--terracotta); }

.panel-bad .send { margin-top: 16px; }

.oops-hint { color: var(--muted); font-size: 14px; }

/* Accessibility */

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

@media (min-width: 560px) {
  .wrap { padding-top: 32px; }
  .head h1 { font-size: 34px; }
  .row.is-on .meta { grid-template-columns: 120px 1fr; }
  .f-brand { grid-column: auto; }
  .f-notes { grid-column: 1 / -1; }
}
