/* Recipe Ancestor — modern cook page (phone-first cooking app).
   Aligns with site.css / demo.css modern chrome. */

:root {
  --cook-bg: #f7f4ef;
  --cook-surface: #ffffff;
  --cook-ink: #1a1a1a;
  --cook-muted: #6b6560;
  --cook-accent: #5d1f1a;
  --cook-accent-soft: #f0e6e0;
  --cook-line: #e8e2d9;
  --cook-radius: 16px;
  --cook-shadow: 0 8px 28px rgba(40, 28, 18, 0.08);
  --cook-text-scale: 1;
  --cook-font: "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body,
button, input, select, textarea {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", serif;
}

body.cook-modern {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--cook-bg);
  color: var(--cook-ink);
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.cook-modern a {
  color: var(--cook-accent);
}

body.cook-modern a:visited {
  color: var(--cook-accent);
}

.cook-app {
  max-width: 28rem;
  margin: 0 auto;
  padding: 0 0 2.5rem;
  min-height: 100vh;
}

/* Small "Recipe Ancestor" wordmark link home (replaces the X banner image on
   cook pages, gravis Sep 29, 2026). Screen only; hidden in print below. */
.cook-brand {
  display: block;
  width: max-content;
  max-width: calc(100% - 2rem);
  margin: 0 auto;
  padding: 0.8rem 0.25rem 0.1rem;
  font-family: var(--cook-font);
  font-size: 0.9rem;
  font-weight: normal;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
}
body.cook-modern a.cook-brand,
body.cook-modern a.cook-brand:visited {
  color: var(--cook-accent);
  text-decoration: none;
}
body.cook-modern a.cook-brand:hover {
  text-decoration: underline;
}

/* "Last updated" status bar (data/site_status.json): plain one-liner
   between the X banner and the back-link bar. Hidden in print below. */
.status-bar {
  margin: 0 1rem 0.25rem;
  padding: 0.15rem 0;
  font-family: var(--cook-font);
  font-size: 0.75rem;
  line-height: 1.4;
  font-style: italic;
  color: var(--cook-muted);
  border-bottom: 1px dotted var(--cook-line);
}

/* Top bar */
.cook-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem 0.5rem;
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--cook-bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.cook-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--cook-accent) !important;
  padding: 0.35rem 0.15rem;
}

.cook-back-link:hover {
  text-decoration: underline;
}

/* Hero sketch */
.cook-hero {
  margin: 0.25rem 1rem 0.75rem;
  border-radius: var(--cook-radius);
  overflow: hidden;
  background: var(--cook-surface);
  box-shadow: var(--cook-shadow);
  border: 1px solid var(--cook-line);
}

.cook-hero img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 10 / 7;
  object-fit: cover;
  object-position: center;
  background: #efeae3;
}

.cook-hero img.sketch-zoom {
  cursor: zoom-in;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.08);
}

.cook-hero-empty {
  display: none;
}

/* Fancy print plate (series *-print.png) — cook page only */
.print-only {
  display: none;
}

.cook-hero-print {
  display: none;
}

/* Title */
.cook-title {
  margin: 0 1rem 0.75rem;
  font-size: clamp(1.55rem, 5.5vw, 1.85rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--cook-ink);
}

.cook-eyebrow {
  margin: 0 1rem 0.35rem;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cook-muted);
}

/* Toolbar */
.cook-toolbar {
  margin: 0 1rem 1rem;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.75rem;
  align-items: center;
  justify-content: space-between;
  background: var(--cook-surface);
  border: 1px solid var(--cook-line);
  border-radius: 14px;
  box-shadow: var(--cook-shadow);
}

.cook-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.cook-tool-btn,
.cook-print-btn {
  appearance: none;
  border: 1px solid var(--cook-line);
  background: var(--cook-bg);
  color: var(--cook-ink);
  border-radius: 999px;
  cursor: pointer;
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", serif;
  font-weight: 650;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.cook-tool-btn {
  min-width: 2.35rem;
  min-height: 2.35rem;
  font-size: 1.05rem;
  padding: 0.35rem 0.55rem;
}

.cook-print-btn {
  font-size: 0.9rem;
  padding: 0.55rem 0.95rem;
  background: var(--cook-accent);
  border-color: var(--cook-accent);
  color: #fff;
}

.cook-print-btn:hover {
  filter: brightness(1.05);
}

.cook-tool-btn:hover:not(:disabled) {
  background: var(--cook-accent-soft);
  border-color: #d4c4b8;
}

.cook-tool-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.cook-zoom {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem;
  border-radius: 999px;
  background: var(--cook-bg);
  border: 1px solid var(--cook-line);
}

.cook-zoom .cook-tool-btn {
  border: none;
  background: transparent;
  min-width: 2.1rem;
  min-height: 2.1rem;
}

/* Recipe sheet */
.cook-sheet {
  margin: 0 1rem;
  padding: 1rem 1.05rem 1.15rem;
  background: var(--cook-surface);
  border: 1px solid var(--cook-line);
  border-radius: var(--cook-radius);
  box-shadow: var(--cook-shadow);
}

.cook-sheet > .meta {
  margin: 0 0 0.85rem;
  color: var(--cook-muted);
  font-size: 0.85rem;
}

/* Source yield + times (viralServings / viralTimes), verbatim. */
.cook-yield {
  margin: -0.25rem 0 0.75rem;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--cook-muted);
}

.cook-section-label {
  margin: 1rem 0 0.45rem;
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cook-accent);
}

.cook-section-label:first-of-type {
  margin-top: 0.15rem;
}

/* Screen-only text zoom target: ingredients + steps (+ qty) */
.cook-text {
  font-size: calc(1.05rem * var(--cook-text-scale, 1));
  line-height: 1.55;
}

.cook-ings,
.cook-steps {
  margin: 0.35rem 0 0.85rem;
  padding-left: 1.25em;
}

.cook-ings li,
.cook-steps li {
  margin: 0.45em 0;
  padding-left: 0.15em;
}

.cook-cites {
  margin: 0.35rem 0 0.75rem;
  padding-left: 1.15em;
  font-size: 0.8rem;
  color: var(--cook-muted);
  line-height: 1.45;
}

.cook-cites a {
  word-break: break-word;
}

.cook-foot-note {
  margin: 0.75rem 0 0;
  font-size: 0.78rem;
  color: var(--cook-muted);
}

.screen-only {
  /* class marker; print hides */
}

/* Wider phones / small tablets */
@media (min-width: 480px) {
  .cook-app {
    max-width: 32rem;
    padding-bottom: 3rem;
  }
}

/* Tablet / desktop: wider reading column (screen only, so print is untouched).
   Phone layout (< 768px) is unchanged. Recipe text is capped at ~70 characters
   per line; the photo grows with the column but is height-limited. */
@media screen and (min-width: 768px) {
  .cook-app {
    max-width: 49rem;
    padding-bottom: 4rem;
  }

  .cook-brand {
    padding-top: 1.1rem;
    font-size: 0.95rem;
  }

  .cook-topbar {
    padding: 0.85rem 1.25rem 0.6rem;
  }

  .cook-hero {
    margin: 0.35rem 1.25rem 1.1rem;
  }

  .cook-hero img {
    aspect-ratio: 16 / 10;
    max-height: 26rem;
  }

  .cook-eyebrow,
  .cook-title {
    margin-left: 1.25rem;
    margin-right: 1.25rem;
  }

  .cook-title {
    font-size: 2.1rem;
    margin-bottom: 0.9rem;
  }

  .cook-toolbar {
    margin: 0 1.25rem 1.25rem;
    padding: 0.7rem 1rem;
  }

  .cook-sheet {
    margin: 0 1.25rem;
    padding: 1.6rem 2.25rem 1.75rem;
  }

  .cook-sheet > .meta,
  .cook-yield {
    font-size: 0.9rem;
  }

  .cook-section-label {
    font-size: 0.85rem;
    margin-top: 1.35rem;
  }

  .cook-text {
    font-size: calc(1.15rem * var(--cook-text-scale, 1));
    line-height: 1.6;
  }

  .cook-ings,
  .cook-steps {
    max-width: 32em;
  }

  .cook-ings li,
  .cook-steps li {
    margin: 0.5em 0;
  }

  .cook-cites {
    font-size: 0.85rem;
  }

  .cook-foot-note {
    font-size: 0.82rem;
  }
}

/* —— Print: always DEFAULT size; ignore screen zoom —— */
@media print {
  :root,
  html,
  body.cook-modern {
    --cook-text-scale: 1 !important;
  }

  body.cook-modern {
    background: #fff !important;
    color: #000 !important;
    font-size: 12pt !important;
    line-height: 1.35 !important;
  }

  .screen-only,
  .cook-brand,
  .status-bar,
  .cook-topbar,
  .cook-toolbar,
  .cook-back-link,
  .sketch-lightbox {
    display: none !important;
  }

  .cook-app {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
  }

  .print-only {
    display: block !important;
  }

  /* LAYOUT LOCK: *-print.png = WIDE full-width header (never small thumb) */
  .cook-hero-print {
    display: block !important;
    margin: 0 0 12pt !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: none !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    break-inside: avoid;
    background: transparent !important;
  }

  .cook-hero-print img {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 2.75in !important; /* banner band; still full page width */
    margin: 0 !important;
    aspect-ratio: auto !important;
    object-fit: cover !important;
    object-position: center !important;
  }

  /* Fallback cook sketch in print (no distinct *-print.png): also full-width, not thumb */
  .cook-hero:not(.cook-hero-print) {
    margin: 0 0 10pt !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    break-inside: avoid;
    width: 100% !important;
  }

  .cook-hero:not(.cook-hero-print) img {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 2.2in !important;
    margin: 0 !important;
    aspect-ratio: auto !important;
    object-fit: cover !important;
  }

  .cook-title {
    margin: 0 0 8pt !important;
    font-size: 18pt !important;
    color: #000 !important;
  }

  .cook-eyebrow {
    display: none !important;
  }

  .cook-sheet {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: transparent !important;
  }

  .cook-sheet > .meta,
  .cook-foot-note {
    font-size: 9pt !important;
    color: #333 !important;
  }

  .cook-section-label {
    font-size: 10pt !important;
    color: #000 !important;
    margin: 10pt 0 4pt !important;
  }

  /* Hard reset: screen zoom must not leak into print */
  .cook-text,
  .cook-ings,
  .cook-steps,
  .cook-ings li,
  .cook-steps li {
    font-size: 11pt !important;
    line-height: 1.4 !important;
    color: #000 !important;
  }

  .cook-cites {
    font-size: 8pt !important;
    color: #333 !important;
  }

  a {
    color: #000 !important;
    text-decoration: none !important;
  }
}


/* Sketch lightbox (shared with site lightbox.js; cook pages load cook.css only) */
.sketch-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  padding: 10px 12px 14px;
  box-sizing: border-box;
  background: rgba(20, 18, 12, 0.92);
  cursor: default;
  touch-action: none;
}
.sketch-lightbox[hidden] {
  display: none !important;
}
.sketch-lightbox-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  z-index: 1;
}
.sketch-lightbox-btn {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #cfc6b4;
  border-radius: 8px;
  background: #f4f0e6;
  color: #1a1610;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", serif;
}
.sketch-lightbox-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.sketch-lightbox-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.sketch-lightbox-close {
  font-size: 28px;
  background: #5d1f1a;
  color: #f7f4ef;
  border-color: #3a120e;
}
.sketch-lightbox-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: zoom-in;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.sketch-lightbox-stage.is-zoomed {
  cursor: grab;
}
.sketch-lightbox-stage.is-zoomed:active {
  cursor: grabbing;
}
.sketch-lightbox-img {
  max-width: min(94vw, 1100px);
  max-height: calc(100vh - 120px);
  width: auto;
  height: auto;
  object-fit: contain;
  background: #f4f0e6;
  box-shadow: 0 0 0 1px #000, 0 8px 32px rgba(0, 0, 0, 0.45);
  transform-origin: center center;
  transition: transform 0.08s ease-out;
  pointer-events: none;
  -webkit-user-drag: none;
}
.sketch-lightbox-hint {
  margin: 0;
  text-align: center;
  color: #ddd6c8;
  font-size: 12px;
  line-height: 1.35;
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", serif;
  flex: 0 0 auto;
}
html.sketch-lightbox-open,
html.sketch-lightbox-open body {
  overflow: hidden;
}

/* ---- Tile One / Tile Two lightbox (tile-lightbox.js) ---- */
img.tile-lb-trigger { cursor: zoom-in; }
.tile-lb {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 8px 10px 12px;
  background: rgba(249, 241, 224, 0.97); /* cream #F9F1E0 */
  color: #000;
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", serif;
}
.tile-lb[hidden] { display: none !important; }
.tile-lb-top {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 34px;
}
.tile-lb-btn,
.tile-lb-back {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: #2b2620; /* soft dark ink */
  font-family: inherit;
  cursor: pointer;
  line-height: 1;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.tile-lb-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 6px;
  font-size: 30px;
  opacity: 0.7;
  transition: opacity 0.12s ease;
}
.tile-lb-btn:hover, .tile-lb-btn:active { opacity: 1; background: none; }
.tile-lb-back {
  max-width: 70%;
  padding: 6px 4px;
  font-size: 11px;
  line-height: 1.3;
  text-align: left;
  color: #00e;
  text-decoration: underline;
  opacity: 0.85;
}
.tile-lb-back:hover { opacity: 1; background: none; }
.tile-lb-back[hidden] { display: none; }
.tile-lb-back-name { font-size: 10px; color: #555; text-decoration: none; display: inline-block; }
/* Focus ring only for keyboard users (JS adds .tile-lb-kbd on keyboard use). */
.tile-lb-btn:focus, .tile-lb-back:focus { outline: none; }
.tile-lb.tile-lb-kbd .tile-lb-btn:focus-visible,
.tile-lb.tile-lb-kbd .tile-lb-back:focus-visible { outline: 1px dotted #2b2620; outline-offset: 2px; opacity: 1; }
.tile-lb-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  touch-action: pan-y;
}
.tile-lb-arrow { flex: 0 0 auto; min-width: 48px; min-height: 88px; font-size: 52px; font-weight: normal; }
.tile-lb-arrow[hidden] { display: none; }
.tile-lb-fig {
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.tile-lb-img {
  display: block;
  max-width: min(86vw, 1100px);
  max-height: calc(100vh - 130px);
  max-height: calc(100dvh - 130px);
  width: auto;
  height: auto;
  object-fit: contain;
  border: 0;
  outline: 0;
  box-shadow: none;
  background: transparent;
  -webkit-user-drag: none;
  user-select: none;
}
.tile-lb-cap {
  margin: 5px 0 0;
  font-size: 11px;
  line-height: 1.3;
  color: #555;
  text-align: center;
  letter-spacing: 0.02em;
}
.tile-lb-sr {
  position: absolute !important;
  width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.tile-lb-img.is-link { cursor: pointer; }
.tile-lb-img:focus { outline: none; }
.tile-lb.tile-lb-kbd .tile-lb-img.is-link:focus-visible { outline: 1px dotted #2b2620; outline-offset: 3px; }
.tile-lb-cap-link, .tile-lb-cap-link:visited { color: inherit; text-decoration: none; border: 0; }
.tile-lb a.tile-lb-cap-link, .tile-lb a.tile-lb-cap-link:visited { color: #555; text-decoration: none; }
.tile-lb a.tile-lb-cap-link:hover { text-decoration: underline; color: #2b2620; }
.tile-lb-cap-link:focus { outline: none; }
.tile-lb.tile-lb-kbd .tile-lb-cap-link:focus-visible { outline: 1px dotted #2b2620; outline-offset: 2px; }
.tile-lb-hint {
  margin: 3px 0 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: 10px;
  line-height: 1.3;
  color: #8a8175;
  text-align: center;
  letter-spacing: 0.02em;
}
.tile-lb-hint[hidden] { display: none; }
html.tile-lb-open, html.tile-lb-open body { overflow: hidden; }
@media (max-width: 600px) {
  .tile-lb { padding: 6px 4px 10px; }
  .tile-lb-stage { gap: 4px; }
  .tile-lb-arrow { min-width: 36px; padding: 0 2px; font-size: 44px; }
  .tile-lb-img { max-width: calc(100vw - 84px); }
  .tile-lb-back { max-width: 80%; }
}
@media print { .tile-lb { display: none !important; } }

/* Joy of Cooking action-style recipe on the cook page (joyRecipe, gravis Sep 29, 2026).
   Bold card lines show exactly as on the source card. No serving scaler (gravis 2026-09-29). */
.joy-note { font-style: italic; color: var(--cook-muted, #555); font-size: 0.9rem; margin: 0.3rem 0 0.4rem; }
.joy-headnote { font-style: italic; margin: 0.5rem 0 0.8rem; line-height: 1.5; }
.joy-body { max-width: 34em; }
.joy-body p.joy-text { margin: 0.55em 0; }
.joy-body .joy-ings { margin: 0.1em 0 0.6em 1.4em; }
.joy-body .joy-ings p.joy-ing { margin: 0.15em 0; }
.joy-body .joy-head { font-weight: 700; font-variant: small-caps; letter-spacing: 0.03em; margin: 1em 0 0.2em; }
@media print {
  .joy-note { color: #333 !important; font-size: 9pt !important; }
  .joy-headnote { font-size: 10pt !important; }
  .joy-body, .joy-body p, .joy-body .joy-ing, .joy-body strong { font-size: 11pt !important; line-height: 1.4 !important; color: #000 !important; }
  .joy-body .joy-ings { break-inside: avoid; }
}

/* ---- Cookbook ancestor block (gravis, Sep 29, 2026): the reference prints; the Amazon
   link lines are screen only (generate.py cook page, book_link_block). ---- */
.cook-book-ref {
  margin: 0.35rem 0 0.25rem;
  font-size: 0.8rem;
  color: var(--cook-muted);
  line-height: 1.45;
}
.cook-book-links p {
  margin: 0.15rem 0;
  font-size: 0.8rem;
  line-height: 1.45;
}
.cook-book-links .no-affiliate { font-style: italic; color: var(--cook-muted); }
.cook-book-links a { word-break: break-word; }
@media print {
  .cook-book-links { display: none !important; }
}

/* ---- Lightbox size bump (gravis, Sep 29, 2026, 3:07 PM) ----
   Bigger caption (~1.35x), bigger prev/next arrows (tap targets >= 48px, also on phones),
   bigger "Back to the recipe you opened this photo from" link with more padding.
   Everything else stays as above. Kept in css/tile-lightbox.css, css/site.css and css/cook.css. */
.tile-lb-top { min-height: 48px; }
.tile-lb-close { min-width: 48px; min-height: 48px; font-size: 36px; }
.tile-lb-back { padding: 10px 12px; font-size: 16px; line-height: 1.35; }
.tile-lb-back-name { font-size: 14px; }
.tile-lb-arrow { min-width: 72px; min-height: 112px; font-size: 96px; }
.tile-lb-cap { margin-top: 8px; font-size: 15px; line-height: 1.35; }
.tile-lb-hint { font-size: 12px; }
.tile-lb-img { max-height: calc(100vh - 170px); max-height: calc(100dvh - 170px); }
@media (max-width: 600px) {
  .tile-lb-back { padding: 10px 8px; font-size: 15px; }
  .tile-lb-back-name { font-size: 13px; }
  .tile-lb-arrow { min-width: 48px; min-height: 96px; padding: 0 2px; font-size: 76px; }
  .tile-lb-cap { font-size: 14.5px; }
  .tile-lb-img { max-width: calc(100vw - 112px); }
}
