/* =====================================================================
   MotorPower SGS — ENHANCE LAYER (calm, premium polish)
   Subtle reveals, refined hover states, refined typography.
   ===================================================================== */

:root {
    --accent: #EE1E23;
    --accent-2: #ff5a4e;
    --accent-3: #2f6df4;
    --ease-out: cubic-bezier(.22, 1, .36, 1);
    --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

::selection {
    background: var(--accent);
    color: #fff;
}

/* ============================================================
   Full-width safeguards (some Android/iOS Safari builds otherwise
   leave a horizontal sliver if any descendant overflows even 1px)
   ============================================================ */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
    /* clip > hidden — neukládá scroll kontext */
}

@supports not (overflow-x: clip) {

    html,
    body {
        overflow-x: hidden;
    }
}

/* Stop accidental horizontal scroll from full-bleed elements */
.marquee-wrap,
.gallery-wrap,
.brand-picker {
    max-width: 100vw;
}

/* iOS Safari sometimes adds extra inline padding via UA — neutralize */
body {
    margin: 0;
    padding: 0;
}

/* ============================================================ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #0a0d13;
}

::-webkit-scrollbar-thumb {
    background: #1b2030;
    border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2a3142;
}

/* ---------- Page enter ---------- */
@keyframes mpPageEnter {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

main {
    animation: mpPageEnter .6s var(--ease-out) both;
}

/* ---------- Reveal-on-scroll ---------- */
.mp-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
    will-change: transform, opacity;
}

.mp-reveal.is-in {
    opacity: 1;
    transform: none;
}

.mp-reveal--left {
    transform: translateX(-32px);
}

.mp-reveal--right {
    transform: translateX(32px);
}

.mp-reveal--scale {
    transform: scale(.96);
}

.mp-reveal--left.is-in,
.mp-reveal--right.is-in,
.mp-reveal--scale.is-in {
    transform: none;
}

.mp-stagger>* {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
}

.mp-stagger.is-in>* {
    opacity: 1;
    transform: none;
}

.mp-stagger.is-in>*:nth-child(1) {
    transition-delay: .04s;
}

.mp-stagger.is-in>*:nth-child(2) {
    transition-delay: .1s;
}

.mp-stagger.is-in>*:nth-child(3) {
    transition-delay: .16s;
}

.mp-stagger.is-in>*:nth-child(4) {
    transition-delay: .22s;
}

.mp-stagger.is-in>*:nth-child(5) {
    transition-delay: .28s;
}

.mp-stagger.is-in>*:nth-child(6) {
    transition-delay: .34s;
}

.mp-stagger.is-in>*:nth-child(7) {
    transition-delay: .4s;
}

.mp-stagger.is-in>*:nth-child(8) {
    transition-delay: .46s;
}

.mp-stagger.is-in>*:nth-child(n+9) {
    transition-delay: .5s;
}

/* ---------- Hero "novinka" pruh ---------- */
.hero-news {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 4px;
    padding: 9px 16px;
    border-radius: 100px;
    background: rgba(58, 210, 159, .12);
    border: 1px solid rgba(58, 210, 159, .45);
    color: #6ef0c2;
    font-size: clamp(13px, 1.1vw, 15px);
    font-weight: 600;
    line-height: 1.4;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 6px 18px rgba(58, 210, 159, .15);
    text-shadow: 0 1px 3px rgba(0, 0, 0, .4);
    animation: mpNewsIn .7s var(--ease-out) .3s both;
}

.hero-news strong {
    color: #fff;
    font-weight: 800;
    letter-spacing: .01em;
}

.hero-news__dot {
    flex-shrink: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--green, #3ad29f);
    box-shadow: 0 0 0 0 rgba(58, 210, 159, .6);
    animation: mpNewsPulse 2.4s ease-out infinite;
}

@keyframes mpNewsPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(58, 210, 159, .6);
    }

    70% {
        box-shadow: 0 0 0 9px rgba(58, 210, 159, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(58, 210, 159, 0);
    }
}

@keyframes mpNewsIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 600px) {
    .hero-news {
        display: flex;
        padding: 9px 14px;
    }
}

/* ---------- Hero refinements ---------- */
.hero h1 .highlight {
    color: var(--accent);
}

.hero h1 {
    text-shadow: 0 8px 36px rgba(0, 0, 0, .45);
}

.hero .lead {
    text-shadow: 0 2px 12px rgba(0, 0, 0, .45);
}

/* ---------- Buttons (refined, no gimmicks) ---------- */
.btn {
    transition: transform .25s var(--ease-out), box-shadow .25s, background .25s, border-color .25s, opacity .25s;
}

.btn-primary {
    background: var(--accent);
    box-shadow: 0 8px 22px rgba(238, 30, 35, .28);
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: #f23a3f;
    box-shadow: 0 14px 32px rgba(238, 30, 35, .42);
}

.btn-outline:hover {
    border-color: rgba(255, 255, 255, .35);
    background: rgba(255, 255, 255, .04);
}

/* ---------- Card hover (subtle, no border animation) ---------- */
.card,
.review,
.why__item {
    transition: transform .35s var(--ease-out), box-shadow .35s, border-color .35s;
}

.review:hover,
.why__item:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, .12);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
}

/* ---------- Why badge: refined with original numbers, no rotating ring ---------- */
.why__badge {
    background: linear-gradient(135deg, var(--accent), #b41217) !important;
    box-shadow: 0 6px 16px rgba(238, 30, 35, .3) !important;
}

.why__item:hover .why__badge {
    transform: scale(1.06);
    transition: transform .3s var(--ease-spring);
}

/* ---------- Marquee logos (refined) ---------- */
.brand-box {
    transition: transform .35s var(--ease-out), box-shadow .35s, background .3s;
}

.brand-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, .35);
    background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .02));
}

.brand-box img {
    transition: filter .3s, transform .3s;
}

.brand-box:hover img {
    filter: drop-shadow(0 4px 10px rgba(255, 255, 255, .1));
}

/* ---------- Gallery photos ---------- */
.photo-box {
    transition: transform .4s var(--ease-out), box-shadow .4s;
}

.photo-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
    z-index: 2;
}

.photo-box img {
    transition: transform 1.2s var(--ease-out);
}

.photo-box:hover img {
    transform: scale(1.04);
}

/* ---------- Section H2 underline accent ---------- */
.h2 {
    position: relative;
    display: inline-block;
    letter-spacing: -.015em;
}

.h2::after {
    content: "";
    display: block;
    width: 56px;
    height: 3px;
    margin-top: 12px;
    background: var(--accent);
    border-radius: 3px;
    transform-origin: left;
    animation: mpBarSlide 1s var(--ease-out) both;
}

@keyframes mpBarSlide {
    from {
        transform: scaleX(0);
        opacity: 0;
    }

    to {
        transform: scaleX(1);
        opacity: 1;
    }
}

/* ---------- Topbar contact items ---------- */
.tb__item {
    transition: color .2s, transform .2s;
}

.tb__item:hover {
    color: #fff;
}

.topbar a svg {
    transition: transform .25s var(--ease-out), color .25s;
}

.topbar a:hover svg {
    transform: translateY(-1px);
    color: var(--accent);
}

/* ---------- Header ---------- */
header {
    transition: background .3s, box-shadow .3s, border-color .3s;
}

header.is-scrolled {
    background: rgba(8, 10, 16, .94) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}

/* Mobile menu trigger — ensure decent tap target (44×44 per Apple HIG) */
.mobile-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 10px;
    background: transparent;
    border: 0;
    color: var(--text);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    border-radius: 10px;
    transition: background .2s;
    -webkit-tap-highlight-color: rgba(238, 30, 35, .15);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    position: relative;
    z-index: 70;
}

.mobile-toggle:hover,
.mobile-toggle:active,
.mobile-toggle:focus-visible {
    background: rgba(255, 255, 255, .08);
    outline: none;
}

@media (max-width: 920px) {
    .mobile-toggle {
        display: inline-flex !important;
    }
}

nav a {
    position: relative;
}

nav a:not(.btn)::after {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 8px;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .3s var(--ease-out);
    border-radius: 2px;
}

nav a:not(.btn):hover::after {
    transform: scaleX(1);
}

.brand img {
    transition: transform .35s var(--ease-out);
}

.brand:hover img {
    transform: scale(1.04);
}

/* ---------- Reviews polish ---------- */
.review__name {
    color: #fff;
}

/* ---------- Map ---------- */
.mapbox {
    transition: box-shadow .35s;
}

.mapbox:hover {
    box-shadow: 0 22px 50px rgba(0, 0, 0, .45);
}

/* ---------- Footer social ---------- */
.footer-social a {
    transition: transform .3s var(--ease-out), background .25s, border-color .25s, color .25s;
}

.footer-social a:hover {
    background: var(--accent) !important;
    color: #fff;
    border-color: var(--accent) !important;
    transform: translateY(-3px);
}

/* ---------- Back to top ---------- */
#toTop {
    width: 44px;
    height: 44px;
    border-radius: 50% !important;
    background: var(--accent) !important;
    color: #fff !important;
    border: 0 !important;
    box-shadow: 0 8px 22px rgba(238, 30, 35, .35);
    font-size: 20px;
    font-weight: 800;
    transition: transform .25s var(--ease-out), opacity .3s, box-shadow .25s !important;
}

#toTop.is-visible {
    opacity: 1 !important;
    pointer-events: all !important;
}

#toTop:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 14px 32px rgba(238, 30, 35, .5);
}

/* ---------- Finder polish (homepage) ---------- */
.finder {
    background: linear-gradient(180deg, rgba(15, 20, 33, .85), rgba(10, 13, 19, .9)) !important;
    border: 1px solid rgba(255, 255, 255, .12) !important;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .45);
}

/* ---------- Car page hero polish ---------- */
.brand-logo-hero {
    box-shadow: 0 22px 44px rgba(0, 0, 0, .45) !important;
    transition: transform .4s var(--ease-out);
}

.brand-logo-hero:hover {
    transform: scale(1.04);
}

.hero-model h1 {
    animation: mpFadeUp .9s var(--ease-out) both;
}

.hero-model p {
    animation: mpFadeUp .9s var(--ease-out) .12s both;
}

@keyframes mpFadeUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ---------- Model tags ---------- */
.model-tag {
    transition: transform .25s var(--ease-out), background .25s, border-color .25s, color .25s;
}

.model-tag:hover {
    background: rgba(238, 30, 35, .08) !important;
    border-color: var(--accent) !important;
    color: #fff !important;
    transform: translateY(-2px) !important;
}

/* ---------- Price card polish ---------- */
.list-row {
    transition: background .2s, padding-left .25s;
}

.list-row:hover {
    background: rgba(255, 255, 255, .025) !important;
}

.list-row.highlight:hover {
    background: linear-gradient(90deg, rgba(238, 30, 35, .1), transparent) !important;
}

.srv-name {
    transition: color .2s;
}

.list-row:hover .srv-name {
    color: #fff;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   FINDER — searchable combobox (typeable trigger + filter list)
   ============================================================ */

/* Trigger row stays a fixed height, no reflow on focus */
.custom-select__trigger {
    padding: 0 64px 0 12px !important;
    /* right room for clear + arrow */
    height: 50px !important;
    min-height: 50px !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    overflow: hidden;
}

/* Hide legacy static span (in case the JS hasn't replaced innerHTML yet) */
.custom-select__trigger>span:not(.brand-icon) {
    display: none !important;
}

/* The brand/search icon — ALWAYS visible, fixed size */
.custom-select__trigger .trigger-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    object-fit: contain;
    display: block !important;
    /* never hide */
    transition: filter .25s, opacity .25s;
}

/* Subtle visual cue: brand logo gets a tiny shadow */
.custom-select__trigger .trigger-icon.is-brand {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .35));
}

/* The input fills remaining width — never resizes */
.custom-select__input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
    color: #e9edff;
    font: inherit;
    font-size: 16px;
    /* 16px prevents iOS auto-zoom */
    font-weight: 700;
    letter-spacing: .005em;
    outline: 0;
    padding: 0;
    margin: 0;
    caret-color: var(--accent, #EE1E23);
}

.custom-select__input::placeholder {
    color: #97a0b8;
    font-weight: 600;
}

/* Strip native search-input adornments (X, magnifier) — we have our own */
.custom-select__input::-webkit-search-decoration,
.custom-select__input::-webkit-search-cancel-button,
.custom-select__input::-webkit-search-results-button,
.custom-select__input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    appearance: none;
}

.custom-select__clear {
    position: absolute;
    right: 38px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, .08);
    color: #cbd3ea;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    padding: 0 0 2px;
    -webkit-tap-highlight-color: transparent;
    transition: background .2s, color .2s;
}

.custom-select__clear:hover,
.custom-select__clear:active {
    background: var(--accent, #EE1E23);
    color: #fff;
}

/* ---- Options: hidden + active states ---- */
.custom-option.is-hidden {
    display: none !important;
}

.custom-option.is-active {
    background: rgba(47, 109, 244, .1);
}

.custom-option:focus {
    outline: 0;
    background: var(--accent, #EE1E23);
    color: #fff;
}

.custom-option--empty {
    text-align: center;
    padding: 20px 14px !important;
    font-style: italic;
    color: var(--muted);
    cursor: default;
}

.custom-option--empty:hover {
    background: transparent !important;
    color: var(--muted) !important;
}

/* Dropdown — sized so it fits above the soft keyboard on mobile */
.custom-options {
    max-height: 320px;
    will-change: transform, opacity;
    /* GPU layer = no flicker on keyboard pop */
}

@media (max-width: 600px) {
    .custom-select__trigger {
        padding: 0 60px 0 12px !important;
    }

    /* dvh accounts for soft keyboard on Android Chrome / Safari iOS */
    .custom-options {
        max-height: min(45dvh, 280px);
    }
}

/* Stabilize finder + section so soft keyboard doesn't make hero jump.
   `overflow-anchor` keeps scroll position pinned to the focused element. */
.finder {
    overflow-anchor: auto;
    contain: layout;
}

/* Browsers may auto-scroll an absolutely-positioned dropdown into view —
   give it scroll-margin so it doesn't slide under the sticky header. */
.custom-options {
    scroll-margin-top: 100px;
    scroll-margin-bottom: 16px;
}

/* ============================================================
   RESPONSIVE — careful tuning for tablets and phones
   ============================================================ */

/* ---------- Section vertical rhythm on smaller screens ---------- */
@media (max-width: 920px) {
    .h2::after {
        width: 44px;
        height: 3px;
        margin-top: 10px;
    }

    /* tighter section spacing on mobile (override 1style.css 110px which is excessive) */
    main .section {
        padding-block: 56px;
    }

    .gallery-wrap {
        padding-block: 36px;
    }

    .marquee-wrap {
        padding-block: 36px;
    }
}

@media (max-width: 600px) {
    main .section {
        padding-block: 44px;
    }

    .container {
        padding-inline: 18px;
    }

    /* topbar already hidden on <920 in base; ensure header height is right */
    .nav {
        height: 64px;
    }

    .brand img {
        height: 44px;
    }

    /* Reduce huge translateY on hero so content stays near top with video */
    .hero {
        min-height: 86dvh;
    }

    .hero__content {
        transform: translateY(-30px);
    }

    .scroll-down-arrow {
        bottom: 20px;
    }
}

/* ---------- Why grid on small phones ---------- */
@media (max-width: 600px) {
    .why {
        gap: 14px;
    }

    .why__item {
        padding: 18px 16px;
        gap: 12px;
    }

    .why__title {
        font-size: 15.5px;
    }

    .why__text {
        font-size: 14px;
    }
}

/* ---------- Reviews — comfortable card spacing ---------- */
@media (max-width: 600px) {
    .review {
        padding: 18px;
    }

    .review__text {
        line-height: 1.65;
        font-size: 14.5px;
    }
}

/* ---------- Hero finder — full width and big tap target on phones ---------- */
@media (max-width: 600px) {
    .finder {
        margin-top: 22px;
        padding: 14px;
    }

    .finder__title {
        font-size: 14px;
    }

    .custom-select__trigger {
        min-height: 50px;
    }

    .btn {
        min-height: 48px;
    }
}

/* ---------- Marquee on small screens ---------- */
@media (max-width: 600px) {
    .brand-box {
        flex-basis: 88px;
        height: 88px;
    }

    .marquee__track {
        gap: 18px;
    }
}

/* ---------- Footer on phones ---------- */
@media (max-width: 600px) {
    footer {
        padding-block: 44px;
    }

    .footer-brand img {
        height: 44px;
    }

    .footer-social a {
        width: 38px;
        height: 38px;
    }
}

/* ---------- #toTop position when soft keyboard / safe-area ---------- */
#toTop {
    bottom: max(18px, env(safe-area-inset-bottom)) !important;
}

@media (max-width: 600px) {
    #toTop {
        right: 14px !important;
        width: 42px;
        height: 42px;
        font-size: 18px;
    }
}

/* ---------- Map height fix on mobile ---------- */
@media (max-width: 600px) {
    .mapbox {
        aspect-ratio: 4/3;
    }
}

/* ---------- Topbar — never show on tablet or phone ---------- */
@media (max-width: 920px) {
    .topbar {
        display: none !important;
    }
}

/* ---------- Make all section headings legible on mobile ---------- */
@media (max-width: 600px) {

    .h1,
    .h2 {
        word-break: break-word;
    }
}
