/*
 * Reworked 2026-08-15 (Moiz: real screenshots of the styled-JSON version
 * showed a duplicated page heading, and a price rendering as literal
 * "&pound;19.99 &ndash; ..." text — "why not reuse the existing cards" was
 * the right question). This file no longer styles a card at all — the
 * result grid renders WooCommerce's own product markup, moved into view by
 * gift-finder.js from a hidden pool
 * (see class-cc-gift-finder.php::pool()), styled by the same
 * `.woocommerce ul.products li.product` rules already live everywhere else
 * on the site. What remains here is the panel form, the mobile sheet, and
 * the results page's own scaffolding (header, note/empty states, grid
 * layout) — none of it duplicates a card.
 */

.cc-gf__form{display:grid;gap:16px;width:100%}
.cc-gf__field{display:grid;gap:6px}
.cc-gf__field label{font:600 .78rem/1.2 var(--cc-font-body,inherit);color:var(--cc-text,CanvasText);letter-spacing:.02em}
/* Pill select, matching the header's own Gift Finder trigger — this panel
   IS that trigger's contents, so its controls should read as the same
   control family, not a generic form. */
.cc-gf__field select{width:100%;min-height:46px;padding:8px 34px 8px 16px;border:1px solid var(--cc-border,ButtonBorder);border-radius:999px;background:var(--cc-surface,Canvas);color:var(--cc-text,CanvasText);font:inherit;cursor:pointer;transition:border-color .2s ease,box-shadow .2s ease}
.cc-gf__field select:hover{border-color:var(--cc-accent,Highlight)}
.cc-gf__field select:focus-visible{outline:2px solid var(--cc-accent,Highlight);outline-offset:2px}

.cc-gf__submit{display:inline-flex;align-items:center;justify-content:center;min-height:46px;padding:10px 20px;border:1px solid var(--cc-accent,ButtonBorder);border-radius:999px;background:var(--cc-accent,ButtonFace);color:var(--cc-on-accent,ButtonText);font:700 .92rem/1.2 var(--cc-font-body,inherit);text-decoration:none;cursor:pointer;transition:transform .18s ease,box-shadow .18s ease,filter .18s ease}
.cc-gf__submit:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 10px 22px -10px color-mix(in srgb,var(--cc-accent,Highlight) 55%,transparent)}
.cc-gf__submit:disabled{opacity:.55;cursor:not-allowed;transform:none;box-shadow:none}

.cc-gf-sheet{position:fixed;inset:0;z-index:100000;visibility:hidden;pointer-events:none}
.cc-gf-sheet.is-open{visibility:visible;pointer-events:auto}
.cc-gf-sheet__backdrop{position:absolute;inset:0;background:var(--cc-overlay,rgba(0,0,0,.55));opacity:0;transition:opacity .22s ease}
.cc-gf-sheet.is-open .cc-gf-sheet__backdrop{opacity:1}
.cc-gf-sheet__panel{position:absolute;right:0;bottom:0;left:0;max-height:min(88vh,640px);overflow:auto;padding:24px max(20px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left));border-radius:20px 20px 0 0;background:var(--cc-surface,Canvas);color:var(--cc-text,CanvasText);box-shadow:0 -20px 50px -20px rgba(0,0,0,.35);transform:translateY(100%);transition:transform .22s ease}
.cc-gf-sheet.is-open .cc-gf-sheet__panel{transform:translateY(0)}
.cc-gf-sheet__title{margin:0 0 16px;font-family:var(--cc-font-heading,inherit)}

/* The WordPress page title (Astra's `.entry-title`, "Find a Gift") renders
   ABOVE this section as plain unstyled theme output — left-aligned, grey,
   no relation to the brand — because removing it in favour of our own <h1>
   would recreate the duplicate-heading bug this file's header already
   describes fixing. Scoped to the body class CC_Gift_Finder::body_class()
   adds only when this shortcode is actually present, so it cannot leak onto
   any other page that happens to reuse Astra's `.entry-title` class. Live-
   verified against the real page, 2026-08-15 (Moiz, screenshot + browser
   inspection): unstyled and left-aligned was the actual complaint, not a
   guess from a static mockup. */
/* Bumped to real H1 scale (Moiz, 2026-08-15: "use the same styling as
   categories or that wedding page") — clamp(24px,3vw,32px) is the same
   second-tier heading scale used for the collection hero
   .products-title, since this page's title sits at that same "section
   intro" weight, not a full hero H1.
   Colour changed to var(--cc-accent) (Moiz, 2026-08-16: "keep Gift Finder
   in golden as the main headline instead of Find a Gift"). The small gold
   eyebrow that used to sit above this title is gone as of the same request
   — once the title itself is gold and (once the actual WP page title is
   renamed, a one-time content edit outside this repo) reads "Gift Finder",
   a small "GIFT FINDER" label above it would repeat the same word twice.
   gift_finder.title_eyebrow / wp_add_inline_style() in enqueue() still
   exist and still work for any brand that sets a DIFFERENT eyebrow word
   than its title — the current config value was cleared back to empty in
   this same change. */
body.cc-gift-finder-page .entry-title{text-align:center;font-family:var(--cc-font-heading,inherit);color:var(--cc-accent,LinkText);font-size:clamp(24px,3vw,32px);font-weight:600;letter-spacing:-.01em}

.cc-gf-results{width:min(1180px,calc(100% - 32px));margin:48px auto 80px;color:var(--cc-text,CanvasText)}

/*
 * Intro band (Moiz, 2026-08-16, annotated screenshot): the title alone left
 * a near-empty row above Top Match. Two columns: a tagline on the left,
 * and on the right whatever the visitor actually searched for — filled by
 * gift-finder.js's renderFilters(), never by PHP (see the PHP comment in
 * results_shortcode() for why: this page is LiteSpeed full-page cached,
 * so query-string-dependent content has to be client-rendered or it
 * freezes at whichever visitor's search got cached first).
 *
 * Single column below 781px — the same breakpoint the results grid and
 * the horizontal Top Match card already step at, so the page reads as one
 * consistent breakpoint rather than three uncoordinated ones.
 */
.cc-gf-results__intro{display:grid;grid-template-columns:1fr;gap:20px;margin-bottom:40px;padding-bottom:32px;border-bottom:1px solid color-mix(in srgb,var(--cc-text,CanvasText) 10%,transparent)}
@media(min-width:781px){
  .cc-gf-results__intro{grid-template-columns:1fr 1fr;align-items:center;gap:40px}
}
.cc-gf-results__tagline{margin:0;font-size:15px;line-height:1.6;color:color-mix(in srgb,var(--cc-text,CanvasText) 68%,transparent);max-width:44ch}
@media(min-width:781px){
  .cc-gf-results__filters{text-align:right}
  .cc-gf-results__filters .cc-gf-results__filters-empty{margin-left:auto}
  .cc-gf-results__filters .cc-gf-results__filter-chips{justify-content:flex-end}
}
/*
 * Title merged into the row (Moiz, 2026-08-16: the title floating centered
 * above the tagline/filters row read as disconnected — wanted in line with
 * them instead). gift-finder.js's inlineTitle() physically moves the real
 * `.entry-title` node into `.cc-gf-results__intro` as its first child, then
 * marks `<body>` with this class — so this 3-column layout only ever
 * applies once the move has actually happened. Without the class (JS
 * failure, or before it has run) `.cc-gf-results__intro` falls back to the
 * plain 2-column rules above, which is the already-shipped, already-
 * verified layout — not a broken state.
 *
 * `order` re-sequences visually as tagline / title / filters. DOM order is
 * left as title / tagline / filters (inlineTitle() inserts the title as
 * the FIRST child), so a screen reader or keyboard user meets the page's
 * one <h1> before its supporting copy, matching normal reading order —
 * `order` changes paint position only, never DOM/focus order.
 *
 * header.entry-header is hidden once emptied by the move; verified live
 * (2026-08-16) that title is its only child, so nothing else is lost.
 */
body.cc-gf-title-inlined .entry-header{display:none}
@media(min-width:781px){
  body.cc-gf-title-inlined .cc-gf-results__intro{grid-template-columns:1fr auto 1fr;gap:32px}
  body.cc-gf-title-inlined .cc-gf-results__intro>.entry-title{order:2;margin:0;flex-shrink:0}
  body.cc-gf-title-inlined .cc-gf-results__intro>.cc-gf-results__tagline{order:1}
  body.cc-gf-title-inlined .cc-gf-results__intro>.cc-gf-results__filters{order:3}
}

.cc-gf-results__filters-heading{margin:0 0 10px;color:var(--cc-accent,LinkText);font-size:.78rem;font-weight:700;letter-spacing:.1em;text-transform:uppercase}
.cc-gf-results__filters-empty{margin:0;font-size:14px;line-height:1.6;color:color-mix(in srgb,var(--cc-text,CanvasText) 55%,transparent);max-width:38ch}
.cc-gf-results__filter-chips{display:flex;flex-wrap:wrap;gap:8px}
/* Same pill family as .cc-gf__field select and .cc-gf__submit — a tinted
   surface rather than a solid fill, since three of these can sit side by
   side and a full gold fill per chip would out-compete the title above
   them for attention. */
.cc-gf-results__filter-chip{display:inline-flex;align-items:center;gap:6px;padding:7px 14px;border-radius:999px;background:color-mix(in srgb,var(--cc-accent,Highlight) 12%,var(--cc-surface,Canvas));font-size:13px;font-weight:600;color:var(--cc-text,CanvasText)}
.cc-gf-results__filter-chip-key{color:var(--cc-accent,LinkText);font-weight:700}
.cc-gf-results__filter-chip-key::after{content:":";margin-right:2px}

/* .cc-gf-results__header is gone (Moiz, 2026-08-16). It held a single gold
   "Thoughtful picks, ranked for you" line, which became the second of three
   stacked gold uppercase labels once gift_finder.title_eyebrow was switched
   on — eyebrow, this line, then the JS-rendered TOP MATCH badge, all the
   same size and colour within ~90px. The eyebrow above the page title won;
   this one was removed from results_shortcode().
   The rule below stays: TOP MATCH reuses .cc-gf-results__eyebrow (see
   gift-finder.js, where the badge is given both classes), so deleting it
   would silently unstyle that badge. */
.cc-gf-results__eyebrow{margin:0;color:var(--cc-accent,LinkText);font-size:.78rem;font-weight:700;letter-spacing:.1em;text-transform:uppercase}

/* Note/empty states read as a soft card, not a bare bordered box — same
   tinted-surface trick as the header's recessed nav band, so it feels like
   part of the same design system rather than a fallback state bolted on. */
.cc-gf-results__note,.cc-gf-results__empty{max-width:520px;margin:0 auto 32px;padding:18px 22px;border-radius:16px;background:color-mix(in srgb,var(--cc-text,CanvasText) 4%,var(--cc-surface,Canvas));box-shadow:inset 0 1px 2px color-mix(in srgb,var(--cc-text,CanvasText) 8%,transparent);text-align:center;font-size:.95rem;line-height:1.5}

/* 400px, not the original 500 — a real WooCommerce card here maxes out
   around 380px on this catalogue's images, so 500 left a wide, empty band
   either side. Verified live: at 500 the card sat in the middle of what
   read as mostly blank page (Moiz's screenshot, 2026-08-15).
   Widened from 360/340 to 400/380 (Moiz, 2026-08-16). The trigger was the
   featured card rendering SMALLER than the ordinary "Crowd Pleasers" cards
   on wide screens — measured live at 1280px against the then-live 3-column
   grid: top match 340px vs grid card 380px, crossover at roughly a 1092px
   viewport. Note the 4-column grid shipping in this same commit already
   removes that inversion on its own (4 columns cap each card at 280px, so
   even the old 340px top match would have stayed larger). 380 is kept
   deliberately anyway: it makes the featured card visibly the biggest
   thing on the page rather than merely a fraction wider. */
.cc-gf-results__top{max-width:400px;margin:0 auto 48px}
.cc-gf-results__top-label{margin-bottom:12px}
/*
 * grid-template-columns is forced with !important, and the selector is
 * prefixed `.woocommerce` for specificity, because Astra's own
 * `ul.products` rule hardcodes a 4-column grid template regardless of how
 * many items are actually in the list. With a single real <li> and no
 * override, that left the card confined to Astra's first grid TRACK
 * (measured live: 178px) inside a 340px container, with three empty phantom
 * columns beside it — not a card that was too small, a card trapped in 1/4
 * of the space it should have had. Confirmed by inspecting
 * getComputedStyle(...).gridTemplateColumns directly against the live page,
 * not assumed from how it looked. The "Crowd Pleasers" 4-column grid below
 * needs the exact same override for the same reason, or Astra's 4-column
 * default silently wins there too the moment it loads after this file.
 */
/* 380px here, matching .cc-gf-results__top's 400px less its breathing room.
   This inner cap is the one that actually sizes the card — widening only
   the outer wrapper does nothing, which is exactly the bug shipped in
   c159813 (verified live 2026-08-16: outer said 400px, the card still
   measured 340px). */
.woocommerce .cc-gf-results__top-list{grid-template-columns:1fr!important;max-width:380px;margin:0 auto}

/*
 * Top Match goes HORIZONTAL from 781px up (Moiz, 2026-08-16: "this card is
 * huge and a lot of whitespace is being left on sides"). A 380px portrait
 * card in a 1180px row left roughly 800px empty either side — the product
 * photos are 4:5 portrait, so a vertical featured card is unavoidably tall.
 * Horizontal: square 300px image left, summary right, card 1180x327.
 *
 * Below 781px nothing here applies and the card falls back to Astra's own
 * stacked flex layout, unchanged. That is the same breakpoint the grid
 * already steps at.
 *
 * Three specificity fights had to be won here, all confirmed live against
 * the real page rather than guessed — record them so the next person does
 * not rediscover them:
 *
 *  1. `.woocommerce ul.products li.product` sets `display:flex!important`.
 *     Ours needs `!important` too, AND the `ul.products` qualifier: without
 *     it our selector scores one element lower than theirs and loses the
 *     tie even with `!important` on both.
 *  2. `.woocommerce ul.products li.product .button` sets `width:100%`,
 *     which stretched the gold button across the full 821px column.
 *  3. The brand product-card CSS sets `height:auto!important` and
 *     `aspect-ratio:4/5!important` on the image, so the square crop needs
 *     `!important` on both or the image stays 300x375 and gets clipped by
 *     the wrapper instead of filling it.
 *
 * The `.astra-shop-thumbnail-wrap` / `.astra-shop-summary-wrap` names are
 * Astra's, which makes this theme-coupled — acceptable because it is a
 * layout override of markup Astra itself renders, not a re-built card (see
 * this file's header for why we never rebuild the card). If the theme ever
 * changes, this block degrades to the stacked layout rather than breaking.
 */
@media(min-width:781px){
  .cc-gf-results__top{max-width:none}
  .woocommerce ul.products.cc-gf-results__top-list{max-width:none}
  .woocommerce ul.products.cc-gf-results__top-list li.product{
    display:grid!important;grid-template-columns:300px minmax(0,1fr);gap:32px;
    align-items:center;justify-items:stretch;text-align:left;padding:20px}
  .woocommerce ul.products.cc-gf-results__top-list li.product>.astra-shop-thumbnail-wrap{
    grid-column:1;width:100%;margin:0;aspect-ratio:1;overflow:hidden;border-radius:14px}
  .woocommerce ul.products.cc-gf-results__top-list li.product .astra-shop-thumbnail-wrap>a{
    display:block;width:100%;height:100%}
  .woocommerce ul.products.cc-gf-results__top-list li.product .astra-shop-thumbnail-wrap img{
    width:100%!important;height:100%!important;aspect-ratio:auto!important;
    object-fit:cover;object-position:center;border-radius:0}
  .woocommerce ul.products.cc-gf-results__top-list li.product>.astra-shop-summary-wrap{
    grid-column:2;width:100%}
  .woocommerce ul.products.cc-gf-results__top-list li.product .ast-loop-product__link{
    font-size:22px;line-height:1.3;display:block;max-width:38ch}
  .woocommerce ul.products.cc-gf-results__top-list li.product .price{
    font-size:19px;margin:0 0 22px;padding-top:0;border-top:0}
  .woocommerce ul.products.cc-gf-results__top-list li.product .button{width:auto;margin:0}
}

/*
 * The description column.
 *
 * CC_Gift_Finder::card() prints .cc-gf-desc inside EVERY pooled product,
 * because the winner is chosen client-side. It must therefore be hidden by
 * default and switched on only in the Top Match slot — a Crowd Pleasers
 * tile has nowhere to put 500 characters.
 */
.cc-gf-desc{display:none}

/*
 * Three columns only at 1100px and up. Between 781 and 1100 the card is
 * already horizontal but only ~750–1070px wide; a third column there
 * squeezes the title column below a readable width, so the description
 * stays hidden and the two-column layout above still applies.
 *
 * The height cap is max-height, not -webkit-line-clamp: the excerpt is
 * wp_kses_post'd post content and can legitimately contain <p>, which
 * stops line-clamp working (it needs inline content in a -webkit-box).
 * 8 x 1.6em lands exactly on a line boundary, so the cut looks deliberate
 * and needs no fade. Measured against the real catalogue on 2026-08-16:
 * excerpts run 119–966 characters, median 564, so most show in full and
 * only the longest few are trimmed.
 */
@media(min-width:1100px){
  .woocommerce ul.products.cc-gf-results__top-list li.product{
    grid-template-columns:300px minmax(0,1fr) minmax(0,1.2fr)}
  .woocommerce ul.products.cc-gf-results__top-list li.product>.cc-gf-desc{
    display:block;grid-column:3;align-self:center;
    font-size:13.5px;line-height:1.6;color:var(--cc-text-muted,#6a6a6a);
    max-height:12.8em;overflow:hidden}
  .woocommerce ul.products.cc-gf-results__top-list li.product>.cc-gf-desc>*{margin:0 0 .7em}
  .woocommerce ul.products.cc-gf-results__top-list li.product>.cc-gf-desc>*:last-child{margin-bottom:0}
}

.cc-gf-results__more{margin-top:8px}
.cc-gf-results__more>h2{margin:0 0 22px;text-align:center;font-family:var(--cc-font-heading,inherit)}
.woocommerce .cc-gf-results__grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:24px}

/* 4 columns only once there is genuinely room for them. Measured live in a
   width-controlled iframe against the real cards (2026-08-16): at a 800px
   viewport a 4-column grid gives 169px cards — narrow enough that product
   names wrap to two lines and the image dominates the tile. The same width
   at 3 columns gives 242px. So the 4-column step is held back to 1100px,
   where a card is ~250px, and 781–1100px keeps the old 3-column layout. */
@media(max-width:1100px){
  .woocommerce .cc-gf-results__grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}
}
@media(max-width:780px){
  .woocommerce .cc-gf-results__grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media(max-width:520px){
  .woocommerce .cc-gf-results__grid{grid-template-columns:1fr!important}
}
@media(prefers-reduced-motion:reduce){
  .cc-gf-sheet__backdrop,.cc-gf-sheet__panel,.cc-gf__submit{transition:none}
}
