/*
 * The new hero style on the Trust1.io home page (front-page.php, template-parts/sections/hero.php).
 *
 * This is the same style as the product pages (apps/web/src/components/new-style/new-style.css), with the class
 * names of this page's hero: .t1-hero__title, __subtitle, __actions, __badges, __video, .t1-btn. Keep the two in
 * step when one changes. Everything is scoped to .new-style-hero (the hero section itself), apart from the header
 * "Install App" button, which is scoped with body:has(.new-style-hero) because the header is outside the hero.
 * The mountains, the big name and the rising stars are drawn by assets/js/new-style-hero.js.
 */

/* The brand colour of this page is white (everything below is mixed from --t1-accent) */
.new-style-hero,
body:has(.new-style-hero) .t1-header {
    --t1-accent: #fff;
}

/* The layers (mountains, name, stars) are positioned in the hero and clipped by it */
.t1-hero.new-style-hero {
    position: relative;
}

/* Hero buttons: same size as the product pages' buttons */
.new-style-hero .t1-hero__actions .t1-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 54px;
    padding: 0 30px;
}

/* Entrance, per part (parts follow one another):
   - scale 1.05 -> 1 and fade in: short
   - rise from 50px low, one continuous move in two segments: 35px (7/10) fast while the scale
     runs, then the remaining 15px slower and settling once the scale is done
   - blur 8px -> 0 over the whole thing, from the start to the end of the rise */
@keyframes new-style-hero-in {
    from {
        opacity: 0;
        scale: 1.05;
    }
    to {
        opacity: 1;
        scale: 1;
    }
}

/* Keyframe at 33.333% = scale duration / total duration (0.25s / 0.75s). Change them together.
   The two easings are matched at the join (end speed of the first = start speed of the second),
   so the part keeps moving instead of stopping and starting again. */
@keyframes new-style-hero-rise {
    0% {
        translate: 0 50px;
        animation-timing-function: cubic-bezier(0.25, 0.4, 0.5, 0.785);
    }
    33.333% {
        translate: 0 15px;
        animation-timing-function: cubic-bezier(0.2, 0.4, 0.5, 1);
    }
    100% {
        translate: 0 0;
    }
}

@keyframes new-style-hero-blur {
    from {
        filter: blur(8px);
    }
    to {
        filter: blur(0);
    }
}

.new-style-hero .t1-hero__badges,
.new-style-hero .t1-hero__title,
.new-style-hero .t1-hero__subtitle,
.new-style-hero .t1-hero__actions,
.new-style-hero .t1-hero__video {
    --hero-scale-duration: 0.25s;
    --hero-total-duration: 0.75s;
    /* Gap between one part starting and the next */
    --hero-in-step: calc(0.4s / 3);
    --hero-in-delay: calc(var(--hero-in-index, 0) * var(--hero-in-step));
    /* Top origin: the top edge keeps its place while scaling, whatever the height */
    transform-origin: 50% 0;
    /* Fill backwards only (hidden during the delay), as on the product pages. Each animation ends on the part's own
       values, so nothing needs holding after: a held filter (even blur(0)), opacity or scale keeps the part a layer
       of its own, and mobile browsers then redraw its text soft right after the entrance (sharp, then blurry) */
    animation:
        new-style-hero-in var(--hero-scale-duration) ease-in-out var(--hero-in-delay) backwards,
        new-style-hero-rise var(--hero-total-duration) linear var(--hero-in-delay) backwards,
        new-style-hero-blur var(--hero-total-duration) ease-in-out var(--hero-in-delay) backwards;
}

.new-style-hero .t1-hero__badges { --hero-in-index: 1; }
.new-style-hero .t1-hero__title { --hero-in-index: 2; }
.new-style-hero .t1-hero__subtitle { --hero-in-index: 3; }
.new-style-hero .t1-hero__actions { --hero-in-index: 4; }
.new-style-hero .t1-hero__video { --hero-in-index: 5; }

@media (prefers-reduced-motion: reduce) {
    .new-style-hero .t1-hero__badges,
    .new-style-hero .t1-hero__title,
    .new-style-hero .t1-hero__subtitle,
    .new-style-hero .t1-hero__actions,
    .new-style-hero .t1-hero__video {
        animation: none;
    }
}

/* Hero buttons: dark glossy pills (both the primary and the outline one) */
.new-style-hero {
    --out: cubic-bezier(0.22, 1, 0.36, 1);
}

.new-style-hero .t1-hero__actions .t1-btn,
.new-style-hero .t1-hero__actions .t1-btn:hover {
    border: 0;
    border-radius: 900px;
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    /* Top sheen over the radial gradient */
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.09), transparent 55%),
        radial-gradient(120% 160% at 30% 0%, #3a3a44 0%, #1d1d23 45%, #0f0f13 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -1px 0 rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.09),
        0 12px 28px -12px rgba(0, 0, 0, 0.9),
        0 0 46px -14px rgba(120, 120, 255, 0.4);
    transition:
        box-shadow 0.45s var(--out),
        transform 0.2s;
}

/* Install button on hover: brighter edge highlight and a wide amber glow (eased by the 0.45s box-shadow transition above) */
.new-style-hero .t1-hero__actions .t1-hero__btn--primary:hover {
    box-shadow:
        inset 0 1px #ffffff42,
        inset 0 -1px #0009,
        0 0 0 1px #ffffff24,
        0 12px 28px -12px #000000e6,
        0 0 64px -10px color-mix(in srgb, color-mix(in srgb, var(--t1-accent) 83%, white) 61.2%, transparent);
}

/* "Explore more" (outline variant): quieter than the primary: muted label, flatter gradient, no glow at rest */
.new-style-hero .t1-hero__actions .t1-hero__btn--outline,
.new-style-hero .t1-hero__actions .t1-hero__btn--outline:hover {
    transition:
        color 0.3s,
        box-shadow 0.45s var(--out),
        transform 0.2s;
}

.new-style-hero .t1-hero__actions .t1-hero__btn--outline {
    color: #b4b2ac;
    background: linear-gradient(180deg, #262629, #0b0b0d);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

/* Label brightens to white on hover; no hover shadow, it keeps the one it has at rest */
.new-style-hero .t1-hero__actions .t1-hero__btn--outline:hover {
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
    /* Same as at rest: the shared hover rule would otherwise bring back the primary's gradient */
    background: linear-gradient(180deg, #262629, #0b0b0d);
}

/* "Explore more" on hover: an amber light (a lighter shade of the brand colour) runs around its border.
   A conic gradient (one bright arc) is clipped to a 1px ring, and its start angle is animated. */
@property --hero-border-angle {
    syntax: '<angle>';
    inherits: false;
    initial-value: 0deg;
}

@keyframes new-style-hero-border-run {
    to {
        --hero-border-angle: 360deg;
    }
}

.new-style-hero .t1-hero__actions .t1-hero__btn--outline {
    position: relative;
}

.new-style-hero .t1-hero__actions .t1-hero__btn--outline::after {
    content: '';
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: inherit;
    background: conic-gradient(
        from calc(90deg + var(--hero-border-angle)) at 50% 50%,
        transparent 0%,
        transparent 72%,
        color-mix(in srgb, color-mix(in srgb, var(--t1-accent) 83%, white) 60%, transparent) 90%,
        color-mix(in srgb, var(--t1-accent) 45%, white) 100%
    );
    /* Keep only the 1px ring: paint the padding box out of the content box */
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask:
        linear-gradient(#000 0 0) content-box exclude,
        linear-gradient(#000 0 0);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.new-style-hero .t1-hero__actions .t1-hero__btn--outline:hover::after {
    opacity: 1;
    animation: new-style-hero-border-run 2s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .new-style-hero .t1-hero__actions .t1-hero__btn--outline:hover::after {
        animation: none;
    }
}

/* Install button: label, 16px gap, then a round 44px glossy arrow icon (inset 5px in the 54px pill) */
.new-style-hero .t1-hero__actions .t1-hero__btn--primary {
    gap: 16px;
    padding: 0 5px 0 28px;
}

.new-style-hero__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: var(--icon-arrow, #000);
    /* Deep amber: the TrustShop accent (var(--t1-accent)) with darker shoulders, so it reads richer than the pale first version */
    background: radial-gradient(circle at 34% 28%, color-mix(in srgb, var(--t1-accent) 36%, white) 0, color-mix(in srgb, var(--t1-accent) 89%, white) 14%, var(--t1-accent) 34%, color-mix(in srgb, var(--t1-accent) 84%, black) 60%, color-mix(in srgb, var(--t1-accent) 61%, black) 82%, color-mix(in srgb, var(--t1-accent) 27%, black) 100%);
    box-shadow:
        inset 0 -5px 9px rgba(90, 50, 0, 0.7),
        inset 0 2px 3px rgba(255, 255, 255, 0.7),
        0 0 0 1px rgba(255, 255, 255, 0.2),
        0 0 18px color-mix(in srgb, var(--t1-accent) 55%, transparent);
    transition: box-shadow 0.45s var(--out);
}

/* The hero's `*` colour rule would colour the arrow; set the arrow colour explicitly */
.new-style-hero .t1-hero__actions .t1-hero__btn--primary .new-style-hero__icon {
    color: var(--icon-arrow, #000);
}

.new-style-hero .t1-hero__actions .new-style-hero__icon svg {
    position: relative;
    z-index: 1;
    color: var(--icon-arrow, #000);
    width: 16px;
    height: 16px;
    transition: transform 0.25s var(--out);
}

/* The hero's `*` colour rule also hits the <path>, so its currentColor would be the hero's light text: set the stroke here */
.new-style-hero .t1-hero__actions .new-style-hero__icon path {
    stroke: var(--icon-arrow, #000);
}

/* On hover the arrow nudges 2px to the right */
.new-style-hero .t1-hero__actions .t1-hero__btn--primary:hover svg {
    transform: translateX(2px);
}

/* Wrapper around the two buttons: takes no box of its own, so they stay laid out by .t1-hero__actions */
.new-style-hero__actions {
    display: contents;
}

/* Orb overlay on the icon: soft light arcs that slowly turn. The icon clips them to the circle;
   the arrow sits above (z-index) */
@keyframes new-style-hero-orb-spin {
    to {
        transform: rotate(360deg);
    }
}

.new-style-hero__icon::after {
    content: '';
    position: absolute;
    inset: -35%;
    mix-blend-mode: screen;
    filter: blur(3px);
    background: conic-gradient(
        from 0deg,
        transparent 0 18%,
        color-mix(in srgb, color-mix(in srgb, var(--t1-accent) 21%, white) 60%, transparent) 28%,
        transparent 42% 62%,
        color-mix(in srgb, color-mix(in srgb, var(--t1-accent) 60%, white) 55%, transparent) 76%,
        transparent 88%
    );
    animation: new-style-hero-orb-spin 7s linear infinite;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .new-style-hero__icon::after {
        animation: none;
    }
}

/* The hero has no background picture (the grid image is gone from Hero.css) and no dark overlay: just the brand dark colour. */

/* Content above the extra layers (glow, mountains, streaks, app name) */
.new-style-hero .t1-section__inner {
    position: relative;
    z-index: 1;
}

/* Header "Install App" button, styled like "Explore more" (but with a white label), only while the header is on the dark
   hero: once the page scrolls the header turns white (.t1-header--scrolled) and the button keeps its original look. The header is rendered by the layout, outside
   .new-style-hero, so these rules are scoped by :has() to pages that contain the new hero. */
body:has(.new-style-hero) .t1-header:not(.t1-header--scrolled) .t1-header__cta .t1-btn {
    position: relative;
    border: 0;
    border-radius: 900px;
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    background: linear-gradient(180deg, #262629, #0b0b0d);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
    opacity: 1;
    transition:
        color 0.3s,
        box-shadow 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

body:has(.new-style-hero) .t1-header:not(.t1-header--scrolled) .t1-header__cta .t1-btn:hover {
    background: linear-gradient(180deg, #262629, #0b0b0d);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
    opacity: 1;
}

/* Running amber border light on hover, same as "Explore more" */
body:has(.new-style-hero) .t1-header:not(.t1-header--scrolled) .t1-header__cta .t1-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: inherit;
    background: conic-gradient(
        from calc(90deg + var(--hero-border-angle)) at 50% 50%,
        transparent 0%,
        transparent 72%,
        color-mix(in srgb, color-mix(in srgb, var(--t1-accent) 83%, white) 60%, transparent) 90%,
        color-mix(in srgb, var(--t1-accent) 45%, white) 100%
    );
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask:
        linear-gradient(#000 0 0) content-box exclude,
        linear-gradient(#000 0 0);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

body:has(.new-style-hero) .t1-header:not(.t1-header--scrolled) .t1-header__cta .t1-btn:hover::after {
    opacity: 1;
    animation: new-style-hero-border-run 2s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    body:has(.new-style-hero) .t1-header:not(.t1-header--scrolled) .t1-header__cta .t1-btn:hover::after {
        animation: none;
    }
}

/* Bolides: 1px streaks rising from the bottom of the hero (see BolideField.tsx).
   The layer comes after the hero in the DOM with z-index 0, so it paints over the hero background and
   overlay but under the hero content (.t1-section__inner is z-index 1). */
.new-style-hero {
    position: relative;
    /* The layers (the mountains reach below the hero) stay inside the hero, like the hero's own overflow */
    overflow: hidden;
    border-radius: 0 0 16px 16px;
    /* Top edge of the area the streaks run in: they rise from the bottom and fade out here, under the header */
    --header-edge: 90px;
}

.new-style-bolides {
    /* A size container, so a streak can travel the layer's whole height (100cqh) whatever the hero's height */
    container-type: size;
    position: absolute;
    inset: var(--header-edge) 0 0;
    z-index: 0;
    overflow: hidden;
    border-radius: 0 0 16px 16px;
    pointer-events: none;
}

@keyframes new-style-bolide-rise {
    /* Starts just below the bottom edge, runs the whole height of the hero and leaves through the top (the layer
       clips it at the header). It stays fully visible all the way and only fades in at the start. */
    0% {
        opacity: 0;
        transform: rotate(var(--a)) translateY(var(--len));
    }
    8% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        transform: rotate(var(--a)) translateY(calc(-100cqh - var(--len)));
    }
}

.new-style-bolides span {
    position: absolute;
    bottom: 0;
    left: var(--x);
    width: 1px;
    height: var(--len);
    transform-origin: 50% 100%;
    /* Tail fades down, the head at the top is the brightest */
    background: linear-gradient(0deg, transparent, rgba(255, 255, 255, 0.9));
    opacity: 0;
    animation: new-style-bolide-rise var(--dur) var(--delay) cubic-bezier(0.4, 0, 0.9, 0.6) both;
}

/* App name lamp (see AppNameLamp.tsx): a huge name behind the hero content, hidden until the pointer is over the hero.
   The layer comes after the hero with z-index 0, like the bolides: over the hero background, under its content. */
.new-style-lamp {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    border-radius: 0 0 16px 16px;
    pointer-events: none;
}

.new-style-lamp__text {
    position: absolute;
    left: 50%;
    /* Vertically centred in the hero, for a hero with no picture (the solution pages). */
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    display: grid;
    font-family: var(--ui, inherit);
    font-size: clamp(8rem, 21vw, 19rem);
    font-weight: 600;
    letter-spacing: -0.06em;
    /* The mask is clipped to this box, so the line box has to be as tall as the letters: at 0.8 it was shorter than
       the glyphs and cut the tail of the "p". */
    line-height: 1.2;
    --l1a: 0;
    --l2a: 0;
    --l3a: 0;
    --l4a: 0;
    --l5a: 0;
    --l6a: 0;
    --l0x: 50%;
    --l0y: 50%;
    --l1x: 50%;
    --l1y: 50%;
    --l2x: 50%;
    --l2y: 50%;
    --l3x: 50%;
    --l3y: 50%;
    --l4x: 50%;
    --l4y: 50%;
    --l5x: 50%;
    --l5y: 50%;
    --l6x: 50%;
    --l6y: 50%;
    /* Warm lamp light on the letters */
    color: color-mix(in srgb, color-mix(in srgb, var(--t1-accent) 53%, white) 30%, transparent);
    /* Lit only where a lamp is: the cursor (--l0*) and the head of each falling streak (--l1* … --l6*).
       With every --lNa at 0 (the default) nothing shows. The layers add up. */
    -webkit-mask-image:
        radial-gradient(circle 260px at var(--l0x) var(--l0y), rgba(0, 0, 0, var(--l0a)) 0%, rgba(0, 0, 0, calc(var(--l0a) * 0.55)) 45%, transparent 100%),
        radial-gradient(circle 150px at var(--l1x) var(--l1y), rgba(0, 0, 0, var(--l1a)) 0%, rgba(0, 0, 0, calc(var(--l1a) * 0.55)) 45%, transparent 100%),
        radial-gradient(circle 150px at var(--l2x) var(--l2y), rgba(0, 0, 0, var(--l2a)) 0%, rgba(0, 0, 0, calc(var(--l2a) * 0.55)) 45%, transparent 100%),
        radial-gradient(circle 150px at var(--l3x) var(--l3y), rgba(0, 0, 0, var(--l3a)) 0%, rgba(0, 0, 0, calc(var(--l3a) * 0.55)) 45%, transparent 100%),
        radial-gradient(circle 150px at var(--l4x) var(--l4y), rgba(0, 0, 0, var(--l4a)) 0%, rgba(0, 0, 0, calc(var(--l4a) * 0.55)) 45%, transparent 100%),
        radial-gradient(circle 150px at var(--l5x) var(--l5y), rgba(0, 0, 0, var(--l5a)) 0%, rgba(0, 0, 0, calc(var(--l5a) * 0.55)) 45%, transparent 100%),
        radial-gradient(circle 150px at var(--l6x) var(--l6y), rgba(0, 0, 0, var(--l6a)) 0%, rgba(0, 0, 0, calc(var(--l6a) * 0.55)) 45%, transparent 100%);
    mask-image:
        radial-gradient(circle 260px at var(--l0x) var(--l0y), rgba(0, 0, 0, var(--l0a)) 0%, rgba(0, 0, 0, calc(var(--l0a) * 0.55)) 45%, transparent 100%),
        radial-gradient(circle 150px at var(--l1x) var(--l1y), rgba(0, 0, 0, var(--l1a)) 0%, rgba(0, 0, 0, calc(var(--l1a) * 0.55)) 45%, transparent 100%),
        radial-gradient(circle 150px at var(--l2x) var(--l2y), rgba(0, 0, 0, var(--l2a)) 0%, rgba(0, 0, 0, calc(var(--l2a) * 0.55)) 45%, transparent 100%),
        radial-gradient(circle 150px at var(--l3x) var(--l3y), rgba(0, 0, 0, var(--l3a)) 0%, rgba(0, 0, 0, calc(var(--l3a) * 0.55)) 45%, transparent 100%),
        radial-gradient(circle 150px at var(--l4x) var(--l4y), rgba(0, 0, 0, var(--l4a)) 0%, rgba(0, 0, 0, calc(var(--l4a) * 0.55)) 45%, transparent 100%),
        radial-gradient(circle 150px at var(--l5x) var(--l5y), rgba(0, 0, 0, var(--l5a)) 0%, rgba(0, 0, 0, calc(var(--l5a) * 0.55)) 45%, transparent 100%),
        radial-gradient(circle 150px at var(--l6x) var(--l6y), rgba(0, 0, 0, var(--l6a)) 0%, rgba(0, 0, 0, calc(var(--l6a) * 0.55)) 45%, transparent 100%);
    /* The cursor lamp eases in and out (--l0a is registered below); streaks already fade by themselves */
    transition: --l0a 0.4s ease;
}

@property --l0a {
    syntax: '<number>';
    inherits: true;
    initial-value: 0;
}

/* Wireframe mountains along the bottom, edge to edge (MountainRange.tsx): behind the hero content */
.new-style-mountains {
    position: absolute;
    z-index: 0;
    left: 0;
    /* 230px below the hero's bottom edge on a 1440px screen, less on narrower ones (16vw), never more than 230px */
    bottom: clamp(-230px, -16vw, -40px);
    width: 100%;
    height: min(520px, 66%);
    opacity: 0.5;
    pointer-events: none;
    /* The far ridges fade into the dark at the top; the range runs unbroken from edge to edge */
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 30%);
    mask-image: linear-gradient(180deg, transparent, #000 30%);
}

/* Shorter mountains on smaller screens: 250px on tablets, 100px on phones */
@media (max-width: 992px) {
    .new-style-mountains {
        height: 250px;
    }
}

@media (max-width: 768px) {
    .new-style-mountains {
        height: 100px;
    }

    .new-style-lamp {
        display: none !important;
    }
}


/* The WordPress theme's own hero button rules (style.css: .t1-hero .t1-btn--outline:hover { color: ... !important })
   would win over the rules above on hover, so the label colour is forced here */
.new-style-hero .t1-hero__actions .t1-hero__btn--outline:hover,
.new-style-hero .t1-hero__actions .t1-hero__btn--primary:hover {
    color: #fff !important;
}

/* The primary button has the label then the icon, in the hero's flex row */
.new-style-hero .t1-hero__actions .t1-hero__btn--primary .new-style-hero__icon {
    margin-left: 0;
}
