/*
 * Product closing band. Transcribed from src/components/product/ProductClosing.tsx
 * and the SOLAR.closing object on the React build.
 *
 * Same furniture as the home page's final ask, on the same panel surface, with
 * the image carrying a curved edge rather than a straight cut so the block does
 * not read as a banner.
 *
 * House rule: every declaration reads a --ge-* custom property whose FALLBACK is
 * the original design value, so an untouched widget is pixel-identical to React
 * and a control only ever overrides the fallback. No inline styles, no
 * !important, nothing keyed to a post id.
 *
 * Nothing here animates. The React version wraps the panel in a whileInView
 * reveal, which is a nicety; porting it would mean an observer whose only
 * failure mode is a blank block, and this project has shipped that three times.
 * The home page's Final CTA made the same call.
 */

/* A defeated [hidden] renders the wrong state on top of the right one and logs
   nothing, because the UA rule is a single attribute selector and loses to any
   class that sets display. Close it once, before anything can reopen it. */
.ge-pclose [hidden] { display: none !important; }

.ge-pclose {
  margin-inline: auto;
  max-width: var(--ge-pclose-frame-max, var(--ge-frame-max, 1320px));
  padding: var(--ge-pclose-pad, 0 var(--ge-frame-gutter, 12px));
  box-sizing: border-box;
}
@media (min-width: 640px) {
  .ge-pclose { padding: var(--ge-pclose-pad, 0 var(--ge-frame-gutter, 20px)); }
}

.ge-pclose__panel {
  overflow: hidden;
  border-radius: var(--ge-pclose-radius, var(--ge-radius-band, 26px));
  background: var(--ge-pclose-bg, var(--ge-panel));
}

.ge-pclose__grid {
  display: grid;
  align-items: center;
  gap: var(--ge-pclose-gap, 32px);
}

@media (min-width: 1024px) {
  .ge-pclose__grid {
    /* A percentage, not a raw fr pair: calc() cannot do arithmetic on fr, and
       an editor does not think in fr either. The React grid is 0.95fr / 1.05fr
       with NO gap at this breakpoint, so the fr split and the percentage agree
       for once: 0.95 / 2 = 47.5%. */
    grid-template-columns:
      minmax(0, var(--ge-pclose-copy-width, 47.5%))
      minmax(0, 1fr);
    gap: var(--ge-pclose-gap-lg, 0px);
  }
}

/* ------------------------------------------------------------------ copy -- */

.ge-pclose__copy { padding: var(--ge-pclose-copy-pad, 32px); }
@media (min-width: 640px) { .ge-pclose__copy { padding: var(--ge-pclose-copy-pad, 44px); } }
@media (min-width: 1024px) { .ge-pclose__copy { padding: var(--ge-pclose-copy-pad, 44px 44px 44px 48px); } }

.ge-pclose__eyebrow {
  display: flex; align-items: center;
  gap: var(--ge-pclose-eb-inner-gap, 12px);
  margin: 0 0 var(--ge-pclose-eb-gap, 24px);
  font-family: var(--ge-type-micro-family, var(--ge-font-mono, "IBM Plex Mono", ui-monospace, Menlo, monospace));
  font-size: var(--ge-type-micro-size, 11px);
  font-weight: var(--ge-type-micro-weight, 400);
  letter-spacing: var(--ge-type-micro-lsp, 0.2em);
  text-transform: uppercase;
  /* The alpha lives in the rule and has its own control. A colour bound to the
     Ink global emits a solid value, and an alpha left only in a CSS fallback
     never runs. */
  color: color-mix(in oklch, var(--ge-pclose-eb-color, var(--ge-ink)) var(--ge-pclose-eb-alpha, 70%), transparent);
}
.ge-pclose__rule {
  display: block; flex: none;
  height: var(--ge-pclose-rule-h, 1px);
  width: var(--ge-pclose-rule-w, 36px);
  background: var(--ge-pclose-rule-color, var(--ge-green));
}

.ge-pclose__heading {
  margin: 0;
  max-width: var(--ge-pclose-h-measure, 14ch);
  font-family: var(--ge-type-h2-wide-family, var(--ge-font-display, "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif));
  /* The h2-wide token is clamp(1.9rem, 3vw, 2.7rem) at 800 / 1.05 / -0.035em,
     which is exactly this heading, so the typography group IS bound to the
     global here. Binding a group whose size does not match the design is how
     three blocks quietly grew by a few pixels each. */
  font-size: var(--ge-type-h2-wide-size, clamp(1.9rem, 3vw, 2.7rem));
  font-weight: var(--ge-type-h2-wide-weight, 800);
  line-height: var(--ge-type-h2-wide-lh, 1.05);
  letter-spacing: var(--ge-type-h2-wide-lsp, -0.035em);
  color: var(--ge-pclose-h-color, var(--ge-ink));
  text-wrap: balance;
}

.ge-pclose__standfirst {
  margin: var(--ge-pclose-sf-gap, 24px) 0 0;
  max-width: var(--ge-pclose-sf-measure, 42ch);
  /* 15.5px matches the body-large token but its line height is 1.625 against
     the design's 1.65, so the group is left unbound and both values sit here. */
  font-size: var(--ge-pclose-sf-size, 15.5px);
  line-height: var(--ge-pclose-sf-lh, 1.65);
  color: var(--ge-pclose-sf-color, var(--ge-body));
}

.ge-pclose__actions {
  display: flex; flex-wrap: wrap;
  gap: var(--ge-pclose-btn-gap, 12px);
  margin-top: var(--ge-pclose-act-gap, 32px);
}

/* ------------------------------------------------------------------ band -- */

/* The curved edge is a large radius on the leading corners only, which is
   predictable at every width, rather than a clip path whose shape changes with
   the aspect ratio of the column.
   min-height is what reserves this box, not the image, which is why the image
   may be lazy here and the hero's structural render may not. */
.ge-pclose__band {
  position: relative;
  height: 100%;
  min-height: var(--ge-pclose-band-min-h, 280px);
  overflow: hidden;
  border-radius: var(--ge-pclose-band-corner, var(--ge-radius-band, 26px));
}
@media (min-width: 1024px) {
  .ge-pclose__band {
    /* Both of these are SINGLE value sliders, not dimensions controls, because
       the side by side radius is composed from them: a dimensions control emits
       all four corners at once, and dropping four values into one corner of a
       shorthand produces nine numbers and an invalid declaration. Two numbers,
       two sliders, and the trailing corners stay welded to the base radius
       instead of being a third value to keep in agreement. */
    border-radius:
      var(--ge-pclose-band-curve, 120px)
      var(--ge-pclose-band-corner, var(--ge-radius-band, 26px))
      var(--ge-pclose-band-corner, var(--ge-radius-band, 26px))
      var(--ge-pclose-band-curve, 120px);
  }
}

/* The band selector is here for SPECIFICITY, not for scoping.
 *
 * Elementor's own base stylesheet carries `.elementor img { height: auto; }`,
 * which is (0,1,1) and beats a bare `.ge-pclose__img` at (0,1,0). So `height:
 * 100%` silently lost and the photograph sized to its intrinsic aspect ratio
 * instead. On desktop the band is short enough that nobody noticed. At 390px
 * the band is held open at its 280px min-height while the image drew only
 * 144px, so the bottom 136px was scrim over the panel background, and the four
 * white words sat on that pale strip 44px below the photo, well under 2:1
 * contrast. Measured on /ge-solar/ at 390: band 280, img 144.109, words
 * bottom +44.
 *
 * `.ge-pclose__band .ge-pclose__img` is (0,2,0) and wins. Same trap as the
 * editor overrides noted in ELEMENTOR-PLAYBOOK.md: a bundled base rule beats a
 * single class, so anything a bundle also targets needs a compound selector. */
.ge-pclose__band .ge-pclose__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: var(--ge-pclose-img-fit, cover);
  object-position: var(--ge-pclose-img-pos, center center);
}

/* A scrim, because the type has to hold whatever the photograph does behind it
   and a light word on a bright sky does not. A gradient rather than an opacity
   on the image: an opacity would dim the photograph everywhere instead of only
   under the words. */
.ge-pclose__scrim {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to left, color-mix(in oklch, var(--ge-pclose-scrim-color, var(--ge-dark)) var(--ge-pclose-scrim-from, 55%), transparent), color-mix(in oklch, var(--ge-pclose-scrim-color, var(--ge-dark)) var(--ge-pclose-scrim-via, 25%), transparent), transparent);
}

/* Real text, set in the mono face the eyebrows use, not a plate with the words
   baked in. A plate cannot be edited, cannot be read aloud and cannot reflow,
   and this line changes per product. */
.ge-pclose__words {
  position: absolute;
  right: var(--ge-pclose-words-x, 8%);
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  text-align: right;
  font-family: var(--ge-font-mono, "IBM Plex Mono", ui-monospace, Menlo, monospace);
  font-size: var(--ge-pclose-words-size, clamp(10px, 1vw, 13px));
  letter-spacing: var(--ge-pclose-words-lsp, 0.2em);
  line-height: var(--ge-pclose-words-lh, 2.4);
  text-transform: uppercase;
  color: var(--ge-pclose-words-color, #fff);
}
.ge-pclose__word { display: block; }
