/* Blog pages, recipe pages and the recipe index. Colours, header, buttons, footer and the recipe
   sheet's pieces (.sheet-head, .why, .nutri, .ing, .steps) come from app.css. */

.blog-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; font-size: .92rem; font-weight: 600; }
.blog-nav a { color: var(--muted); text-decoration: none; }
.blog-nav a:hover { color: var(--accent); }
.blog-nav a[aria-current] { color: var(--ink); }

.blog { max-width: 760px; padding-block: 12px 40px; }
.crumbs { font-size: .85rem; color: var(--muted); }
.crumbs a { color: inherit; }
.crumbs [aria-current] { color: var(--ink, inherit); overflow-wrap: anywhere; }

.blog h1 { margin-top: 10px; font: 700 clamp(1.8rem, 5.5vw, 2.6rem)/1.12 var(--display); letter-spacing: -.01em; text-wrap: balance; }
.post-meta { margin-top: 10px; font-size: .88rem; color: var(--muted); }
.post-by { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 12px; font-size: .92rem; color: var(--muted); }
.post-by a { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.post-by a:hover b { text-decoration: underline; }
.post-by img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.post-by b { color: var(--ink, inherit); }
.post-by span { padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; font-size: .78rem; }
.persona-head { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.persona-head img { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; }
.persona-head > div { flex: 1 1 260px; }
.persona-label { display: inline-block; margin-top: 8px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; color: var(--muted); }
.post-lead { margin-top: 14px; font-size: 1.15rem; line-height: 1.55; color: var(--muted); text-wrap: pretty; }

.blog article { font-size: 1.05rem; line-height: 1.7; }
.blog article h2 { margin-top: 34px; font: 700 1.5rem/1.2 var(--display); text-wrap: balance; }
.blog article h3 { margin-top: 24px; font-size: 1.12rem; }
.blog article p, .blog article ul, .blog article ol, .blog article table, .blog article blockquote { margin-top: 14px; }
.blog article ul, .blog article ol { padding-left: 1.3em; }
.blog article ul { list-style: disc; }
.blog article ol { list-style: decimal; }
.blog article li + li { margin-top: 6px; }
.blog article a { color: var(--accent); }
.blog article sup a { padding: 0 2px; font-size: .75em; font-weight: 700; text-decoration: none; }
.blog article blockquote { margin-inline: 0; padding: 10px 16px; border-left: 3px solid var(--accent); border-radius: 4px 12px 12px 4px; background: var(--accent-soft); }
.blog article table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; font-size: .95rem; }
.blog article th, .blog article td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; hyphens: auto; }
.blog article th { font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 480px) { .blog article th, .blog article td { padding: 8px 6px; } }

.post-cta { margin-top: 34px; padding: 20px; border-radius: var(--radius); background: var(--accent-soft); }
.blog .post-cta h2 { margin-top: 0; font: 700 1.3rem var(--display); }
.post-cta p { margin-top: 6px; }
.post-cta .btn { display: inline-block; margin-top: 14px; text-decoration: none; color: var(--accent-ink); }

.post-faq details { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.post-faq summary { font-weight: 600; cursor: pointer; }
.post-faq details p { margin-top: 8px; }

.post-sources ol { font-size: .92rem; line-height: 1.5; color: var(--muted); }
.post-sources li { overflow-wrap: anywhere; }
.post-sources li:target { background: var(--warm-soft); }

.post-more { margin-top: 40px; }
.post-more h2 { font: 700 1.3rem var(--display); }
.post-list { display: grid; gap: 12px; margin-top: 16px; }
/* The category filter of the blog: links, so every category is a page of its own. */
.post-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.post-cat { padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: .92rem; text-decoration: none; }
.post-cat small { color: var(--muted); }
.post-cat:hover { border-color: var(--accent); }
.post-cat.is-on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.post-cat.is-on small { color: inherit; opacity: .8; }
.post-card { display: flex; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; }
.post-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.post-emoji { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--sunken); font-size: 1.7rem; }
.post-text { display: grid; gap: 4px; min-width: 0; }
.post-text b { font: 700 1.1rem/1.25 var(--display); text-wrap: balance; }
.post-text span { font-size: .92rem; color: var(--muted); }

/* Recipe pages: the recipe sheet of the app laid out as a page. */
.recipe-page { margin-top: 12px; }
.recipe-page .sheet-head { padding-right: 0; }
.blog .recipe-page h1 { margin-top: 0; font-size: clamp(1.6rem, 5vw, 2.3rem); }
.recipe-open { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.blog article .recipe-open { margin-top: 16px; }
.recipe-open .btn { text-decoration: none; color: var(--accent-ink); }
.recipe-open small { flex: 1 1 220px; font-size: .85rem; line-height: 1.4; }
.blog .recipe-open .sheet-act { color: var(--ink); text-decoration: none; }
.share-at { scroll-margin-top: 16px; }
.blog .recipe-page .sheet-cols h2 { margin-top: 0; font: 700 1.3rem var(--display); }
.recipe-page .sheet-cols h2 small { font: 400 .9rem var(--font); }
.blog article .ing, .blog article .steps { padding-left: 0; list-style: none; font-size: 1rem; line-height: 1.5; }
.blog article .ing li + li { margin-top: 0; }
.blog article .steps li + li { margin-top: 0; }
.blog .recipe-diets h2 { margin-top: 18px; font: 700 .75rem var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.blog article .recipe-diets .pills { margin-top: 8px; }
.recipe-diets .pill { font-size: .82rem; padding: 4px 10px; }

/* The recipe index */
.recipe-group h2 { margin-top: 30px; font: 700 1.4rem var(--display); }
.recipe-index { margin-top: 8px; }
.recipe-index li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.recipe-index a { color: var(--ink); font-weight: 600; text-decoration: none; }
.recipe-index a:hover { color: var(--accent); }
.recipe-index small { white-space: nowrap; }
.pager { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 24px; font-weight: 600; }
.pager a { color: var(--accent); }
.page-links { margin-top: 20px; }
.page-links a { color: var(--accent); }

/* The recipe index and a country's dishes with assets/recipes.js: the search and filters (pills, as in the
   app's toolbar), the count, the app's recipe cards in its grid; the plain list under them is the page
   without JavaScript (columns on a wide screen) and is hidden once the cards are drawn. */
.blog-wide { max-width: 1080px; }
.blog-wide .post-lead, .blog-wide .place-about { max-width: 72ch; }
.blog-wide .recipe-index { columns: 2 320px; column-gap: 32px; }
.blog-wide .recipe-index li { break-inside: avoid; }
.ri { display: grid; gap: 12px; margin-top: 18px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.ri-search { display: grid; gap: 6px; }
.ri-search label, .ri-select > span { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ri-search input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font-size: 1.05rem; }
.ri-search input:focus { border-color: var(--accent); }
.ri-search input::placeholder { color: var(--muted); opacity: .8; }
.ri .pill small { font-variant-numeric: tabular-nums; }
.ri .pill small:empty { display: none; }
.ri-more { display: grid; gap: 12px; }
.ri-selects { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 300px)); gap: 10px 14px; }
.ri-select { display: grid; gap: 6px; min-width: 0; }
.ri-select select { width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font-size: .95rem; }
.ri-toggle { justify-self: start; }
.ri-toggle::after { content: "▾"; color: var(--muted); transition: rotate .15s; }
.ri-toggle[aria-expanded="true"] { border-color: var(--accent); }
.ri-toggle[aria-expanded="true"]::after { rotate: 180deg; }
.ri-status { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; font-weight: 650; }
.ri-results { min-height: 40vh; }
.ri-results .group:first-child { margin-top: 20px; }
.ri-results .grid { margin-top: 12px; }
.ri-results .empty { margin-top: 20px; }
a.card { color: var(--ink); text-decoration: none; }
/* A phone: the search and the meals stay in view, the other filters fold under «Фільтри». */
@media (max-width: 719px) {
  .ri { padding: 12px; }
  .ri-selects { grid-template-columns: minmax(0, 1fr); }
  .ri-folds { display: none; }
  .ri.is-open .ri-folds { display: grid; }
}
@media (min-width: 720px) { .ri-toggle { display: none; } }
/* Every country under the list: folded, a grid of links with their counts. */
.ri-places { margin-top: 30px; }
.ri-place-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 24px; margin: 0 16px 14px; font-size: .95rem; line-height: 1.4; }
.ri-place-grid > li > a { color: var(--ink); font-weight: 600; text-decoration: none; }
.ri-place-grid a:hover { color: var(--accent); text-decoration: underline; }
.ri-place-grid small { color: var(--muted); font-variant-numeric: tabular-nums; }
.ri-place-grid > li:first-child { grid-column: 1 / -1; } /* Ukraine, with its many regions */
.ri-regions { display: block; margin-top: 2px; }
.ri-regions a { color: var(--accent); }
.ri-places .page-links { margin: 0 16px 14px; }

/* Dishes by place and the seasonal calendar. */
.post-lead a, .place-regions a, .place-index a + small a { color: var(--accent); }
.place-about { margin-top: 14px; line-height: 1.6; text-wrap: pretty; }
.place-regions { margin-top: 14px; line-height: 1.7; }
.place-regions small, .place-index small { color: var(--muted); }
.blog > .recipe-open { margin-top: 18px; }
.pager.months { margin-top: 18px; }
.blog > h2 small { font: 600 .9rem var(--font); color: var(--muted); }
.blog > h2 { margin-top: 30px; }
.recipe-page .origin a { color: var(--accent); }

/* Products: the calorie table (/products/) and a product's page (/product/<id>/). The tables use the
   width of the page and never scroll it sideways: names wrap, numbers stay on one line. */
.recipe-page .ing-label a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 3px; }
.recipe-page .ing-label a:hover { color: var(--accent); text-decoration-color: currentColor; }
.foot a { color: inherit; }

.blog article .ptable, .blog article .nutable { display: table; width: 100%; overflow: visible; font-size: .95rem; line-height: 1.35; }
.blog article .ptable th, .blog article .ptable td, .blog article .nutable th, .blog article .nutable td { padding: 7px 6px; }
.blog article .ptable td, .blog article .nutable td, .blog article .ptable tbody th, .blog article .nutable tbody th { font-size: inherit; letter-spacing: 0; text-transform: none; color: var(--ink); }
.blog article .ptable .num, .blog article .nutable .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.blog article .ptable tbody th, .blog article .nutable tbody th { font-weight: 400; }
.ptable tbody th a { color: var(--ink); font-weight: 600; text-decoration: none; }
.ptable tbody th a:hover { color: var(--accent); }
.ptable thead th { position: sticky; top: 0; z-index: 1; background: var(--bg); }
.ptable thead button { all: unset; cursor: pointer; }
.ptable thead button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ptable th[aria-sort="ascending"] button::after { content: " ↑"; }
.ptable th[aria-sort="descending"] button::after { content: " ↓"; }
.ptable .short { display: none; }
.blog article .ptable .pt-cat th { padding-top: 22px; font: 700 1.15rem var(--display); color: var(--ink); letter-spacing: 0; text-transform: none; }
.ptable tbody { scroll-margin-top: 12px; }
.typ { margin-left: 2px; color: var(--warm); font-weight: 700; cursor: help; }
.pt-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.pt-tools[hidden], .pt-none[hidden] { display: none; }
.pt-tools label { font-weight: 600; }
.pt-tools input { flex: 1 1 200px; max-width: 320px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; }
.pt-tools input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.pt-tools small { flex: 1 1 100%; font-size: .82rem; color: var(--muted); }
.products-page .post-cats { margin-top: 16px; }
.products-page .post-sources p, .product-page .post-sources .pnote { font-size: .92rem; line-height: 1.55; color: var(--muted); }

.product-page { margin-top: 12px; }
.blog .product-page h1 { margin-top: 0; font-size: clamp(1.5rem, 5vw, 2.2rem); }
.product-page .sheet-head { padding-right: 0; }
.product-page .card-meta a, .product-page .origin a, .product-page .recipe-pro a, .ref a, .post-lead a { color: var(--accent); }
.blog article .product-page h2 small, .product-page h2 small { font: 400 .9rem var(--font); color: var(--muted); }
.blog article .measure { margin-top: 8px; font-weight: 600; }
/* КБЖВ at the top of a product page: the tiles of the recipe page (.nutri in app.css), per 100 g. */
.blog article .product-page .kbzhu { margin-top: 12px; font-size: .92rem; color: var(--muted); }
.blog article .product-page .kbzhu + .nutri { margin-top: 6px; }
.blog article .nutable thead th { vertical-align: bottom; }
.blog article .nutable .pt-sub th { padding-left: 20px; color: var(--muted); }
.blog article .nutable .pt-strong th, .blog article .nutable .pt-strong td { font-weight: 700; }
.blog article .ptable thead th, .blog article .nutable thead th { font-size: .74rem; letter-spacing: .02em; }
.blog article .nutable thead th.num { white-space: normal; }
.blog .product-page .recipe-index { padding-left: 0; list-style: none; }
.blog .product-page .recipe-index li + li { margin-top: 0; }
.blog .product-page .recipe-index a { color: var(--ink); }
.blog .product-page .recipe-index a:hover { color: var(--accent); }
.blog article .nutable .group th { padding-top: 16px; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.nutable .calc { display: block; font-size: .78rem; color: var(--muted); }
.ref { font-size: .72em; font-weight: 600; }
.ref a { text-decoration: none; }
.pnote { margin-top: 8px; font-size: .85rem; line-height: 1.5; color: var(--muted); }
.micro-none { color: var(--muted); }
.blog article .product-page .pills, .product-page .pills { display: inline-flex; vertical-align: middle; }
.post-sources li[id] { scroll-margin-top: 12px; }

/* The USDA reference (/foods/, /food/<id>/): the search box, the household measures, a name still in English. */
.blog article .food-search { margin-top: 18px; }
.food-search input { flex: 1 1 220px; max-width: 420px; }
.food-search .btn { border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.foods-page .food-results { margin-top: 8px; }
.blog article .food-measures { padding-left: 1.2em; }
.blog article .food-measures li { margin-top: 4px; font-size: 1rem; font-weight: 600; }
.blog .food-page h1 .src-lang { font: 400 .9rem var(--font); color: var(--muted); white-space: nowrap; }
.foods-more { margin-top: 12px; font-weight: 600; }
.blog .foods-page h1 small { font: 400 1rem var(--font); color: var(--muted); white-space: nowrap; }
.foods-more a, .food-page .origin a { color: var(--accent); }

/* The site map for people (/sitemap/): <details> sections that fold and unfold without JavaScript;
   the two buttons (shown by its inline script) open or close them all. */
.sm-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.sm-tools[hidden] { display: none; }
.sm-tools .btn { padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: .9rem; }
.sm-tools .btn:hover { border-color: var(--accent); color: var(--accent); }
.sitemap { display: grid; gap: 10px; margin-top: 18px; }
.sm { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.sm > summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font: 700 1.2rem/1.3 var(--display); cursor: pointer; list-style: none; }
.sm > summary::-webkit-details-marker { display: none; }
.sm > summary::before { content: ""; flex: none; width: 7px; height: 7px; margin: 0 3px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
.sm[open] > summary::before { transform: rotate(45deg); }
.sm > summary:hover { color: var(--accent); }
.sm > summary small { margin-left: auto; padding: 2px 9px; border-radius: 999px; background: var(--sunken); color: var(--muted); font: 600 .8rem/1.4 var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sm > .sm-note, .sm > .sm-list { margin: 0 16px 14px; }
.sm-sub { margin: 0 16px; border-width: 1px 0 0; border-radius: 0; background: none; }
.sm-sub:last-child { margin-bottom: 4px; }
.sm-sub > summary { padding: 10px 0; font: 600 1rem/1.3 var(--font); }
.sm-sub > .sm-note, .sm-sub > .sm-list { margin: 0 0 14px; }
.sm-note { font-size: .92rem; color: var(--muted); }
.sm-note a { color: var(--accent); }
.sm-list { padding: 0; list-style: none; font-size: .95rem; line-height: 1.35; }
.sm-list li { padding: 4px 0; break-inside: avoid; }
.sm-list a { color: var(--ink); text-decoration: none; }
.sm-list a:hover { color: var(--accent); text-decoration: underline; }
.sm-list small { color: var(--muted); font-variant-numeric: tabular-nums; }
.sm-cols { columns: 2 240px; column-gap: 28px; }
.sm-months { columns: 3 120px; column-gap: 28px; }
.sm-places > li > a { font-weight: 600; }
.sm-regions { margin: 2px 0 2px 1.6em; font-size: .9rem; }
.sm-regions li { padding: 2px 0; }

@media (max-width: 560px) {
  /* USDA names are English: wrap them at word breaks, not with hyphens. */
  .blog article .ptable.ftable tbody th { hyphens: manual; }
  .ptable .long { display: none; }
  .ptable .short { display: inline; }
  .blog article .ptable, .blog article .nutable { font-size: .86rem; }
  .blog article .ptable th, .blog article .ptable td, .blog article .nutable th, .blog article .nutable td { padding: 6px 3px; }
  .blog article .ptable tbody th { hyphens: auto; overflow-wrap: break-word; }
  .blog article .ptable thead th { letter-spacing: 0; text-transform: none; font-size: .8rem; }
  .blog article .nutable thead th { letter-spacing: 0; text-transform: none; font-size: .78rem; }
  .blog article .nutable .pt-sub th { padding-left: 12px; }
  .post-cats .post-cat { padding: 5px 11px; font-size: .85rem; }
  /* Four links and the brand do not fit beside each other on a phone: the links go under the brand
     (and wrap into more rows when the menu is longer). */
  .top:has(.blog-nav) { flex-wrap: wrap; row-gap: 4px; }
  .blog-nav { gap: 6px 14px; font-size: .9rem; }
}
@media (max-width: 420px) {
  .top:has(.blog-nav) .blog-nav { flex: 1 1 100%; }
}

/* The dish picture of a recipe page (server/images.php): 4:3, above the ingredients; its width and height are in
   the HTML, so the place is kept before it loads. */
.recipe-pic { margin: 22px 0 0; }
.recipe-pic img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); background: var(--sunken); }
.recipe-pic figcaption { margin-top: 6px; font-size: .8rem; color: var(--muted); text-align: right; }

/* The cover and the gallery of an article, the gallery of a recipe (server/gallery.php). */
.post-cover { margin: 20px 0 0; }
.post-cover img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); background: var(--sunken); }
.post-cover figcaption, .gallery-note { margin-top: 6px; font-size: .8rem; color: var(--muted); text-align: right; }
.post-thumb { flex: none; width: 96px; height: 54px; object-fit: cover; border-radius: 10px; background: var(--sunken); }
.gallery { margin-top: 28px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }
.gallery figure { margin: 0; }
.gallery img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); background: var(--sunken); }
.gallery a:hover img { box-shadow: var(--shadow); }
.gallery figcaption { margin-top: 5px; font-size: .88rem; color: var(--muted); }
@media (max-width: 520px) { .gallery-grid { grid-template-columns: 1fr 1fr; gap: 8px; } .post-thumb { width: 72px; height: 54px; } }

/* The admin's way from a page to its pictures in /admin/ (shown only in the admin's browser). */
.admin-pics { position: fixed; right: 14px; bottom: 14px; z-index: 40; padding: 8px 14px; border-radius: 999px; background: var(--ink); color: var(--surface); font-size: .85rem; font-weight: 600; text-decoration: none; box-shadow: var(--shadow); }
.admin-pics:hover { background: var(--accent); }
.admin-pics[hidden] { display: none; }
