/*
 * DesignFirst. Three columns: intro, the design tool on a backing plate, and
 * what we look at. Transcribed from src/components/product/DesignFirst.tsx.
 *
 * Every value reads a --ge-* property whose fallback is the original design
 * value, so an untouched widget is pixel-identical to the React original and a
 * control only ever overrides the fallback.
 */

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

/*
 * The React grid is 0.9fr / 1.25fr / 0.85fr at a 40px gap. `fr` divides what is
 * left after the gaps, a percentage divides the whole track, so the two agree at
 * exactly one width: these are solved at the 1280px content box a 1320px frame
 * gives at a 20px gutter. 3fr total, gaps 2 x 40 = 80, so 1200px of free space
 * splits 360 / 500 / 340, which against 1280 is 28.125% / 39.0625% with the
 * third column taking the remainder as 1fr. Same approach and the same caveat as
 * Systems: below 1360 the thirds drift by a few pixels.
 *
 * minmax(0, ...) on every track, so a track holding something wide cannot refuse
 * to shrink and push the page sideways.
 */
.ge-df__grid {
  display: grid;
  align-items: var(--ge-df-align, center);
  gap: var(--ge-df-gap, 40px);
}
@media (min-width: 1024px) {
  .ge-df__grid {
    grid-template-columns:
      minmax(0, var(--ge-df-col1, 28.125%))
      minmax(0, var(--ge-df-col2, 39.0625%))
      minmax(0, 1fr);
  }
}

/*
 * The standfirst on this section is the body-lg size against the shared intro's
 * body size, and its measure is 46ch against the shared 34ch. Both read the same
 * custom properties the intro's own controls write, so those controls still
 * drive them: only the design fallback differs, scoped to this section.
 *
 * The React source draws it at line-height 1.65. The body-lg token is 1.625,
 * which is what is used here: a hand-written 1.65 would be the eleventh
 * unexplained line-height in the project, and the difference is a quarter of a
 * pixel at this size.
 */
.ge-df .ge-intro__standfirst {
  max-width: var(--ge-intro-sf-measure, 46ch);
  font-size: var(--ge-type-body-lg-size, 15.5px);
  line-height: var(--ge-type-body-lg-lh, 1.625);
}

/* ------------------------------------------------------------- artwork -- */

.ge-df__art { position: relative; }

.ge-df__plate {
  position: absolute;
  z-index: -1;
  left: var(--ge-df-plate-x, 32px);
  right: var(--ge-df-plate-x, 32px);
  top: var(--ge-df-plate-t, 40px);
  bottom: var(--ge-df-plate-b, 24px);
  border-radius: var(--ge-df-plate-radius, var(--ge-radius-xl2, 28px));
  background: var(--ge-df-plate-bg, var(--ge-panel));
}

/*
 * The cast shadow is on this wrapper and not on the image, because the image
 * carries image_style()'s CSS Filter group. Two `filter` declarations on one
 * selector means the later replaces the earlier, so a marketer nudging
 * brightness would have silently deleted the shadow.
 */
.ge-df__shot-wrap {
  display: block;
  filter: drop-shadow(0 var(--ge-df-shot-shadow-y, 34px) var(--ge-df-shot-shadow-blur, 60px) color-mix(in oklch, var(--ge-df-shot-shadow-color, var(--ge-ink)) var(--ge-df-shot-shadow-alpha, 38%), transparent));
}

/*
 * Structural. It is the whole visual of the section, so it is loaded eagerly and
 * reserves its box here as well as through its width and height attributes. A
 * lazy image with no reserved box has nothing to intersect the viewport with, so
 * the browser never schedules the fetch, so the box never gets a height, and it
 * waits for ever. The ratio is the artwork's own 1536 by 1024, and it is also
 * the default on the image_style ratio control so the two cannot disagree.
 */
.ge-df__shot {
  display: block;
  margin-inline: auto;
  width: 100%;
  max-width: var(--ge-df-shot-max, 560px);
  height: auto;
  aspect-ratio: 3 / 2;
  border-radius: var(--ge-df-shot-radius, var(--ge-radius-lg, 20px));
}

/* ------------------------------------------------- the floating figure -- */

/*
 * Bleeds out of its column to the left, so its offset has to stay inside the
 * section gutter or it overhangs the viewport.
 *
 *   below 768: offset 0, gutter 12px at 390. Card left edge sits on the column
 *              edge, 12px in. 210px wide in a 366px column at 390. No overflow.
 *   768 and up: offset -16px against a 20px gutter, so the card lands 4px inside
 *              the viewport. No overflow.
 *
 * The switch is at 768 rather than at the React original's 640 so that this
 * fallback and the control's mobile default agree at every width: Elementor's
 * mobile breakpoint is max-width 767. Changing the gutter means changing the
 * offset with it.
 */
.ge-df__float {
  position: absolute;
  bottom: var(--ge-df-float-y, -16px);
  left: var(--ge-df-float-x, 0px);
  box-sizing: border-box;
  width: var(--ge-df-float-w, 210px);
  padding: var(--ge-df-float-pad, 16px);
  border: var(--ge-df-float-border-w, 1px) solid var(--ge-df-float-border, var(--ge-hair));
  border-radius: var(--ge-df-float-radius, var(--ge-radius-lg, 20px));
  background: var(--ge-df-float-bg, var(--ge-card));
  box-shadow: var(--ge-df-float-shadow, var(--ge-shadow-float));
}
@media (min-width: 768px) {
  .ge-df__float { left: var(--ge-df-float-x, -16px); }
}

/* Ink at 70% on Card is 6.72:1. Body at 70% would be 3.55:1 and fail, which is
   why the alpha lives on the label and not on the copy underneath it. */
.ge-df__float-label {
  margin: 0;
  font-family: var(--ge-font-mono);
  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);
  line-height: var(--ge-type-micro-lh, 1.55);
  text-transform: uppercase;
  color: color-mix(in oklch, var(--ge-df-float-label-color, var(--ge-ink)) var(--ge-df-float-label-alpha, 70%), transparent);
}

.ge-df__float-figure {
  margin: var(--ge-df-float-figure-gap, 6px) 0 0;
  font-family: var(--ge-font-display);
  font-size: 17px;
  font-weight: var(--ge-type-figure-weight, 800);
  line-height: 1.25;
  letter-spacing: var(--ge-type-figure-lsp, -0.03em);
  color: var(--ge-df-float-figure-color, var(--ge-ink));
}

/* The estimate note is a caption, not an eyebrow, so it is the body face at full
   strength: 7.43:1 on Card. Set as the mono label in body/70 it was 3.55:1. */
.ge-df__float-note {
  margin: var(--ge-df-float-note-gap, 8px) 0 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ge-df-float-note-color, var(--ge-body));
}

/* ------------------------------------------------- what we look at rows -- */

.ge-df__list {
  display: flex;
  flex-direction: column;
  gap: var(--ge-df-item-gap, 16px);
}

.ge-df__item {
  display: flex;
  align-items: flex-start;
  gap: var(--ge-df-badge-gap, 12px);
}

.ge-df__badge {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--ge-df-badge-size, 36px);
  height: var(--ge-df-badge-size, 36px);
  border-radius: var(--ge-df-badge-radius, var(--ge-radius-pill, 999px));
  border: var(--ge-df-badge-border-w, 1px) solid var(--ge-df-badge-border, var(--ge-hair));
  background: var(--ge-df-badge-bg, var(--ge-card));
  color: var(--ge-df-badge-fg, var(--ge-ink));
}

.ge-df__icon {
  width: var(--ge-df-icon-size, 17px);
  height: var(--ge-df-icon-size, 17px);
}

/* min-width: 0, so a long line cannot refuse to shrink and push the page
   sideways at 390. */
.ge-df__text {
  min-width: 0;
  padding-top: var(--ge-df-text-nudge, 2px);
}

.ge-df__label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ge-df-label-color, var(--ge-ink));
}

/* Body at full strength is 6.92:1 on Page. At 70% it would be 3.40:1 and fail
   4.5:1, as it does on all three of this project's light surfaces. */
.ge-df__body {
  display: block;
  margin-top: var(--ge-df-body-gap, 4px);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ge-df-body-color, var(--ge-body));
}

/* ---------------------------------------------------------- the reveal -- */

/*
 * Inverted, and this is the order that matters.
 *
 * The section renders VISIBLE. designfirst.js adds data-reveal, which is the
 * thing that hides it, then data-in, which animates it back. No script, a script
 * that errors, or an observer that never fires all leave a finished section,
 * which is the correct failure. The other way round has cost this project a
 * blank section three times.
 */
.ge-df[data-reveal] .ge-df__copy,
.ge-df[data-reveal] .ge-df__art,
.ge-df[data-reveal] .ge-df__item { opacity: 0; }
.ge-df[data-reveal] .ge-df__copy,
.ge-df[data-reveal] .ge-df__art { transform: translate3d(0, 28px, 0); }
.ge-df[data-reveal] .ge-df__item { transform: translate3d(0, 26px, 0); }

@media (prefers-reduced-motion: no-preference) {
  .ge-df[data-in] .ge-df__copy,
  .ge-df[data-in] .ge-df__art,
  .ge-df[data-in] .ge-df__item {
    animation: ge-df-in var(--ge-df-reveal-dur, var(--ge-dur-reveal, 660ms)) var(--ge-df-reveal-ease, var(--ge-ease-out)) forwards;
  }
  /* The React original holds the artwork back by 0.08s and staggers the rows by
     0.06s. Both are controls, so neither is a number hidden in a keyframe. */
  .ge-df[data-in] .ge-df__art { animation-delay: var(--ge-df-art-delay, 80ms); }
  .ge-df[data-in] .ge-df__item { animation-delay: calc(var(--ge-df-i, 0) * var(--ge-df-stagger, 60ms)); }
}
@keyframes ge-df-in { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .ge-df[data-reveal] .ge-df__copy,
  .ge-df[data-reveal] .ge-df__art,
  .ge-df[data-reveal] .ge-df__item { opacity: 1; transform: none; }
}

/*
 * A reveal that replays on every panel keystroke is unusable in the editor.
 *
 * The [data-reveal] selector above is a class, an attribute and a class, so an
 * editor override has to carry the attribute too or it loses on specificity and
 * the canvas sits at opacity 0 until the observer happens to fire. Dropping the
 * attribute here is not a tidier way of writing the same rule; it is a rule that
 * does nothing.
 */
.elementor-editor-active .ge-df[data-reveal] .ge-df__copy,
.elementor-editor-active .ge-df[data-reveal] .ge-df__art,
.elementor-editor-active .ge-df[data-reveal] .ge-df__item { opacity: 1; transform: none; animation: none; }
