/* ============================================================
   CUSTOM — Per-store overrides for Template TF
   Add store-specific tweaks here. Loaded last so it wins
   over theme.css and style.css.
   ============================================================ */

/* Rakesh 2026-10-29: overflow:hidden makes min-height 0, so 26 categories shrank instead of scrolling - keep full height, sidebar scrolls */
.menu-buttons .menu-button { flex-shrink: 0; }

/* ===== TASK E (2026-11-14): repeat-defect guards, measured on a fresh TF scaffold ===== */
/* item 1: gallery tiles at 390@2 were 1.80-2.02x (one 350px column on phones); two columns keep every tile <=1.5x; 6 tracks with tiles spanning 3 = the same 2 columns (TF item 4 gallery fit) */
@media (max-width: 560px) { :root .gallery-wall { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.75rem; } :root .gallery-wall figcaption { padding: 0.55rem 0.7rem; font-size: 0.9rem; } }
/* item 3: back-to-top (fixed 3rem at right 1.4rem) covered "Powered by iOrders.ca" at 375-1280; reserve its width at the end of the legal row
   only where the row reaches it (0 on wide screens) */
:root .foot-legal { padding-right: max(0px, calc(5.5rem - (100vw - 100%) / 2)); }
/* item 6: small text (<14px) at >=4.5:1 on its real background (Dennis's bar) */
:root .dish-rating .rating-count { color: var(--muted); }                       /* was gold on cream, 2.0:1 (Golden Bell a943b1a pattern) */
:root .kicker:not(.kicker--light):not(.menu-band .kicker), :root p.cs-subtitle, :root #home-hero .cs-subtitle, :root .plate .plate-foot { color: var(--chili-dark); }   /* brand red 3.8-4.35:1 on cream/white */
:root .menu-band .kicker { color: color-mix(in srgb, var(--gold) 80%, #fff); }  /* gold on the green band 4.46:1 -> lighter gold */
/* hero kicker sits on the store's photo: a 70% dark pill keeps white text >=6.6:1 over any photo, even pure white */
:root .hero-full .kicker--light { background: rgba(24, 20, 16, 0.7); padding: 0.3rem 0.75rem; border-radius: 999px; }

/* kh75hh77 TF item 8 (2026-11-20): CLS. #header-container is display:contents, so until components.js injects the header
   nothing holds its place and the page drops ~103-140px when it arrives (home CLS 0.079, place 0.113 on a fresh copy).
   Hold the top line + header height while it is empty (TF header 102.781px; top line 37.656px from 901px up, hidden
   below). A store that changes the header re-measures these two numbers. */
#header-container:empty { display: block; min-height: 102.781px; }
@media (min-width: 901px) { #header-container:empty { min-height: 140.4375px; } }

/* kh75hh77 TF item 9 (2026-11-20): tap targets >= 24px (WCAG 2.5.8) + clean /menu rows without a description (PT rule 36) */
main :is(ul, ol) > li > a:only-child:not(.btn):not([class*="btn"]) { display: inline-block; min-height: 24px; padding-block: 3px; line-height: 1.3; }
/* TF rows always carry .item-desc (the category chip), so script.js marks a dish without a description .menu-item--nodesc:
   name + price on one line, the chip under them, centred in the card (row heights stay equal for detector a) */
.menu-item--nodesc { display: flex; align-items: center; }
.menu-item--nodesc .item-details { display: grid; flex: 1; grid-template-columns: minmax(0, 1fr) auto; column-gap: 1rem; align-items: baseline; }
.menu-item--nodesc .item-name, .menu-item--nodesc .item-price { margin-bottom: 0; }
.menu-item--nodesc .item-price { white-space: nowrap; }
.menu-item--nodesc .item-desc { grid-column: 1 / -1; margin: 0.4rem 0 0; }

/* ===== No-photo fallback (TF port of PT rule 31 + d916636, Elena kh75hh77 TF item 3, 2026-11-20) =====
   A hero / split section / card without a photo sizes to its content: no fixed or vh height, no blank
   media box, no empty grid column, no empty band >160px. Every rule is guarded by :has(), so pages
   with photos are unchanged. Keep these lines in any custom.css rewrite. */
/* home hero without a photo: the text band sizes to its text (PT d916636), and the next section's top
   padding is trimmed (Main Track cd4db54: 162-168px at 1280/1440 -> 135) */
.hero-full:not(:has(.hero-full__bg img)) { min-height: 0; padding-block: 0; }
.hero-full:not(:has(.hero-full__bg img)) .hero-full__content { margin-block: 0; padding-block: clamp(3rem, 6vw, 4.5rem); }
.hero-full:not(:has(.hero-full__bg img)) + section { padding-top: clamp(3rem, 5vw, 4rem); }
/* media boxes left without an image are removed, not drawn as blank boxes */
:is(.hero-full__bg, .ph-img, .explore__image, .dish-hero-image, .story-collage, .snap-grid):not(:has(img, video, iframe)) { display: none; }
/* two-column splits with no photo go one column (was: text in one track, an empty track beside it) */
.page-hero--split .wrap:not(:has(.ph-img img)) { grid-template-columns: 1fr; }
.explore__container:not(:has(.explore__image img)) { grid-template-columns: 1fr; }
.dish-hero-container:not(:has(.dish-hero-image img)) { grid-template-columns: 1fr; }
.story .wrap:not(:has(img)) { grid-template-columns: 1fr; }
/* a section left with no text and no media at all (e.g. the about photo strip without photos) */
main > section:not(:has(img, video, iframe, svg, h1, h2, h3, h4, p, li, a, button, form)) { display: none; }
/* ===== Round 4 item 8 (2026-11-22, kh71xwpa): contrast by construction =====
   Any theme.css brand colour keeps text at >= 4.5:1. The brand hue and chroma stay; only OKLCH lightness is capped:
   brand <= 0.52 (white text on buttons/bands = 5.5:1+, brand-coloured text on white/cream = 5:1+), brand-2 <= 0.45.
   Very light brands (L >= 0.75): the main button keeps the brand fill and switches to black text (>= 8:1) instead.
   Old browsers without relative colours keep the plain theme colours. Never re-declare these tokens in a store. */
@supports (color: oklch(from red l c h)) {
  :root {
    --chili: oklch(from var(--brand) min(l, 0.52) c h);
    --chili-dark: oklch(from var(--brand) min(l, 0.42) c h);
    --primary-color: var(--chili);
    --primary: var(--chili);
    --primaryLight: var(--chili);
    --basil: oklch(from var(--brand-2) min(l, 0.45) c h);
    --basil-deep: oklch(from var(--brand-2) min(l, 0.36) c h);
  }
  :root .foot-legal { color: rgba(255, 255, 255, 0.72); }
  :root .menu-band .kicker { color: oklch(from var(--brand-3) max(l, 0.94) min(c, 0.07) h); }   /* tinted near-white on the --basil band (L <= 0.45): 6:1+; was 3.79:1 with a light brand-3 */   /* on --basil-deep (L <= 0.36): 6:1+; 0.55 was 4.28:1 on a light brand-2 */
  :root .btn:not(.btn--green):not(.btn--butter), :root .order-float {
    background: oklch(from var(--brand) calc(clamp(0, (l - 0.75) * 1000, 1) * l + (1 - clamp(0, (l - 0.75) * 1000, 1)) * min(l, 0.52)) c h);
    color: oklch(from var(--brand) calc(1 - clamp(0, (l - 0.75) * 1000, 1)) 0 0);
  }
  :root .btn:not(.btn--green):not(.btn--butter):hover, :root .order-float:hover {
    background: oklch(from var(--brand) calc(clamp(0, (l - 0.75) * 1000, 1) * (l - 0.05) + (1 - clamp(0, (l - 0.75) * 1000, 1)) * min(l, 0.44)) c h);
    color: oklch(from var(--brand) calc(1 - clamp(0, (l - 0.75) * 1000, 1)) 0 0);
  }
}

/* ===== Round 4 items 1+2 (2026-11-22, kh71xwpa): ONE card-grid rule for every page type, 769px and up =====
   Every column = 300px of TEXT + the card's side padding and borders (--col-pad, default 3.2rem + 2px = the widest
   template card padding), so a grid drops a column instead of squeezing text under 300px at any width (901-1023 and
   1024 included). --col-max caps the column count (the /menu list and FAQ are 2 at most). A short last row is centred
   by script.js (balanceGrids: CSS translate only, layout unchanged), a lone card is capped and centred, and an empty
   grid takes no space. Stores: never set grid-template-columns on these grids; change --col-max in a STORE region. */
:root .menu-items, :root .faq-list, :root .dish-ingredients { --col-max: 2; }
:root .faq-list, :root .dish-ingredients { --col-pad: calc(3.2rem + 2px + 2rem); }   /* cards holding a bulleted list: + the list indent */
/* a section heading keeps >= 300px: text or buttons beside the h2 in .sec-head wrap under it (PT rule, kh75hh77 gap 2) */
:root .sec-head { flex-wrap: wrap; }
:root .sec-head > h2, :root .sec-head > :has(> h2) { flex: 1 1 min(100%, 300px); min-width: min(100%, 300px); }
@media (min-width: 769px) {
  :root :is(.bd-list, .food-picks-grid, .delivery-areas-grid, .how-to-order-steps, .packages-grid, .values-grid,
            .quote-grid, .related-dishes-grid, .reviews-grid, .menu-items, .faq-list, .dish-ingredients) {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, max(calc(300px + var(--col-pad, 3.2rem + 2px)),
      calc((100% - (var(--col-max, 4) - 1) * 1.4rem) / var(--col-max, 4)))), 1fr));
    column-gap: 1rem;
    max-width: none;
  }
  :root :is(.bd-list, .food-picks-grid, .delivery-areas-grid, .how-to-order-steps, .packages-grid, .values-grid,
            .quote-grid, .related-dishes-grid, .reviews-grid):has(> :only-child) {
    grid-template-columns: minmax(0, calc(300px + 3.2rem + 2px + 4rem));
    justify-content: center;
  }
}
:root :is(.bd-list, .food-picks-grid, .delivery-areas-grid, .how-to-order-steps, .packages-grid, .values-grid,
          .quote-grid, .related-dishes-grid, .reviews-grid, .gallery-wall, .snap-grid, .home-gallery__grid):not(:has(> *)) { display: none; }
/* Round 4 item 1, TF only: the home plates scroller pages 2 cards up to 1151px (3 cards there left 261-299px of text
   inside the 0.9rem card padding) and 3 from 1152; the about chapters stack the number above the text on phones
   (130px number column left 170px of text at 360). */
@media (min-width: 769px) and (max-width: 1151.98px) { :root .plates-track { gap: 1.4rem; grid-auto-columns: calc((100% - 1.4rem) / 2); } }
@media (max-width: 600px) { :root .chapter { grid-template-columns: 1fr; gap: 0.5rem; } :root .chapter .ch-no { text-align: left; } }

/* Round 4 item 7 (kh71xwpa): the browser never fakes a weight or an italic; TF ships variable Gabarito/Figtree (300-800, Figtree italic) */
html { font-synthesis: none; }
/* Round 4 item 3 (kh71xwpa): every srcset image has a phone source, <picture class="m600"><source media="(max-width: 600px)"
   srcset="<name>-600.webp"><img ...></picture>, so 390@2x/390@3x/360@3x always load the 600w file (<= 150 KB) whatever
   `sizes` says (our-food banner/4: 276 KB on phones before). display: contents = layout unchanged. Same markup as PT. */
picture.m600 { display: contents; }
picture.m600 > source { display: none !important; }
/* Round 4 item 2 (kh71xwpa): the home store bar fits its cell count. A store with no verified Google rating deletes the rating
   cell (rule 28), and the 4-track bar then had an empty 4th track at 1081px+; 3 cells = 3 columns, and from 561-1080 an odd
   last cell spans the row (PT rule). */
@media (min-width: 1081px) { :root .store-bar:not(:has(.sb-cell:nth-child(4))) { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 561px) and (max-width: 1080px) { :root .store-bar > .sb-cell:nth-child(3):last-child { grid-column: 1 / -1; } }

/* Round 4 acceptance (kh71xwpa, 2026-11-23): the header is OPAQUE in every state (TF port of PT kh73h85c item 4).
   It was rgba(255,255,255,.88) with a blur, so page content showed through; preready's header check fails any alpha < 1.
   A store with a dark header sets --header-bg to an OPAQUE colour. */
.site-header,
.site-header.scrolled,
body:has(.hero-full) .site-header:not(.scrolled) { background: var(--header-bg, #fff); backdrop-filter: none; -webkit-backdrop-filter: none; }

/* Round 4 acceptance (kh71xwpa): text >= 300px on 360-400px phones. Card-type boxes inside the 320px wrap carried
   ~22-26px side padding (+ list indent), leaving 258-276px of text (value cards, FAQ answers, menu cards, dish hero,
   hours). At <=400px they keep 10px side padding and FAQ lists drop their indent. Wider screens unchanged. */
@media (max-width: 400px) {
  main :is(.value-card, .qa-body, .faq-item, .menu-item, .hours-table, .info-card, .loc-card, .step-card) { padding-inline: 10px; }
  main .order-step { padding-inline: 10px; }
  /* text sitting straight in a section container (topic/place copy); a section whose text is inside a padded card keeps 0 */
  main .section__container:not(.dish-hero):not(:has(.faq-item, .order-step, .value-card, .qa-body, .dish-hero-container, .plate)) { padding-inline: 10px; }
  main :is(.dish-hero-container, .dish-hero .dish-hero-container) { padding-inline: 10px; }
  main .plate { padding-inline: 6px; }
  main .plate p { padding-inline: 0; }
  .menu-band .wrap { width: calc(100% - 20px); }   /* band is an inset card (20px) and its wrap keeps another 2x20px: 280 -> 300 */
  main :is(.qa-body, .faq-answer, .faq-item) :is(ul, ol) { padding-left: 0; list-style-position: inside; }
}

/* Round 4 acceptance: header logo capped like PT (style.css 4269) - a fixed 250px logo needed a 500px file on phones
   (the template logo is 285px: 1.75-1.84x upscale at 360/390@2). */
.brand img { max-height: 3.25rem; width: auto; height: auto; }

/* Round 4 (kh71xwpa, Atlas 22:3x): body copy lines <= 75 characters on every TF page, with or without <main> (13 live TF stores and
   custom pages may lack it, so this is not scoped to main). Centred blocks keep margin-inline:auto (style.css). */
:root :is(.section__description, .dish-description, .lede, .cs-text, .cta-content p, section p, .qa-body p) { max-width: 48ch; }   /* Figtree: 62ch measured 85 characters, 52ch up to 79; 48ch keeps every line <= 75 */
