/* DinnerDocket: app styles + printable recipe cards */

:root {
  --bg: #fbf8f1;
  --surface: #ffffff;
  --ink: #1d2a22;
  --muted: #66736b;
  --line: #e7e1d3;
  --green: #1f7a4d;
  --green-dark: #155c39;
  --green-soft: #e3f1e8;
  --lime: #9bd14b;
  --amber: #f3b23c;
  --amber-soft: #fdf1d8;
  --red: #b4372f;
  --walmart: #0071dc;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(29 42 34 / 6%), 0 6px 20px rgb(29 42 34 / 6%);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); }
img { max-width: 100%; }
a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 .4em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }

.container { width: min(1180px, 100% - 32px); margin-inline: auto; }
.main { padding: 32px 0 64px; min-height: 70vh; }
.narrow { max-width: 620px; margin-inline: auto; }
.muted { color: var(--muted); }
.tiny { font-size: .82rem; }
.center { text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--green); margin-bottom: .5em; }
.eyebrow a { text-decoration: none; }
.lead { font-size: 1.12rem; color: #3b4a40; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.section-title { margin-top: 48px; }

/* Header / footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; font: 700 1.25rem var(--display); color: var(--ink); text-decoration: none; }
.logo__mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--green); color: #fff; font: 700 .85rem var(--font); }
.nav { display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.nav a.active { color: var(--green); }
.nav form { display: inline; }
.site-footer { border-top: 1px solid var(--line); padding: 24px 0; color: var(--muted); font-size: .85rem; }

/* Buttons */
.btn, input[type="submit"].btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 999px; border: 2px solid var(--green);
  background: var(--green); color: #fff; font: 600 .95rem var(--font); text-decoration: none; cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--green); }
.btn--ghost:hover { background: var(--green-soft); color: var(--green-dark); }
.btn--small { padding: 6px 14px; font-size: .85rem; }
.btn--large { padding: 14px 26px; font-size: 1.05rem; }
.btn--block { width: 100%; }
.btn--picked { background: var(--green-soft); color: var(--green-dark); border-color: var(--green-soft); }
.btn--picked:hover { background: #f8e0dd; border-color: #f8e0dd; color: var(--red); }
.btn--walmart { background: var(--walmart); border-color: var(--walmart); }
.btn--walmart:hover { background: #005bb5; border-color: #005bb5; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--green); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-button.muted { color: var(--muted); }
form.button_to { display: inline; }

/* Flash & badges */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; background: var(--green-soft); }
.flash--alert { background: #fbe4e1; color: #7c231d; }
.flash--notice { background: var(--amber-soft); }
.flash form { display: inline; margin-left: 8px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.badge--info { background: #e5eefc; color: #1f4f9c; }
.badge--good { background: var(--green-soft); color: var(--green-dark); }
.badge--warn { background: var(--amber-soft); color: #7a5306; }
.badge--muted { background: #eeeae0; color: var(--muted); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: #f1ede3; font-size: .72rem; font-weight: 600; color: #4e5a52; }
.tag--veg { background: var(--green-soft); color: var(--green-dark); }

/* Forms */
.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], select {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font: 400 1rem var(--font); color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--lime); outline-offset: 1px; border-color: var(--green); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 700; margin-bottom: 8px; }
.choice-row { display: flex; gap: 10px; flex-wrap: wrap; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: grid; place-items: center; min-width: 54px; height: 54px; padding: 0 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-weight: 700; font-size: 1.1rem; text-align: center; line-height: 1.2; }
.choice--wide span { height: auto; padding: 12px 18px; font-size: 1rem; }
.choice small { font-weight: 400; color: var(--muted); font-size: .8rem; }
.choice input:checked + span { border-color: var(--green); background: var(--green-soft); }
.choice input:focus-visible + span { outline: 2px solid var(--lime); }
.toggle { display: flex !important; grid-template-columns: none; flex-direction: row; gap: 12px; align-items: flex-start; padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font-weight: 400 !important; }
.toggle input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--green); }
.auth-card { max-width: 420px; margin: 24px auto; background: var(--surface); padding: 32px; border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-card .form { margin: 20px 0; }

/* Landing */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; padding: 24px 0 48px; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.hero__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.hero__tile { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 1; text-decoration: none; box-shadow: var(--shadow); }
.hero__tile .photo { width: 100%; height: 100%; object-fit: cover; }
.hero__tile > span { position: absolute; inset: auto 0 0; padding: 24px 10px 8px; background: linear-gradient(transparent, rgb(0 0 0 / 65%)); color: #fff; font-size: .78rem; font-weight: 600; line-height: 1.25; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.step { background: var(--surface); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); }
.step__num { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--lime); font-weight: 800; margin-bottom: 12px; }

/* Photos */
.photo--placeholder {
  display: grid; place-items: center; width: 100%; height: 100%;
  background: radial-gradient(circle at 30% 25%, hsl(var(--hue) 70% 78%), hsl(calc(var(--hue) + 40) 55% 52%));
  color: rgb(255 255 255 / 85%); font: 700 2.4rem var(--display);
}

/* Weeks */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { margin: 0; }
.weeks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: 20px; }
.week-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: grid; gap: 16px; }
.week-card--skipped { opacity: .75; }
.week-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.week-card__head h2, .week-card__head p { margin: 0; }
.week-card__meals { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.mini-meal { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); font-size: .8rem; font-weight: 600; line-height: 1.25; }
.mini-meal { min-width: 0; }
.mini-meal__photo { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; font-size: 1.4rem; }
.mini-meal--empty { align-items: center; justify-content: center; aspect-ratio: 4 / 3; border: 2px dashed var(--line); border-radius: 10px; color: var(--muted); }
.week-card__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.recent { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.recent__row { display: grid; grid-template-columns: 160px 1fr auto auto; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); align-items: center; }
.recent__row:last-child { border-bottom: 0; }

/* Menu */
.menu-layout { display: grid; grid-template-columns: 1fr 300px; gap: 28px; align-items: start; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 18px; }
.meal-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; border: 2px solid transparent; transition: border-color .15s; }
.meal-card--picked { border-color: var(--green); }
.meal-card__photo-link { display: block; aspect-ratio: 4 / 3; overflow: hidden; }
.meal-card__photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.meal-card__body { padding: 14px 16px 6px; flex: 1; }
.meal-card__body h3 { margin: 6px 0; }
.meal-card__body h3 a { color: var(--ink); text-decoration: none; }
.meal-card__body p { font-size: .88rem; }
.meal-card__tags { display: flex; gap: 6px; flex-wrap: wrap; }
.meal-card__action { padding: 0 16px 16px; }
.meal-card__action .btn { width: 100%; }
.meal-card__action form { display: block; }
.side-picker { display: grid; gap: 4px; margin: 10px 0 4px; }
.side-picker label { font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.side-picker .side-select { width: 100%; font-size: .85rem; padding: 6px 8px; }
.meal-card__side { margin: 8px 0 0; font-weight: 600; color: var(--muted); }
.box-summary { position: sticky; top: 84px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: grid; gap: 10px; }
.box-summary h2, .box-summary p { margin: 0; }
.box-summary__list { margin: 4px 0 8px; padding-left: 20px; font-weight: 600; }
.box-summary form { display: block; }

/* Shopping list */
.list { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 14px; background: #f6f2e8; }
.list td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.list__check { width: 48px; text-align: center; }
.list__check input { width: 18px; height: 18px; accent-color: var(--green); }
.list__qty { width: 90px; }
.list__actions { white-space: nowrap; text-align: right; }
.list__actions a + a { margin-left: 10px; }
.qty { width: 70px !important; padding: 6px 8px !important; }
.product { display: flex; gap: 10px; align-items: center; font-size: .88rem; }
.product__img { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--line); flex-shrink: 0; }
.cart-bar { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 16px; padding: 16px 20px; background: var(--surface); border-radius: var(--radius); box-shadow: 0 -4px 24px rgb(29 42 34 / 10%); }
.pantry { margin-bottom: 28px; padding: 18px 20px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.pantry h2 { margin: 0 0 4px; font-size: 1.15rem; }
.pantry__items { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 16px; }
.pantry__items label { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; font-weight: 400; }
.pantry__items input { margin-top: 3px; flex-shrink: 0; }
.on-hand { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.on-hand li { display: flex; justify-content: space-between; gap: 8px; padding: 10px 14px; background: var(--surface); border-radius: 10px; }
.search-bar { display: flex; gap: 8px; margin: 16px 0; }
.results { display: grid; gap: 10px; margin-top: 16px; }
.result { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); }
.result__info { flex: 1; font-size: .9rem; }

/* Recipe page */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.filters input, .filters select { width: auto; flex: 1 1 200px; }
.recipe__hero { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: center; margin-bottom: 36px; }
.recipe__photo { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); font-size: 5rem; box-shadow: var(--shadow); }
.stats { display: flex; gap: 28px; margin: 18px 0; }
.stats div { display: grid; }
.stats strong { font: 700 1.4rem var(--display); }
.stats span { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.recipe__actions { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; }
.servings-form label { display: grid; gap: 4px; font-size: .8rem; font-weight: 600; }
.servings-form select { width: 90px; }
.servings-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.servings-form .side-select { width: auto; max-width: 100%; }
.recipe__body { display: grid; grid-template-columns: 340px 1fr; gap: 36px; align-items: start; }
.recipe__ingredients { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; position: sticky; top: 84px; }
.recipe__ingredients ul { list-style: none; padding: 0; margin: 0 0 12px; }
.recipe__ingredients li { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .93rem; }
.recipe__ingredients li.staple { color: var(--muted); }
.subhead { font: 700 .78rem var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--green); margin-top: 14px; }
.steps-list { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 18px; }
.steps-list li { counter-increment: step; position: relative; padding: 18px 20px 10px 68px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.steps-list li::before { content: counter(step); position: absolute; left: 18px; top: 16px; width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 800; }
.tips { margin-top: 24px; padding: 18px 22px; background: var(--amber-soft); border-radius: var(--radius); }
.tips ul { margin: 0; padding-left: 18px; }

@media (max-width: 900px) {
  .hero, .recipe__hero, .recipe__body, .menu-layout { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
  .box-summary, .recipe__ingredients { position: static; }
  .recent__row { grid-template-columns: 1fr auto auto; }
  .recent__row .muted { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 640px) {
  .steps { grid-template-columns: 1fr; }
  .list thead { display: none; }
  .list, .list tbody, .list tr, .list td { display: block; width: 100%; }
  .list tr { display: grid; grid-template-columns: 40px 1fr 80px; border-top: 1px solid var(--line); padding: 8px 0; }
  .list td { border: 0; padding: 6px 10px; }
  .list td:nth-child(3) { grid-column: 2 / -1; }
  .list td:nth-child(4) { grid-column: 3; grid-row: 1; }
  .list__actions { grid-column: 2 / -1; text-align: left; }
  .list__qty { width: auto; }
}

/* ───────── Printable recipe cards (letter, landscape) ───────── */
.print-body { background: #d9d4c7; }
.print-toolbar { position: sticky; top: 0; z-index: 5; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
.print-empty { text-align: center; padding: 60px; }

.card-page {
  width: 11in; height: 8.5in; margin: 24px auto; padding: .45in; background: #fff; overflow: hidden;
  box-shadow: 0 8px 30px rgb(0 0 0 / 15%); position: relative; font-size: 10.5pt; line-height: 1.4;
}
.card-front { display: grid; grid-template-columns: 4.6in 1fr; gap: .4in; }
.card-front__left { display: flex; flex-direction: column; min-height: 0; }
.card-photo { width: 100%; height: 3.4in; object-fit: cover; border-radius: 12px; font-size: 4rem; flex-shrink: 0; }
.card-number { margin-top: 14px; font-size: 8pt; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--green); }
.card-title { font-size: 24pt; margin: 4px 0 8px; }
.card-desc { color: #46524a; font-size: 10pt; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.card-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.card-stats span { padding: 5px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); font-weight: 600; font-size: 9pt; }
.card-front__right { display: flex; flex-direction: column; min-height: 0; border-left: 2px solid var(--green-soft); padding-left: .35in; }
.card-heading { font-size: 15pt; border-bottom: 3px solid var(--lime); padding-bottom: 6px; }
.card-heading small { font: 500 9pt var(--font); color: var(--muted); }
.card-subhead { font: 700 8pt var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--green); margin: 10px 0 4px; }
.card-ingredients { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 20px; font-size: 9.5pt; }
.card-ingredients li { break-inside: avoid; padding: 3px 0 3px 14px; position: relative; }
.card-ingredients li::before { content: ""; position: absolute; left: 0; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--lime); }
.card-ingredients--pantry { color: var(--muted); }
.card-ingredients--pantry li::before { background: var(--line); }

.card-back { display: flex; flex-direction: column; }
.card-back__head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 3px solid var(--lime); margin-bottom: 14px; }
.card-back__head h2 { font-size: 16pt; margin: 0 0 6px; }
.card-back__head span { color: var(--muted); font-weight: 600; }
.card-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 14px 18px; flex: 1; min-height: 0; }
.card-steps--1, .card-steps--2 { grid-template-columns: repeat(2, 1fr); grid-auto-rows: auto; }
.card-steps--4 { grid-template-columns: repeat(2, 1fr); }
.card-steps--7, .card-steps--8 { grid-template-columns: repeat(4, 1fr); }
.card-step { position: relative; padding: 10px 12px 8px 12px; background: #faf8f2; border-radius: 10px; overflow: hidden; font-size: 9pt; }
.card-step__num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--green); color: #fff; font-weight: 800; font-size: 10pt; margin-bottom: 4px; }
.card-step h3 { font: 700 10pt var(--font); margin: 0 0 4px; }
.card-step p { margin: 0 0 4px; }
.card-tips { margin-top: 12px; padding: 8px 12px; background: var(--amber-soft); border-radius: 8px; font-size: 8.5pt; }

@page { size: letter landscape; margin: 0; }
@media print {
  .no-print { display: none !important; }
  .print-body { background: #fff; }
  .card-page { margin: 0; box-shadow: none; break-after: page; page-break-after: always; }
  .card-page:last-child { break-after: auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media screen and (max-width: 11.5in) {
  .card-page { zoom: .6; }
}

/* Placeholder art keeps its centered letter even where photo classes set display */
.photo--placeholder.meal-card__photo, .photo--placeholder.card-photo, .photo--placeholder.recipe__photo { display: grid; }

/* Long recipes: tighter type so every step fits on the card back */
.card-steps--dense .card-step { font-size: 7.8pt; line-height: 1.3; padding: 8px 10px 6px; }
.card-steps--dense .card-step p { margin-bottom: 2px; }

/* Stock problems on the shopping list */
.list__row--alert td { background: var(--amber-soft); }
.stock-note { color: #7a5306; margin-top: 2px; }
