/* Round17 - Customization - section-hero
   Figma: 1015:3156 (desktop) | 1246:3686 (mobile/tablet, shared breakpoint <=1024px)
   Layout: section > content (headings + mockup). Mockup = form card | connector | toggle panel.
   Rule: single breakpoint @ 1024px covers both tablet and mobile, no min-width usage. */

.r17-hero {
    position: relative;
    display: flex;
    justify-content: center;
    isolation: isolate;
    padding: var(--var-140) var(--section-horizontal-padding);
    background: var(--color-1st-bg);
    font-family: var(--font-body);
    color: var(--color-1st-fg);
}

.r17-hero *,
.r17-hero *::before,
.r17-hero *::after {
    box-sizing: border-box;
}

/* ---------- Background (Figma 1015:3156: image opacity 40% + vertical gradient) ---------- */
.r17-hero__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.r17-hero__bg-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* hero-bg.webp already carries the Figma 40% alpha inside the file, so no extra opacity here */
}

.r17-hero__bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, var(--color-1st-bg) 0%, rgba(5, 5, 5, 0) 51.923%, var(--color-1st-bg) 100%);
}

/* ---------- Content wrapper (Figma 1015:3157) ---------- */
.r17-hero__content {
    position: relative;
    z-index: 1;
    flex: 1 0 0;
    min-width: 0;
    max-width: var(--container-max);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--section-gap);
}

/* ---------- Headings (Figma 1015:3158, gap 28) ---------- */
.r17-hero__headings {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--var-28);
    width: 100%;
}

.r17-hero__intro {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--var-12);
    width: 100%;
}

.r17-hero__badges {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--var-6);
}

.r17-hero__badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--var-4);
    flex-shrink: 0;
}

.r17-hero__badge--bfs {
    background: var(--color-semantic-shopify-bg);
    padding: var(--var-4);
}

.r17-hero__badge-icon {
    display: block;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.r17-hero__badge-text {
    font-weight: 500;
    font-size: var(--fs-label-md);
    line-height: var(--lh-label);
    white-space: nowrap;
}

.r17-hero__badge--bfs .r17-hero__badge-text {
    color: var(--color-semantic-shopify-fg);
}

.r17-hero__badge--rating .r17-hero__badge-text {
    color: var(--color-1st-fg);
}

.r17-hero__divider {
    display: flex;
    align-self: stretch;
    flex-shrink: 0;
}

.r17-hero__divider-img {
    display: block;
    width: 1px;
    height: 100%;
}

/* Title + description: side by side on desktop (Figma gap 16) */
.r17-hero__copy {
    display: flex;
    align-items: flex-start;
    gap: var(--var-16);
    width: 100%;
}

.r17-hero__title {
    flex: 1 0 0;
    min-width: 0;
    max-width: 800px;
    margin: 0;
    font-weight: 600;
    font-size: var(--fs-h1);
    line-height: var(--lh-heading);
    letter-spacing: 0;
    color: var(--color-1st-fg);
}

.r17-hero__desc {
    flex: 1 0 0;
    min-width: 0;
    max-width: 600px;
    margin: 0;
    font-weight: 400;
    font-size: var(--fs-description-lg);
    line-height: var(--lh-body);
    color: var(--color-2nd-fg);
}

/* CTA (Figma button/text: px 28, py 14, pill) */
.r17-hero__actions {
    display: flex;
    align-items: center;
    gap: var(--var-12);
}

.r17-hero__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--var-6);
    padding: var(--var-14) var(--var-28);
    border-radius: var(--radius-pill);
    background: var(--color-1st-btn-bg);
    color: var(--color-1st-btn-fg);
    font-weight: 500;
    font-size: var(--fs-label-md);
    line-height: var(--lh-label);
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
}

/* ---------- Mockup (Figma 1015:3159) ---------- */
.r17-hero__mockup {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
}

/* Form card (Figma 1084:4093) */
.r17-hero__form-card {
    position: relative;
    z-index: 3;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    border: var(--var-1) solid var(--color-stroke);
    border-radius: var(--var-16);
    background: linear-gradient(180deg, var(--color-1st-bg) 0%, var(--color-2nd-bg) 100%);
}

.r17-hero__photo {
    position: relative;
    flex: 0 1 var(--r17-hero-photo-w);
    min-width: 160px;
    display: flex;
    align-items: flex-end;
}

.r17-hero__photo-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* Brand logo overlay (Figma 1085:4281) */
.r17-hero__logo {
    position: relative;
    flex: 1 0 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--var-6);
    padding: var(--var-12);
    background: linear-gradient(180deg, rgba(5, 5, 5, 0) 0%, var(--color-1st-bg) 100%);
    transition: opacity var(--duration-collapse) var(--ease-soft),
                transform var(--duration-collapse) var(--ease-soft),
                visibility 0s linear 0s;
}

.r17-hero__logo.is-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(var(--var-8));
    transition-delay: 0s, 0s, var(--duration-collapse);
}

.r17-hero__logo-mark {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: linear-gradient(135deg, var(--color-1st-brd) 0%, var(--color-2nd-brd) 100%);
}

.r17-hero__logo-name {
    font-weight: 500;
    font-size: var(--fs-label-md);
    line-height: var(--lh-label);
    color: var(--color-1st-fg);
    white-space: nowrap;
}

/* Form body (Figma 1084:4102) */
.r17-hero__form-body {
    flex: 1 0 360px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    /* bottom padding is 4px shorter: the terms line below carries 4px of its own (descender room) */
    padding: var(--var-44) var(--var-32) calc(var(--var-44) - var(--var-4));
}

.r17-hero__form-title {
    margin: 0 0 var(--var-24);
    font-weight: 600;
    font-size: var(--fs-h5);
    line-height: var(--lh-heading);
    text-align: center;
    color: var(--color-1st-fg);
}

/* Collapsible wrapper: grid rows 1fr <-> 0fr + opacity keeps layout smooth when fields are toggled.
   Gaps between blocks are margins of the children inside the clipped inner box, so they collapse together with it. */
.r17-hero__collapse {
    display: grid;
    grid-template-rows: 1fr;
    opacity: 1;
    visibility: visible;
    transition: grid-template-rows var(--duration-collapse) var(--ease-soft),
                opacity var(--duration-collapse) var(--ease-soft),
                visibility 0s linear 0s;
}

.r17-hero__collapse.is-hidden {
    grid-template-rows: 0fr;
    opacity: 0;
    visibility: hidden;
    transition-delay: 0s, 0s, var(--duration-collapse);
}

.r17-hero__collapse-inner {
    min-height: 0;
    overflow: hidden;
}

/* Benefit card (Figma 1084:4225) */
.r17-hero__benefit {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--var-14);
    margin-bottom: var(--var-24);
    padding: var(--var-18);
    border-radius: var(--var-12);
    background: var(--color-2nd-bg);
}

.r17-hero__benefit-title {
    margin: 0;
    font-weight: 600;
    font-size: var(--fs-h6);
    line-height: var(--lh-heading);
    color: var(--color-1st-fg);
}

.r17-hero__benefit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--var-16);
    font-weight: 500;
    font-size: var(--fs-label-md);
    line-height: var(--lh-label);
}

.r17-hero__benefit-label {
    flex-shrink: 0;
    color: var(--color-2nd-fg);
    white-space: nowrap;
}

.r17-hero__benefit-value {
    min-width: 0;
    text-align: right;
    color: var(--color-1st-fg);
}

/* Form (Figma 1084:4277) */
.r17-hero__form {
    display: flex;
    flex-direction: column;
}

.r17-hero__field {
    margin-bottom: var(--var-16);
    display: flex;
    flex-direction: column;
    gap: var(--var-6);
}

.r17-hero__field-label {
    display: flex;
    align-items: center;
    gap: var(--var-2);
    font-weight: 500;
    font-size: var(--fs-label-md);
    line-height: var(--lh-label);
    color: var(--color-1st-fg);
    white-space: nowrap;
}

.r17-hero__req {
    color: var(--color-1st-brd);
}

.r17-hero__input {
    height: 33px;
    padding: var(--var-8);
    border: var(--var-1) solid var(--color-stroke);
    border-radius: var(--var-8);
    background: var(--color-3rd-bg);
}

.r17-hero__join {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: var(--var-12) var(--var-16);
    border-radius: var(--var-140);
    background: var(--color-1st-btn-bg);
    color: var(--color-1st-btn-fg);
    font-weight: 500;
    font-size: var(--fs-label-md);
    line-height: var(--lh-label);
    text-align: center;
}

.r17-hero__terms {
    margin: var(--var-24) 0 0;
    /* line-height is 1 and the collapse wrapper clips (overflow: hidden): without this the tails of y / g / j / p are cut off */
    padding-bottom: var(--var-4);
    font-weight: 500;
    font-size: var(--fs-label-md);
    line-height: var(--lh-label);
    text-align: center;
    color: var(--color-2nd-fg);
}

/* ---------- Connector (Figma 1107:11898) ---------- */
.r17-hero__connector {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    width: var(--r17-hero-connector-w);
    height: calc(var(--var-64) + 5px);
    padding-top: var(--var-64);
    opacity: 0;
    transition: opacity 500ms var(--ease-soft);
}

.r17-hero__connector-line {
    display: block;
    flex-shrink: 0;
    width: 45px;
    height: 1px;
}

.r17-hero__connector-dot {
    display: block;
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    margin: 0 -1px;
}

/* ---------- Toggle panel (Figma 1107:11778) ---------- */
.r17-hero__panel {
    position: relative;
    z-index: 1;
    flex: 0 0 var(--r17-hero-panel-w);
    width: var(--r17-hero-panel-w);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--var-16);
    /* Figma stroke is drawn inside the padding: subtract the 1px border so the box keeps its Figma size */
    padding: calc(var(--var-24) - var(--var-1));
    border: var(--var-1) solid var(--color-stroke);
    border-radius: var(--var-12);
    background: linear-gradient(180deg, var(--color-1st-bg) 0%, var(--color-2nd-bg) 100%);
}

.r17-hero__panel-divider {
    width: 100%;
    height: 0;
    /* Figma divider is a 0-height line: cancel the 1px border box so it takes no space in the column */
    margin: calc(var(--var-1) / -2) 0;
    border: 0;
    border-top: var(--var-1) solid var(--color-glass-brd);
}

.r17-hero__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(var(--var-12) - var(--var-1));
    border: var(--var-1) solid var(--color-glass-brd);
    border-radius: var(--var-8);
    background: var(--color-glass-bg);
}

.r17-hero__drag {
    display: block;
    flex-shrink: 0;
    width: 14px;
    height: 5px;
}

.r17-hero__row-label {
    flex: 1 0 0;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: var(--var-2);
    font-weight: 600;
    font-size: var(--fs-label-xs);
    line-height: var(--lh-heading);
    color: var(--color-1st-fg);
    white-space: nowrap;
}

/* Switch: Figma toggle 32x18, knob 16 (on #68D37F / off stroke). State = .is-on + aria-checked */
.r17-hero__toggle {
    position: relative;
    flex-shrink: 0;
    width: 32px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: var(--var-140);
    background: var(--color-stroke);
    cursor: pointer;
    transition: background-color var(--duration-collapse) var(--ease-soft),
                transform var(--duration-press) var(--ease-soft);
    -webkit-tap-highlight-color: transparent;
}

/* Auto demo: the fake cursor "presses" the switch */
.r17-hero__toggle.is-pressed {
    transform: scale(0.88);
}

.r17-hero__toggle::after {
    content: "";
    position: absolute;
    top: var(--var-1);
    left: var(--var-1);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-1st-fg);
    transition: transform var(--duration-collapse) var(--ease-soft);
}

.r17-hero__toggle.is-on {
    background: var(--color-toggle-on);
}

.r17-hero__toggle.is-on::after {
    transform: translateX(14px);
}

.r17-hero__toggle:focus-visible {
    outline: 2px solid var(--color-2nd-brd);
    outline-offset: 2px;
}

/* ---------- Hot spot (Figma toggle 1246:7865 ring + connector 1107:11898) ----------
   Hidden until the section is revealed (so it never shows over a faded mockup), then fades in.
   Dismissed (.is-dismissed on the mockup) as soon as any toggle is clicked. */
.r17-hero__hotspot {
    position: absolute;
    inset: calc(-1 * var(--r17-hero-ring-y)) calc(-1 * var(--r17-hero-ring-x));
    border: 2px solid var(--color-2nd-brd);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 500ms var(--ease-soft);
}

.r17-hero__hotspot::after {
    content: "";
    position: absolute;
    inset: -2px;
    border: 2px solid var(--color-2nd-brd);
    border-radius: 50%;
    opacity: 0;
}

.r17-hero.is-revealed .r17-hero__mockup:not(.is-dismissed):not(.is-demo) .r17-hero__hotspot,
.r17-hero.is-revealed .r17-hero__mockup:not(.is-dismissed):not(.is-demo) .r17-hero__connector {
    opacity: 1;
    transition-delay: 900ms;
}

.r17-hero.is-revealed .r17-hero__mockup:not(.is-dismissed):not(.is-demo) .r17-hero__hotspot::after {
    animation: r17-hero-pulse 1.8s ease-out 1.2s infinite;
}

/* ---------- Auto demo (desktop only, plays once: assets/scripts.js adds .is-demo to the mockup while it runs,
   which keeps the hot spot hidden; the hot spot shows up when the demo is over) ----------
   Fake cursor: JS sets --demo-x / --demo-y (px, relative to the mockup) to move it to each switch. */
.r17-hero__cursor {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 6;
    width: var(--r17-hero-cursor-size);
    height: var(--r17-hero-cursor-size);
    opacity: 0;
    pointer-events: none;
    transform: translate(var(--demo-x, 0px), var(--demo-y, 0px));
    transition: transform var(--duration-cursor) var(--ease-soft),
                opacity var(--duration-press) var(--ease-soft);
}

.r17-hero__cursor.is-visible {
    opacity: 1;
}

.r17-hero__cursor-img {
    display: block;
    width: 100%;
    height: 100%;
    transform-origin: 18% 12%;
    transition: transform var(--duration-press) var(--ease-soft);
}

.r17-hero__cursor.is-pressed .r17-hero__cursor-img {
    transform: scale(0.8);
}

/* Status pills sit in the gap above the panel (always inside the viewport), one slot: the pills overlap in the
   same grid cell and only one is visible at a time. Purple + spinner while "updating", outlined + check once done */
.r17-hero__pills {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: var(--var-16);
    display: grid;
    justify-items: end;
    pointer-events: none;
}

.r17-hero__pill {
    grid-area: 1 / 1;
    display: inline-flex;
    align-items: center;
    gap: var(--var-6);
    padding: var(--var-6) var(--var-12);
    border: var(--var-1) solid transparent;
    border-radius: var(--radius-pill);
    background: var(--color-2nd-brd);
    color: var(--color-1st-btn-fg);
    font-weight: 500;
    font-size: var(--fs-label-xs);
    line-height: var(--lh-label);
    white-space: nowrap;
    opacity: 0;
    transform: translateY(var(--var-8));
    transition: opacity var(--duration-collapse) var(--ease-soft),
                transform var(--duration-collapse) var(--ease-soft),
                background-color var(--duration-collapse) var(--ease-soft),
                border-color var(--duration-collapse) var(--ease-soft),
                color var(--duration-collapse) var(--ease-soft);
}

.r17-hero__pill.is-visible {
    opacity: 1;
    transform: none;
}

/* The pill that leaves fades out fast so it never overlaps the one coming in (single slot) */
.r17-hero__pill:not(.is-visible) {
    transition-duration: var(--duration-press);
}

.r17-hero__pill.is-done {
    background: var(--color-glass-bg);
    border-color: var(--color-glass-brd);
    color: var(--color-1st-fg);
}

.r17-hero__pill-icon {
    position: relative;
    flex-shrink: 0;
    width: var(--var-12);
    height: var(--var-12);
    border: var(--var-2) solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: r17-hero-spin 700ms linear infinite;
}

.r17-hero__pill.is-done .r17-hero__pill-icon {
    border: 0;
    border-radius: 0;
    animation: none;
}

.r17-hero__pill.is-done .r17-hero__pill-icon::after {
    content: "";
    position: absolute;
    top: var(--var-1);
    left: var(--var-4);
    width: var(--var-4);
    height: var(--var-8);
    border: solid var(--color-toggle-on);
    border-width: 0 var(--var-2) var(--var-2) 0;
    transform: rotate(45deg);
}

@keyframes r17-hero-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes r17-hero-pulse {
    0% {
        opacity: 0.8;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.6);
    }
}

/* ---------- Responsive (tablet + mobile share this single breakpoint) ---------- */
@media (max-width: 1024px) {
    .r17-hero__headings,
    .r17-hero__intro {
        align-items: flex-start;
    }

    .r17-hero__copy {
        flex-direction: column;
        gap: var(--var-16);
    }

    .r17-hero__title,
    .r17-hero__desc {
        flex: 0 0 auto;
        width: 100%;
    }

    .r17-hero__bg {
        display: none;
    }

    /* Mobile / tablet = preview only (Figma 1246:3686 has just the registration form): the photo banner,
       the toggle panel (hot spot ring lives inside it) and the connector are not rendered. The Benefit card
       is driven by assets/scripts.js instead (expanded on entry, auto-shrinks once after 5s). */
    .r17-hero__photo,
    .r17-hero__connector,
    .r17-hero__panel,
    .r17-hero__cursor {
        display: none;
    }

    /* Figma 1247:12664: the last Benefit row ("Additional term") splits label and value into two equal 50% columns */
    .r17-hero__benefit-row:last-child {
        gap: 0;
    }

    .r17-hero__benefit-row:last-child > * {
        flex: 1 1 0;
        min-width: 0;
    }

    .r17-hero__mockup {
        flex-direction: column;
        align-items: stretch;
    }

    .r17-hero__form-card {
        flex: 0 0 auto;
        flex-direction: column;
    }

    .r17-hero__form-body {
        flex: 0 0 auto;
        padding: var(--var-32) var(--var-24) calc(var(--var-32) - var(--var-4));
    }
}

@media (prefers-reduced-motion: reduce) {
    .r17-hero__logo,
    .r17-hero__collapse,
    .r17-hero__toggle,
    .r17-hero__toggle::after,
    .r17-hero__hotspot,
    .r17-hero__connector {
        transition: none;
    }

    .r17-hero.is-revealed .r17-hero__mockup:not(.is-dismissed):not(.is-demo) .r17-hero__hotspot::after {
        animation: none;
        opacity: 0;
    }
}
