/* =============================================================================
   Homepage hero slider
   Loaded on the front page only, from functions.php (wp_head, priority 20).
   The slider is emitted by header.php:342-379 and exists on no other page.

   Two parts:
     PART 1  a shared fix for slide icons rendering out of proportion
     PART 2  the year-end campaign slide

   header.php is not touched by either, so the slider's markup and the other
   slides' content are untouched.

   WHY NOTHING HERE CAN WIN ON SOURCE ORDER
   wp_head() fires at header.php:36. The theme's own hero skin is an inline
   <style> block at header.php:99-249, and the hand-maintained per-slide CSS
   (the field holding .hslide5a, #pawslide and the .hslide1 icon overrides)
   is printed later still. Both come after this file, so specificity has to
   carry every rule on its own. The relevant rules to beat:

       .hslidein * {color:#fff!important;text-align:center}      (0,1,0)
       .hslidein .wrapper {max-width:900px}                      (0,2,0)
       .hslidein {padding:60px 0}                                (0,1,0)
       #hslides h5.hslideh5 a {background:rgba(0,0,0,.33);…}     (1,1,2)
       li.hslide {height:550px;background:#222}                  (0,1,1)
       li.bg_purple {background:#716aae}                         (0,1,1)
       .home #hslides .hslide1 img.hslideicon {width:…!important} (1,3,1)

   THE 550px CEILING shapes everything below it. #hslides, ul.hslidesbx and
   li.hslide are a hard height:550px with no media queries anywhere, and
   #hslides is overflow:hidden — so content that does not fit is silently cut
   off rather than scrolling. Measure, don't eyeball.
   ============================================================================= */


/* =============================================================================
   PART 1 — slide icons, in proportion
   =============================================================================
   img.hslideicon was rendering badly stretched on every screen size except a
   phone. Measured against CFM.png's natural 300x300:

       1440px viewport   600x320   +87%  wider than it should be
       1069px viewport   720x280  +157%
        768px viewport   554x280   +98%
        390px viewport   264x264     0%  (the only size that was correct)

   The cause is a combination, not a single bad rule. header.php:193 bounds the
   icon with max-width/max-height and width:auto/height:auto, which preserves
   the ratio correctly. The per-slide CSS then adds an EXPLICIT width —
   `width:80%!important`, and `width:600px!important` above 1100px — while the
   max-height cap stays in place. An explicit width plus a clamped height is
   the one combination a replaced element cannot satisfy proportionally: the
   width is honoured, the height is clipped to the cap, and the picture
   squashes. Below about 350px of icon width the cap never engages, which is
   why phones looked right and nothing else did.

   The fix is to take the explicit sizing back out and let the existing
   max-width/max-height bounds do the work, which is what they were written
   for. Nothing here changes those bounds, so the other slides' icons are
   untouched — slide 4 measures identically before and after.

   Side effect worth knowing: slide 1's logo was being upscaled 2x as well as
   stretched (a 300px source drawn 600px wide). It now renders at its natural
   300px and is sharper for it, but it IS visibly smaller. If you want it big
   again the answer is a larger source file, not a larger width — the artwork
   is only 300px across.

   The selector needs (1,3,3) to outrank the (1,3,1) !important rules it is
   correcting; that is the only reason it is this long. */
body.home #hslides li.hslide img.hslideicon{
  width:auto !important;
  height:auto !important;
}

/* Second symptom of the same fixed-height box, and the costly one: on a phone
   slide 1's icon is capped at 280px, which together with its heading and a
   four-line paragraph makes 629px of content in the 550px slide. The overflow
   is split top and bottom by the table-cell centring, and what falls off the
   bottom is the CTA — the "Learn More!" button is not visible at all at 390px
   wide. Measured 629px before this rule, 549px after.

   Capping the icon by height is what buys the button back. 180px is the
   largest value that still leaves the CTA on screen at 390px with room for
   a larger system font. Slide 4's icon is 150x67 and so is untouched by this.
   If the icon should stay large on phones instead, the copy is what has to
   get shorter — the 550px is set in header.php:171 and shared by every
   slide. */
@media (max-width:767px){
  body.home #hslides li.hslide img.hslideicon{
    max-height:180px !important;
  }
}


/* =============================================================================
   PART 2 — the year-end campaign slide
   =============================================================================
   The slide is content: an ACF row on page 96102 using the slider's own
   hslide_custom_yes / hslide_content fields.

   This is standalone CSS, not an extension of eoy2026.css. Every rule in that
   file is scoped `#main .eoy …`, and the slider sits OUTSIDE #main — it is
   emitted between #header and #main. None of the campaign page's CSS reaches
   here, so the colours and metrics are restated rather than inherited.

   There is no per-slide class field: header.php:346 builds the li's classes as
   `hslide<n>` plus the colour. So the handle is :has(.eoy-copy), which keeps
   working if the slide is ever reordered — a positional .hslide1 would not.

   WITHOUT :has() the slide degrades rather than breaks: it keeps bg_purple
   (#716aae, a shade off ours), loses the paw trail, and gets the theme's dark
   pill buttons. The artwork sizing under "the artwork" deliberately does NOT
   use :has(), because those are the rules holding a 628px-wide cut-out inside
   the 550px box. */


/* ----------------------------------------------------------------- the band */
/* The campaign purple, not the slider's bg_purple. A shade apart, and the
   slide should match the page it leads to. */
#hslides li.hslide:has(.eoy-copy){ background:#706CA9; }

/* One paw trail across the band, the same artwork the campaign page uses. The
   box is inset negatively because a rotated rectangle flush to the band leaves
   bare wedges at the corners; li.hslide is already position:relative and
   #hslides is overflow:hidden, so this positions and clips for free.
   pawprints-white.svg carries opacity:.45 on its own group, which multiplies
   with this and lands around .14 on screen. */
#hslides li.hslide:has(.eoy-copy)::before{
  content:"";
  position:absolute;
  inset:-25% -10%;
  z-index:0;
  pointer-events:none;
  background-image:url("images/eoy2026/marks/pawprints-white.svg");
  background-repeat:no-repeat;
  background-position:center;
  background-size:115vmax auto;
  transform:rotate(-11deg);
  opacity:.30;
}
#hslides li.hslide:has(.eoy-copy) .hslidecontent{ position:relative;z-index:1; }


/* --------------------------------------------------------------- the layout */
/* 60px top and bottom out of 550px is unaffordable with artwork this tall. */
#hslides li.hslide:has(.eoy-copy) .hslidein{ padding:16px 0; }

/* The CTAs are not ours — header.php:361-366 emits .hslidectas as a SIBLING
   after the custom content, so the slide's own HTML cannot wrap them. Making
   the wrapper itself the grid is what puts the buttons under the lettering in
   the left column instead of centred beneath both. 1180px matches the campaign
   page's shell. */
#hslides li.hslide:has(.eoy-copy) .wrapper{
  display:grid;
  grid-template-columns:minmax(0,1.05fr) minmax(0,.95fr);
  column-gap:clamp(20px,3vw,44px);
  align-items:center;
  max-width:1180px;
  padding:0 50px;
}
#hslides li.hslide:has(.eoy-copy) .eoy-copy{
  grid-column:1;grid-row:1;align-self:end;
}
#hslides li.hslide:has(.eoy-copy) .hslidectas{
  grid-column:1;grid-row:2;align-self:start;
}
#hslides li.hslide:has(.eoy-copy) .eoy-pet{
  grid-column:2;grid-row:1 / span 2;justify-self:center;
}

/* Beats .hslidein *'s forced centring. The !important is for the h5, which
   carries an INLINE text-align:center from header.php:362 — an important
   author rule is the only thing that outranks an inline style. */
#hslides li.hslide:has(.eoy-copy) .eoy-copy,
#hslides li.hslide:has(.eoy-copy) .hslidectas,
#hslides li.hslide:has(.eoy-copy) .hslidectas h5{ text-align:left !important; }


/* -------------------------------------------------------------- the artwork */
/* No :has() on this group, on purpose — see the note above.

   Each cap is written as `img.eoy-mark`, not `.eoy-mark`. The shared rule
   below is (1,1,1) because of its `img`, and a bare `.eoy-mark` would be
   (1,1,0) — so the shared max-width would have won and the lettering would
   have drawn at full column width. Qualifying each cap with the element puts
   them at (1,2,1), above it. */
#hslides .eoy-copy img,
#hslides .eoy-pet img{ display:block;height:auto; }

#hslides .eoy-copy img.eoy-mark{ width:100%;max-width:380px;margin:0 0 14px; }
#hslides .eoy-copy img.eoy-gift{ width:100%;max-width:280px;margin:0; }

#hslides .eoy-pet picture{ display:block; }
#hslides .eoy-pet img{ width:100%;max-width:400px;margin:0 auto; }


/* -------------------------------------------------------------- the buttons */
/* The campaign's yellow primary and ghost secondary. Colour needs !important
   to beat .hslidein *{color:#fff!important}; between two important
   declarations specificity decides, and these outrank it. */
#hslides li.hslide:has(.eoy-copy) .hslideh5{ margin-top:26px; }

#hslides li.hslide:has(.eoy-copy) .hslidectas a,
#hslides li.hslide:has(.eoy-copy) .hslidectas a:visited{
  background:#FFD74F;
  color:#231F20 !important;
  border:2px solid #FFD74F;
  border-radius:999px;
  font-weight:700;
  min-width:0;
  padding:16px 30px;
}
#hslides li.hslide:has(.eoy-copy) .hslidectas a + a,
#hslides li.hslide:has(.eoy-copy) .hslidectas a + a:visited{
  background:transparent;
  color:#FFFFFF !important;
  border-color:rgba(255,255,255,.6);
}
/* The theme's hover is background:#000!important;color:#fff!important at
   (1,2,2); these land at (1,4,2) and take it. */
#hslides li.hslide:has(.eoy-copy) .hslidectas a:hover,
#hslides li.hslide:has(.eoy-copy) .hslidectas a:focus{
  background:#FFFFFF !important;
  color:#C72F3D !important;
  border-color:#FFFFFF;
}


/* ----------------------------------------------------------------- narrow */
/* The slider stays 550px on a phone, so this is where the budget is tightest.
   The cut-out comes out rather than the lettering shrinking further — she is
   the part that needs size to read, and dropping her is what buys the
   headroom. To bring her back, give her about 120px above the lettering and
   re-measure; there is roughly 140px of slack at 390px wide.

   1050px, not the theme's own 900px slider breakpoint. Between about 900 and
   1050 the left column gets too narrow to hold both CTAs on one line; they
   wrap to two rows, which adds ~60px and pushes the slide over the 550px
   ceiling. Measured at 901px before this was raised: 556px of content, clipped
   by 6px. Everything below the squeeze zone has room to spare stacked, so the
   fix is to leave the two-column layout earlier rather than shrink the type. */
@media (max-width:1050px){
  #hslides li.hslide:has(.eoy-copy) .hslidein{ padding:20px 0; }

  #hslides li.hslide:has(.eoy-copy) .wrapper{
    display:block;
    max-width:none;
    padding:0 24px;
  }
  #hslides li.hslide:has(.eoy-copy) .eoy-copy,
  #hslides li.hslide:has(.eoy-copy) .hslidectas,
  #hslides li.hslide:has(.eoy-copy) .hslidectas h5{ text-align:center !important; }

  #hslides .eoy-copy img.eoy-mark{ max-width:240px;margin:0 auto 10px; }
  #hslides .eoy-copy img.eoy-gift{ max-width:205px;margin:0 auto; }
  #hslides .eoy-pet{ display:none; }

  #hslides li.hslide:has(.eoy-copy) .hslideh5{ margin-top:22px; }
  #hslides li.hslide:has(.eoy-copy) .hslidectas a{
    display:block;
    max-width:270px;
    margin:0 auto 10px;
  }
}
