/* Recipe library, detail, review, and cook mode. */

.rlist { list-style: none; margin: 0; padding: 0; }

.rcard {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  margin-bottom: 9px;
  cursor: pointer;
}
.rcard:active { background: var(--accent-dim); }
.rcard-main { min-width: 0; flex: 1; }
.rthumb {
  flex: none;
  width: 56px; height: 56px;
  object-fit: cover;
  border-radius: 9px;
  background: var(--bg);
}
.rhero {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: var(--radius);
  margin: 8px 0 12px;
  background: var(--bg);
}

/* Photo picker in the review sheet */
.photo-pick { display: flex; gap: 12px; align-items: center; margin: 10px 0 4px; }
.photo-prev {
  flex: none;
  width: 84px; height: 84px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  font-size: 0.7rem;
  text-align: center;
}
.photo-prev img { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { flex: 1; min-width: 0; }
.photo-actions .addrow { margin-bottom: 4px; }
.photo-actions .linkdanger { margin: 0; display: inline-block; font-size: 0.8rem; }
.photo-actions small { display: block; line-height: 1.35; margin-top: 4px; font-size: 0.74rem; }
.rcard-title { font-weight: 600; line-height: 1.3; }
.rcard-meta { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.chev { color: var(--muted); font-size: 1.5rem; line-height: 1; flex: none; }

.rtags { margin-top: 6px; display: flex; gap: 5px; flex-wrap: wrap; }
.rtag {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

/* --------------------------------------------------------------- detail */

.linkback, .linkdanger {
  background: none;
  border: 0;
  padding: 6px 0;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.linkback { color: var(--accent); }
.linkdanger { color: var(--out); display: block; margin: 18px auto 0; }

.rtitle { font-size: 1.5rem; line-height: 1.2; margin: 6px 0 4px; }
.rmeta { color: var(--muted); font-size: 0.85rem; margin: 0 0 14px; }
.rmeta a { color: var(--accent); }

.scaler {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.85rem;
}
.sbtn {
  min-width: 40px; height: 34px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.sbtn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.serves-out { margin-left: 2px; white-space: nowrap; }

.ings, .steps { margin: 0; }
.ings { list-style: none; padding: 0; }
.ings li + li, .steps li + li { margin-top: 9px; }
.ings label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.ings input[type="checkbox"] { margin-top: 3px; flex: none; width: 19px; height: 19px; }
.ings label:has(input:checked) span { opacity: 0.45; text-decoration: line-through; }
.steps { padding-left: 22px; }
.steps li { line-height: 1.5; }

.rate-row { display: flex; gap: 9px; margin: 16px 0 12px; }
/* .hwbtn (cook mode's "how was it?" sheet, static/cook.js askHowWasIt) is
   styled identically but kept a separate class from .ratebtn on purpose:
   #sheet-host lives inside #view, so a click on a .ratebtn bubbles into the
   detail page's own delegated .ratebtn handler further down this file — same
   hash, same view, no way to guard it by route the way today.js does. */
.ratebtn, .hwbtn {
  flex: 1;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.ratebtn.on, .hwbtn.on { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

.rbuttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.rbuttons .fab { position: static; box-shadow: none; }

/* ---------------------------------------------------------------- import */

.import-choices { display: flex; flex-direction: column; gap: 9px; margin-top: 6px; }
.ichoice {
  text-align: left;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.ichoice b { display: block; font-size: 0.97rem; margin-bottom: 3px; }
.ichoice small { color: var(--muted); line-height: 1.35; display: block; }

.warnbox {
  background: color-mix(in srgb, var(--low) 16%, transparent);
  color: var(--low);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 0.82rem;
  margin: 0 0 10px;
}

.tworow { display: flex; gap: 10px; }
.tworow label { flex: 1; }

.subh { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 18px 0 7px; }

.inglist { list-style: none; margin: 0; padding: 0; }
.ingedit { display: flex; gap: 5px; margin-bottom: 6px; align-items: center; }
.ingedit input {
  min-width: 0;
  flex: 1;
  padding: 9px 10px !important;
  margin-top: 0 !important;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
.ingedit input.q { flex: 0 0 58px; }
.ingedit input.u { flex: 0 0 68px; }
.delrow {
  flex: none;
  width: 30px; height: 34px;
  border: 0; background: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}
.addrow {
  width: 100%;
  padding: 9px;
  border: 1px dashed var(--border);
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
}

.sheet textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 11px 12px;
  font: inherit;
  font-size: 16px;
  line-height: 1.45;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}

/* ------------------------------------------------------------ cook mode
   One step at a time — markup in static/cook.js cookHtml(). Colors and
   type reference the Paper tokens defined in paper.css; custom properties
   resolve at use time, so the load order (this file first) doesn't matter. */

.cookmode {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  background: var(--bg);
  padding: calc(var(--safe-t) + 20px) 20px calc(var(--safe-b) + 108px);
}

/* .cook-close (not used here — see .cook-exit below) also styles the
   interview panel's close button in setup.js. Leave it alone. */
.cook-close {
  position: fixed;
  top: calc(var(--safe-t) + 12px);
  right: 14px;
  z-index: 41;
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.cook-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cook-head-info { min-width: 0; }
.cook-dish {
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cook-meta { margin-top: 6px; text-transform: uppercase; }

.cook-exit {
  flex: none;
  width: 44px; height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.cook-exit:hover { color: var(--out); }
.cook-exit-label { display: none; }

.cook-progress { display: flex; gap: 5px; margin-top: 22px; }
.cook-dot-step { flex: 1; height: 5px; border-radius: 999px; background: var(--cook-track); }
.cook-dot-step.on { background: var(--accent); }

.cook-body {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: cook-step-in 0.22s var(--ease) both;
}
@keyframes cook-step-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.cook-steplabel {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-press);
}
.cook-steptext {
  margin: 16px 0 0;
  font-size: 22px;
  line-height: 1.5;
  color: var(--text);
  text-wrap: pretty;
}

.cook-timer, .cook-panel { border-radius: 22px; padding: 16px 18px; }
.cook-timer { background: var(--surface); box-shadow: var(--shadow-2); }
.cook-timer-info { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cook-timer-label, .cook-panel-label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.cook-timer-clock {
  margin-top: 9px;
  font-family: var(--mono);
  font-size: 40px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.cook-timer-btn {
  min-height: 52px;
  padding: 0 22px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.94rem;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-cta);
  cursor: pointer;
}
.cook-timer-btn:hover { background: var(--accent-press); }
.cook-timer-btn:disabled { opacity: 0.45; cursor: default; box-shadow: none; }

/* rgba(251,249,245,.7) in the mockup is --surface at 70% — derive it rather
   than hardcode a second hex for the same color. */
.cook-panel { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.cook-panel-body { display: flex; flex-direction: column; gap: 10px; margin-top: 13px; }
.cook-ing { display: flex; align-items: baseline; gap: 11px; font-size: 0.95rem; line-height: 1.35; }
.cook-dot { flex: none; width: 7px; height: 7px; border-radius: 999px; background: var(--accent); }
.cook-upnext p { margin: 12px 0 0; font-size: 1.02rem; line-height: 1.45; color: var(--muted); text-wrap: pretty; }

.cook-nav {
  position: fixed;
  left: 20px; right: 20px;
  bottom: calc(var(--safe-b) + 20px);
  z-index: 41;
  display: flex;
  gap: 10px;
}
.cook-back {
  flex: none;
  width: 64px; min-height: 60px;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: 0 1px 2px rgba(31, 28, 23, 0.06), 0 8px 20px -12px rgba(31, 28, 23, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.cook-back:hover { color: var(--accent); }
.cook-back:disabled { opacity: 0.4; cursor: default; }
.cook-next {
  flex: 1;
  min-height: 60px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.06rem;
}

@media (min-width: 640px) {
  .cookmode { padding-left: 30px; padding-right: 30px; padding-bottom: calc(var(--safe-b) + 100px); }
  .cook-dish { font-size: 17px; }

  /* Left column (step text, then up next) over right column (timer, then
     for-this-step) — explicit grid placement so the phone's simple vertical
     stack (step, timer, for-this-step, up next — plain source order) can
     become two columns here with no markup change. */
  .cook-body { display: grid; grid-template-columns: 1.5fr 1fr; gap: 12px 28px; align-items: start; }
  .cook-step   { grid-column: 1; grid-row: 1; }
  .cook-upnext { grid-column: 1; grid-row: 2; }
  .cook-timer  { grid-column: 2; grid-row: 1; }
  .cook-forstep{ grid-column: 2; grid-row: 2; }

  .cook-steptext { font-size: 26px; }
  .cook-timer-clock { font-size: 36px; }

  .cook-nav { left: 30px; right: 30px; bottom: 24px; }
  .cook-back { min-height: 56px; border-radius: 16px; }
  .cook-next { min-height: 56px; border-radius: 16px; }
}

@media (min-width: 1024px) {
  .cookmode { padding-left: 48px; padding-right: 48px; padding-bottom: 130px; }
  .cook-head { padding-top: 6px; }
  .cook-dish { font-size: 20px; white-space: normal; overflow: visible; text-overflow: clip; }

  /* Circular icon button becomes the "Exit ESC" pill on a pointer device. */
  .cook-exit {
    width: auto; height: auto;
    padding: 11px 18px;
    gap: 9px;
    font-family: var(--sans);
    font-weight: 500;
    font-size: 0.82rem;
  }
  .cook-exit-label { display: inline-flex; align-items: baseline; gap: 5px; }
  .cook-exit-label kbd { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }

  .cook-body { grid-template-columns: 1.6fr 1fr; gap: 16px 44px; }
  .cook-timer, .cook-forstep { max-width: 420px; }
  .cook-steptext { font-size: 34px; max-width: 26ch; }
  .cook-timer-clock { font-size: 46px; }

  .cook-nav { left: 48px; right: 48px; bottom: 36px; }
  .cook-back { width: 72px; }
  .cook-next { flex: none; min-width: 340px; }
}

@media (prefers-reduced-motion: reduce) {
  .cook-body { animation: none; }
}
