/* hp-tabs.css — styles for the homepage tabbed feature section */
/* Namespaced under .wpchar-hp-tabs to avoid collisions. */
/*
 * Rebuilt 2026-09-16 against Figma "Charitable-Website-Final",
 * page node 2346:274, variant "V1 - stock image", tab state 2441:6436.
 *
 * Colour note: the active green is #3d914b. That is the value in the Figma
 * and the value this file already used. It is NOT the canon brand green
 * (#31714c) and is deliberately absent from the brand token file's asBuilt
 * arrays, per the 2026-09-15 ruling that shipped values do not become canon.
 * Matching the file and the design rather than converting. Ink #1e1515 is
 * canon exactly.
 *
 * Layout note: the Figma content column is 1115px inside a 1440px page. This
 * section stays constrained to the theme's wide-size (1280px) so the nav and
 * panel keep lining up with the icon grid below and the hero row above, so
 * the two panel columns use proportional fr units (415:650, the design's own
 * ratio) rather than the design's literal pixel widths. Type, spacing and the
 * nav are at their exact design values.
 */

.wpchar-hp-tabs {
  /* Figma nav + active state */
  --wpchar-hp-tabs-green: #3d914b;
  --wpchar-hp-tabs-track: #d9d9d9;
  /* Figma ink and the 60% ink used for all secondary copy */
  --wpchar-hp-tabs-ink: #1e1515;
  --wpchar-hp-tabs-ink-60: rgba(30, 21, 21, 0.6);
  /* Retained for the placeholder card and the video branch */
  --wpchar-hp-tabs-yellow: #fef3d4;

  /* Content wrapper stays constrained to alignwide (80rem = 1280px) so the
     nav + panel line up horizontally with the icon grid below and the legacy
     hero-grid row above. Gradient extends beyond via ::before. */
  max-width: var(--wp--style--global--wide-size, 80rem);
  margin: 0 auto 30px;
  /* The shortcode renders as a top-level block, so it never receives the
     theme's `has-global-padding`. With `padding: 0` the nav, the headline and
     the bullet check glyphs all sat at x=0 and touched the screen edge at every
     width below 1280px.
     5% reproduces the theme's own global padding exactly: measured against the
     "Finally, a WordPress Donation Plugin" h2, its inset is 64px at 1280,
     43px at 866, 35px at 700 and 20px at 390, i.e. 5% of the viewport in each
     case. content-box keeps max-width applying to the *content*, so the content
     edges still land on 1280 at wide widths and stay flush with that h2 and
     with the icon grid below. */
  box-sizing: content-box;
  padding: 0 5%;
  position: relative;
  isolation: isolate;
  font-family: inherit;
}

/* Full-bleed section background.
 *
 * #fffaf3 is the same cream the hero band uses (set inline as
 * background-color on .wpcharitable-big-top and
 * .wpcharitable-testimonial-strip in the front-page wp_template row). Matching
 * it makes the hero band and the tab band read as one continuous field from the
 * nav down to the "Finally, a WordPress Donation Plugin" section, which is what
 * production does and what was asked for on 2026-09-30.
 *
 * History, so this does not get "fixed" back: this was briefly #fffcfa. The
 * four media composites in ../images/hp-tabs/ are exported from Figma with
 * #fffcfa baked in as an opaque backdrop (verified: `webpinfo` reports
 * Alpha: 0, and a fresh 2x re-export of all four media nodes comes back RGBA
 * but 100%% opaque, so the Figma nodes themselves carry the fill). Setting the
 * band to #fffcfa hid that backdrop perfectly, at the cost of losing the cream.
 *
 * The images/hp-tabs/README.md claim that the composites "carry an alpha
 * channel" is wrong and has been corrected there.
 *
 * Against #fffaf3 each composite's backdrop is off by (0, +2, +7) in RGB.
 * Their drop shadows are also pre-blended against #fffcfa, so a naive alpha
 * cutout would leave a pale halo rather than a clean edge. If those edges ever
 * do read as visible rectangles, the fix is to re-export each media node with
 * its frame fill hidden in Figma (file nj6B6tCZtF0kqeW9oI6gpJ, nodes listed in
 * that README) so the shadows carry real alpha. Do not flood-fill the shipped
 * WebPs: they are lossy and the shadow falloff will band. */
.wpchar-hp-tabs::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  height: 100%;
  width: 100vw;
  transform: translateX(-50%);
  background: #fffaf3;
  z-index: -1;
}

/* Keep the hero cream band and the tab band touching.
 *
 * The hero band's colour comes from .wpcharitable-big-top. Its last child has a
 * bottom margin (80px at desktop widths, 40px at mobile) and big-top has no
 * bottom border, so that margin collapses *through* big-top whenever big-top's
 * own bottom padding is 0. The margin then renders as bare white between the
 * two cream bands instead of as cream inside the hero band. That is what made
 * the cream look like it "ended right under the trust badges".
 *
 * display: flow-root gives big-top its own block formatting context, which
 * contains that margin without adding a single pixel: the space stays exactly
 * as designed, it just renders as cream instead of white.
 *
 * This is the ONLY thing containing it. Blocking the collapse with
 * padding-bottom on big-top also works, and was tried, but it *adds* to the
 * gap rather than just re-colouring it: the badge group above already carries
 * `margin-bottom: 80px`, so 54.08px of padding made the space between the trust
 * badges and the tab labels 134px where production has exactly 80px.
 * Production gets away with that padding because its hero has a slider between
 * the badges and the end of big-top; staging replaced that slider with these
 * tabs, so here the badge margin lands directly against the nav. Do not
 * reintroduce padding-bottom on big-top to fix a colour problem.
 *
 * Declared unconditionally on purpose: am-theme/style.css line 5679 forces
 * `padding-bottom: 0 !important` on big-top inside its max-width:600px block,
 * so there is no width at which padding is doing this job.
 *
 * Selector is `body .wpcharitable-big-top` on purpose: this file is enqueued
 * before am-theme/style.css, so a bare `.wpcharitable-big-top` would lose to
 * that file at equal specificity if it ever declares `display` too. */
body .wpcharitable-big-top {
  display: flow-root;
}

/* ---------------------------------------------------------------------------
   Nav. Figma: four equal columns, each tab centred in its own quarter, with a
   3px #d9d9d9 track across the full width and the active quarter in green.
   The track is the nav's bottom border; each tab carries a transparent 3px
   border pulled down over it, so the active tab's green border covers exactly
   one quarter with no extra markup and no JS changes.
   --------------------------------------------------------------------------- */
.wpchar-hp-tabs__nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-bottom: 3px solid var(--wpchar-hp-tabs-track);
  margin-bottom: 0;
}

.wpchar-hp-tabs__tab {
  /* 24px label row, then the 20px gap Figma leaves above the 3px bar. */
  padding: 0 0 20px;
  min-width: 0;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
  border-radius: 0;
  font-family: inherit;
  font-size: 18px;
  font-weight: 500;
  line-height: normal;
  color: var(--wpchar-hp-tabs-ink-60);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  transition: color 0.15s, border-color 0.15s;
}

.wpchar-hp-tabs__tab-label {
  white-space: nowrap;
}

.wpchar-hp-tabs__tab-icon {
  flex-shrink: 0;
  /* Figma nav glyphs are all 17px wide; heights differ per glyph, so the
     height follows the viewBox rather than being forced square. */
  width: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}

.wpchar-hp-tabs__tab-icon svg {
  width: 17px;
  height: auto;
  display: block;
  fill: currentColor;
}

.wpchar-hp-tabs__tab:hover {
  color: var(--wpchar-hp-tabs-green);
}

.wpchar-hp-tabs__tab:focus-visible {
  outline: 2px solid var(--wpchar-hp-tabs-green);
  outline-offset: 2px;
}

.wpchar-hp-tabs__tab[aria-selected="true"] {
  color: var(--wpchar-hp-tabs-green);
  font-weight: 700;
  border-bottom-color: var(--wpchar-hp-tabs-green);
}

/* ---------------------------------------------------------------------------
   Panel
   --------------------------------------------------------------------------- */
.wpchar-hp-tabs__panel {
  display: none;
}

.wpchar-hp-tabs__panel[data-active="true"] {
  display: grid;
  /* The design's own 415:650 column ratio. See the layout note at the top. */
  grid-template-columns: 415fr 650fr;
  grid-template-rows: auto;
  column-gap: 50px;
  row-gap: 0;
  align-items: start;
  /* Figma leaves 45px between the nav bar and the first line of copy.
     The bottom value is not from the design: it was 120px to feed the
     page-level gradient fade-out that no longer exists.
     20px is chosen so the cream below the media equals the white above the
     "Finally, a WordPress Donation Plugin" heading, which is what was asked
     for on 2026-09-30. The algebra, with S = the height of the cream top strip
     of the feature-grid's hero-bg.png:
         cream below media = padding-bottom + 30 (tabs margin) - 50 (fg margin) + S
         white above h2    = 200 (fg padding-top) - S
     S is ~100px under the centred content, so padding-bottom of 20px puts both
     at ~100px. Change this and the two gaps stop matching. */
  padding: 45px 0 20px;
}

/* Pin children to explicit cells so stray wpautop-injected <p> tags cannot
   push our real content into the wrong grid cell. */
.wpchar-hp-tabs__panel > .wpchar-hp-tabs__copy {
  grid-column: 1;
  grid-row: 1;
}

.wpchar-hp-tabs__panel > .wpchar-hp-tabs__media {
  grid-column: 2;
  grid-row: 1;
}

/* Hide any empty <p> or <br> tags WordPress injects between our grid children. */
.wpchar-hp-tabs__panel > p:empty,
.wpchar-hp-tabs__panel > br {
  display: none;
}

/* ---------------------------------------------------------------------------
   Tab-switch fade. The copy comes in first, the media follows just behind it.
   These are animations rather than transitions on purpose: the inactive panels
   are display:none, and display is not an animatable property, so a transition
   would never run. An animation restarts every time the element is rendered
   again out of display:none, which is exactly the switch we want to catch.
   --------------------------------------------------------------------------- */
@keyframes wpchar-hp-tabs-rise-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes wpchar-hp-tabs-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.wpchar-hp-tabs__panel[data-active="true"] > .wpchar-hp-tabs__copy {
  animation: wpchar-hp-tabs-rise-in 200ms ease-out both;
}

/* Delayed just enough to read as "text, then image" without feeling slow.
   Opacity only: a 700px-wide photographic composite sliding looks heavy. */
.wpchar-hp-tabs__panel[data-active="true"] > .wpchar-hp-tabs__media {
  animation: wpchar-hp-tabs-fade-in 260ms ease-out 110ms both;
}

@media (prefers-reduced-motion: reduce) {
  .wpchar-hp-tabs__panel[data-active="true"] > .wpchar-hp-tabs__copy,
  .wpchar-hp-tabs__panel[data-active="true"] > .wpchar-hp-tabs__media {
    animation: none;
  }
}

/* Eyebrow removed per design revision — headline stands on its own. */
.wpchar-hp-tabs__eyebrow {
  display: none;
}

/* ---------------------------------------------------------------------------
   Copy column. Figma stacks headline / body / bullets with a 20px gap, then
   40px before the CTA.
   --------------------------------------------------------------------------- */
.wpchar-hp-tabs__headline {
  font-size: 20px;
  font-weight: 700;
  line-height: 32px;
  letter-spacing: normal;
  color: var(--wpchar-hp-tabs-ink);
  margin: 0 0 20px;
}

.wpchar-hp-tabs__body {
  font-size: 18px;
  font-weight: 500;
  line-height: 28px;
  letter-spacing: 0.25px;
  color: var(--wpchar-hp-tabs-ink-60);
  margin: 0 0 20px;
}

.wpchar-hp-tabs__bullets {
  list-style: none;
  padding: 0;
  /* 40px to the CTA, less the 12px row gap already below the last bullet. */
  margin: 0 0 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wpchar-hp-tabs__bullets li {
  position: relative;
  /* 16px check glyph + the 16px gap Figma sets between glyph and label. */
  padding: 0 0 0 32px;
  margin: 0;
  font-size: 16px;
  line-height: normal;
  letter-spacing: 0.25px;
  color: var(--wpchar-hp-tabs-ink-60);
  /* Figma applies a capitalize text-case to every bullet, which is why the
     designed strings mix "and" with "And" yet all render in title case. */
  text-transform: capitalize;
}

/* The bullet label is wrapped in <strong> by the shortcode; Figma sets these
   at Medium, not bold, so undo the user-agent weight. */
.wpchar-hp-tabs__bullets li strong {
  font-weight: 500;
}

/* Check glyph exported from the Figma bullet rows (16x24, #3d914b). */
.wpchar-hp-tabs__bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 24px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="24" viewBox="0 0 16 24" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M5.33328 15.3888L14.2222 6.5L16 8.27777L5.33328 18.9444L0 13.6111L1.77777 11.8333L5.33328 15.3888Z" fill="%233D914B"/></svg>');
  background-size: 16px 24px;
  background-repeat: no-repeat;
  background-position: center;
}

/* Addon badges hidden for now — the copy inside each bullet already conveys
   the same info, and the Figma design has no badges. Keep the markup so we
   can flip these back on cheaply later. */
.wpchar-hp-tabs__addon-tag {
  display: none;
}

/* CTA row. Figma: Satoshi Bold 14px ink, a 1px 50%-opacity ink rule beneath,
   and a 13.37x11.03 stroked arrow at 1.7 weight. */
.wpchar-hp-tabs__cta-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
}

.wpchar-hp-tabs__cta {
  color: var(--wpchar-hp-tabs-ink);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.21px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(30, 21, 21, 0.5);
  text-underline-offset: 10px;
}

.wpchar-hp-tabs__cta:hover {
  text-decoration-color: rgba(30, 21, 21, 1);
}

.wpchar-hp-tabs__cta-arrow {
  color: var(--wpchar-hp-tabs-ink);
  width: 13.37px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

.wpchar-hp-tabs__cta-arrow svg {
  width: 13.37px;
  height: 11.03px;
  display: block;
  fill: none;
}

/* ---------------------------------------------------------------------------
   Media column. The V1 design supplies one flat composite per tab (stock photo
   with floating UI cards), exported from Figma at 2x and converted to WebP.
   Transparent background, so no card framing.
   --------------------------------------------------------------------------- */
.wpchar-hp-tabs__media {
  background: transparent;
  border-radius: 0;
  padding: 0;
  min-height: 0;
  box-shadow: none;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: visible;
}

.wpchar-hp-tabs__media img,
.wpchar-hp-tabs__media video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;
}

/* The feature-grid section sits directly below the tabs. This block used to
   force `padding-top: 40px !important; margin-top: 0 !important` so the tabs
   butted flush against the bottom of the tab gradient. That gradient no longer
   exists (see the flat-background note above), and with only 40px of padding
   the "Finally, a WordPress Donation Plugin" heading was pulled up onto the
   cream top strip of the section's own hero-bg.png. Removing the override lets
   am-theme/style.css supply its `padding-top: 200px`, which is what production
   renders and which clears that strip by ~115px.

   The `margin-top: 0 !important` was already dead: am-theme/style.css declares
   `margin-top: -50px !important` at equal specificity and loads after this
   file, so it won. Dropping it here removes a landmine that would have
   reversed the -50px overlap if the enqueue order ever flipped. */

/* The video branch is retained so a tab can go back to an autoplay clip by
   setting media_video. Transparent-background clips need no framing. */
.wpchar-hp-tabs__media--video {
  background: transparent;
  padding: 0;
  min-height: 0;
  box-shadow: none;
}

.wpchar-hp-tabs__media--video video {
  display: block;
  width: 100%;
  border-radius: 12px;
}

/* Fallback card, shown only when a tab has neither an image nor a video. */
.wpchar-hp-tabs__media-placeholder {
  background: var(--wpchar-hp-tabs-yellow);
  border-radius: 12px;
  padding: 1.5rem;
  min-height: 280px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #7a5a00;
  font-size: 0.85rem;
  line-height: 1.5;
}

.wpchar-hp-tabs__media-placeholder strong {
  display: block;
  color: #5a3f00;
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
}

/* ---------------------------------------------------------------------------
   Responsive.

   One breakpoint at 960px governs the whole narrow treatment, because both
   halves of the design run out of room at roughly the same place: the copy
   column drops under ~350px (it is 331px at 900 and 318px at 866), and the four
   18px nav labels stop fitting on one row.

   What this replaces: the nav used to become a horizontally scrollable strip
   below 1080px with `scrollbar-width: none`. Measured, that left 49px of the nav
   off-screen at 866px and 451px off-screen at 390px, i.e. more than half of it,
   with no scrollbar, fade or arrow to say so. Tabs 3 and 4 read as missing
   rather than scrollable, and the panel meanwhile stayed two cramped columns all
   the way down to 860px.
   --------------------------------------------------------------------------- */
/* Four across still fits between 961px and 1080px, but the longest label
   outgrows its own 1fr cell on the way down: measured headroom for
   "Launch Your Fundraiser" is +19px at 1080, +1px at 1000 and -8px at 961,
   and because the label is `white-space: nowrap` inside a centred flex item
   with `min-width: 0`, the overspill lands in the neighbouring cell rather
   than being clipped. Letting it wrap keeps all four columns without that
   collision, and is why this file no longer needs the hidden-scrollbar nav
   strip it used to switch to at this width. */
@media (max-width: 1080px) {
  .wpchar-hp-tabs__tab-label {
    white-space: normal;
  }
}

@media (max-width: 960px) {
  /* Nav: 2x2 grid. Every tab stays visible and tappable, the per-tab underline
     stays the active indicator, and no new markup or JS is needed. */
  .wpchar-hp-tabs__nav {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 0;
    /* At wide widths the 3px track is this border and each tab pulls its own
       transparent 3px border down over its quarter of it. That trick only works
       for a single row, so in two rows the track moves onto the tabs. */
    border-bottom: 0;
  }
  .wpchar-hp-tabs__tab {
    padding: 12px 8px;
    font-size: 16px;
    margin-bottom: 0;
  }
  /* Colour only the inactive tabs, so the [aria-selected="true"] green further
     up the file still wins on the active one. */
  .wpchar-hp-tabs__tab:not([aria-selected="true"]) {
    border-bottom-color: var(--wpchar-hp-tabs-track);
  }
  /* Labels wrap from 1080px down; see the block above. In the 2x2 grid they
     need to wrap *neatly*, because greedy wrapping produced a one-word orphan:
     "Skip the Admin Work" broke as "Skip the Admin / Work", and at 390px
     "Collect Donations" still fitted on one line while its three neighbours
     were on two, so the row read ragged.

     `text-wrap: balance` minimises the longest line rather than filling the
     first, which fixes the orphan. The 11ch cap is what forces the shorter
     labels to wrap at all, so all four tabs land on exactly two lines.
     Measured at 360 and 390: Launch Your / Fundraiser, Collect / Donations,
     Skip the / Admin Work, Grow Your / Support.

     11ch specifically: 12ch leaves "Collect Donations" on one line at 390px,
     and 10ch works but squeezes every label to 111px. `margin-inline: auto`
     keeps the capped box centred under the icon.

     Width-based wrapping cannot produce "Grow / Your Support", because the
     longest line always has to fit and "Your Support" is wider than
     "Grow Your". That split would need per-tab break markup in
     shortcodes-homepage-tabs.php, where the label currently goes through
     esc_html(). Deliberately not done; the balanced break is tidier. */
  .wpchar-hp-tabs__tab-label {
    text-wrap: balance;
    max-width: 11ch;
    margin-inline: auto;
  }

  /* Panel: one column, media first. The media is the point of each tab, and on
     a narrow screen a reader should not have to scroll past five bullets to
     reach it. */
  .wpchar-hp-tabs__panel[data-active="true"] {
    grid-template-columns: 1fr;
    row-gap: 32px;
    padding: 32px 0 20px;
  }
  .wpchar-hp-tabs__panel > .wpchar-hp-tabs__copy,
  .wpchar-hp-tabs__panel > .wpchar-hp-tabs__media {
    grid-column: 1;
  }
  .wpchar-hp-tabs__panel > .wpchar-hp-tabs__media {
    grid-row: 1;
  }
  .wpchar-hp-tabs__panel > .wpchar-hp-tabs__copy {
    grid-row: 2;
  }
  .wpchar-hp-tabs__headline {
    font-size: 20px;
    line-height: 28px;
  }
  .wpchar-hp-tabs__body {
    font-size: 16px;
    line-height: 26px;
  }
}
