/* ==========================================================================
   Homepage — "sidewall" redesign.
   Everything is scoped under .hp so the shared header/footer, main-form on the
   search page and the product card elsewhere are untouched. Several rules need
   !important because style.css sets h1–h5 and select2 sizes with !important.
   ========================================================================== */

.hp {
    --hp-asphalt: #2a2e33;
    --hp-concrete: #eceef0;
    --hp-line: #d5d9dd;
    --hp-steel: #5f676e;
    --hp-ghost-ink: #80878e; /* example digits: 3.6:1 on the white field */
    --hp-red: #fc3232;
    --hp-red-ink: #d4232a;
    --hp-display: "Fira Sans Extra Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;

    color: var(--hp-asphalt);
    padding-bottom: 72px;
}

.hp :focus-visible {
    outline: 2px solid var(--hp-red-ink);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Headings — style.css forces uppercase + fixed sizes with !important.
   -------------------------------------------------------------------------- */

.hp .hp-hero__title,
.hp .hp-h2,
.hp .hp-h3 {
    font-family: var(--hp-display);
    text-transform: none;
    letter-spacing: 0;
    margin: 0;
    color: var(--hp-asphalt);
}

.hp .hp-hero__title {
    font-size: 30px !important;
    font-weight: 700 !important;
    line-height: 1.1;
    padding-top: 32px;
}

.hp .hp-h2 {
    font-size: 40px !important;
    font-weight: 700 !important;
    line-height: 1.05;
}

.hp .hp-h3 {
    font-size: 26px !important;
    font-weight: 700 !important;
    line-height: 1.1;
}

/* --------------------------------------------------------------------------
   Hero: category tabs + search form on concrete.
   -------------------------------------------------------------------------- */

.hp-hero {
    background: var(--hp-concrete);
    padding-bottom: 40px;
}

.hp-hero .search-form {
    margin-top: 20px;
}

.hp-hero .tabs {
    height: auto;
    background: transparent;
    border-radius: 0;
}

/* Category tabs read as a plain text switch with a red underline. */
.hp-hero .tabs-nav {
    background: transparent;
    border-radius: 0;
    border-bottom: 1px solid var(--hp-line);
    gap: 28px;
    font-size: 17px;
    font-weight: 500;
    text-transform: none;
    color: var(--hp-steel);
}

.hp-hero .tabs-nav li,
.hp-hero .tabs-nav li.active {
    background: transparent;
    border-radius: 0;
    padding: 10px 0 12px;
    margin: 0 0 -1px;
    border-bottom: 3px solid transparent;
}

.hp-hero .tabs-nav li:hover {
    color: var(--hp-asphalt);
}

.hp-hero .tabs-nav li.active {
    color: var(--hp-asphalt);
    border-bottom-color: var(--hp-red);
}

.hp-hero .tabs-content {
    padding: 24px 0 0;
}

/* "By size / by car" — a two-option segmented switch. */
.hp-hero .tabs-nav-an {
    display: inline-flex;
    background: #fff;
    border: 1px solid var(--hp-line);
    border-radius: 999px;
    padding: 3px;
}

.hp-hero .tabs-nav-an li,
.hp-hero .tabs-nav-an li.active {
    margin: 0;
    padding: 6px 16px;
    border: 0;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    text-transform: none;
    color: var(--hp-steel);
    cursor: pointer;
}

.hp-hero .tabs-nav-an li.active {
    background: var(--hp-asphalt);
    color: #fff;
    cursor: default;
}

.hp-hero #tab-1-an,
.hp-hero #tab-2-an,
.hp-hero #tab-2,
.hp-hero #tab-3 {
    padding-top: 24px;
}

/* Generic field grid (by car, oils, batteries, and the sidewall's extras). */
.hp-hero .tabs-content .row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px !important;
    align-items: end;
}

.hp-hero .tabs-content .row .content-block {
    min-width: 0;
}

/* style.css pins .select2 to 35px, shorter than the 44px trigger below. */
.hp-hero .tabs-content .select2 {
    height: auto;
}

.hp-hero .tabs-content .select2-selection__clear {
    display: none;
}

.hp-hero .tabs-content .select2-container--default .select2-selection--single {
    height: 44px !important;
    border-color: var(--hp-line) !important;
    border-radius: 6px;
}

.hp-hero .tabs-content .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 42px !important;
    padding-left: 12px;
    color: var(--hp-asphalt);
}

.hp-hero .tabs-content .select2-container--default .select2-selection--single .select2-selection__arrow {
    top: 9px !important;
}

.hp-hero .tabs-content .select2-container--default.select2-container--disabled .select2-selection--single {
    background: #f6f7f8;
}

/* style.css forces button[type=submit] to --rcolor with !important, which also
   hid the disabled state (car tab, before a year is picked). #d4232a keeps
   white 16px text at AA contrast; --rcolor does not. */
.hp-hero .tabs-content button[type="submit"] {
    width: 100% !important;
    height: 44px;
    border-radius: 6px;
    background-color: var(--hp-red-ink) !important;
    font-size: 16px;
    font-weight: 500;
    text-transform: none;
    transition: background-color .15s ease;
}

.hp-hero .tabs-content button[type="submit"]:hover:not(:disabled) {
    background-color: #b51d23 !important;
}

.hp-hero .tabs-content button[type="submit"]:disabled {
    background-color: #c9cdd1 !important;
    color: #4a5056;
    cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   The sidewall: width / height R diameter, read like the code on the tyre,
   but each number is an obvious field — white box, label, chevron.
   -------------------------------------------------------------------------- */

.hp-hero #tab-1-an form {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
    gap: 24px 48px;
    align-items: start;
}

.hp-sidewall {
    --sw-size: clamp(48px, 5.4vw, 84px);
    display: flex;
    align-items: flex-end;
    gap: 10px;
    font-family: var(--hp-display);
    font-weight: 800;
    font-size: var(--sw-size);
    line-height: 1;
    color: var(--hp-asphalt);
}

/* style.css sets Roboto on `*`, so the family must be restated per element. */
.hp-sidewall * {
    font-family: var(--hp-display);
}

/* "/" and "R" sit on the value line, between the boxes. */
.hp-sidewall__sep {
    flex: none;
    padding-bottom: 12px;
    color: var(--hp-steel);
    font-weight: 500;
    line-height: 1.05;
}

.hp-sidewall__sep--r {
    color: var(--hp-asphalt);
    font-weight: 800;
}

.hp-slot {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    padding: 10px 40px 10px 16px;
    background: #fff;
    border: 2px solid var(--hp-line);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.hp-slot--width {
    flex-grow: 1.3;
}

/* Chevron: the universal "this opens a list" cue. */
.hp-slot::after {
    content: "";
    position: absolute;
    right: 16px;
    top: 50%;
    width: 10px;
    height: 10px;
    margin-top: -2px;
    border-right: 2px solid var(--hp-steel);
    border-bottom: 2px solid var(--hp-steel);
    transform: translateY(-50%) rotate(45deg);
    pointer-events: none;
}

.hp-slot:hover {
    border-color: var(--hp-steel);
}

.hp-slot:focus-within,
.hp-slot:has(.select2-container--open) {
    border-color: var(--hp-red);
    box-shadow: 0 0 0 3px rgba(252, 50, 50, .15);
}

.hp-slot.is-set {
    border-color: var(--hp-asphalt);
}

.hp-slot.is-set::after {
    border-color: var(--hp-asphalt);
}

.hp-slot__label {
    display: block;
    margin: 0 0 4px;
    font-family: "Roboto", sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--hp-steel);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.hp-slot__value {
    position: relative;
}

/* style.css pins .select2 to 35px / 15px, which would shrink the digits. */
.hp-hero .tabs-content .hp-sidewall .select2 {
    display: block;
    height: auto;
    font-size: inherit;
}

.hp-hero .tabs-content .hp-sidewall .select2-container--default .select2-selection--single {
    height: auto !important;
    background: transparent;
    border: 0 !important;
    border-radius: 0;
    outline: 0;
}

.hp-hero .tabs-content .hp-sidewall .select2-container--default .select2-selection--single .select2-selection__rendered {
    font-family: var(--hp-display);
    font-size: 1em;
    font-weight: 800;
    line-height: 1.05 !important;
    padding: 0;
    color: var(--hp-asphalt);
    text-align: left !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hp-hero .tabs-content .hp-sidewall .select2-selection__arrow,
.hp-hero .tabs-content .hp-sidewall .select2-selection__clear {
    display: none;
}

/* Empty: the example digit sits in the box like a placeholder. */
.hp-slot__ghost {
    position: absolute;
    left: 0;
    top: 0;
    line-height: 1.05;
    color: var(--hp-ghost-ink);
    pointer-events: none;
    z-index: 1;
}

.hp-slot:not(.is-set) .select2-selection__rendered {
    color: transparent !important;
}

.hp-slot.is-set .hp-slot__ghost {
    display: none;
}

/* --------------------------------------------------------------------------
   Size picker panel: the select2 dropdown is re-parented to .hp-sidewall
   (see index.blade.php) and laid out as a value grid spanning the whole row,
   so 130 widths are scannable at once and every value is a 44px target.
   select2 writes inline top/left/width — hence the !important.
   -------------------------------------------------------------------------- */

.hp-sidewall {
    position: relative;
}

.hp-sidewall > .select2-container {
    top: calc(100% + 8px) !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    z-index: 30;
}

.hp-sidewall > .select2-container .select2-dropdown {
    position: relative;
    width: 100% !important;
    padding: 12px;
    background: #fff;
    border: 2px solid var(--hp-red) !important;
    border-radius: 10px !important;
    box-shadow: 0 12px 32px rgba(42, 46, 51, .18);
    /* Reset what it would inherit from the 84px / 800 sidewall digits. */
    font-family: "Roboto", sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.3;
}

.hp-sidewall .select2-search--dropdown {
    padding: 0 0 10px;
}

.hp-sidewall .select2-search--dropdown .select2-search__field {
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--hp-line) !important;
    border-radius: 8px;
    font-family: "Roboto", sans-serif;
    font-size: 17px;
    outline: 0;
}

.hp-sidewall .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--hp-asphalt) !important;
}

.hp-sidewall .select2-results > .select2-results__options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    gap: 6px;
    max-height: 296px;
    padding-right: 4px;
    overscroll-behavior: contain;
}

.hp-sidewall .select2-results__option {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 6px 4px;
    border: 1px solid var(--hp-line);
    border-radius: 8px;
    font-family: "Roboto", sans-serif;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.15;
    text-align: center;
    color: var(--hp-asphalt);
    word-break: break-word;
}

/* The empty option resets the field: a quiet full-width row on top. */
/* "No results" message also spans the row. */
.hp-sidewall .select2-results__option.select2-results__message {
    grid-column: 1 / -1;
    border: 0;
    color: var(--hp-steel);
}

.hp-sidewall .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--hp-asphalt);
    border-color: var(--hp-asphalt);
    color: #fff;
}

.hp-sidewall .select2-container--default .select2-results__option[aria-selected=true] {
    background: #fff;
    border: 2px solid var(--hp-red);
    color: var(--hp-red-ink);
}

.hp-sidewall .select2-container--default .select2-results__option[aria-selected=true].select2-results__option--highlighted {
    background: var(--hp-red-ink);
    border-color: var(--hp-red-ink);
    color: #fff;
}

/* The empty option (select2 renders it without an id) resets the field:
   a quiet full-width row on top, never styled as a picked value. */
.hp-sidewall .select2-container--default .select2-results__option:not([id]):not(.select2-results__message) {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding: 6px 12px;
    background: #fff;
    border: 1px dashed var(--hp-line);
    font-size: 15px;
    font-weight: 400;
    color: var(--hp-steel);
}

.hp-sidewall .select2-container--default .select2-results__option.select2-results__option--highlighted:not([id]):not(.select2-results__message) {
    background: var(--hp-concrete);
    border-color: var(--hp-steel);
    color: var(--hp-asphalt);
}

.hp-size__hint {
    margin: 16px 0 0;
    max-width: 62ch;
    font-size: 15px;
    line-height: 1.5;
    color: var(--hp-steel);
}

/* Extras column next to the sidewall: stacked, then the search button. */
.hp-hero #tab-1-an form > .row {
    grid-template-columns: 1fr;
    padding-top: 8px;
}

.hp-hero #tab-1-an form > .row .content-block:last-child button {
    height: 52px;
    font-size: 18px;
}

/* --------------------------------------------------------------------------
   Promo slider.
   -------------------------------------------------------------------------- */

.hp-promo {
    margin-top: 40px;
}

.hp-promo .main-slider img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

/* --------------------------------------------------------------------------
   Sections.
   -------------------------------------------------------------------------- */

.hp-section {
    margin-top: 72px;
}

.hp-section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.hp .hp-more {
    flex: none;
    font-size: 16px;
    font-weight: 500;
    color: var(--hp-red-ink);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}

.hp .hp-more:hover {
    color: var(--hp-asphalt);
}

/* Product rails: one scrollable row per category group. */
.hp-group {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--hp-line);
}

.hp-section > .hp-h2 + .hp-group {
    margin-top: 24px;
}

.hp-group__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.hp-rail-nav {
    display: flex;
    gap: 8px;
}

.hp-rail-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--hp-line);
    border-radius: 50%;
    background: #fff;
    color: var(--hp-asphalt);
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}

.hp-rail-btn:hover {
    border-color: var(--hp-asphalt);
}

.hp-rail-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hp .hp-rail {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: var(--hp-line) transparent;
    margin: 0 -10px !important;
}

.hp .hp-rail > [class*="col-"] {
    flex: 0 0 16.666%;
    max-width: 16.666%;
    scroll-snap-align: start;
}

.hp .hp-rail .card {
    border: 0;
    border-radius: 8px;
}

.hp .hp-rail .card-title {
    text-transform: none;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.35;
}

/* Services: a ruled list, not cards. */
.hp-services {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: 32px;
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--hp-line);
}

.hp-services li {
    border-bottom: 1px solid var(--hp-line);
}

.hp .hp-service {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 72px;
    padding: 12px 0;
    color: var(--hp-asphalt);
    font-size: 15px;
    line-height: 1.35;
    text-decoration: none;
}

.hp .hp-service:hover {
    color: var(--hp-red-ink);
}

.hp .hp-service img {
    flex: none;
    margin: 0;
    width: 40px;
    height: 40px;
    object-fit: contain;
}

/* News: one lead story, three headlines beside it. */
.hp-news {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 48px;
}

.hp-news__img,
.hp-news__thumb {
    display: block;
    overflow: hidden;
    border-radius: 8px;
    background: var(--hp-concrete);
}

.hp-news__img img,
.hp-news__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hp-news__img {
    aspect-ratio: 16 / 9;
}

.hp-news__date {
    display: block;
    margin-top: 16px;
    font-size: 14px;
    color: var(--hp-steel);
}

.hp .hp-news__title {
    margin: 6px 0 0;
    font-family: "Roboto", sans-serif;
    font-size: 18px !important;
    font-weight: 500 !important;
    line-height: 1.35;
    text-transform: none;
}

.hp .hp-news__title--lead {
    font-family: var(--hp-display);
    font-size: 30px !important;
    font-weight: 700 !important;
    line-height: 1.15;
}

.hp .hp-news__title a {
    color: var(--hp-asphalt);
}

.hp .hp-news__title a:hover {
    color: var(--hp-red-ink);
    text-decoration: none;
}

.hp-news__short {
    margin: 12px 0 0;
    max-width: 62ch;
    font-size: 16px;
    line-height: 1.55;
    color: var(--hp-steel);
}

.hp-news__list {
    display: flex;
    flex-direction: column;
}

.hp-news__item {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    padding: 20px 0;
    border-bottom: 1px solid var(--hp-line);
}

.hp-news__item:first-child {
    padding-top: 0;
}

.hp-news__item .hp-news__date {
    margin-top: 0;
}

.hp-news__thumb {
    aspect-ratio: 4 / 3;
}

/* SEO copy: readable measure. */
.hp-seo {
    margin-top: 72px;
    max-width: 75ch;
    font-size: 15px;
    line-height: 1.65;
    color: var(--hp-steel);
}

/* --------------------------------------------------------------------------
   Responsive.
   -------------------------------------------------------------------------- */

@media (max-width: 1199px) {
    .hp .hp-rail > [class*="col-"] {
        flex-basis: 25%;
        max-width: 25%;
    }

    .hp-services {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 991px) {
    .hp-hero #tab-1-an form {
        grid-template-columns: minmax(0, 1fr);
    }

    .hp-hero #tab-1-an form > .row {
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    }

    .hp-hero #tab-1-an form > .row .content-block:last-child {
        grid-column: 1 / -1;
    }

    .hp .hp-rail > [class*="col-"] {
        flex-basis: 33.333%;
        max-width: 33.333%;
    }

    .hp-services {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hp-news {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}

@media (max-width: 660px) {
    .hp .hp-hero__title {
        font-size: 26px !important;
        padding-top: 24px;
    }

    .hp .hp-h2 {
        font-size: 32px !important;
    }

    .hp .hp-h3 {
        font-size: 22px !important;
    }

    /* style.css stacks tab items full-width at this size; keep them inline. */
    .hp-hero .tabs-nav {
        flex-wrap: nowrap;
        gap: 20px;
        font-size: 16px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .hp-hero .tabs-nav li {
        width: auto;
        white-space: nowrap;
    }

    .hp-hero .tabs-nav-an {
        display: flex;
        flex-wrap: nowrap;
    }

    .hp-hero .tabs-nav-an li,
    .hp-hero .tabs-nav-an li.active {
        flex: 1 1 0;
        width: auto;
        padding: 6px 8px;
        font-size: 13px;
        line-height: 1.25;
        text-align: center;
    }

    .hp-sidewall {
        --sw-size: clamp(30px, 10vw, 44px);
        gap: 6px;
    }

    .hp-sidewall__sep {
        padding-bottom: 9px;
    }

    .hp-slot {
        padding: 8px 24px 8px 10px;
        border-radius: 8px;
    }

    .hp-slot::after {
        right: 9px;
        width: 7px;
        height: 7px;
    }

    .hp-slot__label {
        font-size: 12px;
        margin-bottom: 2px;
    }

    .hp-sidewall > .select2-container .select2-dropdown {
        padding: 10px;
    }

    .hp-sidewall .select2-results > .select2-results__options {
        grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
        max-height: 260px;
    }

    /* Two columns: short choices pair up (Sezon | Indice viteză, Model | Anul,
       Diametru | Sezon…); long lists (manufacturer, car make — their labels
       don't fit half a row in RU) and the button keep the full row. */
    .hp-hero .tabs-content .row,
    .hp-hero #tab-1-an form > .row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px !important;
    }

    .hp-hero #tab-1-an form {
        row-gap: 16px;
    }

    .hp-hero #tab-1-an form > .row {
        padding-top: 0;
    }

    .hp-hero .tabs-content .row > .content-block:last-child,
    .hp-hero .tabs-content .row > .content-block:has(#man_anv, #make, #man_auto, #man_oil, #type_oil_mec, #man_bat, #polar) {
        grid-column: 1 / -1;
    }

    /* Half a row is ~150px on a 360px phone; "Индекс скорости" needs 14px. */
    .hp-hero .tabs-content .select2-container--default .select2-selection--single .select2-selection__rendered {
        padding-left: 10px;
        font-size: 14px;
    }

    /* Oils: "Aplicarea uleiului" / "Применение масла" needs a full row, so the
       two short ones (Tip ulei | Vâscozitate) pair up instead. */
    .hp-hero #tab-2 .row {
        grid-auto-flow: row dense;
    }

    .hp-section {
        margin-top: 48px;
    }

    .hp .hp-rail > [class*="col-"] {
        flex-basis: 50%;
        max-width: 50%;
    }

    .hp-rail-nav {
        display: none;
    }

    .hp-services {
        grid-template-columns: 1fr;
    }

    .hp-news__item {
        grid-template-columns: 96px minmax(0, 1fr);
        gap: 14px;
    }

    .hp .hp-news__title--lead {
        font-size: 24px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hp *,
    .hp *::before,
    .hp *::after {
        transition: none !important;
    }
}
