/* Commonplace on the web: the same Classical look as the Android app. */
:root {
  --bg: #f3f2f2;
  --surface: #eae9e9;
  --text: #201f1d;
  --accent: #b68235;
  --accent-100: #fff3e4;
  --accent-700: #7d5411;
  --accent-800: #5a3b0a;
  --neutral-200: #eae7e7;
  --neutral-800: #444141;
  --divider: rgba(32, 31, 29, 0.16);
  --muted: rgba(32, 31, 29, 0.55);
  --faint: rgba(32, 31, 29, 0.4);
  --hatch-a: #fef7ec;
  --hatch-b: #fbf3e6;
  --heading: "Cormorant Garamond", Georgia, serif;
  --body: "Lora", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a18;
    --surface: #282622;
    --text: #ede8df;
    --accent: #d3a45f;
    --accent-100: #3a2f20;
    --accent-700: #e6bf85;
    --accent-800: #f0d2a4;
    --neutral-200: #302e2a;
    --neutral-800: #d2ccc3;
    --divider: rgba(237, 232, 223, 0.18);
    --muted: rgba(237, 232, 223, 0.55);
    --faint: rgba(237, 232, 223, 0.4);
    --hatch-a: #23211e;
    --hatch-b: #2a2824;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Beats the display rules below: hiding a screen or the tab bar must always win. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
}

h1, h2, h3, h4 { font-family: var(--heading); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 28px; }
h2 { font-size: 21px; }

.screen { padding: max(12px, env(safe-area-inset-top)) 20px 24px; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 0 12px; }
.topbar .actions { margin-left: auto; display: flex; gap: 8px; }
.kicker { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); flex: 1; }
.muted { color: var(--muted); }
.center { text-align: center; }
.error { color: var(--accent-700); font-size: 14px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--divider);
  background: transparent; color: var(--text); font-size: 19px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-family: var(--body);
}
.icon-btn.on { color: var(--accent); border-color: var(--accent); }
.icon-btn.tiny { width: 34px; height: 34px; border: none; font-size: 15px; color: var(--faint); }

.btn {
  font-family: var(--heading); font-weight: 600; font-size: 16px;
  padding: 11px 18px; border-radius: 4px; border: 1px solid var(--divider);
  background: transparent; color: var(--text); cursor: pointer;
}
.btn-primary { border-color: var(--accent); color: var(--accent); }
.btn.small { padding: 7px 14px; font-size: 15px; }
.btn.block, .block { display: block; width: 100%; margin: 8px 0; }
.btn:disabled { opacity: 0.45; }
.link { background: none; border: none; color: var(--accent-700); font-family: var(--body); font-size: 13px; cursor: pointer; padding: 6px 4px; }

.input {
  width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; font-size: 15px;
  color: var(--text); background: transparent; border: 1px solid var(--divider); border-radius: 4px;
}
.input.rounded { border-radius: 22px; padding: 10px 16px; }
textarea.input { min-height: 120px; resize: vertical; }
select.input { appearance: none; }
.input:focus { outline: none; border-color: var(--accent); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--divider);
  background: transparent; color: var(--text); font-family: var(--body); font-size: 14px; cursor: pointer;
}
.chip.on { border-color: var(--accent); background: var(--accent-100); color: var(--accent-700); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding-top: 10px; }
/* Marked as missing something: faded back and colourless, like a page not finished yet. */
.card.needs-info { opacity: 0.55; }
.card.needs-info .photo img { filter: grayscale(1); }
.meta.missing { color: var(--muted); }
.field.check { flex-direction: row; align-items: flex-start; gap: 10px; font-size: 13px; }
.field.check input { margin-top: 2px; accent-color: var(--accent); }
.card { border: 1px solid var(--divider); border-radius: 4px; overflow: hidden; cursor: pointer; background: var(--bg); }
.card .photo { position: relative; height: 112px; background: repeating-linear-gradient(45deg, var(--hatch-a), var(--hatch-a) 9px, var(--hatch-b) 9px, var(--hatch-b) 18px); display: grid; place-items: center; overflow: hidden; }
/* Absolute, so a tall photo fills its box instead of pushing the title over itself. */
.card .photo img, .hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.card .photo span { font-family: ui-monospace, Menlo, monospace; font-size: 10px; color: var(--muted); padding: 0 8px; text-align: center; }
.card .text { padding: 10px 12px 13px; border-top: 1px solid var(--divider); }
/* A set number of lines each, so every card is the same height and the grid lines up. */
.card .title {
  font-family: var(--heading); font-weight: 600; font-size: 17px; line-height: 1.2; margin: 3px 0 6px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  min-height: 2.4em;
}
.card .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { font-size: 12px; color: var(--muted); }

.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 3px; background: var(--accent-100); color: var(--accent-800); }
.tag.plain { background: var(--neutral-200); color: var(--neutral-800); }

.hero { border: 1px solid var(--divider); padding: 1px; background: var(--surface); margin: 6px 0 14px; }
.hero > div { position: relative; height: 220px; background: repeating-linear-gradient(45deg, var(--hatch-a), var(--hatch-a) 9px, var(--hatch-b) 9px, var(--hatch-b) 18px); display: grid; place-items: center; margin: 6px; overflow: hidden; }
hr.rule { border: none; border-top: 1px solid var(--divider); margin: 16px 0; }

.servings { display: flex; align-items: center; gap: 10px; }
.servings .count { min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; }
.ingredient, .step { padding: 9px 0; border-bottom: 1px solid var(--divider); }
.step { display: flex; gap: 10px; }
.step .n { font-family: var(--heading); font-weight: 600; color: var(--accent); width: 22px; flex: none; }
.notes { font-style: italic; }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.field > span { color: var(--text); }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

.item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--divider); }
.item .box { width: 22px; height: 22px; flex: none; border: 1.5px solid var(--divider); border-radius: 6px; display: grid; place-items: center; color: var(--accent); cursor: pointer; }
.item .box.on { border-color: var(--accent); }
.item .label { flex: 1; cursor: text; }
.item .input { flex: 1; }
.item.done .label { text-decoration: line-through; color: var(--muted); }
.item .src { font-size: 11px; color: var(--faint); }
.shop-head { font-family: var(--heading); font-size: 21px; font-weight: 600; margin: 20px 0 0; }
.section-head { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-700); margin: 16px 0 2px; }
.row-actions { display: flex; align-items: center; gap: 4px; margin: 0 0 6px; }
.row-actions .muted { flex: 1; font-size: 13px; }
.add-row { display: flex; gap: 8px; margin-top: 16px; }
.add-row .input { flex: 1; }

.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.day { padding-top: 14px; border-bottom: 1px solid var(--divider); }
.day h3 { font-family: var(--heading); font-size: 20px; display: flex; align-items: baseline; gap: 8px; }
.day h3 .when { font-family: var(--body); font-size: 12px; color: var(--muted); font-weight: 400; }
.day .add { margin-left: auto; }
.planned { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.planned .thumb { width: 48px; height: 48px; border-radius: 4px; overflow: hidden; flex: none; background: var(--surface); }
.planned .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.planned .name { flex: 1; font-family: var(--heading); font-weight: 600; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around;
  background: var(--bg); border-top: 1px solid var(--divider);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}
.tab { background: none; border: none; font-family: var(--body); font-size: 13px; color: var(--text); padding: 6px 12px; cursor: pointer; }
.tab.on { color: var(--accent); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(86px + env(safe-area-inset-bottom));
  background: var(--text); color: var(--bg); padding: 9px 18px; border-radius: 999px; font-size: 14px;
  max-width: 90vw; text-align: center;
}

.sheet {
  border: none; border-radius: 16px; background: var(--bg); color: var(--text);
  width: min(520px, 92vw); max-height: 80vh; padding: 20px;
}
.sheet::backdrop { background: rgba(0, 0, 0, 0.5); }
.sheet .input { margin: 10px 0; }
.pick { padding: 10px 0; border-bottom: 1px solid var(--divider); cursor: pointer; }

.join { max-width: 420px; margin: 12vh auto 0; text-align: center; display: flex; flex-direction: column; gap: 14px; }
.join .input { text-align: center; letter-spacing: 0.12em; font-family: var(--heading); font-size: 20px; }

@media (min-width: 640px) {
  .screen { max-width: 760px; margin: 0 auto; }
  .grid { grid-template-columns: repeat(3, 1fr); }
}
