/*
 * The recipe on paper (linked with media="print" on the recipe page only; «Печать» calls
 * window.print() from static/js/recipe_detail.js, and the browser's own Print uses it too).
 * Only the recipe: title, author, pan, ingredients (as scaled on screen), steps, the page
 * address. No navigation, buttons, cookie banner, galleries or cooking mode; the cover
 * and step photos stay off. Black on white whatever the screen theme.
 */
@page {
  margin: 14mm 14mm 16mm;
}

:root {
  color-scheme: light;
  --bg: #fff !important;
  --surface: #fff !important;
  --surface-2: #fff !important;
  --ink: #000 !important;
  --muted: #333 !important;
  --line: #bbb !important;
  --field: #666 !important;
  --accent: #000 !important;
  --accent-deep: #000 !important;
  --accent-soft: #fff !important;
  --shadow-sm: none !important;
  --shadow-md: none !important;
  --shadow-lg: none !important;
}

html,
body {
  height: auto;
  background: #fff !important;
  color: #000 !important;
}

body {
  font-size: 11pt;
  line-height: 1.45;
}

.container,
main {
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Everything that is not the recipe. The stack keeps only ingredients, steps and the address,
   so blocks added later after the steps (galleries, readers' results) stay off paper too. */
.skip-link,
.geo-preview-bar,
.topbar,
.back-link,
.site-messages,
.site-footer,
.mobile-dock,
.cookie-banner,
.cookie-notice,
.recipe-jump-nav,
.recipe-actions,
.recipe-cook-bar,
.cook,
.tool-sheet,
.recipe-lightbox,
.recipe-share-toast,
.recipe-detail-hero__media,
.recipe-detail-avatar,
.recipe-detail-author-meta,
.recipe-detail-description,
.recipe-machine-translation-note,
.recipe-wake,
.recipe-scale,
.units-switch,
.recipe-pan-note a,
.recipe-scale-banner button,
.ingredient-check-bar,
.recipe-step-card__media,
.recipe-detail-stack > :not(#ingredients):not(#steps):not(.recipe-print-source) {
  display: none !important;
}

/* A scaled recipe says so: «Порции 2×» (only the chosen button), or the pan banner. */
.recipe-section--ingredients.is-scaled .recipe-scale:has([aria-pressed="true"]) {
  display: flex !important;
  margin: 0 0 2mm;
}

.recipe-scale .tool-seg {
  background: none !important;
  padding: 0;
}

.recipe-scale button {
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  color: #000 !important;
  font-weight: 700;
}

.recipe-scale button:not([aria-pressed="true"]) {
  display: none !important;
}

.recipe-scale-banner {
  margin: 0 0 2mm;
  padding: 0;
  background: none;
  color: #000;
}

/* Flat black-on-white layout. */
.recipe-page,
.page-shell,
.recipe-text,
.recipe-detail-hero,
.recipe-detail-hero__body,
.recipe-section,
.recipe-step-card,
.recipe-preparation-heading {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  overflow: visible !important;
}

.recipe-detail-hero,
.recipe-detail-hero__body,
.recipe-detail-stack {
  display: block !important;
}

.recipe-detail-hero {
  margin-bottom: 5mm !important;
}

.recipe-detail-hero__body h1 {
  margin: 0 0 1mm;
  font-size: 20pt;
  line-height: 1.15;
}

.recipe-detail-meta {
  display: block;
}

.recipe-detail-author-name {
  font-size: 10pt;
  font-weight: 600;
}

.recipe-section {
  margin-bottom: 6mm !important;
}

.recipe-section h2 {
  margin: 0 0 2mm;
  font-size: 14pt;
  line-height: 1.2;
  letter-spacing: 0;
}

.recipe-preparation-heading {
  padding-top: 2mm !important;
}

.recipe-preparation-heading h3 {
  font-size: 12pt;
}

.recipe-pan-note {
  margin: 0 0 2mm;
  color: #000;
  font-size: 10pt;
}

.ingredient-group__title {
  margin: 3mm 0 1mm !important;
  padding: 0 !important;
  border: 0 !important;
  color: #000 !important;
  font-size: 11pt;
  font-weight: 700;
  break-after: avoid;
}

.ingredient-group__title:first-child {
  margin-top: 0 !important;
}

.ingredient-list li,
.ingredient-list li.is-checkable {
  padding: 1.2mm 0 1.2mm 5mm !important;
  padding-inline: 5mm 0 !important;
  border-bottom: 0.5pt solid #ccc;
  font-size: 11pt;
  line-height: 1.4;
  break-inside: avoid;
}

/* Check-off marks are for the screen: plain dots on paper (a border: browsers skip backgrounds). */
.ingredient-list li::before,
.ingredient-list li.is-checkable::before {
  top: calc(1.2mm + 0.7em - 3px);
  width: 0;
  height: 0;
  border: 3px solid #000;
  background: none;
}

.ingredient-list li::after {
  content: none !important;
}

.ingredient-check {
  min-height: 0 !important;
  padding: 0 !important;
  color: #000 !important;
  text-decoration: none !important;
}

.recipe-section--ingredients.is-scaled .ing-q {
  color: #000 !important;
}

.recipe-step-list,
.recipe-preparation-flow {
  gap: 2.5mm !important;
}

.recipe-step-card {
  display: grid !important;
  grid-template-columns: 8mm minmax(0, 1fr) !important;
  gap: 2mm !important;
  break-inside: avoid;
}

.recipe-step-card__number {
  width: auto !important;
  height: auto !important;
  justify-content: flex-start !important;
  background: none !important;
  color: #000 !important;
  font-size: 11pt;
}

.recipe-step-card__text p,
.step-list li {
  font-size: 11pt !important;
  line-height: 1.45 !important;
}

.step-list li {
  margin-bottom: 2.5mm;
  break-inside: avoid;
}

.step-list li::before {
  background: none !important;
  color: #000 !important;
}

.recipe-scale-note,
.ingredient-us-note {
  color: #333 !important;
  font-size: 9pt !important;
}

h1,
h2,
h3 {
  break-after: avoid;
}

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

.recipe-print-source {
  display: block !important;
  margin: 6mm 0 0;
  padding-top: 2mm;
  border-top: 0.5pt solid #999;
  color: #333;
  font-size: 9pt;
}
