/* --- Recipe page -----------------------------------------------------------
   One recipe, on an address of its own (#/recipe/<id>). A photo you can
   actually see, the numbers that decide whether you're cooking it, then the
   two columns you work from — ingredients on the left, method on the right.
   Everything below that is ours: what it has cost, what we thought of it. */

#recipeInner { max-width: 1160px; padding-bottom: 64px; }

/* ---------- the bar above the page: back, where it came from, prev/next ---------- */
.rp-nav { gap: 10px; margin-bottom: 14px; }
.rp-nav .rp-gap { flex: 1; }
.rp-crumb {
  font-size: 12.5px; font-weight: 600; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.rp-crumb i { font-style: normal; opacity: .5; }
.rp-pos { font-size: 12px; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rp-pos i { font-style: normal; font-weight: 500; opacity: .7; }
.rp-step {
  width: 34px; height: 34px; display: grid; place-items: center; flex: none;
  border-radius: var(--radius-sm); background: var(--surface);
  border: 1px solid var(--border-strong); color: var(--text-soft);
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.rp-step:hover:not([disabled]) { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.rp-step[disabled] { opacity: .35; cursor: default; }

/* ---------- hero ---------- */
.rp-hero {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  min-height: 340px;
  display: flex;
  align-items: flex-end;
  background: linear-gradient(135deg, var(--green-dark), #0b3f26 70%);
  box-shadow: var(--shadow-card);
  isolation: isolate;
}
.rp-hero-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 60%;
  z-index: -2;
}
.rp-hero-img.gone { display: none; }
/* the scrim: dark enough at the bottom to read white type over any photo,
   clear at the top so the food is still the thing you see */
.rp-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to top, rgba(6,10,8,.94) 0%, rgba(6,10,8,.84) 38%,
                                       rgba(6,10,8,.46) 68%, rgba(6,10,8,.08) 100%);
}
.rp-hero-text { padding: 30px 30px 26px; width: 100%; }

.rp-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.rp-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  padding: 4px 11px; border-radius: 999px;
  background: rgba(255,255,255,.94); color: var(--green-dark);
}
.rp-pill.v4 { color: #3341c9; }
.rp-pill.soft {
  background: rgba(255,255,255,.14); color: #fff;
  border: 1px solid rgba(255,255,255,.3); font-weight: 600;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}

.rp-hero h1 {
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.08;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0,0,0,.4);
  max-width: 20ch;
}
.rp-desc {
  margin-top: 10px; max-width: 62ch;
  font-size: 14px; line-height: 1.5; color: rgba(255,255,255,.88);
  text-shadow: 0 1px 10px rgba(0,0,0,.55);
}
.rp-facts {
  display: flex; gap: 8px 18px; flex-wrap: wrap; margin-top: 14px;
  font-size: 12.5px; font-weight: 650; color: rgba(255,255,255,.92);
  text-shadow: 0 1px 10px rgba(0,0,0,.55);
}
.rp-facts > span { display: inline-flex; align-items: center; gap: 7px; }
.rp-facts .gold { color: #ffd451; }
.rp-facts .ok { color: #7ce6ab; }
.rp-facts a { color: inherit; }

.rp-heart {
  position: absolute; top: 16px; right: 16px;
  width: 42px; height: 42px; border-radius: 999px;
  display: grid; place-items: center; font-size: 17px;
  background: rgba(255,255,255,.92); color: var(--text-muted);
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
  transition: transform .15s ease, color .15s ease, background-color .15s ease;
}
.rp-heart:hover { transform: scale(1.08); color: var(--red); }
.rp-heart.on { color: var(--red); }

/* ---------- the actions, which follow you down the page ---------- */
.rp-actions {
  position: sticky; top: 0; z-index: 6;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin: 0 -8px; padding: 12px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
}
.rp-actions .rp-gap { flex: 1; }
.rp-actions .cookbtn { padding: 11px 20px; font-size: 14px; border-radius: var(--radius-sm); }
.rp-actions .cookbtn .ic { width: 1.25em; height: 1.25em; }

.selbtn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13.5px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.selbtn:hover { background: var(--surface-3); border-color: var(--accent); color: var(--accent); }
.selbtn.on {
  background: var(--accent-soft); color: var(--green-dark);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-weight: 650;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-soft);
  cursor: pointer;
  transition: background-color 0.15s ease, color .15s ease, border-color .15s ease;
}
.iconbtn:hover { background: var(--surface-3); color: var(--text); }
.iconbtn.favon {
  background: color-mix(in srgb, var(--red) 11%, transparent);
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 28%, transparent);
}

/* ---------- macros ---------- */
.rp-macros {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.rp-mgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

.bm {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
}
.bm b { display: block; font-size: 21px; font-weight: 780; letter-spacing: -.02em; line-height: 1.15; color: var(--text); }
.bm span { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.bm.cal { background: color-mix(in srgb, var(--amber) 11%, transparent); border-color: color-mix(in srgb, var(--amber) 24%, transparent); }
.bm.cal b { color: var(--amber); }
.bm.p { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 26%, transparent); }
.bm.p b { color: var(--green-dark); }
.bm.c { background: color-mix(in srgb, var(--blue) 10%, transparent); border-color: color-mix(in srgb, var(--blue) 24%, transparent); }
.bm.c b { color: var(--blue); }
.bm.f { background: color-mix(in srgb, var(--gold) 12%, transparent); border-color: color-mix(in srgb, var(--gold) 26%, transparent); }
.bm.f b { color: var(--gold); }

.rp-split { margin-top: 14px; }
.rp-splitbar { display: flex; height: 9px; border-radius: 99px; overflow: hidden; background: var(--surface-3); }
.rp-splitbar i { display: block; height: 100%; }
.rp-splitbar .rp-protein { background: var(--accent); }
.rp-splitbar .rp-carbs   { background: var(--blue); }
.rp-splitbar .rp-fat     { background: var(--gold); }
.rp-splitkey { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 9px; font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
.rp-splitkey span { display: inline-flex; align-items: center; gap: 6px; }
.rp-splitkey b { font-weight: 750; color: var(--text-soft); }
.rp-splitkey i { width: 9px; height: 9px; border-radius: 3px; }
.rp-splitkey .rp-protein i { background: var(--accent); }
.rp-splitkey .rp-carbs i   { background: var(--blue); }
.rp-splitkey .rp-fat i     { background: var(--gold); }
.rp-mnote {
  display: flex; align-items: center; gap: 7px; margin-top: 12px;
  font-size: 11.5px; color: var(--text-muted);
}

/* ---------- the two working columns ---------- */
.rp-body {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) 1.35fr;
  gap: 18px;
  align-items: start;
}
.rp-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.rp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 18px 20px 20px;
}
.rp-card > h3 {
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; font-weight: 750; letter-spacing: -.01em; color: var(--text);
  padding-bottom: 12px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.rp-card > h3 > .ic { color: var(--accent); }
.rp-card > h3 small {
  margin-left: auto; font-size: 11px; font-weight: 650;
  color: var(--text-muted); text-transform: none; letter-spacing: 0;
}

/* ingredients — grouped as the book has them, with a dot each for
   "it's in the house" and "it isn't" */
.rp-ing h4 {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); font-weight: 700; margin: 16px 0 6px;
}
.rp-ing h4:first-of-type { margin-top: 0; }
.rp-ing .covbox + h4 { margin-top: 0; }

.ing { list-style: none; }
.ing li {
  padding: 6px 0 6px 22px;
  position: relative;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-soft);
}
.ing li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 13px;
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--accent);
  opacity: 0.5;
}
.ing .rp-q { color: var(--text); font-weight: 750; font-variant-numeric: tabular-nums; }
/* the hollow "we haven't got it" dot is a touch bigger, so it lines up a
   pixel higher than the filled one at this line height */
.rp-ing .ing li.miss::before { top: 12px; }
.rp-ing .ing li.link.miss::before { left: 11.5px; }

/* a line that maps to something the pantry tracks opens it */
.ing li.link { cursor: pointer; border-radius: 8px; padding-right: 24px; margin-inline: -8px; padding-left: 30px; }
.ing li.link::before { left: 12px; }
.ing li.link > .ic {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--text-muted); opacity: 0; transition: opacity .15s ease;
}
.ing li.link:hover { background: var(--surface-2); color: var(--text); }
.ing li.link:hover > .ic { opacity: 1; }

/* method */
.rp-method .steps li {
  padding: 11px 0 11px 44px;
  font-size: 14px;
  line-height: 1.58;
  border-top: 1px dashed var(--border);
}
.rp-method .steps li:first-child { border-top: none; padding-top: 2px; }
.rp-method .steps li::before {
  width: 30px; height: 30px; font-size: 12px;
  top: 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.rp-method .steps li:first-child::before { top: 0; }

/* cost card reuses the cook-history rows from the product page */
.rp-cost .cc-heads { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.rp-cost .cc-stat {
  flex: 1; min-width: 108px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px;
}
.rp-cost .cc-stat b { display: block; font-size: 18px; font-weight: 780; letter-spacing: -.02em; }
.rp-cost .cc-stat span { font-size: 10.5px; font-weight: 650; color: var(--text-muted); }
.rp-cost details { margin-top: 12px; }
.rp-cost summary { cursor: pointer; font-size: 12px; font-weight: 650; color: var(--text-muted); }
.rp-cost summary:hover { color: var(--accent); }
/* the history rows come from the product page, where they had a full-width
   table to spread across — in a column they take two lines instead */
.rp-cost .hist-row { flex-wrap: wrap; gap: 4px 10px; padding: 9px 0; }
.rp-cost .hist-when { flex: 1 0 100%; min-width: 0; }
.rp-cost .li-fix { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; }

/* book notes + the metric footnote, under the method. Both are shared with the
   old sheet layout in cook-pantry.css, which sets a margin for a full-bleed
   panel — inside a column they're already inset, so it's taken back here. */
.rp-col .booknotes, .rp-col .aunote { margin: 0; }
.rp-col .booknotes b { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- our cook log ---------- */
.rpage .cooksec { margin-top: 18px; padding: 18px 20px 20px; }
.rpage .cooksec .notes-form { margin-top: 14px; }
.rpage .cooksec .who { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- more like this ---------- */
.rp-more { margin-top: 22px; }
.rp-more h3 {
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; font-weight: 750; color: var(--text); margin-bottom: 12px;
}
.rp-more h3 > .ic { color: var(--accent); }
.rp-morerow {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px;
}
.rp-mcard {
  display: flex; flex-direction: column; text-align: left;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.rp-mcard:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 10px 22px -14px rgba(22,26,49,.5); }
.rp-mcard img { width: 100%; height: 96px; object-fit: cover; object-position: center 62%; background: var(--surface-3); }
.rp-mtitle {
  padding: 9px 11px 2px; font-size: 12.5px; font-weight: 650; line-height: 1.3;
  color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rp-mmeta { padding: 0 11px 10px; font-size: 11px; color: var(--text-muted); }

/* ---------- where a recipe came from ----------
   Only drawn for recipes that arrived in an installed pack. A private pack —
   somebody else's copyrighted book, licensed to this house — is marked as
   such, because that's the fact a person needs before they pass it on. */
.pack-credit {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  border: 1px solid var(--border);
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-muted);
  max-width: 460px;
}

.pack-credit .ic {
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 1px;
}

.pack-credit b {
  color: var(--text-soft);
  font-weight: 700;
}

.pack-credit i {
  display: block;
  font-style: normal;
  margin-top: 2px;
}

.pack-credit.private {
  border-color: color-mix(in srgb, var(--amber) 42%, var(--border));
  background: color-mix(in srgb, var(--amber) 8%, var(--surface-3));
}

.pack-credit.private i { color: var(--amber); font-weight: 650; }


/* ---------- narrower screens ---------- */
@media (max-width: 900px) {
  .rp-body { grid-template-columns: 1fr; }
  .rp-hero { min-height: 260px; }
  .rp-hero-text { padding: 22px 20px 20px; }
  /* the favourite button sits over the top-right corner — on a narrow hero the
     pills reach it, so they wrap short of it rather than running underneath */
  .rp-pills { padding-right: 46px; }
  .rp-actions .iconbtn span { display: none; }
  .rp-actions .iconbtn { padding-inline: 13px; }
}
@media (max-width: 640px) {
  #recipeInner { padding-inline: 14px; }
  .rp-mgrid { grid-template-columns: repeat(2, 1fr); }
  .rp-crumb { display: none; }
  .rp-card { padding: 15px 15px 17px; }
  /* a bar that follows you down a phone screen would cover the step you're
     reading — on a phone it stays where it was put */
  .rp-actions { position: static; padding: 12px 8px 4px; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .rp-actions .cookbtn, .rp-actions .selbtn { flex: 1 0 100%; justify-content: center; }
  .rp-actions .rp-gap { display: none; }
  /* ten stars at full size run off the edge of a phone */
  .rpage .stars button { font-size: 1.05rem; }
}
