/* Coquina web. Colours and type follow the app (lib/design/colors.dart, type.dart): Anton headlines, Nunito Sans text,
   coral brand #F0493E, primary #D7382D (light) / #FF8A7F (dark). */
@font-face { font-family: Anton; src: url(/fonts/anton_regular.ttf) format('truetype'); font-display: swap; }
@font-face { font-family: 'Nunito Sans'; src: url(/fonts/nunito_sans_regular.ttf) format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Nunito Sans'; src: url(/fonts/nunito_sans_semibold.ttf) format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Nunito Sans'; src: url(/fonts/nunito_sans_bold.ttf) format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Nunito Sans'; src: url(/fonts/nunito_sans_extrabold.ttf) format('truetype'); font-weight: 800; font-display: swap; }

:root {
  color-scheme: light dark;
  --brand: #F0493E;
  --accent: light-dark(#D7382D, #FF8A7F);
  --on-accent: light-dark(#fff, #3A0905);
  --accent-soft: light-dark(#FDE4E1, #4A2420);
  --on-accent-soft: light-dark(#7E1D15, #FFD9D4);
  --ink: light-dark(#1E1E1E, #EDE8E4);
  --muted: light-dark(#575757, #B4ADA8);
  --paper: light-dark(#FFFFFF, #1B1A1A);
  --paper-2: light-dark(#F8F6F4, #232120);
  --paper-3: light-dark(#F2EFEC, #2B2827);
  --rule: light-dark(#E3DED9, #46413F);
  --danger: light-dark(#A23B2E, #FFB4A9);
  --breakfast: light-dark(#F7E9CC, #4A3A12);
  --lunch: light-dark(#DDEFE0, #1F3A26);
  --dinner: light-dark(#FDE4E1, #4A2420);
  --snack: light-dark(#E4E6F7, #262B4A);
  --radius: 14px;
  --head: Anton, Impact, 'Arial Narrow', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 'Nunito Sans', system-ui, sans-serif; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--head); font-weight: 400; letter-spacing: .3px; line-height: 1.1; }
h1 { font-size: clamp(30px, 4vw, 44px); text-transform: uppercase; margin: 0; }
h2 { font-size: 22px; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
h3 { font-size: 17px; text-transform: uppercase; margin: 0 0 6px; color: var(--muted); }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--danger); min-height: 1.5em; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; padding: 9px 12px; min-height: 42px;
}
textarea { width: 100%; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px;
}
.loading { display: grid; place-items: center; height: 100vh; font-family: var(--head); font-size: 40px; color: var(--brand); text-transform: uppercase; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center; border: 0; border-radius: 999px;
  padding: 9px 18px; min-height: 42px; background: var(--accent); color: var(--on-accent); font-weight: 700;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.btn.ghost:hover { background: var(--paper-2); }
.btn.on { background: var(--accent-soft); color: var(--on-accent-soft); }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: 14px; }
.btn.danger { background: var(--danger); color: var(--paper); }
.danger-text { color: var(--danger) !important; }
.link { background: none; border: 0; color: var(--accent); font-weight: 700; cursor: pointer; padding: 4px 8px; }
.icon { background: none; border: 0; cursor: pointer; font-size: 22px; line-height: 1; padding: 6px 10px; border-radius: 999px; color: var(--muted); }
.icon:hover { background: var(--paper-3); color: var(--ink); }
.icon.small { font-size: 18px; padding: 4px 8px; }
.row { display: flex; gap: 10px; align-items: center; margin: 10px 0; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 10px; }

/* shell */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 24px; padding: 10px 24px;
  background: var(--brand); color: #fff;
}
.brand { font-family: var(--head); font-size: 28px; text-transform: uppercase; color: #fff; text-decoration: none; letter-spacing: .5px; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
.top nav a { color: #fff; text-decoration: none; font-weight: 700; padding: 8px 14px; border-radius: 999px; }
.top nav a:hover { background: rgba(255,255,255,.16); }
.top nav a.on { background: #fff; color: #B42A20; }
.banner { background: var(--accent-soft); color: var(--on-accent-soft); padding: 10px 24px; font-weight: 600; }
.page { max-width: 1280px; margin: 0 auto; padding: 24px; min-height: 70vh; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search { min-width: min(340px, 100%); }
.foot { max-width: 1280px; margin: 0 auto; padding: 24px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--rule); }
.foot a { color: var(--muted); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); grid-column: 1 / -1; }
.panel { border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 22px; margin: 0 0 16px; max-width: 760px; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 45%, var(--rule)); }
.crumb { margin: 0 0 14px; }
.crumb a { text-decoration: none; font-weight: 700; }

/* toasts and dialogs */
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(560px, calc(100% - 32px)); }
.toast { background: light-dark(#1E1E1E, #EDE8E4); color: light-dark(#fff, #1E1E1E); padding: 12px 16px; border-radius: 12px; display: flex; justify-content: space-between; gap: 12px; align-items: center; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.toast .link { color: light-dark(#FF8A7F, #B42A20); }
dialog.sheet { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100% - 24px)); background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog.sheet::backdrop { background: rgba(20,18,17,.45); }
.sheet-body { padding: 18px 22px 22px; max-height: 85vh; overflow: auto; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.sheet-head h2 { margin: 0; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-weight: 600; }
.form label.check, label.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.form fieldset { border: 1px solid var(--rule); border-radius: 10px; }
.pick-list { max-height: 300px; overflow: auto; display: grid; gap: 4px; border: 1px solid var(--rule); border-radius: 10px; padding: 6px; }
.pick { text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.pick:hover, .pick:focus-visible { background: var(--accent-soft); }
.or { text-align: center; color: var(--muted); font-size: 14px; }
.form .row input { flex: 1; min-width: 0; }

/* sign in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, var(--brand), #B42A20); }
.signin-card { background: var(--paper); border-radius: 24px; padding: 40px 36px; width: min(440px, 100%); text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.brand-big { font-family: var(--head); font-size: 64px; color: var(--brand); text-transform: uppercase; line-height: 1; margin-bottom: 12px; }
.lede { font-size: 18px; }
.provider { width: 100%; background: var(--paper); color: var(--ink); border: 1px solid var(--rule); }
.provider.apple { background: light-dark(#000, #fff); color: light-dark(#fff, #000); border: 0; }
.provider .g { font-weight: 800; color: #4285F4; font-size: 18px; }
.links { margin-top: 18px; }

/* recipe box */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.chip { border: 1px solid var(--rule); background: var(--paper); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.chip .count { font-size: 12px; opacity: .8; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
.card { display: block; text-decoration: none; color: inherit; border-radius: var(--radius); overflow: hidden; background: var(--paper-2); border: 1px solid var(--rule); transition: transform .12s, box-shadow .12s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.card-photo { aspect-ratio: 4/3; background: var(--paper-3); overflow: hidden; }
.card-photo img, .hero-photo img, .p-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile { width: 100%; height: 100%; display: grid; place-items: center; font-family: var(--head); font-size: 56px; color: var(--accent); background: var(--accent-soft); }
.card-text { padding: 10px 14px 14px; }
.card-title { font-weight: 800; line-height: 1.25; }
.card-meta { display: flex; gap: 10px; color: var(--muted); font-size: 14px; margin-top: 4px; }
.fav, .stars { color: var(--accent); }

/* recipe page */
.recipe { max-width: 1000px; }
.recipe-head { display: grid; grid-template-columns: minmax(0, 380px) 1fr; gap: 28px; align-items: start; margin-bottom: 28px; }
.hero-photo { aspect-ratio: 4/3; border-radius: var(--radius); overflow: hidden; background: var(--paper-3); }
.recipe-title h1 { margin-bottom: 10px; text-transform: none; }
.meta { color: var(--muted); font-weight: 600; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { background: var(--accent-soft); color: var(--on-accent-soft); border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 700; }
.tag.soft { background: var(--paper-3); color: var(--muted); }
.rate { display: inline-flex; }
.star { background: none; border: 0; font-size: 26px; cursor: pointer; color: var(--rule); padding: 0 2px; line-height: 1; }
.star.on { color: var(--accent); }
.recipe-body { display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: 36px; }
.ing-list { list-style: none; padding: 0; margin: 0; }
.ing-list li { padding: 7px 0; border-bottom: 1px solid var(--rule); }
.ing-list li.section, .step-list li.section { font-family: var(--head); text-transform: uppercase; color: var(--muted); border: 0; padding-top: 14px; list-style: none; }
.step-list { list-style: none; padding: 0; margin: 0; }
.step-list li.step { display: grid; grid-template-columns: 36px 1fr; gap: 10px; margin-bottom: 14px; }
.step-list .num { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.notes-box { margin-top: 28px; max-width: 760px; }

/* meal plan */
.month-name { min-width: 150px; text-align: center; font-size: 18px; }
.legend { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.legend .meal { cursor: default; }
.plan-layout { display: grid; grid-template-columns: 1fr 260px; gap: 18px; align-items: start; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.dow { padding: 8px; text-align: center; font-weight: 800; font-size: 13px; text-transform: uppercase; color: var(--muted); background: var(--paper-2); border-bottom: 1px solid var(--rule); }
.day { min-height: 118px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 4px; display: flex; flex-direction: column; gap: 3px; background: var(--paper); }
.day:nth-child(7n) { border-right: 0; }
.day.other { background: var(--paper-2); }
.day.other .num { color: var(--muted); }
.day.past .meals { opacity: .75; }
.day.today .num { background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 0 8px; }
.day.over { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -3px; }
.day-head { display: flex; justify-content: space-between; align-items: center; }
.day-head .num { font-weight: 800; font-size: 14px; }
.day .add { opacity: 0; background: none; border: 0; cursor: pointer; font-size: 18px; color: var(--accent); width: 28px; height: 28px; border-radius: 50%; }
.day:hover .add, .day .add:focus-visible { opacity: 1; }
.day .add:hover { background: var(--accent-soft); }
@media (hover: none) { .day .add { opacity: 1; } }
.meals { display: grid; gap: 3px; }
.meal { display: flex; align-items: center; gap: 5px; border: 0; border-radius: 7px; padding: 3px 6px; font-size: 12.5px; text-align: left; cursor: grab; line-height: 1.25; width: 100%; color: var(--ink); }
.meal.dragging { opacity: .4; }
.meal .slot { font-weight: 800; font-size: 10px; flex: none; width: 15px; }
.meal-title { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.legend .meal { width: auto; font-size: 13px; padding: 4px 10px; }
.slot-breakfast { background: var(--breakfast); }
.slot-lunch { background: var(--lunch); }
.slot-dinner { background: var(--dinner); }
.slot-snack { background: var(--snack); }
.meal.kind-note, .meal.kind-leftovers { font-style: italic; }
.side { position: sticky; top: 80px; border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px; max-height: calc(100vh - 100px); display: flex; flex-direction: column; gap: 8px; }
.side .search { min-width: 0; width: 100%; }
.side-list { overflow: auto; display: grid; gap: 4px; }
.side-item { display: grid; grid-template-columns: 18px 1fr auto; gap: 6px; align-items: center; padding: 6px 6px; border-radius: 8px; cursor: grab; font-size: 14px; background: var(--paper-2); }
.side-item:hover { background: var(--accent-soft); }
.grip { color: var(--muted); font-size: 12px; letter-spacing: -2px; }

/* grocery */
.addbar { display: flex; gap: 8px; max-width: 760px; margin: 0 0 16px; }
.addbar input { flex: 1; }
.aisle { max-width: 760px; margin-bottom: 16px; }
.glist { list-style: none; padding: 0; margin: 0; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.gitem { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; padding: 6px 10px 6px 14px; border-bottom: 1px solid var(--rule); }
.gitem:last-child { border-bottom: 0; }
.gcheck { display: flex; gap: 12px; align-items: center; cursor: pointer; min-height: 36px; }
.gcheck input { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); }
.gname { font-weight: 700; }
.gamt { font-weight: 400; color: var(--muted); }
.gfrom { color: var(--muted); font-size: 13px; text-align: right; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gitem.done .gname { text-decoration: line-through; color: var(--muted); }
select.small { min-height: 32px; padding: 3px 8px; font-size: 13px; }

/* cookbook form */
.cb-form { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; margin-bottom: 20px; }
.cb-form label { display: grid; gap: 4px; font-weight: 600; }
.cb-form p { flex-basis: 100%; }
.book { display: grid; gap: 24px; }
.book .page { border: 1px solid var(--rule); border-radius: var(--radius); padding: 40px 48px; max-width: 900px; background: var(--paper); }
.cover { text-align: center; }
.cover-brand { font-family: var(--head); text-transform: uppercase; color: var(--brand); font-size: 22px; letter-spacing: 2px; }
.cover-title { font-size: 56px; margin: 30px 0 10px; }
.cover-range { color: var(--muted); }
.contents { text-align: left; margin: 40px auto 0; max-width: 560px; padding: 0; list-style: none; counter-reset: none; }
.contents li { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; padding: 6px 0; }
.c-title { font-weight: 800; }
.c-dots { border-bottom: 1px dotted var(--rule); transform: translateY(-5px); }
.c-days { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
.p-head { display: grid; grid-template-columns: 1fr 240px; gap: 24px; margin-bottom: 20px; }
.p-head:has(> :only-child) { grid-template-columns: 1fr; }
.p-num { font-family: var(--head); color: var(--brand); font-size: 18px; }
.p-title { font-size: 34px; color: var(--ink); text-transform: none; margin: 0 0 8px; }
.p-photo { aspect-ratio: 4/3; border-radius: 12px; overflow: hidden; }
.p-meta { color: var(--muted); font-weight: 600; }
.p-days { font-size: 14px; color: var(--muted); }
.p-notes { margin-top: 20px; }
.p-source { margin-top: 18px; font-size: 12px; color: var(--muted); word-break: break-all; }

@media (max-width: 960px) {
  .plan-layout { grid-template-columns: 1fr; }
  .side { position: static; max-height: 360px; }
}
@media (max-width: 700px) {
  .top { gap: 10px; padding: 8px 12px; flex-wrap: wrap; }
  .top nav a { padding: 6px 10px; font-size: 14px; }
  .page { padding: 16px 12px; }
  .recipe-head, .recipe-body, .p-head { grid-template-columns: 1fr; }
  .day { min-height: 76px; padding: 2px; }
  .meal { font-size: 11px; padding: 2px 3px; }
  .meal .slot { display: none; }
  .gitem { grid-template-columns: 1fr auto; }
  .gfrom { grid-column: 1; text-align: left; }
  .book .page { padding: 20px; }
}

/* print: the cookbook (and any page) without the site around it */
@media print {
  @page { size: letter; margin: 16mm 16mm 18mm; }
  :root { color-scheme: light; }
  body { background: #fff; color: #1E1E1E; font-size: 11pt; }
  .no-print, .top, .foot, #toasts, .banner { display: none !important; }
  .page { padding: 0; max-width: none; }
  .book { display: block; }
  .book .page { border: 0; border-radius: 0; padding: 0; max-width: none; break-after: page; }
  .book .page:last-child { break-after: auto; }
  .cover { padding-top: 40mm; }
  .recipe-body { grid-template-columns: 1fr 1.8fr; gap: 10mm; }
  .p-head { grid-template-columns: 1fr 60mm; }
  .step-list li.step, .ing-list li { break-inside: avoid; }
  .p-photo { aspect-ratio: 4/3; }
  h2 { color: #D7382D; }
  a { color: inherit; text-decoration: none; }
}
