/* ==========================================================================
   Bridge between Elementor (free) markup and the Cokolex design system.
   Layout comes from Elementor container settings; look comes from our
   tokens and component classes. Loaded after Elementor's frontend CSS.
   ========================================================================== */

/* Headings whose look comes from a class on the widget (label, card title,
   key figure, CTA heading): the heading element inside inherits that look
   instead of the h1/h2 base styles or the browser's h3 defaults. */
:is(.eyebrow, .why-card__title, .stat-tile__value, .stat-tile__label, .cta-card__heading, .brand-panel__tag, .contact-info-item__value) .elementor-heading-title {
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; line-height: inherit; margin: 0;
}

/* Buttons: Elementor's button widget with our .btn look via wrapper classes */
.cx-btn .elementor-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 var(--space-5);
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font-family: var(--font-sans); font-weight: var(--weight-medium); font-size: var(--text-sm); line-height: 1;
  white-space: nowrap;
  transition: var(--transition-control), transform var(--duration-fast) var(--ease-standard);
}
.cx-btn .elementor-button:active { transform: translateY(1px); }
.cx-btn--lg .elementor-button { height: 48px; padding: 0 var(--space-6); font-size: var(--text-md); }
.cx-btn--sm .elementor-button { height: 36px; padding: 0 var(--space-4); }
.cx-btn--primary .elementor-button { background: var(--brand-primary); color: var(--white); }
.cx-btn--primary .elementor-button:hover { background: var(--brand-deep); color: var(--white); }
.cx-btn--secondary .elementor-button { background: var(--surface-card); color: var(--text-strong); border-color: var(--border-default); }
.cx-btn--secondary .elementor-button:hover { background: var(--surface-sunken); color: var(--text-strong); }
.cx-btn--inverse .elementor-button { background: var(--white); color: var(--blue-600); }
.cx-btn--inverse .elementor-button:hover { background: rgba(255,255,255,0.86); color: var(--blue-600); }

/* Our layout classes own the spacing: Elementor's default container padding
   and widget gap (set on the kit) are zeroed for everything inside a page. */
.elementor {
  --container-default-padding-top: 0px; --container-default-padding-right: 0px;
  --container-default-padding-bottom: 0px; --container-default-padding-left: 0px;
  --widgets-spacing: 0px; --widgets-spacing-row: 0px; --widgets-spacing-column: 0px;
}

/* Labels sitting directly on the grey page ground (contrast, see pages.css) */
.elementor > .section .eyebrow:not(.card .eyebrow):not(.eyebrow--invert) { color: var(--text-body); }

/* An HTML widget holding just a badge or the logo: as a flex box the element no
   longer sits on a text line, whose line height would push it down a few pixels. */
.elementor-widget-html:has(> :is(.badge, .logo):only-child) { display: flex; }

/* Hero: the stage (brand motif) positions against .hero-home, not its widget */
.hero-home > .elementor-widget-html { position: static; }

/* Paragraphs that share one text widget keep the rhythm of separate blocks */
.about-grid__copy p + p { margin-top: var(--space-5); }

/* TecDoc panel: answer title sits closer to its text; button gets air */
.tecdoc-feature__copy .elementor-widget-heading:has(h3) + .elementor-widget-text-editor { margin-top: calc(var(--space-3) - var(--space-5)); }
.tecdoc-feature__copy .cx-btn { margin-top: var(--space-3); }

/* Mobile: hero buttons stack full width, as on the static site (our 860px
   breakpoint; body prefix outranks the row setting stored in post-N.css). */
@media (max-width: 860px) {
  body .elementor .hero-home__actions.e-con { --flex-direction: column; --align-items: stretch; flex-direction: column; align-items: stretch; }
  .hero-home__actions .cx-btn .elementor-button { width: 100%; }
}

/* The kit (post-6.css) sets a 20px widget/container gap on EVERY
   .elementor-element, so the reset has to sit on the elements themselves. */
.elementor .elementor-element {
  --widgets-spacing: 0px; --widgets-spacing-row: 0px; --widgets-spacing-column: 0px;
}

/* Elementor uses ::before on containers for its background overlay
   (opacity from --overlay-opacity, 100% width/height). Our hero light pool
   lives on that pseudo-element, so give it back its own box and opacity. */
.hero-home.e-con::before { opacity: 1; width: auto; height: auto; }

/* ---- TecDoc page ---- */
.hero-split__copy .cx-btn { margin-top: var(--space-3); }
.tab-panel-grid .elementor-widget-text-editor p { font-size: var(--text-lg); color: var(--text-body); }

/* Image widgets (cx-media + cx-ratio-*).
   - Placeholder: framed box at the design's aspect ratio.
   - Real image on a light section: the TecDoc images are cut-outs (transparent
     PNG/WebP, trimmed to their content), so they stand on the page ground with
     no frame, at their own proportion.
   - Real image in a pair (.grid-2): both share one box and are contained in it,
     so a square and a landscape composite read at the same visual weight.
   - Dark card grid: the frame stays as a glass tile; the icon is contained with
     an inset so it is never cropped and all tiles match. */
.cx-media img {
  display: block; width: 100%; height: auto; aspect-ratio: auto; object-fit: contain; object-position: center;
  border-radius: var(--radius-xl); border: 1px solid var(--border-default); background: var(--surface-sunken);
}
.cx-media img[src*="placeholder"] { aspect-ratio: var(--cx-ratio, auto); object-fit: cover; }
.cx-media:not(.cx-media--dark) img:not([src*="placeholder"]) { border: 0; border-radius: 0; background: none; }
@media (min-width: 861px) { .grid-2 > .cx-media img:not([src*="placeholder"]) { aspect-ratio: 5 / 4; } }
.cx-media--dark img {
  aspect-ratio: var(--cx-ratio, auto); padding: var(--space-5);
  border-color: rgba(255,255,255,0.16); background: rgba(255,255,255,0.08);
}
.cx-media--dark img[src*="placeholder"] { padding: 0; }
/* Mirrored text/media row (image first): the image keeps the wider track, so
   every row shows its image at the same size. */
@media (min-width: 861px) { .tab-panel-grid:has(> .cx-media:first-child) { grid-template-columns: 1.2fr 1fr; } }
/* Cut-out in the split hero: the image grows into the right-hand margin (never
   closer than --space-6 to the viewport edge) so it matches the copy's height
   without narrowing the headline column. */
.hero-split__inner > .cx-media--cutout {
  --cx-bleed: max(0px, min(11rem, (100vw - var(--page-max)) / 2 + var(--page-gutter) - var(--space-6)));
  width: auto; max-width: none; margin-right: calc(-1 * var(--cx-bleed));
}
@media (max-width: 860px) { .hero-split__inner > .cx-media--cutout { margin-right: 0; } }
.cx-media figure { margin: 0; }
.cx-media figcaption { text-align: left; }
.cx-ratio-1024-713 { --cx-ratio: 1024 / 713; }
.cx-ratio-1920-1044 { --cx-ratio: 1920 / 1044; }
.cx-ratio-750-535 { --cx-ratio: 750 / 535; }
.cx-ratio-744-695 { --cx-ratio: 744 / 695; }
.cx-ratio-1-1 { --cx-ratio: 1 / 1; }
.cx-ratio-4-3 { --cx-ratio: 4 / 3; }

/* Video widget framed like the other media, play button in CI */
.cx-video { width: 100%; max-width: var(--site-measure-headline); margin-inline: auto; }
.cx-video .elementor-wrapper { border-radius: var(--radius-xl); overflow: hidden; border: 1px solid var(--border-default); }
.cx-video .elementor-custom-embed-play {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--surface-card); border: 1px solid var(--border-default);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition-control);
}
.cx-video .elementor-custom-embed-play svg,
.cx-video .elementor-custom-embed-play i {
  width: 22px; height: 22px; font-size: 22px; margin-left: 3px;
  fill: var(--brand-primary); color: var(--brand-primary); filter: none; opacity: 1;
}
.cx-video .elementor-custom-embed-image-overlay:hover .elementor-custom-embed-play { border-color: var(--border-brand); }

/* ---- Contact page ---- */
.contact-copy > .elementor-widget-text-editor { max-width: var(--site-measure-text); }
.contact-copy > .elementor-widget-text-editor p { font-size: var(--text-lg); color: var(--text-body); }
/* The form is an HTML widget; the widget takes the form's place in the grid */
.contact-grid > .elementor-widget-html:has(> .contact-form) { grid-area: form; }
/* Honeypot field against spam bots: out of sight, out of the tab order */
.cx-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* Without JavaScript the server sends the visitor back to #contactToast */
.toast:target { transform: translateY(0); opacity: 1; pointer-events: auto; }
