/* ==========================================================================
   eGateweb — Shared sub-page primitives
   --------------------------------------------------------------------------
   Blocks every inner page reuses: the page hero, the stats strip, the closing
   CTA band and form controls. Page-specific layout stays in css/eg-{page}.css.

   Depends on css/eg-base.css. No hardcoded colors — see inc/eg-colors.php.
   ========================================================================== */

/* ==========================================================================
   PAGE HERO
   ========================================================================== */
.eg-phero {
    position: relative;
    padding-block: 64px 72px;
    background: var(--eg-bg);
    overflow: hidden;
}

.eg-phero::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -5%;
    width: 55vw;
    height: 130%;
    background: radial-gradient(closest-side,
                rgba(var(--eg-brand-rgb), .10), transparent 100%);
    pointer-events: none;
    z-index: 0;
}

.eg-phero__inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 56px;
    align-items: center;
}

.eg-phero h1 {
    font-size: clamp(1.9rem, 4vw, 3rem);
    line-height: 1.12;
}

.eg-phero__text {
    margin-top: 18px;
    font-size: 1.05rem;
    color: var(--eg-muted);
    max-width: 52ch;
}

.eg-phero__actions {
    margin-top: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.eg-phero__img {
    width: 100%;
    aspect-ratio: 4 / 3.2;
    object-fit: cover;
    border-radius: var(--eg-radius-lg);
    box-shadow: var(--eg-shadow-lg);
}

/* ---- Centered variant (no image) ---- */
.eg-phero--center { text-align: center; }

.eg-phero__narrow {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin-inline: auto;
}

.eg-phero--center .eg-phero__text {
    margin-inline: auto;
}

/* ==========================================================================
   FULL-BLEED IMAGE HERO (shared by /diensten and every service page)
   --------------------------------------------------------------------------
   Deliberately different from the other page heroes: the photo fills the whole
   block instead of sitting in a column. Text goes white on top, so everything
   here depends on the overlay doing its job.
   ========================================================================== */
.eg-dhero {
    /* Fallback behind the image: if the photo is slow or missing, the text is
       still white on a dark panel rather than white on white. */
    position: relative;
    display: grid;
    place-items: center;
    min-height: 460px;
    padding-block: 84px;
    overflow: hidden;
    background-color: var(--eg-dark);
    text-align: center;
}

.eg-dhero__bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Slight zoom keeps the photo from looking flat at wide aspect ratios. */
    transform: scale(1.02);
}

/*
 * The overlay. --eg-overlay is set inline per page from the Customizer (0–1);
 * the COLOR comes from the palette, so the hero rebrands with the site.
 *
 * The text is centered, so the CENTER must be the darkest part — a vignette
 * that clears the middle would leave the headline sitting on the busiest part
 * of the photo. Base layer is a flat wash at the chosen strength; the radial on
 * top adds a little extra right behind the text and eases off toward the edges,
 * which keeps the photo readable without ever going lighter than the wash.
 */
.eg-dhero__veil {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(85% 70% at 50% 50%,
            rgba(var(--eg-dark-rgb), calc(var(--eg-overlay, .65) * .45)) 0%,
            rgba(var(--eg-dark-rgb), calc(var(--eg-overlay, .65) * .18)) 60%,
            rgba(var(--eg-dark-rgb), 0) 100%),
        linear-gradient(180deg,
            rgba(var(--eg-dark-rgb), calc(var(--eg-overlay, .65) * 1.06)) 0%,
            rgba(var(--eg-dark-rgb), var(--eg-overlay, .65)) 50%,
            rgba(var(--eg-dark-rgb), calc(var(--eg-overlay, .65) * 1.06)) 100%);
}

.eg-dhero .eg-container {
    position: relative;
    z-index: 1;
}

.eg-dhero__inner {
    max-width: 760px;
    margin-inline: auto;
}

/* White heading — this hero sits on a photo, not on --eg-bg.
   The shadow is a safety net: the client can swap in any photo, and a bright
   one would otherwise wash the text out no matter what the overlay does. */
.eg-dhero h1 {
    color: #fff;
    font-size: clamp(2rem, 4.4vw, 3.2rem);
    line-height: 1.1;
    text-wrap: balance;
    text-shadow: 0 2px 18px rgba(var(--eg-dark-rgb), .55);
}

/* The brand highlight needs its own tint here. The full brand color is too dark
   to read on a darkened photo, and the pale Soft tint is so close to white that
   the highlight disappears entirely — which is exactly what happened first. */
.eg-dhero h1 .eg-hl { color: var(--eg-brand-light); }

.eg-dhero__text {
    margin-top: 20px;
    margin-inline: auto;
    max-width: 60ch;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #fff;
    text-shadow: 0 1px 12px rgba(var(--eg-dark-rgb), .6);
}

.eg-dhero__actions {
    margin-top: 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
}

/* Eyebrow variant for dark backgrounds: the default pill uses brand-soft,
   which disappears against a photo. */
.eg-eyebrow--light {
    background: rgba(255, 255, 255, .14);
    color: #fff;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, .2);
}

/* ==========================================================================
   STATS STRIP
   ========================================================================== */
.eg-stats {
    padding-bottom: 8px;
}

.eg-stats__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--eg-card);
    border: 1px solid var(--eg-border);
    border-radius: var(--eg-radius-lg);
    box-shadow: var(--eg-shadow);
    overflow: hidden;
}

.eg-stat {
    padding: 28px 24px;
    text-align: center;
    border-right: 1px solid var(--eg-border);
}

.eg-stat:last-child { border-right: 0; }

.eg-stat__value {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--eg-brand);
    line-height: 1;
    letter-spacing: -.02em;
}

.eg-stat__label {
    margin-top: 8px;
    font-size: .84rem;
    color: var(--eg-muted);
    line-height: 1.4;
}

/* ==========================================================================
   CLOSING CTA BAND
   ========================================================================== */
.eg-endcta__card {
    position: relative;
    overflow: hidden;
    border-radius: var(--eg-radius-lg);
    padding: 46px;
    background: linear-gradient(135deg, var(--eg-brand), var(--eg-brand-dark));
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

/* Decorative bubble */
.eg-endcta__card::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -30px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    pointer-events: none;
}

.eg-endcta__body {
    position: relative;
    z-index: 1;
    max-width: 56ch;
}

.eg-endcta__card h2 {
    color: #fff;
    font-size: clamp(1.4rem, 2.4vw, 1.85rem);
}

.eg-endcta__card p {
    margin-top: 10px;
    color: rgba(255, 255, 255, .85);
    font-size: 1rem;
}

.eg-endcta__actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Outlined button for use on the brand gradient */
.eg-btn--outline-light {
    background: transparent;
    color: #fff;
    border-color: rgba(255, 255, 255, .5);
}

.eg-btn--outline-light:hover {
    background: rgba(255, 255, 255, .12);
    border-color: #fff;
    color: #fff;
}

/* ==========================================================================
   FORM CONTROLS
   ========================================================================== */
.eg-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 18px;
}

.eg-field label {
    font-size: .86rem;
    font-weight: 700;
    color: var(--eg-heading);
}

.eg-req { color: var(--eg-brand); }

.eg-field input[type="text"],
.eg-field input[type="email"],
.eg-field input[type="tel"],
.eg-field select,
.eg-field textarea {
    width: 100%;
    font: inherit;
    font-size: .95rem;
    color: var(--eg-heading);
    background: var(--eg-bg);
    border: 1.5px solid var(--eg-border);
    border-radius: var(--eg-radius-sm);
    padding: 13px 15px;
    transition: border-color .2s var(--eg-ease), box-shadow .2s var(--eg-ease);
}

.eg-field textarea {
    resize: vertical;
    min-height: 130px;
    line-height: 1.6;
}

.eg-field input:focus,
.eg-field select:focus,
.eg-field textarea:focus {
    outline: none;
    border-color: var(--eg-brand);
    box-shadow: 0 0 0 4px rgba(var(--eg-brand-rgb), .14);
}

.eg-field input[aria-invalid="true"],
.eg-field textarea[aria-invalid="true"] {
    border-color: var(--eg-danger);
}

.eg-field__err {
    font-size: .8rem;
    font-weight: 600;
    color: var(--eg-danger);
}

/* Native select arrow varies wildly between browsers; draw our own. */
.eg-field select {
    appearance: none;
    -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--eg-muted) 50%),
                      linear-gradient(135deg, var(--eg-muted) 50%, transparent 50%);
    background-position: calc(100% - 20px) center, calc(100% - 14px) center;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 40px;
}

/* ---- Checkbox ---- */
.eg-field--check { margin-top: 4px; }

.eg-check {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    cursor: pointer;
    font-size: .88rem;
    font-weight: 500;
    color: var(--eg-muted);
    line-height: 1.5;
}

.eg-check input {
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    flex-shrink: 0;
    accent-color: var(--eg-brand);
    cursor: pointer;
}

.eg-check a {
    color: var(--eg-brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ---- Honeypot: hidden from people, still reachable by bots ---- */
.eg-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ==========================================================================
   ALERTS
   ========================================================================== */
.eg-alert {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 15px 18px;
    border-radius: var(--eg-radius-sm);
    font-size: .92rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 22px;
}

.eg-alert .eg-icon { flex-shrink: 0; margin-top: 1px; }

.eg-alert--ok {
    background: var(--eg-accent-soft);
    color: var(--eg-accent-dark);
    border: 1px solid rgba(var(--eg-accent-rgb), .3);
}

.eg-alert--error {
    background: var(--eg-danger-soft);
    color: var(--eg-danger);
    border: 1px solid rgba(var(--eg-danger-rgb), .35);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
    .eg-phero { padding-block: 40px 56px; }

    .eg-dhero { min-height: 380px; padding-block: 64px; }

    .eg-phero__inner {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .eg-phero__text { max-width: none; }

    .eg-stats__grid { grid-template-columns: repeat(2, 1fr); }
    .eg-stat:nth-child(2n) { border-right: 0; }
    .eg-stat:nth-child(-n+2) { border-bottom: 1px solid var(--eg-border); }

    .eg-endcta__card { padding: 36px 30px; }
}

@media (max-width: 600px) {
    .eg-phero__actions .eg-btn { width: 100%; }

    .eg-dhero { min-height: 320px; padding-block: 52px; }
    .eg-dhero__actions { width: 100%; }
    .eg-dhero__actions .eg-btn { width: 100%; }

    .eg-stats__grid { grid-template-columns: 1fr; }
    .eg-stat {
        border-right: 0;
        border-bottom: 1px solid var(--eg-border);
    }
    .eg-stat:last-child { border-bottom: 0; }

    .eg-endcta__card { padding: 30px 24px; }
    .eg-endcta__actions,
    .eg-endcta__actions .eg-btn { width: 100%; }
}
