/**
 * Home page sections (tz/03 §6–§12).
 */

/* ==========================================================
 * Hero + mini calculator (§6)
 * ========================================================== */
.hero {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 48px;
    padding: clamp(28px, 5vw, 64px);
    overflow: hidden;
    background: var(--c-aqua);
    border-radius: var(--r-hero);
}

.hero__spark {
    position: absolute;
    top: -140px;
    right: -120px;
    fill: var(--c-surface);
    opacity: 0.7;
    pointer-events: none;
}

.hero__text {
    position: relative;
    flex: 1 1 440px;
    min-width: 0;
}

.hero__title {
    margin: 20px 0 18px;
    font-family: var(--font-head);
    font-size: clamp(30px, 3.7vw, 52px);
    font-weight: 700;
    line-height: 1.04;
    letter-spacing: -1.5px;
}

.hero__lead {
    max-width: 520px;
    margin-bottom: 28px;
}

.hero__cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    max-width: 520px;
}

.mini-card {
    padding: 16px;
    background: var(--c-surface);
    border-radius: var(--r-sm);
}

.mini-card__title {
    margin-bottom: 4px;
    font-size: 15px;
    font-weight: 600;
    color: var(--c-primary);
}

.mini-card__text {
    font-size: 14px;
    line-height: 1.45;
    color: var(--c-text-2);
}

.mini-calc {
    position: relative;
    flex: 1 1 400px;
    min-width: 0;
    max-width: 480px;
    padding: 24px;
    background: var(--c-surface);
    border-radius: var(--r-card);
}

.mini-calc > .segmented {
    margin-bottom: 24px;
}

.mini-calc .area-field {
    margin-bottom: 20px;
}

.mini-calc .range-scale {
    margin-top: 2px;
}

.mini-calc__dirt {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.mini-calc__label {
    font-size: 15px;
    font-weight: 600;
}

/* Caption above, price below on every screen: side by side, the longest range (24 000 – 36 000)
   does not fit, so the row used to wrap or not depending on the number and the layout jumped. */
.mini-calc__result {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
    padding-top: 18px;
    border-top: 1px dashed var(--c-line);
    container-type: inline-size;
}

.mini-calc__caption {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    color: var(--c-text-3);
}

/* One line for any range: the size follows the card width so "24 000 – 36 000 lei*" (≈ 11.2em) fits, max 32px. */
.mini-calc__price {
    font-family: var(--font-head);
    font-size: clamp(20px, calc(100cqi / 11.5), 32px);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    letter-spacing: -1px;
    white-space: nowrap;
}

.mini-calc__note {
    margin-bottom: 16px;
    font-size: 12px;
    color: var(--c-text-3);
    text-align: right;
}

.mini-calc__callback {
    display: block;
    margin-top: 12px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

@media (max-width: 639px) {
    .hero__cards {
        grid-template-columns: 1fr;
    }

    .hero,
    .mini-card,
    .mini-calc {
        padding: var(--pad-block-sm);
    }
}

/* Narrow phones */
@media (max-width: 419px) {
    /* Long RU/RO labels don't fit three in a row: tabs size to content and wrap, words stay whole. */
    .mini-calc > .segmented {
        flex-wrap: wrap;
    }

    .mini-calc > .segmented .segmented__tab {
        flex: 1 1 auto;
        padding-right: 12px;
        padding-left: 12px;
        -webkit-hyphens: manual;
        hyphens: manual;
    }
}

/* ==========================================================
 * Why us (§8) — row-reverse is a customer requirement
 * ========================================================== */
.why {
    display: flex;
    flex-direction: row-reverse;
    flex-wrap: wrap;
    gap: 40px;
}

.why__text {
    flex: 1 1 300px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.why__text .link-strong {
    align-self: flex-start;
    margin-top: 8px;
}

.why__list {
    flex: 2 1 560px;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 32px 40px;
}

.feature {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.feature__title {
    margin-bottom: 6px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

.feature__text {
    font-size: 15px;
    color: var(--c-text-3);
}

/* ==========================================================
 * Before / after slider (§10)
 * --pos (0–100%) is set by before-after.js; 50% is the start state.
 * ========================================================== */
.ba {
    --pos: 50%;
    display: flex;
    flex-direction: row-reverse;
    flex-wrap: wrap;
    align-items: center;
    gap: 32px;
}

.ba__text {
    flex: 1 1 320px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ba__lead {
    font-size: 17px;
    color: var(--c-text-3);
}

/* Cleanliness meter */
.ba-meter {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px;
    background: var(--c-surface);
    border-radius: var(--r-card);
}

@media (max-width: 639px) {
    .ba-meter {
        padding: var(--pad-block-sm);
    }
}

.ba-meter__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.ba-meter__label {
    font-size: 15px;
    font-weight: 600;
}

.ba-meter__value {
    font-family: var(--font-head);
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -1px;
}

.ba-meter__track {
    height: 10px;
    overflow: hidden;
    background: var(--c-switch);
    border-radius: 5px;
}

.ba-meter__fill {
    width: var(--pos);
    height: 100%;
    background: var(--c-accent);
    border-radius: 5px;
    transition: width 0.15s, background-color 0.3s;
}

.ba--low .ba-meter__fill {
    background: var(--c-coral);
}

.ba--high .ba-meter__fill {
    background: var(--c-primary);
}

.ba-meter__phrase {
    min-height: 45px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--c-text-2);
}

/* Slider */
.ba-slider {
    position: relative;
    flex: 1.4 1 520px;
    min-width: 0;
    aspect-ratio: 10 / 7;
    overflow: hidden;
    background: var(--c-aqua);
    border-radius: var(--r-panel);
    -webkit-user-select: none;
    user-select: none;
}

.ba-slider__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ba-slider__after {
    position: absolute;
    inset: 0;
    clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}

.ba-slider__sparkles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.ba-sparkle {
    fill: var(--c-surface);
    transform-box: fill-box;
    transform-origin: center;
    animation: mc-twinkle 2.2s ease-in-out infinite;
}

.ba-sparkle--accent {
    fill: var(--c-accent);
}

.ba-sparkle:nth-child(2) { animation-delay: 0.6s; }
.ba-sparkle:nth-child(3) { animation-delay: 1.1s; }
.ba-sparkle:nth-child(4) { animation-delay: 1.6s; }

/* Joke captions on the "before" picture; each disappears when the border passes it */
.ba-joke {
    position: absolute;
    left: var(--x);
    top: var(--y);
    max-width: calc(100% - var(--x) - 8px);
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--c-ink);
    background: var(--c-surface);
    border-radius: var(--r-xs);
    transform: rotate(var(--r));
    pointer-events: none;
    animation: mc-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ba-joke--1 { --x: 8%; --y: 27%; --r: -4deg; }   /* oil stain on the tiles */
.ba-joke--2 { --x: 52%; --y: 4%; --r: 3deg; }    /* cobweb on the hood */
.ba-joke--3 { --x: 60%; --y: 36%; --r: -3deg; }  /* dishes in the sink */
.ba-joke--4 { --x: 27%; --y: 79%; --r: 2deg; }   /* banana peel on the floor */

/* The bottom caption must stop before the "Înainte" pill in the bottom-right corner. */
.ba-joke--4 {
    max-width: calc(100% - var(--x) - 96px);
}

/* Narrow phones: the caption wraps to several lines — lift it so it clears the bottom pills. */
@media (max-width: 479px) {
    .ba-joke--4 {
        --y: 62%;
    }
}

.ba-pill {
    position: absolute;
    bottom: 16px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-ink);
    border-radius: var(--r-pill);
    pointer-events: none;
}

.ba-pill--after {
    left: 16px;
    background: var(--c-accent);
}

.ba-pill--before {
    right: 16px;
    background: var(--c-surface);
}

.ba-slider__line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--pos);
    width: 4px;
    margin-left: -2px;
    background: var(--c-surface);
    pointer-events: none;
}

.ba-slider__knob {
    position: absolute;
    top: 50%;
    left: var(--pos);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: -28px 0 0 -28px;
    color: var(--c-ink);
    background: var(--c-accent);
    border: 4px solid var(--c-surface);
    border-radius: 50%;
    pointer-events: none;
}

/* Wiggles until the first touch (.is-touched is set by before-after.js) */
.ba-slider:not(.is-touched) .ba-slider__knob {
    animation: mc-nudge 1.4s ease-in-out infinite;
}

.ba-slider:has(.ba-slider__input:focus-visible) .ba-slider__knob {
    outline: var(--focus);
    outline-offset: 3px;
}

/* Transparent range over the whole picture: drag anywhere, arrows on the keyboard.
 * pan-y keeps vertical page scrolling on touch screens. */
.ba-slider__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: ew-resize;
    touch-action: pan-y;
}

@keyframes mc-nudge {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(16px); }
}

@keyframes mc-twinkle {
    0%, 100% { opacity: 0.15; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1.15); }
}

@keyframes mc-pop {
    from { opacity: 0; scale: 0.6; }
    to { opacity: 1; scale: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .ba-sparkle,
    .ba-joke,
    .ba-slider:not(.is-touched) .ba-slider__knob {
        animation: none;
    }
}

/* ==========================================================
 * Free quote from photos (v2 §10.5)
 * ========================================================== */
.photo-quote {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 40px;
    padding: clamp(28px, 5vw, 56px);
    overflow: hidden;
    background: var(--c-ink);
    border-radius: var(--r-hero);
}

.photo-quote__spark {
    position: absolute;
    bottom: -150px;
    left: -110px;
    fill: var(--c-surface);
    opacity: 0.08;
    pointer-events: none;
}

.photo-quote__text {
    position: relative;
    flex: 1 1 380px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.photo-quote__text .pill-label {
    align-self: flex-start;
}

.photo-quote__title {
    color: var(--c-surface);
}

.photo-quote__title .highlight {
    color: var(--c-ink);
}

.photo-quote__lead {
    max-width: 460px;
    font-size: 17px;
    color: var(--c-on-dark);
}

.photo-quote__steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.photo-quote__steps li {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--c-surface);
    border: 1px solid var(--c-ink-line);
    border-radius: 18px;
}

.photo-quote__steps .icon {
    color: var(--c-accent);
}

.photo-quote__card {
    position: relative;
    flex: 1 1 400px;
    min-width: 0;
    max-width: 500px;
    padding: 24px;
    background: var(--c-surface);
    border-radius: var(--r-card);
}

@media (max-width: 639px) {
    .photo-quote,
    .photo-quote__card {
        padding: var(--pad-block-sm);
    }
}

.photo-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.photo-form .field__input {
    border-radius: var(--r-control);
}

.photo-form .field__input.is-invalid {
    border-color: var(--c-error);
}

/* Native file input stays in the tab order; its focus is shown on the drop zone. */
.photo-form__file {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.dropzone {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    cursor: pointer;
    background: var(--c-bg);
    border: 2px dashed var(--c-teal-light);
    border-radius: var(--r-sm);
}

.dropzone.is-over {
    background: var(--c-aqua-soft);
}

.dropzone.is-invalid {
    border-color: var(--c-error);
}

.photo-form__file:focus-visible + .dropzone {
    outline: var(--focus);
    outline-offset: 2px;
    box-shadow: var(--focus-ring);
}

.dropzone__icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    color: var(--c-primary);
    background: var(--c-aqua);
    border-radius: var(--r-btn);
}

.dropzone__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dropzone__title {
    font-size: 15px;
    color: var(--c-primary);
}

.dropzone__hint {
    overflow: hidden;
    font-size: 13px;
    color: var(--c-text-3);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.field__error {
    display: block;
    font-size: 13px;
    color: var(--c-error);
}

/* Honeypot, off-screen */
.photo-form__trap {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.photo-success {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 4px;
}

.photo-success:focus {
    outline: none;
}

.photo-success__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    color: var(--c-ink);
    background: var(--c-accent);
    border-radius: 18px;
}

.photo-success__icon .icon {
    stroke-width: 2.4;
}

.photo-success__title {
    font-size: 24px;
}

.photo-success__text {
    color: var(--c-text-2);
}

/* ==========================================================
 * Final CTA (§12)
 * ========================================================== */
.cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding: clamp(28px, 5vw, 64px);
    color: var(--c-surface);
    background: var(--c-primary);
    border-radius: var(--r-hero);
}

@media (max-width: 639px) {
    .cta {
        padding: var(--pad-block-sm);
    }
}

.cta__text {
    flex: 1 1 380px;
    min-width: 0;
}

.cta__text .h2 {
    margin-bottom: 12px;
}

.cta__lead {
    font-size: 17px;
}

.cta__form {
    flex: 1 1 380px;
    min-width: 0;
}

.cta a {
    color: var(--c-surface);
}
