/*
 * "What to make with…" hub pages (/cook-with.html and /cook-with/<slug>.html). Loaded after
 * /compare/compare.css and reuses its tokens and components; this file only adds the recipe
 * pieces. Pages are generated by backend/scripts/cook-with/build.ts.
 */

:root {
  --receipt-bg: #fffbeb;
  --receipt-rule: #e6cfa6;
  --step-bg: var(--yellow);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --receipt-bg: #2a2112;
    --receipt-rule: #5a4529;
  }
}

:root[data-theme="dark"] {
  --receipt-bg: #2a2112;
  --receipt-rule: #5a4529;
}

/* ---------- Hero: the three dishes on the table ---------- */

.plates {
  position: relative;
  width: min(100%, 440px);
  margin: 4px auto 0;
  aspect-ratio: 11 / 9;
}

.plate {
  position: absolute;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--surface-alt);
  border: var(--border);
  border-color: var(--brown-dark);
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 rgba(43, 26, 1, 0.22);
}

.plate-1 {
  z-index: 2;
  top: 9%;
  left: 0;
  width: 76%;
  transform: rotate(-2.5deg);
}

.plate-2 {
  z-index: 1;
  top: 0;
  right: 0;
  width: 46%;
  transform: rotate(4deg);
}

.plate-3 {
  z-index: 3;
  right: 3%;
  bottom: 0;
  width: 50%;
  transform: rotate(-1deg);
}

@media (max-width: 859px) {
  .plates {
    width: min(100%, 360px);
  }
}

/* ---------- Recipe picker under the hero ---------- */

.picker-section {
  padding-bottom: 32px;
}

.picker {
  display: grid;
  gap: 12px;
  margin: 0 0 36px;
  padding: 0;
  list-style: none;
}

.picker a {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 14px;
  align-items: center;
  height: 100%;
  padding: 10px;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.picker a:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.picker img {
  grid-row: 1 / 3;
  width: 96px;
  height: 72px;
  object-fit: cover;
  border: 2px solid var(--ink);
  border-radius: 8px;
}

.p-title {
  align-self: end;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  line-height: 1.2;
  text-transform: uppercase;
}

.p-meta {
  align-self: start;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

@media (min-width: 760px) {
  .picker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .picker a {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
  }

  .picker img {
    grid-row: auto;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    margin-bottom: 10px;
  }

  .p-title {
    padding: 0 4px;
  }

  .p-meta {
    padding: 0 4px 4px;
  }
}

.intro p {
  font-size: 1.08rem;
}

/* ---------- Recipe ---------- */

.recipes {
  display: grid;
  gap: 44px;
}

.recipe {
  overflow: hidden;
  background: var(--surface);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  scroll-margin-top: 80px;
}

.recipe-top {
  display: grid;
}

@media (min-width: 980px) {
  .recipe-top {
    grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
  }
}

.recipe-photo {
  margin: 0;
  border-bottom: var(--border);
}

@media (min-width: 980px) {
  .recipe-photo {
    border-right: var(--border);
    border-bottom: 0;
  }
}

.recipe-photo img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--surface-alt);
}

.recipe-photo figcaption {
  padding: 8px 14px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.recipe-intro {
  padding: 22px 22px 8px;
}

.recipe h2 {
  margin-bottom: 0.45em;
  font-size: clamp(1.55rem, 3.2vw, 2.05rem);
}

.recipe-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.recipe-facts li {
  padding: 4px 11px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface-alt);
  font-size: 0.88rem;
  font-weight: 600;
}

.recipe-facts li.diet {
  border-color: var(--yes);
  background: var(--yes-bg);
  color: var(--yes);
}

.recipe-desc {
  color: var(--text-muted);
  font-size: 1.04rem;
}

/* The Fridge Receipt: what the AI was given, used, left and suggested. */
.receipt {
  --zz: 9px;
  margin: 18px 0 14px;
  padding: 16px 18px calc(18px + var(--zz));
  background: var(--receipt-bg);
  border-radius: 12px 12px 0 0;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(2 * var(--zz)) 100%;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(2 * var(--zz)) 100%;
}

.receipt-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
}

.receipt-head svg {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--accent-text);
}

.receipt-input {
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 2px dashed var(--receipt-rule);
  font-size: 0.92rem;
}

.receipt .label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.receipt .rows {
  display: grid;
  gap: 12px;
}

.skips {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.skips li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.why {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.recipe-body {
  display: grid;
  gap: 28px;
  margin: 0 22px;
  padding: 24px 0 26px;
  border-top: 2px dashed var(--line);
}

@media (min-width: 860px) {
  .recipe-body {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.35fr);
    gap: 40px;
  }
}

.recipe-body h3 {
  font-size: 1.35rem;
}

.ingredients ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ingredients li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.ingredients li::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  transform: translateY(1px);
}

.allergens {
  margin: 18px 0 16px;
  padding: 10px 12px;
  border-left: 4px solid var(--orange);
  border-radius: 6px;
  background: var(--surface-alt);
  font-size: 0.9rem;
}

.nutrition {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.nutrition div {
  padding: 8px 6px;
  border-radius: 10px;
  background: var(--surface-alt);
  text-align: center;
}

.nutrition dt {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.nutrition dd {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 1.12rem;
  letter-spacing: 0.02em;
}

.nutrition-note {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.method ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.method li {
  position: relative;
  margin-bottom: 8px;
  padding: 6px 8px 10px 50px;
  border-radius: 10px;
  counter-increment: step;
  scroll-margin-top: 90px;
}

.method li::before {
  content: counter(step);
  position: absolute;
  top: 4px;
  left: 4px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--brown-dark);
  border-radius: 50%;
  background: var(--step-bg);
  color: var(--brown-dark);
  font-family: var(--font-display);
  font-size: 1rem;
}

.method li:target {
  background: var(--receipt-bg);
}

.tip {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 2px dashed var(--brown-warm);
  border-radius: var(--radius-sm);
  background: var(--receipt-bg);
  font-size: 0.95rem;
}

.tip strong {
  margin-right: 6px;
}

/* ---------- Swaps, shopping, tips ---------- */

.swaps {
  display: grid;
  gap: 14px;
  margin: 0;
}

@media (min-width: 640px) {
  .swaps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.swaps dt {
  margin-bottom: 6px;
  font-size: 1.05rem;
  font-weight: 700;
}

.swaps dd {
  margin: 0;
  color: var(--text-muted);
}

.buy-grid {
  display: grid;
  gap: 20px;
  align-items: start;
}

@media (min-width: 860px) {
  .buy-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 32px;
  }
}

.buy-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.buy-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.buy-list li:first-child {
  padding-top: 0;
}

.pantry h3 {
  font-size: 1.15rem;
}

.tips .source {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}

.callout.how {
  display: block;
  max-width: var(--prose);
  margin: 0;
}

.callout.how h2 {
  margin-bottom: 0.4em;
  font-size: 1.3rem;
}

/* ---------- Links to other hubs ---------- */

.related img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  margin-bottom: 6px;
  border: 2px solid var(--ink);
  border-radius: 8px;
}

.compare-head {
  margin: 44px 0 20px;
  font-size: clamp(1.3rem, 2.6vw, 1.6rem);
}

/* ---------- Index page ---------- */

.hub-grid {
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 560px) {
  .hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 980px) {
  .hub-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.hub-grid > li > a {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
  color: var(--text);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hub-grid > li > a:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.hub-grid img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-bottom: var(--border);
  background: var(--surface-alt);
}

.h-title {
  padding: 14px 16px 6px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.h-recipes {
  margin: 0;
  padding: 0 16px 18px;
  list-style: none;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.h-recipes li + li {
  margin-top: 4px;
}

/* ---------- Footer with four columns ---------- */

.footer-hubs {
  columns: 2;
  column-gap: 20px;
}

@media (min-width: 760px) and (max-width: 959px) {
  .site-footer .wrap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .site-footer .wrap {
    grid-template-columns: 1.2fr 1.5fr 1fr 0.8fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .picker a,
  .hub-grid > li > a {
    transition: none;
  }

  .picker a:hover,
  .hub-grid > li > a:hover {
    transform: none;
  }
}

@media print {
  .plates,
  .picker,
  .cta-band,
  .receipt-input {
    display: none;
  }

  .recipe {
    box-shadow: none;
    break-inside: avoid-page;
  }
}

.edit-note {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-left: 4px solid var(--yes);
  border-radius: 6px;
  background: var(--yes-bg);
  font-size: 0.9rem;
}

.edit-note strong {
  margin-right: 6px;
}
