/* === P3 sitewide safety nets ===================================== */
html { -webkit-tap-highlight-color: rgba(154, 72, 39, 0.15); }
/* IMPORTANT: use `overflow-x: clip` (not `hidden`) — `hidden` on
   html/body breaks `position: sticky` on the mobile header. `clip`
   does the same horizontal-overflow clamp without that side effect.
   Supported in Chrome 90+, Safari 16+, Firefox 102+. */
html, body { overflow-x: clip; }
h1, h2, h3, h4, h5, h6, .faq-question, .breadcrumb { overflow-wrap: anywhere; }

/* === P3 horizontal-overflow guards on class / venue page content ===
   Stop oversized images, MEC widgets, photo strips, iframes, and
   tables from pushing the layout wider than the viewport on phones. */
@media (max-width: 768px) {
  img, video, svg, iframe, embed, object { max-width: 100%; height: auto; }
  table { display: block; overflow-x: auto; max-width: 100%; }
  pre, code { max-width: 100%; overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
  /* Common offenders on class pages */
  .venue-card, .ticket-card, .ffw-photo-strip, .ffw-photo-strip > *,
  .mec-wrap, .mec-calendar, .pick-date-grid,
  .editorial-page-fragment .wp-block-group,
  .editorial-page-fragment .wp-block-columns {
    max-width: 100% !important;
    box-sizing: border-box;
  }
  /* Photo strips: let them scroll horizontally rather than overflow body */
  .ffw-photo-strip { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* === Hamburger toggle button (replaces "Menu" text) =============== */
.site-header .nav-toggle {
  background: transparent;
  border: 0;
  color: var(--paper, #f5efe4);
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
  display: none;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.site-header .nav-toggle .nav-toggle-icon { display: block; }
.site-header .nav-toggle .nav-toggle-label { display: none; }
.site-header .nav-toggle:focus-visible {
  outline: 2px solid var(--paper, #f5efe4);
  outline-offset: 2px;
  border-radius: 4px;
}

/* === Accessibility (wheelchair) icon — mobile only, left of hamburger === */
.site-header .nav-accessibility-mobile {
  display: none;
  color: var(--paper, #f5efe4);
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 8px;
  text-decoration: none;
}
.site-header .nav-accessibility-mobile:hover,
.site-header .nav-accessibility-mobile:focus-visible {
  color: var(--terracotta, #b85c38);
  text-decoration: none;
  outline: none;
}
.site-header .nav-accessibility-mobile:focus-visible {
  outline: 2px solid var(--paper, #f5efe4);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (max-width: 980px) {
  .site-header .nav-toggle { display: inline-flex; }
  .site-header .nav-accessibility-mobile { display: inline-flex; }
  /* Hide the desktop nav-actions strip (Gift Vouchers, Book a class,
     cart, accessibility) — these have moved into the drawer. */
  .site-header .nav-actions { display: none !important; }
  /* Right-align both icons together. */
  .site-header .header-inner nav[aria-label="Main navigation"] {
    display: flex;
    align-items: center;
    gap: 4px;
  }
}

/* === Sticky header on mobile ===================================== */
@media (max-width: 980px) {
  .wrap > .site-header {
    position: sticky;
    top: 0;
    z-index: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  }
  /* Hide the announcement rotator above the sticky header at small
     widths so the header itself can pin to the very top of the
     viewport without the rotator taking the slot. */
  .wrap > .announcement-rotator { display: none; }
}

/* === P0.1 mobile nav drawer ====================================== */
.mobile-nav {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(86vw, 380px);
  transform: translateX(100%);
  background: var(--olive-deep, #3d4a2a);
  color: var(--paper, #f5efe4);
  padding: 64px 24px 48px;
  z-index: 10000;
  transition: transform 250ms ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  visibility: hidden;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 16px rgba(0,0,0,0.18);
}
.mobile-nav.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}
body.mobile-nav-open { overflow: hidden; }
.mobile-nav ul { list-style: none; padding: 0; margin: 0 0 24px; }
.mobile-nav li + li { margin-top: 8px; }
.mobile-nav a {
  display: block;
  padding: 12px 0;
  font-family: 'Fraunces', serif;
  font-size: 22px;
  color: var(--paper, #f5efe4);
  text-decoration: none;
  min-height: 44px;
  border-bottom: 1px solid rgba(245, 239, 228, 0.12);
}
.mobile-nav a:hover,
.mobile-nav a:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  outline: none;
}
.mobile-nav .mobile-nav-ctas {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 28px;
  padding: 0 0 24px;
  border-bottom: 1px solid rgba(245, 239, 228, 0.18);
}
.mobile-nav .btn-primary,
.mobile-nav .btn-secondary {
  display: block;
  width: 100%;
  margin: 0;
  text-align: center;
  text-decoration: none;
}
.mobile-nav .btn-primary,
.mobile-nav a.btn-primary {
  background: var(--terracotta-text, #9a4827) !important;
  color: var(--paper, #f5efe4) !important;
  border: 1px solid var(--terracotta-text, #9a4827) !important;
}
.mobile-nav .btn-secondary,
.mobile-nav a.btn-secondary {
  background: transparent !important;
  color: var(--paper, #f5efe4) !important;
  border: 1px solid var(--paper, #f5efe4) !important;
  font-weight: 500;
}
.mobile-nav .btn-primary:hover,
.mobile-nav .btn-secondary:hover,
.mobile-nav a.btn-primary:hover,
.mobile-nav a.btn-secondary:hover {
  background: var(--paper, #f5efe4) !important;
  color: var(--olive-deep, #3d4a2a) !important;
  border-color: var(--paper, #f5efe4) !important;
}
.mobile-nav-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: 0;
  color: var(--paper, #f5efe4);
  font-size: 32px;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  padding: 0;
}
.mobile-nav-close:focus-visible {
  outline: 2px solid var(--paper, #f5efe4);
  outline-offset: 2px;
  border-radius: 4px;
}
@media (min-width: 981px) { .mobile-nav { display: none; } }

/* Cascading submenus. The drawer renders the same WordPress menu as the
   desktop nav, so parent items arrive with their .sub-menu in the markup.
   Each parent gets its own toggle button next to the label. */
.mobile-nav .mobile-nav-list,
.mobile-nav .mobile-nav-list .sub-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}
.mobile-nav .mobile-nav-list { margin: 0 0 24px; }
.mobile-nav .mobile-nav-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  border-bottom: 1px solid rgba(245, 239, 228, 0.12);
}
.mobile-nav .mobile-nav-row > a {
  flex: 1 1 auto;
  border-bottom: 0;
}
.mobile-nav-sub-toggle {
  flex: 0 0 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--paper, #f5efe4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mobile-nav-sub-toggle svg { transition: transform 200ms ease; }
.mobile-nav-sub-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.mobile-nav-sub-toggle:focus-visible {
  outline: 2px solid var(--paper, #f5efe4);
  outline-offset: -2px;
  border-radius: 4px;
}
.mobile-nav .sub-menu {
  display: none;
  margin: 0 0 8px;
  padding: 4px 0 12px 14px;
  border-left: 2px solid rgba(245, 239, 228, 0.25);
}
.mobile-nav li.is-expanded > .sub-menu { display: block; }
.mobile-nav .sub-menu li + li { margin-top: 0; }
.mobile-nav .sub-menu a {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  padding: 10px 0;
  border-bottom: 0;
  opacity: 0.92;
}
@media (prefers-reduced-motion: reduce) {
  .mobile-nav-sub-toggle svg { transition: none; }
}

/* The drawer is rendered inside .site-header, so the desktop dropdown rule
   (paper background, ink text) would otherwise repaint these submenus as
   cream blocks sitting inside the olive drawer. Keep them on the drawer
   palette. The #mobile-nav id is needed to outrank that !important rule. */
html body #mobile-nav .sub-menu,
html body #mobile-nav .sub-menu li,
html body #mobile-nav .sub-menu a {
  background: transparent !important;
  color: var(--paper, #f5efe4) !important;
}
html body #mobile-nav .sub-menu a:hover,
html body #mobile-nav .sub-menu a:focus {
  background: transparent !important;
  color: var(--paper, #f5efe4) !important;
}

/* === P0.2 sticky "Book a class" bar (mobile, long pages only) === */
.sticky-book-mobile {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--terracotta-text, #9a4827);
  color: var(--paper, #f5efe4);
  padding: 14px 20px;
  display: none;
  z-index: 900;
  text-align: center;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
}
.sticky-book-mobile:hover,
.sticky-book-mobile:focus-visible {
  background: var(--olive-deep, #3d4a2a);
  color: var(--paper, #f5efe4);
  text-decoration: none;
  outline: none;
}
@media (max-width: 980px) {
  body.has-sticky-book .sticky-book-mobile { display: flex; }
  body.has-sticky-book { padding-bottom: 72px; }
}

/* === P1.1 hero H1 floor ========================================== */
@media (max-width: 560px) {
  .hero h1,
  .page-hero h1,
  .venue-hero h1,
  .class-hero h1 {
    font-size: clamp(28px, 8vw, 84px) !important;
    line-height: 1.1;
  }
}

/* === P1.2 hero CTA stack ========================================= */
@media (max-width: 560px) {
  .hero-actions,
  .cta-strip .hero-actions {
    flex-direction: column !important;
    gap: 12px !important;
    align-items: stretch !important;
  }
  .hero-actions .btn-primary,
  .hero-actions .btn-secondary {
    width: 100% !important;
    text-align: center;
  }
}

/* === P1.3 button readability ===================================== */
@media (max-width: 560px) {
  .btn-primary,
  .btn-secondary,
  .nav-cta,
  .nav-cta-secondary,
  body.editorial-page-fragment .wp-block-button__link {
    font-size: 13px !important;
    letter-spacing: 0.16em !important;
  }
}

/* === P1.4 announcement rotator slim down on phones =============== */
@media (max-width: 560px) {
  .announcement-rotator .announcement-slide a { display: none; }
  .announcement-rotator .announcement-slide,
  .announcement-rotator p {
    font-size: 12px !important;
    line-height: 1.4;
    padding: 8px 12px;
  }
}

/* === P1.5 breadcrumb single-parent on phones (Option A) =========== */
@media (max-width: 560px) {
  .breadcrumb ol > li:not(:nth-last-child(1)):not(:nth-last-child(2)) { display: none; }
  .breadcrumb ol > li:nth-last-child(2)::before {
    content: '\2190';
    margin-right: 6px;
    color: var(--terracotta-text, #9a4827);
    font-weight: 600;
  }
}

/* === P1.6 mood grid → 2 columns on phones ========================== */
@media (max-width: 560px) {
  .mood-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  .mood-card-image { aspect-ratio: 1 / 1 !important; }
  .mood-card h3 { font-size: 15px !important; }
  .mood-card p { display: none; }
}

/* === P1.7 cookbook grid → 2 columns on phones ====================== */
@media (max-width: 560px) {
  .cookbooks-grid,
  .feature-grid-3 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }
}

/* === P1.8 region grid → 2 columns on phones ========================= */
@media (max-width: 560px) {
  section[aria-labelledby="regions-heading"] .feature-grid,
  section[aria-labelledby="wts-regions-h"] .feature-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
}

/* === Venue sidebar — don't stick on mobile ========================= */
@media (max-width: 980px) {
  .venue-sidebar { position: static !important; top: auto !important; }
}

/* === FAQ jump-nav horizontal scroll ================================ */
@media (max-width: 768px) {
  .faq-jump-nav {
    display: flex !important;
    overflow-x: auto;
    gap: 8px;
    padding: 12px 16px;
    -webkit-overflow-scrolling: touch;
  }
  .faq-jump-nav a {
    white-space: nowrap;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* === Inclusive testimonials → 1 col on phones ====================== */
@media (max-width: 560px) {
  .testimonial-grid { grid-template-columns: 1fr !important; }
}

/* === Region pages: cap hero image height on mobile ================= */
@media (max-width: 768px) {
  .region-hero .venue-hero-image img,
  .region-hero img.ffw-venue-hero-img {
    max-height: 50vh !important;
    object-fit: cover;
  }
}

/* === MEC calendar — min 44px tap target on day cells =============== */
@media (max-width: 560px) {
  .mec-calendar .mec-event-article a,
  .mec-calendar .mec-events-day .mec-event-title a {
    min-height: 44px;
    padding: 8px;
    display: inline-block;
  }
}

/* === Embeds: YouTube/iframe responsive 16:9 ======================== */
@media (max-width: 768px) {
  iframe[src*="youtube"],
  iframe[src*="youtu.be"] {
    aspect-ratio: 16 / 9;
    width: 100% !important;
    height: auto !important;
  }
}

/* === Form inputs — 44px min + 16px font (no iOS zoom) ============= */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="search"],
  select,
  textarea {
    min-height: 44px;
    font-size: 16px !important;
  }
}

/* === Reduce-motion guard for any animated hover effects =========== */
@media (prefers-reduced-motion: reduce) {
  .mobile-nav { transition: none !important; }
  .feature-card:hover,
  .ffw-region-tile:hover,
  .region-pick-tile:hover { transform: none !important; }
}

/* === MEC desktop / mobile shortcode toggle ========================= */
/* The home + cooking-classes hub pages render TWO MEC shortcodes wrapped
   in .ffw-mec-desktop and .ffw-mec-mobile. Show the right one per
   viewport so each gets the layout that suits its width. */
.ffw-mec-mobile { display: none; }
@media (max-width: 768px) {
  .ffw-mec-desktop { display: none !important; }
  .ffw-mec-mobile { display: block !important; }
}
/* Mobile MEC list-skin polish — tighter padding, full-width cards. */
@media (max-width: 768px) {
  .ffw-mec-mobile .mec-event-list-classic .mec-event-article,
  .ffw-mec-mobile .mec-wrap .mec-event-article {
    padding: 16px !important;
    margin-bottom: 12px !important;
  }
  .ffw-mec-mobile .mec-event-image img {
    aspect-ratio: 16/9;
    object-fit: cover;
    width: 100% !important;
    height: auto !important;
  }
  .ffw-mec-mobile .mec-event-title { font-size: 18px !important; line-height: 1.25 !important; }
  .ffw-mec-mobile .mec-event-meta-wrap { font-size: 13px !important; }
}

/* === Awards/partners/reviews carousels: horizontal scroll safety = */
@media (max-width: 560px) {
  .awards-carousel,
  .partners-carousel,
  .trustindex-widget,
  .trust-grid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* === Cooking-classes hub: "Browse by class" filter bar ============
   Jackie's request 2026-05-30: do NOT make this bar sticky, and make
   it look nicer on phones (label on its own row, chips wrap as
   pill-shaped tap targets with breathing room). */
.filter-bar { position: static !important; top: auto !important; }
@media (max-width: 768px) {
  .filter-bar {
    padding: 16px 20px !important;
    background: var(--paper-warm, #ede4d2);
  }
  .filter-bar .filter-bar-inner > div {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }
  .filter-label {
    display: block;
    width: 100%;
    font-size: 11px !important;
    letter-spacing: 0.22em !important;
    color: var(--olive-deep, #3d4a2a);
    margin-bottom: 4px;
  }
  .filter-chips {
    width: 100%;
    gap: 8px !important;
  }
  .filter-chip {
    border-radius: 999px !important;
    padding: 10px 16px !important;
    font-size: 14px !important;
    min-height: 40px;
    line-height: 1.1;
  }
}

/* === Class hub cards — heading floor + breathing room on phones ===
   Jackie's screenshot 2026-05-30: "Mozzarella & Cheese Making" /
   "Hibachi Steak Masterclass" / "Spice & Flavour Masterclass" titles
   were overflowing their 2-up card boxes at narrow widths. Reduce the
   font, force long words to wrap, and tighten internal padding so
   long titles fit without truncation. */
@media (max-width: 768px) {
  .class-card { padding: 16px !important; }
  .class-card-title {
    font-size: 16px !important;
    line-height: 1.2 !important;
    margin-bottom: 8px !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .class-card-desc {
    font-size: 13px !important;
    line-height: 1.45 !important;
    margin-bottom: 8px !important;
  }
  .class-card-cta { font-size: 11px !important; letter-spacing: 0.18em !important; }
  .class-card-number { font-size: 12px !important; margin-bottom: 4px !important; }
}
@media (max-width: 480px) {
  .class-card-title { font-size: 15px !important; }
}

/* === Cookbook page — show the WHOLE cover on every device ==========
   Jackie's screenshot 2026-05-30: mobile was cropping the top/bottom of
   each Amazon cover because the card used aspect-ratio 1/1 with
   object-fit: cover. The Amazon `.LZZZZZZZ.jpg` variant for these KDP
   titles is the PORTRAIT cover at 334x500 (2:3). Switch the card to
   2:3 + object-fit contain so the whole cover renders inside a paper-
   coloured letterbox. Applies sitewide because the crop was visible
   at every width. */
.cookbook-card-image {
  aspect-ratio: 2 / 3 !important;
  background: var(--paper-warm, #ede4d2) !important;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cookbook-card-image img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block;
}
.cookbook-card-image .image-placeholder {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
}

/* === Shop product cards — same "show whole image" treatment ========
   Jackie's screenshot 2026-05-30: WC shop loop was cropping the wide
   FFW-branded cookbook covers because the product card image used
   object-fit: cover at a square ratio. Switch the WC product loop
   image to landscape 4:3 + contain, on paper-warm letterbox bg, so
   the wide marketing covers show fully on every device. */
.woocommerce ul.products li.product a img,
.woocommerce-page ul.products li.product a img,
.wc-block-grid__product-image img,
ul.products li.product .woocommerce-loop-product__link img {
  aspect-ratio: 4 / 3 !important;
  width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
  background: var(--paper-warm, #ede4d2) !important;
  display: block;
}
/* Tighten the white panel that holds the title + price so it doesn't
   look like a giant empty card around a small image. */
@media (max-width: 768px) {
  .woocommerce ul.products li.product .woocommerce-loop-product__title,
  .woocommerce ul.products li.product .price {
    font-size: 14px !important;
  }
}

/* === Sitewide mobile heading floor — fewer overflow surprises =====
   Apply a small max-size to long card / tile / section titles below
   480px so any future similar bug is caught before it ships. */
@media (max-width: 480px) {
  .feature-card h3,
  .mood-card h3,
  .region-pick-tile h3,
  .ffw-region-tile h3 {
    font-size: 16px !important;
    line-height: 1.25 !important;
    overflow-wrap: anywhere;
  }
  /* Hero H1 on phones — protect against giants */
  h1 { overflow-wrap: anywhere; }
}

/* === Mobile content gutter — fix flush-left text on phones ========
   Some pages (e.g. cheese, sausage class pages) render their entry
   content with zero horizontal padding on phones, so headings and
   paragraphs sit flush against the viewport edge. Add a safe gutter
   to the standard content wrappers without disturbing alignfull /
   alignwide blocks (which are intentionally edge-to-edge). */
@media (max-width: 768px) {
  main#main,
  main.site-main,
  .site-main > article > .entry-content,
  body.editorial-page-fragment > main,
  body.editorial-page-fragment .entry-content,
  body.page .entry-content {
    padding-left: max(20px, env(safe-area-inset-left)) !important;
    padding-right: max(20px, env(safe-area-inset-right)) !important;
    box-sizing: border-box;
  }
  /* Direct children that opt into full-bleed should still ignore the
     gutter and reach edge to edge. */
  .entry-content > .alignfull,
  .entry-content > .wp-block-cover.alignfull,
  main .alignfull {
    margin-left: calc( -1 * max(20px, env(safe-area-inset-left)) ) !important;
    margin-right: calc( -1 * max(20px, env(safe-area-inset-right)) ) !important;
    width: calc( 100% + 2 * max(20px, env(safe-area-inset-left)) ) !important;
    max-width: none !important;
  }
  /* Button blocks: keep clear of the new gutter and don't overflow. */
  .entry-content .wp-block-buttons,
  .entry-content .wp-block-button { max-width: 100%; }
}