/* Recipe Ancestor — sparse 1999 / Craigslist-ish */
body {
  margin: 0;
  background: #eee;
  color: #000;
  font: 14px/1.45 Arial, Helvetica, sans-serif;
}
a { color: #00e; }
a:visited { color: #551a8b; }
a:hover { color: #00e; text-decoration: underline; }

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 8px 12px 24px;
  background: #f5f5f5;
  border-left: 1px solid #ccc;
  border-right: 1px solid #ccc;
  min-height: 100vh;
  box-sizing: border-box;
}

.top {
  display: table;
  width: 100%;
  border-bottom: 1px solid #999;
  padding-bottom: 8px;
  margin-bottom: 10px;
}
.brand { display: table-cell; vertical-align: top; }
.brand h1 { margin: 0; font-size: 22px; font-weight: bold; }
.brand h1 a { color: #000; text-decoration: none; }
.brand .tag { color: #333; font-size: 12px; }
.tag-mission{font-size:12px;color:#333;margin-top:2px;}
.tag-page{font-size:12px;color:#666;margin-top:4px;}

.date { font-size: 11px; color: #555; }

.ad { display: table-cell; vertical-align: top; width: 180px; text-align: center; }
.adbox {
  border: 2px solid #000;
  background: #ffc;
  padding: 6px;
  font-size: 11px;
}
.adbox .lbl { font-size: 10px; color: #666; margin-bottom: 4px; }

.nav {
  margin: 8px 0 12px;
  font-size: 12px;
  line-height: 1.7;
}
.nav a { margin-right: 2px; }

h2 {
  font-size: 14px;
  margin: 14px 0 6px;
  border-bottom: 1px solid #aaa;
  padding-bottom: 2px;
}
h3 { font-size: 13px; margin: 12px 0 4px; }

ol.books, ol.toplist { margin: 0 0 12px 18px; padding: 0; }
ol.books li, ol.toplist li { margin: 2px 0; }

ul.plain { margin: 0 0 12px 18px; padding: 0; }
ul.plain li { margin: 2px 0; }

table.compare {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  margin: 8px 0;
}
table.compare th, table.compare td {
  border: 1px solid #000;
  padding: 8px;
  vertical-align: top;
  width: 50%;
}
table.compare th {
  background: #ddd;
  text-align: left;
  font-size: 13px;
}
table.compare img {
  max-width: 100%;
  height: auto;
  border: 1px solid #999;
  margin: 6px 0;
  display: block;
}

.match {
  margin: 10px 0;
  padding: 6px 8px;
  border: 1px solid #000;
  background: #fff;
  font-weight: bold;
}
.match.exact { background: #dfd; }
.match.somewhat { background: #ffc; }
.match.reasonably { background: #fed; }
.match.none { background: #eee; }

.source, .bookcard, .howto {
  margin: 10px 0;
  padding: 8px;
  border: 1px solid #999;
  background: #fff;
}
.badge {
  display: inline-block;
  border: 1px solid #000;
  padding: 1px 6px;
  font-size: 11px;
  background: #fff;
  margin-left: 4px;
}

.footer {
  margin-top: 18px;
  font-size: 11px;
  color: #555;
  border-top: 1px solid #999;
  padding-top: 6px;
}

table.list {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 13px;
}
table.list th, table.list td {
  border: 1px solid #bbb;
  padding: 4px 6px;
  text-align: left;
  vertical-align: top;
}
table.list th { background: #ddd; }

.meta { font-size: 12px; color: #444; margin: 4px 0; }
.crumb { font-size: 12px; color: #333; font-style: italic; }

.columns { display: table; width: 100%; }
.col { display: table-cell; vertical-align: top; width: 50%; padding-right: 12px; }
.col:last-child { padding-right: 0; padding-left: 12px; }

@media (max-width: 640px) {
  .col { display: block; width: auto; padding: 0 !important; }
  .ad { display: block; width: auto; margin-top: 8px; }
  .brand { display: block; }
}

form { margin: 10px 0; }
input[type=text] { width: 70%; max-width: 28em; font-size: 14px; padding: 3px; border: 1px solid #666; }
input[type=submit] { font-size: 14px; padding: 3px 10px; }

/* Share / print actions (viral always; ancestor only when publicDomain) */
.share-actions {
  margin: 8px 0 12px;
  font-size: 12px;
  line-height: 1.8;
}
.share-actions a {
  margin-right: 10px;
  white-space: nowrap;
}
.share-actions .share-status {
  display: inline-block;
  margin-left: 6px;
  color: #060;
  font-size: 11px;
}
.share-actions.ancestor-share {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dotted #999;
}
.viral-plain {
  margin: 10px 0;
  padding: 8px;
  border: 1px solid #999;
  background: #fff;
  white-space: pre-wrap;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
}
.viral-plain h3, .ancestor-crumb-block h3 {
  margin-top: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
}
.ancestor-crumb-block {
  margin: 10px 0;
  padding: 8px;
  border: 1px dashed #666;
  background: #fff;
}
/* .screen-only hidden in @media print */
.pd-badge {
  display: inline-block;
  font-size: 10px;
  border: 1px solid #060;
  color: #060;
  padding: 0 4px;
  margin-left: 4px;
}

.dish-title { margin-bottom: 4px; }

.trace-receipt {
  margin: 12px 0;
  padding: 8px;
  border: 1px solid #999;
  background: #fff;
}
.receipt-list { margin: 0; }
.receipt-list dt {
  font-weight: bold;
  margin-top: 6px;
}
.receipt-list dd { margin: 0 0 0 1em; }

.print-only { display: none; }

/* Print: dual-tile (compact) + match + bottom exact recipes (prefer 1 page).
   Squish tiles / chrome / fonts first; keep bottom viral Ingredients+Steps larger.
   Huge recipes may spill to page 2 rather than becoming unreadable. */
@page {
  margin: 0.4in;
}

@media print {
  body {
    background: #fff;
    font-size: 11px;
    line-height: 1.3;
  }
  .wrap {
    max-width: none;
    margin: 0;
    padding: 0;
    border: none;
    background: #fff;
    min-height: 0;
  }

  .ad, .nav, .share-actions, .related, .footer,
  .breadcrumb, form, .top .ad,
  .no-print, .screen-only,
  .bookcard.no-print {
    display: none !important;
  }
  .ancestor-recipe-body.no-print { display: none !important; }

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

  /* Compact site header */
  .top {
    border-bottom: 1px solid #999;
    padding-bottom: 2px;
    margin-bottom: 4px;
  }
  .brand h1 {
    font-size: 14px;
    margin: 0;
    line-height: 1.2;
  }
  .brand .tag {
    font-size: 9px;
    line-height: 1.2;
  }
  .brand .date {
    font-size: 8px;
    color: #555;
  }

  /* Compact dish title / match / meta */
  h2.dish-title {
    font-size: 13px;
    margin: 4px 0 3px;
    padding-bottom: 1px;
    border-bottom: 1px solid #aaa;
    line-height: 1.2;
  }
  .match, .dish-match {
    display: block !important;
    margin: 4px 0;
    padding: 2px 5px;
    font-size: 10px;
    line-height: 1.25;
  }
  .meta {
    font-size: 9px;
    margin: 1px 0;
    line-height: 1.25;
  }
  .crumb {
    font-size: 9px;
  }

  /* Dual-tile compare: shrink first (secondary to bottom recipe) */
  table.compare.dish-compare {
    display: table !important;
    page-break-inside: avoid;
    width: 100%;
    margin: 2px 0 4px;
    font-size: 10px;
    line-height: 1.25;
  }
  table.compare.dish-compare th,
  table.compare.dish-compare td {
    padding: 3px 5px;
    font-size: 10px;
    line-height: 1.25;
  }
  table.compare.dish-compare th {
    font-size: 9px;
    padding: 2px 5px;
  }
  table.compare.dish-compare img {
    max-width: 120px;
    max-height: 80px;
    margin: 2px 0;
  }
  /* Drop duplicate full recipe from viral tile — bottom .print-viral is the cook sheet */
  .dish-compare .viral-label,
  .dish-compare .viral-ings,
  .dish-compare .viral-steps,
  .dish-compare .viral-cite,
  .dish-compare .viral-card > p {
    display: none !important;
  }
  .dish-compare .viral-card > br {
    display: none;
  }
  .dish-compare .viral-card > strong,
  .dish-compare .viral-card > .meta {
    display: block;
    margin: 0 0 1px;
  }
  .dish-compare .ancestor-recipe-body {
    font-size: 9px;
    line-height: 1.25;
  }
  .dish-compare .ancestor-recipe-body p {
    margin: 2px 0;
  }
  .dish-compare .howto {
    display: none !important;
  }

  /* Bottom exact-recipe area — keep fairly large vs tiles */
  .trace-receipt.print-recipes {
    display: block !important;
    margin: 6px 0 0;
    padding: 4px 6px;
    border: 1px solid #999;
    page-break-inside: avoid;
  }
  .print-recipes-bottom,
  .print-recipes-bottom-single,
  .print-viral,
  .print-ancestor,
  .viral-plain {
    display: block !important;
  }
  .print-viral,
  .print-ancestor,
  .print-recipes-bottom-single {
    page-break-inside: avoid;
  }
  table.compare.print-recipes-bottom {
    display: table !important;
    width: 100%;
    margin-top: 4px;
    page-break-inside: avoid;
    font-size: 12px;
  }
  table.compare.print-recipes-bottom th {
    font-size: 11px;
    padding: 2px 5px;
  }
  table.compare.print-recipes-bottom td {
    vertical-align: top;
    padding: 4px 6px;
  }
  .print-only {
    font-size: 12px;
    margin: 0 0 3px;
  }
  .viral-plain {
    margin: 0;
    padding: 4px 6px;
    border: 1px solid #bbb;
    background: #fff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 13px;
    line-height: 1.3;
    white-space: pre-wrap;
    orphans: 3;
    widows: 3;
    page-break-inside: avoid;
  }
  /* Structured lists if ever shown in print recipe body */
  .print-viral ul,
  .print-viral ol,
  .print-ancestor ul,
  .print-ancestor ol,
  .viral-card ul.viral-ings,
  .viral-card ol.viral-steps {
    font-size: 13px;
    line-height: 1.3;
    margin: 0 0 4px 1.1em;
    page-break-inside: avoid;
  }
  /* Citations trail in plain text — keep small when marked */
  .viral-cite,
  .print-recipes .meta {
    font-size: 9px;
    line-height: 1.25;
  }

  /* Trace meta receipt stays screen-only via .screen-only */

  /* Scope: ancestor button focuses bottom ancestor col but keeps dual-tile + viral recipe */
  body[data-print-scope="ancestor"] .print-recipes-bottom-single {
    display: none !important;
  }

  a[href]::after { content: ""; }
  a { color: #000; text-decoration: none; }
}

.viral-card .viral-label {
  margin: 8px 0 2px;
  font-size: 12px;
  font-weight: bold;
}
.viral-card ul.viral-ings,
.viral-card ol.viral-steps {
  margin: 0 0 8px 1.2em;
  padding: 0;
  font-size: 13px;
  line-height: 1.45;
}
.viral-card .viral-cite {
  margin-top: 6px;
}
