/* Additional custom styles beyond Tailwind */

/* Smooth scrolling + lock horizontal overflow so mobile pull-down doesn't drift sideways */
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}
body {
    overflow-x: hidden;
    overscroll-behavior-x: none;
    width: 100%;
    max-width: 100vw;
    position: relative;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Animation for service cards */
.service-card {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== HERO BACKGROUND ========== */
.hero-bg {
    background-image:
        linear-gradient(135deg, rgba(15, 23, 42, 0.78) 0%, rgba(15, 23, 42, 0.55) 55%, rgba(146, 64, 14, 0.55) 100%),
        url('imgs/hero/hero-bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

@media (max-width: 768px) {
    .hero-bg {
        background-image:
            linear-gradient(180deg, rgba(15, 23, 42, 0.85) 0%, rgba(15, 23, 42, 0.7) 60%, rgba(146, 64, 14, 0.6) 100%),
            url('imgs/hero/hero-bg.jpg');
    }
}

/* ========== Coverage / Cities ========== */
.cities-wrap {
    position: relative;
}
.cities-search-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.cities-search-input {
    position: relative;
    flex: 1 1 260px;
    min-width: 0;
    display: flex;
    align-items: center;
}
.cities-search-icon {
    position: absolute;
    left: 14px;
    color: rgba(248, 250, 252, 0.55);
    pointer-events: none;
}
.cities-search-input input {
    width: 100%;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #fff;
    border-radius: 12px;
    padding: 12px 14px 12px 40px;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}
.cities-search-input input::placeholder { color: rgba(248, 250, 252, 0.45); }
.cities-search-input input:focus {
    border-color: rgba(249, 115, 22, 0.65);
    background: rgba(15, 23, 42, 0.85);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.12);
}
.cities-count {
    font-size: 0.85rem;
    color: rgba(248, 250, 252, 0.55);
    flex-shrink: 0;
    white-space: nowrap;
}

.cities-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 8px;
    justify-content: flex-start;
    /* Collapsed state: clip overflow so only first rows are visible.
       JS sets explicit max-height (in px) when toggling for smooth animation. */
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.55s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: max-height;
}
/* When fully expanded after JS animation, allow content to flow naturally
   (no transition flicker on resize / search). */
.cities-grid.is-fully-open {
    max-height: none;
    overflow: visible;
}

/* City tags */
.city-tag {
    background: rgba(30, 41, 59, 0.85);
    color: #cbd5e1;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 0.875rem;
    cursor: default;
    border: 1px solid rgba(148, 163, 184, 0.18);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, opacity 0.35s ease;
    user-select: none;
    line-height: 1.2;
}
.city-tag:hover {
    background: rgba(249, 115, 22, 0.92);
    color: #fff;
    border-color: rgba(249, 115, 22, 0.6);
    transform: translateY(-1px);
}
/* Tags beyond the preview list — fade them in/out gracefully when revealed */
.city-tag.is-extra {
    opacity: 0;
    transform: translateY(-3px);
}
.cities-grid.is-expanded .city-tag.is-extra,
.cities-grid.is-fully-open .city-tag.is-extra {
    opacity: 1;
    transform: none;
}

.cities-empty {
    margin-top: 1rem;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px dashed rgba(148, 163, 184, 0.3);
    color: rgba(248, 250, 252, 0.7);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.cities-empty[hidden] { display: none; }

.cities-actions {
    display: flex;
    justify-content: center;
    margin-top: 1.25rem;
}
.cities-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    color: #fed7aa;
    border: 1px solid rgba(249, 115, 22, 0.45);
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.cities-toggle-btn:hover {
    background: rgba(249, 115, 22, 0.15);
    color: #fff;
    border-color: rgba(249, 115, 22, 0.75);
}
.cities-toggle-chev {
    transition: transform 0.3s ease;
}
.cities-toggle-btn.is-expanded .cities-toggle-chev {
    transform: rotate(180deg);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Focus states for accessibility */
button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid #f97316;
    outline-offset: 2px;
}

/* Loading state for buttons */
button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Image hover effects */
img {
    transition: transform 0.3s ease;
}

.group:hover img {
    transform: scale(1.05);
}

/* Glass morphism enhancement */
.glass-card {
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

/* Text selection color */
::selection {
    background-color: #f97316;
    color: white;
}

/* ========== QUIZ STYLES ========== */
/* Big orange progress bar */
.quiz-progress-track {
    height: 6px;
    background: #fef3e7;
    border-radius: 999px;
    overflow: hidden;
}
.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f97316, #fb923c);
    border-radius: 999px;
    transition: width 0.35s ease;
}

/* Image-card option (for type selection) */
.option-card {
    position: relative;
    cursor: pointer;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    display: block;
}
.option-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}
.option-card .option-card-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}
.option-card-frame {
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.option-card-frame > picture {
    display: block;
    line-height: 0;
}
.option-card-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    vertical-align: top;
    background: #f1f5f9;
}
.option-card-label {
    padding: 10px 12px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 500;
    color: #1e293b;
    line-height: 1.3;
}
.option-card-check {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: #fff;
    border: 2px solid #f97316;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease;
    z-index: 2;
}
.option-card-check::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: transparent;
    transition: background 0.18s ease;
}
/* Selected state */
.option-card:has(.option-card-input:checked) .option-card-frame {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}
.option-card:has(.option-card-input:checked) .option-card-check::after {
    background: #f97316;
}
.option-card:has(.option-card-input:checked) .option-card-check {
    background: #fff7ed;
}

/* Pill option (for text-only choices like area, timing) */
.option-pill {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border: 2px solid transparent;
    background: #f1f5f9;
    border-radius: 12px;
    color: #1e293b;
    font-weight: 500;
    transition: background 0.18s ease, border-color 0.18s ease;
}
.option-pill:hover {
    background: #e2e8f0;
}
.option-pill .option-pill-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}
.option-pill-radio {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 2px solid #f97316;
    background: #fff;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease;
}
.option-pill-radio::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: transparent;
    transition: background 0.18s ease;
}
.option-pill:has(.option-pill-input:checked) {
    background: #fff7ed;
    border-color: #f97316;
}
.option-pill:has(.option-pill-input:checked) .option-pill-radio::after {
    background: #f97316;
}

/* Quiz nav buttons */
.quiz-btn-primary {
    background: linear-gradient(90deg, #f97316, #fb923c);
    color: #fff;
    font-weight: 700;
    padding: 14px 22px;
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(249, 115, 22, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.quiz-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(249, 115, 22, 0.32);
}
.quiz-btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}
.quiz-btn-back {
    width: 56px;
    height: 56px;
    border: 2px solid #fed7aa;
    border-radius: 14px;
    color: #f97316;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}
.quiz-btn-back:hover:not(:disabled) {
    background: #fff7ed;
}
.quiz-btn-back:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Phone input */
.quiz-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    font-size: 1rem;
    transition: border-color 0.18s ease, background 0.18s ease;
}
.quiz-input:focus {
    border-color: #f97316;
    background: #fff;
    outline: none;
}

/* ========== HERO CARDS (clean, professional) ========== */
/* Compound selector to outweigh `.glass-card` declared inline in <head> */
.glass-card.liquid-glass {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 12px 32px rgba(15, 23, 42, 0.10),
        0 28px 60px rgba(15, 23, 42, 0.10);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.glass-card.liquid-glass:hover {
    transform: translateY(-3px);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 18px 40px rgba(15, 23, 42, 0.12),
        0 36px 70px rgba(15, 23, 42, 0.14);
}

.glass-card.liquid-glass--orange:hover {
    box-shadow:
        0 1px 2px rgba(249, 115, 22, 0.06),
        0 18px 40px rgba(249, 115, 22, 0.18),
        0 36px 70px rgba(249, 115, 22, 0.18);
}

/* ========== SMOOTH FADE / TAB ANIMATIONS ========== */
.fade-in-up {
    animation: fadeInUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(14px);
        filter: blur(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

.fade-out {
    animation: fadeOut 0.22s ease-in both;
}
@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-8px); }
}

/* Stagger card grids when they appear */
.stagger-fade > * {
    opacity: 0;
    animation: fadeInUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.stagger-fade > *:nth-child(1)  { animation-delay: 0.00s; }
.stagger-fade > *:nth-child(2)  { animation-delay: 0.04s; }
.stagger-fade > *:nth-child(3)  { animation-delay: 0.08s; }
.stagger-fade > *:nth-child(4)  { animation-delay: 0.12s; }
.stagger-fade > *:nth-child(5)  { animation-delay: 0.16s; }
.stagger-fade > *:nth-child(6)  { animation-delay: 0.20s; }
.stagger-fade > *:nth-child(7)  { animation-delay: 0.24s; }
.stagger-fade > *:nth-child(8)  { animation-delay: 0.28s; }
.stagger-fade > *:nth-child(9)  { animation-delay: 0.32s; }
.stagger-fade > *:nth-child(10) { animation-delay: 0.36s; }
.stagger-fade > *:nth-child(n+11) { animation-delay: 0.40s; }

/* Tab buttons get a smoother color transition */
.tab-active, .tab-inactive {
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.18s ease;
}
.tab-active {
    box-shadow: 0 8px 18px rgba(249, 115, 22, 0.25);
}
.tab-inactive:hover {
    transform: translateY(-1px);
}

/* Quiz step animation */
.roofing-step,
.terrace-step,
.inline-step {
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.quiz-step-enter {
    animation: quizStepEnter 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes quizStepEnter {
    from {
        opacity: 0;
        transform: translateX(18px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
.quiz-step-enter-back {
    animation: quizStepEnterBack 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes quizStepEnterBack {
    from {
        opacity: 0;
        transform: translateX(-18px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .fade-in-up, .stagger-fade > *, .quiz-step-enter, .quiz-step-enter-back {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ========== QUIZ MODAL UX ========== */
/* Sticky navigation row inside quiz form */
.quiz-nav {
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.95) 35%, #fff 100%);
    backdrop-filter: blur(6px);
    margin-top: 1rem;
    margin-bottom: -1rem;   /* pull bottom of form down so background covers ~bottom edge */
    padding: 1rem 0 1rem;
    z-index: 5;
}

/* ========== INLINE ANKETA (under hero) ========== */
.inline-quiz-section {
    position: relative;
    background:
        radial-gradient(1200px 400px at 50% -120px, rgba(249, 115, 22, 0.08), transparent 70%),
        linear-gradient(180deg, #f8fafc 0%, #ffffff 60%, #f8fafc 100%);
}
.inline-quiz-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 10%, rgba(249, 115, 22, 0.04) 0%, transparent 35%),
        radial-gradient(circle at 80% 80%, rgba(249, 115, 22, 0.04) 0%, transparent 35%);
    pointer-events: none;
}
.inline-quiz-card {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 24px;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 12px 32px rgba(15, 23, 42, 0.08),
        0 24px 60px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.inline-quiz-card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 18px 40px rgba(15, 23, 42, 0.10),
        0 32px 70px rgba(15, 23, 42, 0.08);
}
.inline-quiz-header {
    padding: 1.5rem 2rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}
.inline-quiz-body {
    padding: 1.5rem 2rem;
}
.inline-quiz-nav {
    /* override the modal-style sticky behavior — the inline quiz is inside the page flow */
    position: static !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    background: transparent !important;
    backdrop-filter: none !important;
}
.inline-quiz-trust {
    color: #64748b;
}
.inline-quiz-trust-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 500;
}
.inline-quiz-trust-item span {
    line-height: 1.2;
}

/* Quiz image-card grid: always 3 columns on phone — 6 cards fit on screen at once */
@media (max-width: 767px) {
    #roofingQuizForm .grid.grid-cols-2,
    #terraceQuizForm .grid.grid-cols-2,
    #inlineQuizForm .grid.grid-cols-2 {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 0.4rem !important;
    }
    /* Smaller image, smaller label */
    .option-card-img {
        aspect-ratio: 1 / 1 !important;
    }
    .option-card-label {
        font-size: 0.7rem !important;
        padding: 4px 2px !important;
        line-height: 1.15 !important;
        min-height: 2rem !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .option-card-frame { border-radius: 10px !important; }
    .option-card { border-radius: 10px !important; }
    .option-card-check {
        top: 4px !important;
        right: 4px !important;
        width: 18px !important;
        height: 18px !important;
        border-width: 1.5px !important;
    }
    .option-card-check::after {
        width: 7px !important;
        height: 7px !important;
    }

    /* Reduce form vertical padding so step content + sticky CTA fit */
    #roofingQuizForm,
    #terraceQuizForm {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
    .roofing-step h4,
    .terrace-step h4,
    .inline-step h4 {
        margin-bottom: 0.85rem !important;
        font-size: 1.05rem !important;
        line-height: 1.4rem !important;
    }

    /* Inline quiz: tighter padding on phone */
    .inline-quiz-section {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    .inline-quiz-header {
        padding: 1rem 1.1rem 0.9rem !important;
    }
    .inline-quiz-body {
        padding: 1rem 1.1rem !important;
    }
    .inline-quiz-card {
        border-radius: 18px !important;
    }
    .inline-quiz-trust-item {
        font-size: 0.7rem !important;
    }
}

/* Even tinier on very small phones */
@media (max-width: 360px) {
    .option-card-label { font-size: 0.62rem !important; }
}

/* ========== MOBILE OPTIMIZATIONS ========== */

/* Tablet & phone (≤768px) */
@media (max-width: 767px) {
    /* Smaller, less wasteful section padding */
    section.py-20 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    main > section:first-of-type {
        /* hero — keep room above fixed header but trim total height */
        min-height: auto !important;
        padding-top: 5rem !important;
        padding-bottom: 2rem !important;
    }

    /* Header — slightly more compact */
    #header .h-20 { height: 4.5rem; }

    /* Logo subtitle is decorative — hide on phone to free space for nav */
    header .text-xs.text-slate-500 { display: none; }
    header .text-2xl.font-bold { font-size: 1.25rem; line-height: 1.6rem; }

    /* Hero glass cards: tighten padding so content has more room */
    .hero-bg .glass-card {
        padding: 1.25rem !important;
    }
    .hero-bg h1,
    .hero-bg h2 {
        font-size: 1.875rem !important;
        line-height: 2.25rem !important;
        margin-bottom: 0.75rem !important;
    }
    .hero-bg p.text-lg {
        font-size: 1rem !important;
        line-height: 1.5rem !important;
        margin-bottom: 1.25rem !important;
    }
    .hero-bg ul.space-y-3 { margin-bottom: 1.25rem !important; }
    .hero-bg ul.space-y-3 > li + li { margin-top: 0.5rem !important; }
    .hero-bg button {
        padding: 0.875rem 1rem !important;
        font-size: 0.95rem !important;
    }

    /* Trust badges grid: a bit tighter */
    .hero-bg .mt-12 { margin-top: 1.5rem !important; }
    .hero-bg .mt-12 .glass-card { padding: 0.75rem !important; }
    .hero-bg .mt-12 .text-3xl {
        font-size: 1.5rem !important;
        line-height: 1.75rem !important;
    }
    .hero-bg .mt-12 .text-sm { font-size: 0.75rem !important; }

    /* Section headlines */
    section h2.text-4xl,
    section h2.text-5xl {
        font-size: 1.75rem !important;
        line-height: 2.1rem !important;
    }
    section .mb-16 { margin-bottom: 2.5rem !important; }
    section .mb-12 { margin-bottom: 2rem !important; }
    section p.text-lg, section p.text-xl {
        font-size: 1rem !important;
        line-height: 1.55rem !important;
    }

    /* Service cards spacing */
    #services .grid.gap-6 { gap: 1rem !important; }
    .service-card { padding: 1.25rem !important; }
    .service-card h3.text-xl {
        font-size: 1.05rem !important;
        line-height: 1.4rem !important;
    }

    /* Service tab buttons: full-row scrollable, larger touch */
    #services .flex.flex-wrap.justify-center.gap-3 {
        gap: 0.5rem !important;
    }
    #services .flex.flex-wrap.justify-center button {
        padding: 0.55rem 0.9rem !important;
        font-size: 0.85rem !important;
    }

    /* Coverage section cities — compact on mobile */
    #coverage .cities-wrap { padding: 1rem !important; }
    #coverage .city-tag { font-size: 0.82rem; padding: 6px 11px; }
    #coverage .cities-grid { gap: 6px; }
    #coverage .cities-search-row { margin-bottom: 0.875rem; gap: 8px; }
    #coverage .cities-search-input input { padding: 10px 12px 10px 36px; font-size: 0.9rem; }
    #coverage .cities-search-icon { left: 12px; }
    #coverage .cities-count { width: 100%; text-align: right; }
    #coverage .cities-actions { margin-top: 1rem; }
    #coverage .cities-toggle-btn { padding: 9px 16px; font-size: 0.85rem; }

    /* Gallery cards */
    #gallery .grid.gap-6 { gap: 1rem !important; }
    #gallery img.h-64 { height: 13rem !important; }

    /* About section icons + grid */
    #about .grid.gap-6 { gap: 1.25rem !important; }
    #about h3.text-xl {
        font-size: 1.05rem !important;
        line-height: 1.4rem !important;
    }
    /* The "15+ лет на рынке" badge — re-position so it doesn't overflow viewport */
    #about .absolute.-bottom-6.-right-6 {
        right: 0.5rem !important;
        bottom: -1rem !important;
        padding: 1rem !important;
    }
    #about .absolute.-bottom-6.-right-6 .text-4xl {
        font-size: 1.75rem !important;
        line-height: 2rem !important;
    }

    /* Contacts CTA section */
    #contacts h2.text-4xl {
        font-size: 1.75rem !important;
        line-height: 2.1rem !important;
    }
    #contacts p.text-xl {
        font-size: 1rem !important;
        line-height: 1.5rem !important;
        margin-bottom: 1.5rem !important;
    }
    #contacts input[type="tel"] {
        font-size: 1rem !important;
        padding: 0.875rem 1.25rem !important;
    }
    #contacts button {
        font-size: 1rem !important;
        padding: 0.875rem 1.5rem !important;
    }

    /* Footer */
    footer.py-12 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    footer .grid.gap-8 { gap: 1.5rem !important; }

    /* Modals: full-screen friendly */
    #modal .max-w-md { width: 100% !important; max-width: 100% !important; }
    #modal .p-4 { padding: 1rem !important; }
    #modal .p-8 { padding: 1.5rem !important; }
    #modal h3.text-2xl {
        font-size: 1.25rem !important;
        line-height: 1.6rem !important;
    }

    /* Roofing/terrace quiz modals: comfortable on small screens */
    #roofingModal .max-w-2xl,
    #terraceModal .max-w-2xl {
        max-width: 100% !important;
    }
    #roofingModal .p-3,
    #terraceModal .p-3 { padding: 0.5rem !important; }
    #roofingModal .max-h-\[92vh\],
    #terraceModal .max-h-\[92vh\] { max-height: 95vh !important; }
    #roofingModal h4,
    #terraceModal h4 {
        font-size: 1.1rem !important;
        line-height: 1.5rem !important;
        margin-bottom: 1rem !important;
    }

    /* Pills (radio options): larger touch + smaller text wrap */
    .option-pill {
        padding: 12px 14px !important;
        font-size: 0.95rem !important;
        line-height: 1.3 !important;
    }

    /* Quiz nav buttons */
    .quiz-btn-primary {
        padding: 12px 16px !important;
        font-size: 0.95rem !important;
    }
    .quiz-btn-back {
        width: 48px !important;
        height: 48px !important;
    }

    /* Make body leave space for sticky bottom CTA bar */
    body { padding-bottom: 68px; }
}

/* Small phones (≤480px) */
@media (max-width: 480px) {
    .hero-bg h1,
    .hero-bg h2 {
        font-size: 1.625rem !important;
        line-height: 2rem !important;
    }
    .hero-bg .glass-card { padding: 1rem !important; }
    section h2.text-4xl,
    section h2.text-5xl {
        font-size: 1.5rem !important;
        line-height: 1.9rem !important;
    }
    /* Drop the second hero card's top spacing since they stack */
    .hero-bg .gap-8, .hero-bg .lg\:gap-12 { gap: 1rem !important; }

    /* Trust badges: 2-cols already; tighten further */
    .hero-bg .mt-12 .text-3xl { font-size: 1.25rem !important; }

    /* Service tabs scroll horizontally on tiniest screens to keep them on one row look */
    #services .flex.flex-wrap.justify-center.gap-3 {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        justify-content: flex-start !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.25rem;
    }
    #services .flex.flex-wrap.justify-center.gap-3::-webkit-scrollbar { display: none; }
    #services .flex.flex-wrap.justify-center.gap-3 button {
        flex-shrink: 0 !important;
    }

    .container,
    .mx-auto.px-4 { padding-left: 0.875rem !important; padding-right: 0.875rem !important; }
}

/* Hide page-level bottom CTA when any modal is open */
body:has(#modal:not(.hidden)) .mobile-bottom-bar,
body:has(#roofingModal:not(.hidden)) .mobile-bottom-bar,
body:has(#terraceModal:not(.hidden)) .mobile-bottom-bar {
    display: none !important;
}

/* ========== STICKY MOBILE BOTTOM CTA ========== */
.mobile-bottom-bar {
    display: none;
}
@media (max-width: 767px) {
    .mobile-bottom-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 60;
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(14px) saturate(140%);
        -webkit-backdrop-filter: blur(14px) saturate(140%);
        border-top: 1px solid rgba(226, 232, 240, 0.7);
        padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 10px);
        gap: 10px;
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
    }
    .mobile-bottom-bar a,
    .mobile-bottom-bar button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        height: 48px;
        border-radius: 12px;
        font-weight: 600;
        font-size: 0.95rem;
        text-decoration: none;
        transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
    }
    /* Phone — icon-only, secondary */
    .mobile-bottom-bar .mb-call {
        flex: 0 0 48px;
        width: 48px;
        background: #f1f5f9;
        color: #0f172a;
        border: 1px solid #e2e8f0;
    }
    .mobile-bottom-bar .mb-call:active {
        background: #e2e8f0;
    }
    /* Order callback — primary, but calmer than the hero CTA */
    .mobile-bottom-bar .mb-cta {
        flex: 1;
        background: #0f172a;
        color: #fff;
    }
    .mobile-bottom-bar .mb-cta:active {
        background: #1e293b;
    }
    .mobile-bottom-bar a:active,
    .mobile-bottom-bar button:active {
        transform: translateY(1px);
    }
}

/* Mobile menu polish */
@media (max-width: 1023px) {
    #mobileMenu a { font-size: 1rem; padding: 12px 4px; }
    #mobileMenu .mobile-cta-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        margin-top: 6px;
        background: #f97316;
        color: #fff;
        padding: 12px 16px;
        border-radius: 999px;
        font-weight: 700;
        width: 100%;
    }
}

/* ========== HERO (text on background, with toggle) ========== */
.hero-content {
    color: #f8fafc;
    position: relative;
}

/* Toggle pill */
.hero-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 4px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    margin-bottom: 2rem;
    overflow: hidden;
}
.hero-toggle-btn {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 999px;
    color: rgba(248, 250, 252, 0.78);
    font-weight: 600;
    font-size: 0.95rem;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: color 0.35s ease;
}
.hero-toggle-btn.active {
    color: #ffffff;
}
.hero-toggle-btn svg {
    transition: transform 0.4s ease;
}
.hero-toggle-btn.active svg {
    transform: scale(1.05);
}
/* Sliding indicator behind active button */
.hero-toggle-indicator {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    border-radius: 999px;
    background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.45);
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 1;
    pointer-events: none;
}
.hero-toggle[data-active="terrace"] .hero-toggle-indicator {
    transform: translateX(100%);
}

/* Stack — both panels share the same grid cell so heights align and we can crossfade */
.hero-stack {
    position: relative;
    display: grid;
    grid-template-areas: "panel";
}
.hero-panel {
    grid-area: panel;
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
    transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), filter 0.45s ease;
    filter: blur(2px);
    will-change: opacity, transform;
}
.hero-panel.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    filter: blur(0);
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #f8fafc;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    margin-bottom: 1.25rem;
}
.hero-eyebrow--orange {
    background: rgba(249, 115, 22, 0.18);
    border-color: rgba(251, 146, 60, 0.35);
    color: #fed7aa;
}

.hero-heading {
    font-size: clamp(2.25rem, 6vw, 4.25rem);
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
    margin-bottom: 1.25rem;
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}
.hero-heading-accent {
    background: linear-gradient(135deg, #f8fafc 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-heading-accent--orange {
    background: linear-gradient(135deg, #fb923c 0%, #f97316 60%, #ea580c 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-heading-accent--white {
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-lead {
    color: rgba(248, 250, 252, 0.92);
    font-size: clamp(1.02rem, 2.2vw, 1.2rem);
    line-height: 1.7;
    max-width: 38rem;
    margin: 0 auto 1.75rem;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.35);
}

.hero-bullets {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 22px;
    list-style: none;
    padding: 0;
    margin: 0 auto 2.25rem;
    max-width: 40rem;
}
/* Default pill style — kept for back-compat */
.hero-bullets li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    font-size: 0.92rem;
    font-weight: 500;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.hero-bullets li svg {
    color: #4ade80;
    flex-shrink: 0;
}
.hero-bullets--orange li svg {
    color: #fb923c;
}

/* Plain bullets — no pills, just icon + text. Used by the cleaned-up hero. */
.hero-bullets--plain li {
    background: transparent;
    border: 0;
    padding: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    color: rgba(248, 250, 252, 0.92);
    font-size: 0.95rem;
    font-weight: 500;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}
.hero-bullets--plain li svg {
    color: #34d399;
    width: 18px;
    height: 18px;
    stroke-width: 3;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
}

.hero-cta {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 32px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 1rem;
    border: 0;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
    color: #fff;
}
.hero-cta svg { transition: transform 0.25s ease; }
.hero-cta:hover svg { transform: translateX(3px); }
.hero-cta:active { filter: brightness(0.96); transition-duration: 0.1s; }
.hero-cta--slate {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.hero-cta--slate:hover {
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
}
.hero-cta--orange {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    box-shadow: 0 12px 28px rgba(249, 115, 22, 0.45);
}
.hero-cta--orange:hover {
    background: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
}

/* Trust badges — frosted on dark hero */
.hero-badges { padding: 0; }
.hero-badge {
    padding: 22px 16px;
    text-align: center;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    transition: transform 0.3s ease, background 0.3s ease;
}
.hero-badge:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.11);
}
.hero-badge-num {
    font-size: clamp(2rem, 4vw, 2.5rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.01em;
    background: linear-gradient(135deg, #ffffff 0%, #fed7aa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.hero-badge-label {
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(226, 232, 240, 0.55);
    margin-top: 8px;
    font-weight: 500;
}

/* Mobile tweaks for new hero */
@media (max-width: 767px) {
    .hero-heading { margin-bottom: 0.85rem; }
    .hero-lead { margin-bottom: 1.25rem; font-size: 0.98rem; line-height: 1.6; }
    .hero-bullets { gap: 8px 18px; margin-bottom: 1.6rem; }
    .hero-bullets li { font-size: 0.88rem; }
    .hero-bullets--plain li { font-size: 0.9rem; }
    .hero-cta { padding: 14px 24px; font-size: 0.98rem; }
    .hero-badges { margin-top: 2rem !important; gap: 10px !important; }
    .hero-badge { padding: 16px 10px; }
    .hero-badge-num { font-size: 1.65rem; }
    .hero-badge-label { font-size: 0.65rem; margin-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
    .hero-panel, .hero-toggle-indicator, .hero-cta {
        transition: none !important;
    }
}

/* ========== MODAL ENTRANCE / EXIT ANIMATIONS ========== */
/* Light-weight transform-only animations — perform smoothly on mobile */
#modal:not(.hidden):not(.is-closing) > div:nth-child(1),
#roofingModal:not(.hidden):not(.is-closing) > div:nth-child(1),
#terraceModal:not(.hidden):not(.is-closing) > div:nth-child(1) {
    animation: backdropFadeIn 0.28s ease both;
}
#modal:not(.hidden):not(.is-closing) > div:nth-child(2),
#roofingModal:not(.hidden):not(.is-closing) > div:nth-child(2),
#terraceModal:not(.hidden):not(.is-closing) > div:nth-child(2) {
    animation: modalContentIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
    will-change: transform, opacity;
}

/* Exit animations — fade + small scale-down, no blur (mobile-friendly) */
#modal.is-closing > div:nth-child(1),
#roofingModal.is-closing > div:nth-child(1),
#terraceModal.is-closing > div:nth-child(1) {
    animation: backdropFadeOut 0.24s ease both;
}
#modal.is-closing > div:nth-child(2),
#roofingModal.is-closing > div:nth-child(2),
#terraceModal.is-closing > div:nth-child(2) {
    animation: modalContentOut 0.26s cubic-bezier(0.4, 0, 1, 1) both;
}

@keyframes backdropFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes backdropFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}
@keyframes modalContentIn {
    from {
        opacity: 0;
        transform: translate(-50%, calc(-50% + 16px)) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}
@keyframes modalContentOut {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, calc(-50% + 12px)) scale(0.97);
    }
}

@media (prefers-reduced-motion: reduce) {
    #modal > div, #roofingModal > div, #terraceModal > div {
        animation: none !important;
    }
}

/* ========== NOTIFICATION TOAST ON MOBILE — keep above sticky bottom bar ========== */
@media (max-width: 767px) {
    #notification {
        bottom: 84px !important;
        right: 12px !important;
        left: 12px !important;
        max-width: calc(100% - 24px);
        width: auto;
    }
}

/* ========== SMOOTH SERVICES GRID FILTER ========== */
#servicesGrid {
    transition: opacity 0.22s ease, height 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, height;
}
#servicesGrid.is-filtering {
    opacity: 0;
}
#servicesGrid > .service-card {
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
    backface-visibility: hidden;
}

/* ========== SERVICE CARDS WITH PHOTOS & PRICE ========== */
.service-card--with-photo {
    padding: 0 !important;
    overflow: hidden;
    background: #fff !important;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}
.service-card--with-photo .service-card-photo-wrap {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #f1f5f9;
    /* isolate creates a new stacking context, prevents subpixel bleed */
    isolation: isolate;
    -webkit-transform: translateZ(0);
            transform: translateZ(0);
}
.service-card--with-photo .service-card-photo-wrap > picture {
    display: block;
    width: 100%;
    height: 100%;
}
.service-card--with-photo .service-card-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    vertical-align: top;
    transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
    transform-origin: center center;
    /* tiny base scale eliminates 1px subpixel gap on edges in all browsers */
    transform: scale(1.01);
}
.service-card--with-photo:hover .service-card-photo {
    transform: scale(1.04);
}
.service-card--with-photo .service-card-photo-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.55) 0%, rgba(15, 23, 42, 0) 45%);
    pointer-events: none;
}
.service-price-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #f97316;
    color: #fff;
    font-weight: 700;
    font-size: 0.82rem;
    padding: 6px 12px;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35);
    z-index: 2;
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.service-price-badge .price-unit {
    font-weight: 500;
    opacity: 0.9;
    margin-left: 2px;
}
.service-card--with-photo .service-card-body {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}
.service-card--with-photo .service-card-body h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
    line-height: 1.25;
}
.service-card--with-photo .service-card-body p {
    color: #64748b;
    font-size: 0.88rem;
    margin-bottom: 14px;
    line-height: 1.45;
    flex: 1 1 auto;
}
.service-card--with-photo .service-card-body .service-card-cta {
    color: #ea580c;
    font-weight: 600;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    margin-top: auto;
    transition: color 0.2s ease, transform 0.2s ease;
    pointer-events: none; /* whole card is clickable */
}
.service-card--with-photo:hover .service-card-cta {
    color: #c2410c;
    transform: translateX(2px);
}
.service-card--with-photo {
    cursor: pointer;
}
.service-card--with-photo:hover {
    border-color: #fed7aa;
    box-shadow: 0 18px 30px -12px rgba(15, 23, 42, 0.15);
}
.service-card--with-photo:focus-visible {
    outline: 3px solid #fb923c;
    outline-offset: 2px;
}

/* featured ("под ключ") — ведёт себя идентично остальным карточкам */

@media (max-width: 640px) {
    .service-card--with-photo .service-card-photo-wrap { aspect-ratio: 16 / 9; }
    .service-price-badge { font-size: 0.78rem; padding: 5px 10px; top: 10px; right: 10px; }
    .service-card--with-photo .service-card-body { padding: 14px 16px 16px; }
    .service-card--with-photo .service-card-body h3 { font-size: 1rem; }
    .service-card--with-photo .service-card-body p { font-size: 0.84rem; margin-bottom: 10px; }
}

/* ========== QUIZ STEP 1: WORK TYPE — IMAGE GRID ========== */
.work-type-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
@media (min-width: 640px) {
    .work-type-grid { gap: 14px; }
}
.work-type-grid .option-card-img {
    aspect-ratio: 4 / 3;
}
.work-type-grid .option-card-label {
    padding: 9px 8px 11px;
    font-size: 0.85rem;
    line-height: 1.25;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
@media (max-width: 380px) {
    .work-type-grid .option-card-label { font-size: 0.74rem; min-height: 38px; }
}

/* ========== MOBILE MENU — smooth slide/fade ========== */
.mobile-menu {
    background: #fff;
    border-top: 1px solid #e2e8f0;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: max-height 0.38s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.25s ease,
                transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.mobile-menu.is-open {
    max-height: 480px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.mobile-menu-inner {
    padding: 14px 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mobile-menu-inner > * {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.mobile-menu.is-open .mobile-menu-inner > * {
    opacity: 1;
    transform: translateY(0);
}
.mobile-menu.is-open .mobile-menu-inner > *:nth-child(1) { transition-delay: 0.06s; }
.mobile-menu.is-open .mobile-menu-inner > *:nth-child(2) { transition-delay: 0.10s; }
.mobile-menu.is-open .mobile-menu-inner > *:nth-child(3) { transition-delay: 0.13s; }
.mobile-menu.is-open .mobile-menu-inner > *:nth-child(4) { transition-delay: 0.16s; }
.mobile-menu.is-open .mobile-menu-inner > *:nth-child(5) { transition-delay: 0.19s; }
.mobile-menu.is-open .mobile-menu-inner > *:nth-child(6) { transition-delay: 0.22s; }

/* Animated burger ⇄ X icon */
.mobile-burger { background: transparent; border: 0; cursor: pointer; }
.mobile-burger-icon {
    position: relative;
    display: inline-block;
    width: 24px;
    height: 18px;
}
.mobile-burger-icon span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2.5px;
    background: #334155;
    border-radius: 2px;
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.2s ease,
                top 0.25s ease;
}
.mobile-burger-icon span:nth-child(1) { top: 0; }
.mobile-burger-icon span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.mobile-burger-icon span:nth-child(3) { top: calc(100% - 2.5px); }
.mobile-burger.is-active .mobile-burger-icon span:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}
.mobile-burger.is-active .mobile-burger-icon span:nth-child(2) {
    opacity: 0;
}
.mobile-burger.is-active .mobile-burger-icon span:nth-child(3) {
    top: 50%;
    transform: translateY(-50%) rotate(-45deg);
}

/* ========== MOBILE QUIZ POLISH ========== */
@media (max-width: 640px) {
    /* Modal quiz — full-screen on phones so nav buttons are always reachable */
    #roofingModal > div:nth-child(2) {
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    #roofingModal > div:nth-child(2) > div {
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important; /* form does the scrolling */
    }
    /* Quiz form is the scrollable region; nav row stays sticky at the bottom */
    #roofingModal #roofingQuizForm {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
        padding-top: 16px !important;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
        font-size: 0.95rem !important;
    }
    #roofingModal .border-b.border-slate-100 {
        flex: 0 0 auto;
        padding-left: 16px !important;
        padding-right: 52px !important;
        padding-top: calc(14px + env(safe-area-inset-top, 0px)) !important;
        padding-bottom: 12px !important;
    }
    /* Close button — bigger touch target, account for safe-area-inset */
    #roofingModal button[onclick="closeRoofingModal()"] {
        top: calc(10px + env(safe-area-inset-top, 0px)) !important;
        right: 10px !important;
    }
    /* Sticky nav inside the scrollable form — always visible */
    #roofingModal .quiz-nav {
        position: sticky;
        bottom: 0;
        margin-top: 16px !important;
        margin-bottom: 0 !important;
        padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)) !important;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #fff 30%, #fff 100%);
    }

    /* Step heading smaller */
    .roofing-step h4,
    .inline-step h4 {
        font-size: 1.05rem !important;
        margin-bottom: 14px !important;
        line-height: 1.3;
    }
    .roofing-step .option-pill,
    .inline-step .option-pill {
        padding: 11px 14px;
        font-size: 0.92rem;
    }
    .work-type-grid { gap: 10px; }
    .roofing-step .grid.grid-cols-2,
    .inline-step .grid.grid-cols-2 {
        gap: 10px !important;
    }
    .work-type-grid .option-card-label {
        font-size: 0.78rem;
        padding: 8px 6px 10px;
        min-height: 36px;
    }
    /* Quiz nav: smaller buttons + tighter gap */
    .quiz-nav {
        gap: 8px !important;
    }
    .quiz-nav .quiz-btn-back {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }
    .quiz-nav .quiz-btn-primary {
        padding: 12px 14px;
        font-size: 0.92rem;
    }
    .quiz-input {
        padding: 12px 14px;
        font-size: 0.95rem;
    }

    /* Same treatment for terrace modal */
    #terraceModal > div:nth-child(2) {
        top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
        transform: none !important; width: 100% !important; max-width: 100% !important;
        height: 100vh !important; height: 100dvh !important;
        max-height: 100vh !important; max-height: 100dvh !important;
        padding: 0 !important; margin: 0 !important;
    }
    #terraceModal > div:nth-child(2) > div {
        height: 100vh !important; height: 100dvh !important;
        max-height: 100vh !important; max-height: 100dvh !important;
        border-radius: 0 !important;
        display: flex !important; flex-direction: column !important;
        overflow: hidden !important;
    }
    #terraceModal form {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 16px !important;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    }
}
@media (max-width: 380px) {
    .roofing-step h4,
    .inline-step h4 { font-size: 1rem !important; }
    .work-type-grid .option-card-label { font-size: 0.72rem; min-height: 34px; }
    .roofing-step .option-pill,
    .inline-step .option-pill { padding: 10px 12px; font-size: 0.88rem; }
}

/* When ANY modal is open, lock body scroll (helps iOS rubber-band) */
body.modal-open {
    overflow: hidden;
    touch-action: none;
}

/* ========== INLINE QUIZ HIGHLIGHT ========== */
/* Когда пользователь кликает по карточке услуги или CTA — анкета подсвечивается */
@keyframes quizHighlightPulse {
    0% {
        box-shadow:
            0 0 0 0 rgba(249, 115, 22, 0.55),
            0 1px 2px rgba(15, 23, 42, 0.04),
            0 12px 32px rgba(15, 23, 42, 0.08);
        transform: translateY(0);
    }
    50% {
        box-shadow:
            0 0 0 14px rgba(249, 115, 22, 0),
            0 1px 2px rgba(15, 23, 42, 0.04),
            0 22px 50px rgba(249, 115, 22, 0.18);
        transform: translateY(-3px);
    }
    100% {
        box-shadow:
            0 0 0 0 rgba(249, 115, 22, 0),
            0 1px 2px rgba(15, 23, 42, 0.04),
            0 12px 32px rgba(15, 23, 42, 0.08);
        transform: translateY(0);
    }
}
.inline-quiz-card.quiz-highlight {
    animation: quizHighlightPulse 1.4s ease-out;
    border-color: rgba(249, 115, 22, 0.6) !important;
}

/* ========== PHONE FIELD ERROR STATE ========== */

.phone-invalid {
    border-color: #ef4444 !important;
    background: #fef2f2 !important;
}
.phone-error-message {
    display: none;
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 8px 12px;
    margin-top: 10px;
    margin-left: auto;
    margin-right: auto;
    max-width: 360px;
    font-size: 0.9rem;
    line-height: 1.3;
    font-weight: 500;
    text-align: center;
    box-sizing: border-box;
    animation: phoneErrorSlide 0.25s ease-out;
}
.phone-error-message.is-visible {
    display: block;
}
@keyframes phoneErrorSlide {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========== REVIEWS SECTION ========== */
#reviews {
    background:
        radial-gradient(800px 320px at 50% -120px, rgba(249, 115, 22, 0.06), transparent 70%),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.reviews-summary {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-top: 1.25rem;
    padding: 8px 16px;
    border-radius: 999px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
}
.reviews-summary-stars {
    display: inline-flex;
    gap: 2px;
    color: #f59e0b;
    fill: #f59e0b;
}
.reviews-summary-stars svg {
    fill: currentColor;
    stroke: currentColor;
}
.reviews-summary-text {
    font-weight: 600;
    color: #9a3412;
    font-size: 0.92rem;
}

.reviews-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    align-items: stretch;
}
@media (max-width: 1024px) {
    .reviews-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.25rem;
    }
}
@media (max-width: 640px) {
    .reviews-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.review-card {
    position: relative;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 26px 24px 22px;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 8px 22px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                border-color 0.3s ease;
    overflow: hidden;
}
.review-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #f97316 0%, #fb923c 100%);
    opacity: 0.85;
}
.review-card:hover {
    transform: translateY(-4px);
    border-color: #fed7aa;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 16px 36px rgba(15, 23, 42, 0.08),
        0 28px 56px rgba(249, 115, 22, 0.06);
}
.review-card-quote {
    position: absolute;
    top: 18px;
    right: 18px;
    color: #fed7aa;
    opacity: 0.55;
    pointer-events: none;
}
.review-card-stars {
    display: inline-flex;
    gap: 2px;
    color: #f59e0b;
    margin-bottom: 12px;
}
.review-card-stars svg {
    fill: currentColor;
    stroke: currentColor;
}
.review-card-text {
    color: #334155;
    font-size: 0.97rem;
    line-height: 1.55;
    margin-bottom: 18px;
    flex: 1 1 auto;
    /* preserve whitespace gracefully */
    word-wrap: break-word;
}
.review-card-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid #f1f5f9;
    padding-top: 16px;
}
.review-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    flex-shrink: 0;
    box-shadow: inset 0 -2px 6px rgba(0, 0, 0, 0.08);
}
.review-avatar--orange { background: linear-gradient(135deg, #fb923c, #f97316); }
.review-avatar--blue   { background: linear-gradient(135deg, #60a5fa, #3b82f6); }
.review-avatar--green  { background: linear-gradient(135deg, #34d399, #10b981); }
.review-avatar--purple { background: linear-gradient(135deg, #c084fc, #8b5cf6); }
.review-avatar--rose   { background: linear-gradient(135deg, #fb7185, #e11d48); }
.review-avatar--teal   { background: linear-gradient(135deg, #2dd4bf, #0d9488); }
.review-card-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.review-card-name {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.98rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.review-card-date {
    color: #94a3b8;
    font-size: 0.82rem;
    font-weight: 500;
}

.reviews-cta {
    display: flex;
    justify-content: center;
    margin-top: 2.5rem;
}
.reviews-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #f97316;
    color: #fff;
    padding: 14px 28px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 10px 24px rgba(249, 115, 22, 0.32);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    cursor: pointer;
    border: none;
}
.reviews-cta-btn:hover {
    background: #ea580c;
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(249, 115, 22, 0.4);
}

@media (max-width: 640px) {
    #reviews { padding-top: 3rem; padding-bottom: 3rem; }
    #reviews h2 { font-size: 1.75rem !important; line-height: 1.2; }
    .review-card { padding: 22px 20px 18px; border-radius: 18px; }
    .review-card-text { font-size: 0.93rem; }
    .review-card-quote { width: 28px !important; height: 28px !important; top: 14px; right: 14px; }
    .reviews-summary { font-size: 0.85rem; padding: 6px 12px; gap: 8px; }
    .reviews-summary-text { font-size: 0.85rem; }
    .reviews-cta-btn { width: 100%; max-width: 360px; justify-content: center; }
}

/* Print styles */
@media print {
    header,
    .fixed,
    button,
    #modal {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
}
