/* ══════════════════════════════════════════════════════════════════════════
   tft-panel — the shared homepage panel BOX.

   ⚠️ GEOMETRY ONLY. There is not one colour in this file, and there must
   never be one: the gate counts lines carrying a hash character and fails on
   a single hit. Colour, imagery, typography and copy belong to the module.
   Foodie Friday is dark and photographic, SpeedQuizzing is cyan and magenta,
   the What's On banner is teal and cream, and all three should go on being
   so. Shared box, separate brands — same size and shape, nothing else.

   Four classes, and that is the whole vocabulary:

     .tft-panel        the box: radius, clipping, full column height
     .tft-panel-row    two or three panels together outside Elementor
     .tft-panel-body   the padded inside, and the part of the panel that
                       absorbs the height two panels do not share
     .tft-panel-cta    the button: shape, padding, hit area — never colour

   ⚠️ NEVER `!important`. The customer theme is hello-elementor and it does
   not fight these class names. Escalating pre-emptively is a staff-portal
   habit that does not belong on this site; check the rendered result.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── The box ───────────────────────────────────────────────────────────────
   A flex COLUMN at full column height. Both halves of that matter and they
   are the whole point of the file: a panel that only sizes to its own
   content can never line up with the panel beside it, and a body that cannot
   grow has nowhere to push a call to action down into.

   ⚠️ It must not assume a `div`. SpeedQuizzing's outer element is an `<a>` —
   the whole panel is one link — so nothing here may depend on the tag. */
.tft-panel {
  /* The padded inside, as ONE number the module can read rather than restate.
     A panel that wants a full-bleed strip flush with its own copy — the
     What's On banner's does — asks for this instead of typing 28px again and
     drifting the day it changes. */
  --tft-panel-pad-x: 28px;
  --tft-panel-pad-y: 24px;
  /* And the gap above a call to action — see the rule further down for why it
     is a fixed number rather than `auto`. */
  --tft-panel-cta-gap: 1.1rem;
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  border-radius: 12px;
  overflow: hidden;
}

/* ── Two or three panels together, outside Elementor ───────────────────────
   Elementor gives its own columns equal height; this is for a module that
   lays out its own row, as the banner does when two or three dates are
   promoted at once. */
.tft-panel-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 20px;
  height: 100%;
}
.tft-panel-row > * {
  flex: 1 1 320px;
  min-width: 0;
}

/* ── The padded inside ─────────────────────────────────────────────────────
   `position: relative` so it sits above a picture or a scrim the module has
   absolutely positioned behind it; `flex: 1 1 auto` so it is the part of the
   panel that absorbs the difference in height between two panels, which is
   what puts their two buttons on one baseline. Direction is deliberately NOT
   set: Foodie Friday's body is a row (mark, then copy) and the other two are
   columns. That is layout, and layout is the module's. */
.tft-panel-body {
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--tft-panel-pad-y) var(--tft-panel-pad-x);
}

/* ── The gap above a call to action ────────────────────────────────────────
   ⚠️ NOT `margin-top: auto`. The original brief asked the body to "push the
   CTA to the bottom", and that was wrong: with sparse content it aligns
   nothing and simply opens a hole — a visible void under the banner's title
   and between Foodie Friday's date box and its button (Leigh, 18 Sep). The
   contents sit together and the slack falls at the bottom of the panel as
   padding, which reads as breathing room rather than as a gap.

   The cost is that two panels' CTAs no longer share a baseline. That was a
   verification criterion in the original brief and should not have been: a
   void is far more visible than two buttons at different heights.

   One number (`--tft-panel-cta-gap`, declared on the box above), so a module
   whose button is nested deeper — Foodie Friday's is inside its copy column —
   sets the same gap by reading the variable instead of picking its own. */
.tft-panel-body > .tft-panel-cta {
  margin-top: var(--tft-panel-cta-gap);
}

/* ── The button ────────────────────────────────────────────────────────────
   ⚠️ 44px MINIMUM in both directions, on everything meant to be tapped. That
   is the reason this is a shared rule at all: three modules each picked
   their own padding and two of them landed under a thumb's width. Shape and
   hit area here; colour, weight and letterforms in the module. */
.tft-panel-cta {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 22px;
  border-radius: 10px;
  text-align: center;
}

/* ── Elementor: letting the column's height actually reach the panel ───────
   ⚠️ MEASURED, NOT ASSUMED. On the live homepage the two columns of the
   panel row are already exactly equal (388px), and so is
   `.elementor-widget-wrap` inside each. The height stops there:
   `.elementor-widget-wrap` is a flex container with `align-content:
   flex-start`, so its single line of widgets keeps its natural height, the
   widget is 289px in one column and 368px in the other, and `height: 100%`
   on our panel then resolves against a parent of height `auto` and is
   dropped. The panel is not fighting the theme — it is never being told how
   tall the column is.

   So the three boxes between the column and the panel pass the height down.
   Scoped with `:has()` to a wrap whose ONLY widget contains a panel, so a
   column holding a heading as well as a panel is untouched. A browser
   without `:has()` gets today's behaviour — panels that size to their own
   content — rather than anything broken. */
.elementor-widget-wrap:has(> .elementor-widget:only-child .tft-panel) {
  align-content: stretch;
}
.elementor-widget:has(.tft-panel),
.elementor-widget:has(.tft-panel) > .elementor-widget-container,
.elementor-widget:has(.tft-panel) > .elementor-widget-container > .elementor-shortcode {
  height: 100%;
}

/* ── One mobile rule, written once ─────────────────────────────────────────
   Below 780px panels stack full width, in DOM order, with the same gap the
   row uses at any other width. Three modules previously had three different
   numbers here (640px, 760px and 900px), which is exactly how two panels
   end up stacking at different widths on the same page. */
@media (max-width: 779px) {
  .tft-panel-row > * {
    flex-basis: 100%;
  }
  .tft-panel {
    --tft-panel-pad-x: 20px;
    --tft-panel-pad-y: 20px;
  }
}
