/**
 * The Food Gene — print.css
 * Version: 3.4 (Site V2) · Teal Kitchen
 * Owner: Recipe agent.
 *
 * Two jobs (CNT-004):
 *
 *   1. The recipe print view, /recipe/{slug}/print/ (layouts/print.php). This
 *      file is its only stylesheet besides tokens.css, so §1 styles it for the
 *      screen as well as for paper: a reader sees the sheet before the dialog.
 *   2. Any other page printed straight from the browser. layouts/site.php loads
 *      this file with media="print", and §2 strips the furniture that means
 *      nothing on paper, so even a directly printed recipe page comes out as the
 *      recipe only.
 *
 * Ink-friendly: on paper there are no fills, only the body-text colour and thin
 * rules. Every colour is a token (NFR-008).
 */

/* ═══ 1. The print view (layouts/print.php) ══════════════════════════════ */

.layout-print {
  margin: 0;
  padding: var(--space-lg) var(--gutter) var(--space-2xl);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}
.layout-print *, .layout-print *::before, .layout-print *::after { box-sizing: border-box; }
.layout-print main { display: block; max-width: 52rem; margin: 0 auto; }
.layout-print a { color: var(--accent-juniper); }
.layout-print :focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }

/* NFR-004: the print view has its own skip link (main.css is not loaded here),
   off-screen until focused, and never on paper (the @media print list below). */
.layout-print .skip-link {
  position: absolute;
  top: var(--space-2xs); left: var(--space-sm);
  transform: translateY(-160%);
  padding: var(--space-2xs) var(--space-sm);
  border-radius: var(--radius-pill);
  background: var(--accent-juniper);
  color: var(--text-inverse);
}
.layout-print .skip-link:focus { transform: translateY(0); }

/* Screen-only tools above the sheet. */
.print-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2xs);
  margin-bottom: var(--space-sm);
}
.print-tools__back, .print-tools__print {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-target);
  padding: var(--space-2xs) 22px;
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  font-family: var(--font-label);
  font-weight: var(--weight-medium);
  font-size: var(--size-label);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent-juniper);
  cursor: pointer;
}
.print-tools__back::before { content: "\2190"; content: "\2190" / ""; margin-right: var(--space-2xs); }
.print-tools__print { background: var(--accent-juniper); border-color: var(--accent-juniper); color: var(--text-inverse); }
.print-tools__back:hover { border-color: var(--accent-juniper); }
.print-tools__print:hover { background: var(--accent-juniper-hover); }

.print-recipe {
  padding: var(--space-xl) var(--space-lg);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
}

.print-recipe h1, .print-recipe h2, .print-recipe h3 {
  margin: 0 0 var(--space-2xs);
  font-family: var(--font-display);
  font-weight: var(--weight-heavy);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  text-transform: uppercase;
  text-wrap: balance;
  color: var(--accent-juniper);
}
.print-recipe h1 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem); }
.print-recipe h2 { font-size: var(--text-xl); }
.print-recipe h3 {
  margin-top: var(--space-xs);
  font-family: var(--font-title);
  font-weight: var(--weight-semi);
  font-size: var(--text-base);
  letter-spacing: var(--tracking-title);
}
.print-recipe p { margin: 0 0 var(--space-2xs); }

.print-recipe__head {
  padding-bottom: var(--space-sm);
  margin-bottom: var(--space-sm);
  border-bottom: 2px solid var(--border-strong);
}
.print-recipe__brand {
  font-family: var(--font-label);
  font-weight: var(--weight-medium);
  font-size: var(--size-badge);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--accent-sage-strong);
}
.print-recipe__summary { font-size: var(--text-lg); }
.print-recipe__byline { font-size: var(--text-sm); color: var(--text-secondary); word-break: break-word; }

.print-recipe__details {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-lg);
  margin: 0 0 var(--space-md);
}
.print-recipe__details dt {
  font-family: var(--font-label);
  font-weight: var(--weight-medium);
  font-size: var(--size-badge);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--accent-sage-strong);
}
.print-recipe__details dd { margin: 0; font-weight: var(--weight-semi); }

.print-recipe__body { display: grid; gap: var(--space-lg); }
.print-recipe ul, .print-recipe ol { margin: 0 0 var(--space-xs); padding-left: 1.25rem; }
.print-recipe li { margin-bottom: var(--space-3xs); }
.print-recipe__ingredients li { list-style: disc; }
.print-recipe__method li { margin-bottom: var(--space-xs); padding-left: var(--space-3xs); }
.print-recipe__timer { color: var(--text-secondary); white-space: nowrap; }
.print-recipe__tip { display: block; margin-top: var(--space-3xs); font-style: italic; color: var(--text-secondary); }

.print-recipe__extras {
  display: grid;
  gap: var(--space-sm) var(--space-lg);
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-medium);
}
.print-recipe__note div > * { margin: 0 0 var(--space-3xs); }

/* The nutrition panel, reused from the recipe page (partials/nutrition.php). */
.print-recipe .nutrition h2 { margin-bottom: var(--space-3xs); }
.print-recipe .nutrition__table { width: 100%; max-width: 22rem; border-collapse: collapse; font-size: var(--text-sm); }
.print-recipe .nutrition__caption { caption-side: top; text-align: left; padding-bottom: var(--space-3xs); color: var(--text-secondary); }
.print-recipe .nutrition__table th,
.print-recipe .nutrition__table td { padding: 0.2rem 0; border-top: 1px solid var(--border-medium); }
.print-recipe .nutrition__table th { text-align: left; font-weight: var(--weight-normal); }
.print-recipe .nutrition__table td { text-align: right; font-weight: var(--weight-semi); white-space: nowrap; }
.print-recipe .nutrition__sub th { padding-left: var(--space-sm); }
.print-recipe .nutrition__kj { margin-left: var(--space-3xs); font-weight: var(--weight-normal); color: var(--text-secondary); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 640px) {
  /* Ingredients beside the method, as on a recipe card. */
  .print-recipe__body { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
  .print-recipe__extras { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 639.98px) {
  .print-recipe { padding: var(--space-md) var(--space-sm); }
}

/* ═══ 2. Paper (both the print view and any page printed directly) ═══════ */

@media print {
  @page { margin: 14mm 12mm; }

  html, body, .layout-print {
    margin: 0;
    padding: 0;
    background: none;
    color: var(--text-primary);
    font-size: 10.5pt;
    line-height: 1.4;
  }
  *, *::before, *::after { box-shadow: none !important; text-shadow: none !important; }

  /* The print view on paper: no tools, no sheet fill, no rounded corners. */
  .print-tools { display: none !important; }
  .layout-print main { max-width: none; }
  .print-recipe { padding: 0; background: none; border-radius: 0; }
  .print-recipe h1 { font-size: 20pt; }
  .print-recipe h2 { font-size: 12.5pt; }
  .print-recipe__body { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 8mm; }
  .print-recipe__extras { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4mm 8mm; }
  .print-recipe__method li, .print-recipe__note, .nutrition { break-inside: avoid; }
  .print-recipe h2, .print-recipe h3 { break-after: avoid; }
  .print-recipe a { color: inherit; text-decoration: none; }

  /* A site page printed directly (CNT-004: recipe only, no navigation, photos
     or footer). Everything that is chrome, a control or a picture goes. */
  .skip-link, .site-header, .site-footer, .breadcrumbs, .search-panel,
  .recipe__actions, .recipe__hero, .content-hero, .video-page__player,
  .content-share, .share-bar, .follow-icons, .related, .content-section,
  .newsletter, .flavor-dna, .watch-it, .recipe__tags, .cook-mode,
  .copy-list, .step__done, .step-timer, .servings__btn, .video-player,
  .mb-thumb__save, .card__bookmark, picture, img, video, iframe {
    display: none !important;
  }

  .site-main { max-width: none; margin: 0; padding: 0; background: none; }
  .content-layout { display: block; }
  .content-layout__side { display: block; margin-top: 6mm; }
  .recipe-card {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: 8mm;
    padding: 0;
    background: none;
    border-radius: 0;
  }
  .details-bar, .editorial-block, .nutrition, .chapters { background: none; padding-inline: 0; }
  .details-bar { justify-content: flex-start; border-top: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); border-radius: 0; }
  .recipe__head, .content-head { text-align: left; margin-inline: 0; }
  .recipe__summary, .content-head__intro { margin-inline: 0; }
  .content-layout__side .nutrition { max-width: 22rem; }
  .byline, .recipe__head .badge-row, .content-head .badge-row { justify-content: flex-start; }
  .step, .ingredient, .editorial-block, .faq__item { break-inside: avoid; }
  .step::before { background: none; color: var(--text-primary); border: 1px solid var(--border-strong); }
  .tick { display: none; }
  .tick:checked + .ingredient__text { text-decoration: none; color: inherit; }
  a { color: inherit; text-decoration: none; }
}
