/* cookbook.css — the 2.0 Cookbook lists: Collections (#/cookbook), All
 * Recipes (#/cookbook/recipes), one collection (#/cookbook/collections/:id)
 * and New collection. Loaded after shell.css. Same rules as shell.css: 2.0
 * token names only, no raw hex, no prefers-color-scheme, no fixed
 * phone-width px widths (OPEN-QUESTIONS #24), every selector rooted in a v2-
 * class. Accent comes from the skill scope ([data-skill="cookbook"] = amber).
 * The recipe screen itself lives in css/cookbook-recipe.css.
 */

/* ---- collections + recipe lists ---- */

.v2-ck {
  position: relative; /* the pull-to-refresh disc hangs above it */
}
.v2-ck .ptr__disc {
  background: var(--s-card);
  border: 1px solid var(--raised-line);
  box-shadow: var(--sh-raised);
  color: var(--accent);
}
.v2-ck .ptr__label {
  color: var(--accent-ink);
}
.v2-ck__results {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* quiet states */
.v2-ck-quiet {
  margin: 4px 2px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--t-muted);
}
.v2-ck-retry {
  align-self: flex-start;
  min-height: var(--hit-min);
  padding: 0 18px;
  border-radius: var(--r2-round);
  border: 1px solid var(--raised-line);
  background: var(--s-card);
  box-shadow: var(--sh-raised);
  color: var(--accent-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 620;
}
.v2-ck-empty {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 16px;
  border-radius: var(--r2-bigcard);
  background: var(--s-card);
  border: 1px solid var(--raised-line);
  box-shadow: var(--sh-raised);
}
.v2-ck-empty__h {
  margin: 0;
  font-size: 16px;
  font-weight: 680;
  letter-spacing: -0.3px;
  color: var(--t-primary);
}
.v2-ck-empty__p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--t-muted);
}
.v2-ck-link {
  color: var(--accent-ink);
  font-weight: 620;
  text-decoration: none;
}

/* layouts: 2-up grid (boards Collections / Cookbook), rows (the -List boards) */
.v2-ck-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.v2-ck-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.v2-ck-ctile,
.v2-ck-crow,
.v2-ck-rtile,
.v2-ck-rrow,
.v2-ck-cnew,
.v2-ck-newrow {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  min-width: 0;
}
.v2-ck-ctile:focus-visible,
.v2-ck-crow:focus-visible,
.v2-ck-rtile:focus-visible,
.v2-ck-rrow:focus-visible,
.v2-ck-cnew:focus-visible,
.v2-ck-rnew:focus-visible,
.v2-ck-newrow:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 3px;
  border-radius: var(--r2-card);
}

/* photos: a placeholder glyph until the blob: URL lands */
.v2-ck-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t-chevron);
}
.v2-ck-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.v2-ck-mosaic__cell.has-img .v2-ck-img,
.v2-ck-rtile__photo.has-img .v2-ck-img,
.v2-ck-rrow__thumb.has-img .v2-ck-img {
  opacity: 1;
}
.v2-ck-mosaic__cell.has-img .v2-ck-ph,
.v2-ck-rtile__photo.has-img .v2-ck-ph,
.v2-ck-rrow__thumb.has-img .v2-ck-ph {
  visibility: hidden;
}

/* meta line under a name/title: "10 recipes", "Baking · 3h 20m" */
.v2-ck-meta {
  font-size: 12.5px;
  color: var(--t-nav-off);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* the collection cover mosaic: one big cell over two small. The recipe
 * tile's 4:5 frame, split EXACTLY in half (Randy 2026-09-30): the top half
 * one full-width photo, the bottom half two photos side by side. */
.v2-ck-mosaic {
  aspect-ratio: 4 / 5;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-radius: var(--r2-card);
  overflow: hidden;
  background: var(--s-panel);
  border: 1px solid var(--raised-line);
  box-shadow: var(--sh-raised);
}
.v2-ck-mosaic__row {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  gap: 3px;
}
.v2-ck-mosaic__cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--s-card);
}
.v2-ck-mosaic__cell.is-big {
  flex: 1 1 0;
  min-height: 0;
}
.v2-ck-mosaic__cell.is-small {
  flex: 1 1 0;
  min-width: 0;
}
/* The cover grows with its photos (Randy 2026-10-05): one photo fills the
 * frame; two split it exactly 50/50, one over the other (both .is-big, flex
 * 1 1 0); three or more keep one wide over two small. */
.v2-ck-mosaic__cell.is-full {
  flex: 1 1 0;
  min-height: 0;
}

/* collection tile (grid) */
.v2-ck-ctile {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.v2-ck-ctile__text,
.v2-ck-crow__text,
.v2-ck-rtile__text,
.v2-ck-rrow__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.v2-ck-rtile__text,
.v2-ck-rrow__text,
.v2-ck-crow__text {
  gap: 3px;
}
.v2-ck-ctile__name,
.v2-ck-crow__name {
  font-size: 15.5px;
  font-weight: 660;
  letter-spacing: -0.3px;
  color: var(--t-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v2-ck-crow__name {
  font-weight: 640;
  letter-spacing: -0.25px;
}

/* the dashed "+ New collection" tile: the mosaic's footprint */
.v2-ck-cnew,
.v2-ck-rnew {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--r2-card);
  background: transparent;
  border: 1px dashed var(--dash-line);
  color: var(--accent-ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 620;
  padding: 0;
}
.v2-ck-cnew {
  aspect-ratio: 4 / 5;
}
.v2-ck-rnew {
  aspect-ratio: 4 / 5;
  border-color: var(--accent-tint-line);
}

/* collection row (list): a 60px 2×2 mosaic */
.v2-ck-crow,
.v2-ck-rrow,
.v2-ck-newrow {
  display: flex;
  align-items: center;
  gap: 13px;
}
.v2-ck-quad {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 60px;
  height: 60px;
  flex: none;
  box-sizing: border-box;
  border-radius: 14px;
  overflow: hidden;
  background: var(--s-panel);
  border: 1px solid var(--raised-line);
  box-shadow: var(--sh-raised);
}
.v2-ck-quad.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--s-card);
}
.v2-ck-quad .v2-ck-mosaic__row {
  gap: 2px;
}

/* recipe tile (grid) + row (list) */
.v2-ck-rtile {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.v2-ck-rtile__photo,
.v2-ck-rrow__thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--s-card);
  border: 1px solid var(--raised-line);
  box-shadow: var(--sh-raised);
}
/* A slightly-portrait square, 4:5 (Randy 2026-09-30, after 2:3 read too
 * tall on device; closer to ReciMe's grid). The list row's thumb stays
 * square. */
.v2-ck-rtile__photo {
  aspect-ratio: 4 / 5;
  border-radius: var(--r2-card);
}
.v2-ck-rrow__thumb {
  width: 60px;
  height: 60px;
  flex: none;
  box-sizing: border-box;
  border-radius: 14px;
}
.v2-ck-rtile__title,
.v2-ck-rrow__title {
  font-size: 15px;
  font-weight: 640;
  letter-spacing: -0.25px;
  line-height: 1.25;
  color: var(--t-primary);
}
.v2-ck-rtile__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.v2-ck-rrow__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v2-ck-rtile .v2-ck-meta,
.v2-ck-rrow .v2-ck-meta {
  font-size: 12px;
}
.v2-ck-rtile.is-failed .v2-ck-meta,
.v2-ck-rrow.is-failed .v2-ck-meta {
  color: var(--danger);
}

/* the dashed "New collection" / "New recipe" row */
.v2-ck-newrow {
  min-height: 60px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
}
.v2-ck-newrow__box {
  width: 60px;
  height: 60px;
  flex: none;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px dashed var(--dash-line);
  color: var(--accent-ink);
}
.v2-ck-newrow.is-accent .v2-ck-newrow__box {
  border-color: var(--accent-tint-line);
}
.v2-ck-newrow__label {
  font-size: 15px;
  font-weight: 620;
  color: var(--accent-ink);
}

/* ⋯ menu on a collection's pushed header */
.v2-ck-more {
  position: relative;
  flex: none;
}
.v2-ck-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  min-width: 13rem;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* surface + row text: .v2-pop (shell.css) */
}
.v2-ck-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--hit-min);
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--t-primary);
  font: inherit;
  text-align: left;
  white-space: nowrap;
}
.v2-ck-menu__item:active {
  background: var(--s-card);
}
.v2-ck-menu__item.is-danger {
  color: var(--danger);
}

/* rename + delete dialogs */
.v2-ck-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}
.v2-ck-dialog__scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim-create);
  -webkit-backdrop-filter: blur(var(--scrim-blur));
  backdrop-filter: blur(var(--scrim-blur));
}
.v2-ck-dialog__box {
  position: relative;
  width: 100%;
  max-width: 22rem;
  box-sizing: border-box;
  margin: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--s-panel);
  border: 1px solid var(--glass-nav-line);
  border-radius: var(--r2-bigcard);
  box-shadow: var(--sh-nav);
  color: var(--t-primary);
}
.v2-ck-dialog__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.35px;
  line-height: 1.3;
}
.v2-ck-dialog__body {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--t-muted);
}
.v2-ck-dialog__err {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--danger);
}
.v2-ck-dialog__input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  box-sizing: border-box;
  border-radius: 13px;
  font-size: 15px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.v2-ck-dialog__input:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 1px;
}
.v2-ck-dialog__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
.v2-ck-dialog__btn {
  min-height: var(--hit-min);
  padding: 0 14px;
  border: 0;
  border-radius: var(--r2-round);
  background: var(--s-chip);
  color: var(--t-nav);
  font: inherit;
  font-size: 15px;
  font-weight: 640;
}
.v2-ck-dialog__btn.is-danger {
  background: var(--danger);
  color: var(--on-accent);
}
.v2-ck-dialog__btn.is-accent {
  background: var(--accent);
  color: var(--on-accent);
}
.v2-ck-dialog__btn:disabled {
  opacity: 0.55;
}

/* New collection (board CollectionNew): search well + recipe checklist */
.v2-ck-add {
  display: contents;
}
.v2-ck-new .v2-label {
  margin-top: 2px;
}
.v2-ck-new .v2-label__count {
  text-transform: none; /* "3 of 24" */
}
.v2-ck-find {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 0 13px;
  box-sizing: border-box;
  color: var(--t-placeholder);
}
.v2-ck-find__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0;
  background: none;
  border: 0;
  outline: none;
  color: var(--t-primary);
  font: inherit;
  font-size: 14.5px;
  -webkit-appearance: none;
  appearance: none;
}
.v2-ck-find__input::placeholder {
  color: var(--t-placeholder);
}
.v2-ck-checks {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.v2-ck-check {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 13px;
  box-sizing: border-box;
  border-radius: 13px;
  background: var(--s-card);
  border: 1px solid var(--raised-line);
  box-shadow: var(--sh-raised);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.v2-ck-check:focus-within {
  outline: 2px solid var(--accent-ink);
  outline-offset: 1px;
}
.v2-ck-check__box {
  width: 20px;
  height: 20px;
  flex: none;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1.5px solid var(--dash-line);
  color: var(--on-accent);
}
.v2-ck-check.is-on .v2-ck-check__box {
  background: var(--done);
  border-color: var(--done);
}
.v2-ck-check__title {
  min-width: 0;
  font-size: 14.5px;
  font-weight: 450;
  color: var(--t-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Settings → Cookbook ---- */
.v2-cset__seg .v2-seg {
  flex: 1 1 100%;
}


/* ---------- order + reorder (batch 6 §5, Randy 2026-10-09) ----------
 * The label row carries the shared Reorder / Done toggle (.v2-reorder-toggle,
 * shell.css) across from "Your collections", like the recipe editor's
 * ingredient label. */
.v2-ck-sectlabel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.v2-ck-sectlabel > .v2-label {
  min-width: 0;
}
/* LIST reorder: read-only rows with the ingredient rows' grip at the far
 * right (.v2-elist__grip, shell.css); the lifted row is the shared dashed
 * gap, the copy rides the finger (shell/drag-reorder.js). */
.v2-ck-crow.is-reorder {
  cursor: default;
}
.v2-ck-crow.is-reorder .v2-ck-crow__text {
  flex: 1 1 auto;
}
.v2-ck-crow__grip {
  margin-right: -6px;
}
/* GRID reorder (batch 8 §3): the grip DISC is the handle — touch-action
 * none on the disc only, so a finger on it drags the tile while a finger
 * anywhere else on the tile scrolls the page as usual (pan-y). The disc's
 * hit area is at least 44 × 44 (the ::before pad; the drawn disc keeps its
 * size). The cover dims under the centred disc (the arrange mode's round
 * raised button, .v2-ck-shuffle) and the tiles wiggle gently, iPhone-home-
 * screen style — not under Reduce Motion (the dim + disc stay). The lifted
 * tile is the dashed gap; its copy (.v2-tile-ghost) rides the finger. */
.v2-ck-grid.is-reordering .v2-ck-ctile {
  touch-action: pan-y;
  cursor: default;
}
.v2-ck-gripdisc {
  touch-action: none;
  cursor: grab;
}
.v2-ck-gripdisc::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, 44px);
  height: max(100%, 44px);
  transform: translate(-50%, -50%);
}
.v2-ck-ctile.is-reorder [data-cover]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

/* ---------- shuffle a collection's cover (Randy 2026-10-03) ----------
 * Hold the collage → a small raised shuffle button over it. The cover
 * never opens iOS's link menu on that hold. */
.v2-ck-mosaic[data-cover],
.v2-ck-quad[data-cover] {
  position: relative;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
/* Item 18: the hold shows no native swell / preview lift / drag on the
   photos or the tile link (with draggable="false" in the markup). */
.v2-ck-ctile,
.v2-ck-crow,
[data-cover] .v2-ck-img {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}
/* Arrange mode: drag a photo onto another cell to swap them. */
.v2-ck-ctile.is-shuffling [data-cover],
.v2-ck-crow.is-shuffling [data-cover] {
  touch-action: none;
}
.v2-ck-ctile.is-shuffling [data-cell],
.v2-ck-crow.is-shuffling [data-cell] {
  cursor: grab;
}
[data-cover] .v2-ck-mosaic__cell.is-dragging .v2-ck-img {
  opacity: 0.3;
}
[data-cover] .v2-ck-mosaic__cell.is-drop::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 3px var(--accent-ink);
  pointer-events: none;
}
.v2-ck-dragghost {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  overflow: hidden;
  border-radius: var(--r2-tile);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
  opacity: 0.94;
  will-change: transform;
}
.v2-ck-dragghost .v2-ck-img {
  opacity: 1;
  transition: none;
}
.v2-ck-shuffle {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--raised-line);
  background: var(--s-card);
  box-shadow: var(--sh-raised), 0 4px 14px rgba(0, 0, 0, 0.22);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.v2-ck-shuffle:active {
  transform: translate(-50%, -50%) scale(0.94);
}
.v2-ck-quad .v2-ck-shuffle {
  width: 34px;
  height: 34px;
}
.v2-ck-ctile.is-shuffling [data-cover],
.v2-ck-crow.is-shuffling [data-cover] {
  outline: 2px solid var(--accent-tint-line);
  outline-offset: 2px;
}
