/* Coqpit Hero Section - structural styles (colors/typography/spacing come from Elementor controls) */

.coqpit-hero {
    --coqpit-hero-cols: 4;
    --coqpit-hero-rows: 3;
    --coqpit-hero-skew: 9.2;
    --coqpit-hero-round: 6px;
    --coqpit-hero-frame: #191c2a;

    position: relative;
    width: 100%;
    height: 100vh;
    height: 100svh;
    font-family: 'Manrope', sans-serif;
}

/* ScrollTrigger pins this element (position:fixed at runtime, with its own spacer). */
.coqpit-hero__pin {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #191c2a;
}

.coqpit-hero__stage {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 1;
}

.coqpit-hero__media {
    object-position: center center;
    transform-origin: 50% 50%;
    will-change: transform;
}

/* Layout props on a stronger selector: Elementor/themes ship `img { height: auto; max-width: 100% }`
   (specificity 0,1,1) which otherwise wins, lets the image keep its own ratio and makes
   object-fit / object-position (the "Cadrage" setting) do nothing. object-position stays on the
   weak rule above so the Elementor control (0,2,0) can override it. */
.coqpit-hero .coqpit-hero__stage .coqpit-hero__media {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
}

.coqpit-hero__overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.coqpit-hero__content {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 80px 40px;
    text-align: center;
    pointer-events: none;
}

.coqpit-hero__text {
    width: 100%;
    max-width: 100%;
}

.coqpit-hero__eyebrow {
    margin: 0 0 16px;
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
}

.coqpit-hero__title {
    margin: 0 0 24px;
    font-family: 'Merca', sans-serif;
    font-size: 11vw;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    color: #fff;
}

.coqpit-hero__description {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
}

/* Word-by-word reveal: each word is clipped by its own wrapper (see JS) */
.coqpit-hero__word {
    display: inline-block;
    overflow: hidden;
    padding: 0.12em 0;
    margin: -0.12em 0;
    vertical-align: top;
}

.coqpit-hero__word-inner {
    display: inline-block;
    will-change: transform;
}

/* Tiles: JS creates them; polygons start collapsed so nothing shows without JS */
.coqpit-hero__tiles {
    position: absolute;
    inset: 0;
    z-index: 5;
    overflow: hidden;
    pointer-events: none;
}

.coqpit-hero.is-static .coqpit-hero__tiles {
    display: none;
}

.coqpit-hero__tile {
    position: absolute;
    inset: 0;
    background-color: #191c2a;
    background-size: cover;
    background-position: center;
    clip-path: polygon(0 0, 0 0, 0 0, 0 0);
    will-change: clip-path;
}

.coqpit-hero__cover {
    position: absolute;
    inset: 0;
    background-color: rgba(10, 12, 20, 0); /* TEST: transparent for now (was #0a0c14) */
    will-change: clip-path;
}

/* Cut corner */
.coqpit-hero__corner {
    position: absolute;
    z-index: 6;
    display: flex;
    box-sizing: border-box;
    background-color: #191c2a;
}

.coqpit-hero__corner--br {
    --coqpit-btn-slant: 9.4px;
    --coqpit-btn-h: 65px;
    --coqpit-btn-angle: 8.2deg;

    right: 0;
    bottom: 0;
    align-items: flex-end;
    padding: 12px 0 0 12px;
    background: none;
}

/* Same slope as the button, whatever its size (trigonometric functions need a recent browser) */
@supports (transform: skewX(atan2(1px, 2px))) {
    .coqpit-hero__corner--br {
        --coqpit-btn-angle: atan2(var(--coqpit-btn-slant), var(--coqpit-btn-h));
    }
}

/* The notch: a slanted block with a rounded top-left corner, pinned to the bottom-right of the hero */
.coqpit-hero__corner--br::before {
    content: '';
    position: absolute;
    z-index: 0;
    inset: 0;
    background-color: #191c2a;
    border-top-left-radius: 6px;
    transform-origin: 0 100%;
    transform: skewX(calc(-1 * var(--coqpit-btn-angle)));
}

.coqpit-hero__corner--br > * {
    position: relative;
    z-index: 1;
}

.coqpit-hero__button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 195px;
    height: 65px;
    padding: 0 40px;
    text-decoration: none;
    transition: min-width 0.45s ease, padding 0.45s ease;
}

.coqpit-hero__button-shape {
    position: absolute;
    top: 0;
    bottom: 0;
    /* A skewed box sticks out by half the slant on each side: keep the total width as set */
    left: calc(var(--coqpit-btn-slant, 9.4px) / 2);
    right: calc(var(--coqpit-btn-slant, 9.4px) / 2);
    background-color: #e10b17;
    border-radius: 5.6px;
    transform: skewX(calc(-1 * var(--coqpit-btn-angle, 8.2deg)));
    transition-property: background-color;
    transition-duration: 250ms;
    transition-timing-function: ease;
}

.coqpit-hero__button-label {
    position: relative;
    font-size: 14px;
    font-weight: 800;
    line-height: normal;
    text-transform: uppercase;
    white-space: nowrap;
    color: #fff;
    max-width: var(--coqpit-label-w, 400px);
    overflow: hidden;
    transition: color 250ms ease, max-width 0.45s ease, opacity 0.3s ease;
}

/* ---- Rounded image corners next to the cut corners ----
   Small squares painted in the frame colour, with a transparent quarter circle: they round
   the image where it meets a notch. */
.coqpit-hero__round {
    position: absolute;
    z-index: 5;
    width: var(--coqpit-hero-round);
    height: var(--coqpit-hero-round);
    pointer-events: none;
}

/* Above the button's notch, against the right edge */
.coqpit-hero__round--top {
    right: 0;
    top: calc(-1 * var(--coqpit-hero-round));
    background: radial-gradient(circle at 0 0, transparent var(--coqpit-hero-round), var(--coqpit-hero-frame) calc(var(--coqpit-hero-round) + 0.5px));
}

/* Left of the notch, against the bottom edge: same slope as the notch edge */
.coqpit-hero__round--side {
    right: 100%;
    bottom: 0;
    transform-origin: 100% 100%;
    transform: skewX(calc(-1 * var(--coqpit-btn-angle)));
    background: radial-gradient(circle at 0 0, transparent var(--coqpit-hero-round), var(--coqpit-hero-frame) calc(var(--coqpit-hero-round) + 0.5px));
}

/* Next to the header's logo corner: placed by the script (hidden until then) */
.coqpit-hero__round--logo-top,
.coqpit-hero__round--logo-left {
    display: none;
    z-index: 5;
}

.coqpit-hero__round--logo-top {
    transform-origin: 0 0;
    background: radial-gradient(circle at 100% 100%, transparent var(--coqpit-hero-round), var(--coqpit-hero-frame) calc(var(--coqpit-hero-round) + 0.5px));
}

.coqpit-hero__round--logo-left {
    background: radial-gradient(circle at 100% 100%, transparent var(--coqpit-hero-round), var(--coqpit-hero-frame) calc(var(--coqpit-hero-round) + 0.5px));
}

/* ---- Button that shrinks to its icon and stays fixed while scrolling (the script adds the classes) ---- */
.coqpit-hero__button-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0;
    margin-right: 0;
    overflow: hidden;
    opacity: 0;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    transition: width 0.45s ease, margin 0.45s ease, opacity 0.3s ease;
}

.coqpit-hero__button-icon i,
.coqpit-hero__button-icon svg {
    display: block;
    width: 1em;
    height: 1em;
    fill: currentColor;
}

.coqpit-hero__corner--br.is-docked {
    --coqpit-dock-r: 20px;
    --coqpit-dock-b: 20px;

    position: fixed;
    right: var(--coqpit-dock-r);
    bottom: var(--coqpit-dock-b);
    z-index: 80;
    transition: right 0.4s ease, bottom 0.4s ease, padding 0.4s ease, opacity 0.25s ease;
}

/* Hidden while the window is being resized (see the script) */
.coqpit-hero__corner--br.is-docked.is-resizing {
    opacity: 0;
    transition: none;
}

/* As soon as the page scrolls the button takes its fixed place for good and the notch fades out */
.coqpit-hero__corner--br.is-docked.is-compact {
    right: var(--coqpit-dock-right, 24px);
    bottom: var(--coqpit-dock-bottom, 24px);
    padding: 0;
}

.coqpit-hero__corner--br::before {
    transition: opacity 0.35s ease;
}

.coqpit-hero__corner--br.is-compact::before,
.coqpit-hero__corner--br.is-compact .coqpit-hero__round {
    opacity: 0;
}

/* Reduced: only the icon. Hover (or a first tap on touch screens) shows the label again. */
.coqpit-hero__corner--br.is-compact .coqpit-hero__button-icon,
.coqpit-hero__corner--br.is-hover .coqpit-hero__button-icon {
    width: 1em; /* follows the icon size setting */
    opacity: 1;
}

.coqpit-hero__corner--br.is-hover .coqpit-hero__button-icon {
    /* also when the button is not reduced yet (top of the page): the icon slides in on hover */
    margin-right: var(--coqpit-icon-gap, 10px);
}

.coqpit-hero__corner--br.is-compact:not(.is-hover) .coqpit-hero__button {
    /* !important: the width/padding controls (Elementor, same specificity) would otherwise win */
    min-width: 0 !important;
    padding: 0 calc(var(--coqpit-btn-slant, 9.4px) + 24px) !important;
}

.coqpit-hero__corner--br.is-compact:not(.is-hover) .coqpit-hero__button-label {
    max-width: 0;
    opacity: 0;
}

/* Icon always shown in front of the label (option), and in the editor so that its spacing can be adjusted */
.coqpit-hero__corner--icon .coqpit-hero__button-icon,
.elementor-editor-active .coqpit-hero__button-icon {
    width: 1em;
    margin-right: var(--coqpit-icon-gap, 10px);
    opacity: 1;
}

/* ...but the reduced button shows the icon alone */
.coqpit-hero__corner--br.is-compact:not(.is-hover) .coqpit-hero__button-icon {
    margin-right: 0;
}

@media (prefers-reduced-motion: reduce) {
    .coqpit-hero__button,
    .coqpit-hero__button-label,
    .coqpit-hero__button-icon,
    .coqpit-hero__corner--br.is-docked,
    .coqpit-hero__corner--br::before {
        transition: none;
    }
}
