/*
 Theme Name:        Dorrinew SV
 Description:       Dorri shop theme (SV): a standalone theme built on Twenty Twenty-One as customised in the former "dorrinew" theme, with WooCommerce templates. Site features (blog, product information, filters, invoices, contact form, Google Merchant) come from the Dorri Core plugin.
 Author:            Dorri Ltd
 Version:           2.2.0
 Requires at least: 6.5
 Tested up to:      7.1
 Requires PHP:      8.1
 License:           GNU General Public License v2 or later
 License URI:       https://www.gnu.org/licenses/gpl-2.0.html
 Text Domain:       dorrinew-sv
*/

/* Add custom CSS below */

/*=====================================================================
  1.0.1 - Mobile & tablet
  Loaded after the parent's style.css / responsive.css, so equal
  selectors here win. Breakpoints follow the parent (Bootstrap 5):
  tablet 768-991px, mobile <=767px, small mobile <=575px.
=====================================================================*/

/* Product rating counts, e.g. "(147)", used the browser's serif font. */
.star-reviews {
    font-family: "Poppins", sans-serif;
}

/* Product cards: .card-body had height:100% under the image, which pushed
   "Buy Now" below the card in the home carousels, and as a wrapping row it
   spread spare height between rating/title/price. A column keeps them
   stacked at the top with the button pinned to the bottom. */
.pdct-item .card-body {
    height: auto;
    flex: 1 1 auto;
    flex-direction: column;
    flex-wrap: nowrap;
}

/* Product cards (shop grid, related products, home carousels): rating sits
   under the image, left-aligned, instead of floating over the image. */
.pdct-item .card-body > .star-reviews {
    position: static;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-height: 16px;
    margin: 14px 0 8px;
    line-height: 1;
    text-align: left;
}
.pdct-item .card-body > .star-reviews .star-rating {
    float: none;
    margin: 0;
    left: auto;
    transform: none;
}
.pdct-item .card-body > .star-reviews .st_cnt {
    position: static;
    font-size: 14px;
    line-height: 1;
}

/* Home carousels: the last visible card ended exactly on the clipped edge
   and lost its right border. */
.product-item.owl-carousel .owl-item > .item {
    padding: 0 1px;
}
/* The slides are flex items, so without a width each card shrank to its text (the image is
   absolutely positioned in its square frame and no longer sets a width). */
.product-item.owl-carousel .owl-item > .item,
.product-item.owl-carousel .owl-item .card.pdct-item {
    width: 100%;
}

/* Home page "From Our Blog": equal-height cards, buttons on one line. */
.from-our-blog .post-item {
    height: 100%;
}
.from-our-blog .post-item .card-body,
.from-our-blog .post-header {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}
.from-our-blog .post-header .btnstyle {
    margin-top: auto !important;
    padding-top: 24px;
}
.from-our-blog .image-holder img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* Home page Turkish Delight ratings: stars and "(count)" side by side
   (the count used to sit inside the star font and overlap the stars). */
.trksd-item .woocommerce.star-reviews.trksd-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: none;
}
.trksd-item .trksd-rating .star-rating {
    flex: none;
    width: 5.4em;
    margin: 0;
    left: auto;
    transform: none;
}
.trksd-rating-count {
    font-size: 14px;
    line-height: 1;
}

/* Single product gallery (single.php + assets/js/dorri-product-gallery.js).
   Images of any shape are shown whole inside square frames (object-fit: contain). The
   ".dorri-product-gallery" prefix outranks WooCommerce's ".woocommerce img { height: auto }",
   which LiteSpeed's combined CSS loads after this file and which let tall images overflow. */
.dorri-product-gallery {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.dorri-gallery-main {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 12px;
    background: #fff;
    cursor: zoom-in;
}
.dorri-gallery-main.is-placeholder {
    cursor: default;
}
/* Absolutely positioned, because a percentage height inside an aspect-ratio box falls back to
   the image's own height. !important because the site adds an inline style to images from their
   proportions (e.g. "height:119.88%"), which made tall images overflow the square and be cut off. */
.dorri-product-gallery .dorri-gallery-main img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}
.dorri-gallery-zoom {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    color: #3a6f23;
    font-size: 16px;
    pointer-events: none;
    z-index: 1;
}
.dorri-gallery-thumbs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 2px 2px 6px;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.dorri-gallery-thumb {
    flex: 0 0 76px;
    height: 76px;
    padding: 4px;
    border: 2px solid #e6eadf;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    scroll-snap-align: start;
    transition: border-color .2s ease;
}
.dorri-product-gallery .dorri-gallery-thumb img {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

/* Product cards (shop grid, related products, home carousels) and the Cart page: the whole
   product image in a square frame, whatever its shape (uncropped image sizes in the templates). */
.pdct-item .pdct-item-img a {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
}
.pdct-item .pdct-item-img a img {
    position: absolute;
    inset: 0;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}
.woocommerce-cart table.cart td.product-thumbnail img {
    aspect-ratio: 1 / 1;
    height: auto !important;
    object-fit: contain;
}
.dorri-gallery-thumb:hover,
.dorri-gallery-thumb.is-active {
    border-color: #74a331;
}
.dorri-gallery-thumb:focus-visible {
    outline: 2px solid #3a6f23;
    outline-offset: 2px;
}
@media (min-width: 992px) {
    .dorri-gallery-thumb {
        flex-basis: 88px;
        height: 88px;
    }
}

/* Contact page */
.contactus-social {
    display: flex;
    gap: 16px;
    padding: 0;
    margin: 0;
    list-style: none;
}
.contactus-social a {
    color: #3a6f23;
}
.contactus-social a:hover {
    color: #74a331;
}

/* Touch screens have no hover: show the Turkish Delight "Buy Now" buttons. */
@media (hover: none), (max-width: 991px) {
    .trksd-item .btnstyle,
    .trksd-item .card-body .btnstyle {
        display: block;
        bottom: 0;
    }
}

/*------------------------------ Tablet & mobile ------------------------------*/
@media (max-width: 991px) {
    /* 16px stops iOS Safari zooming the page when a field is focused. */
    input[type="text"],
    input[type="search"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px;
    }

    /* Keep the search row clear of the logo on pages without the Trustpilot bar. */
    .header-bar .ssy-basket {
        margin-top: 8px;
    }

    /* Side menu search */
    .sidebar .search-bar {
        max-width: none;
        margin: 0;
    }

    /* Product grid (shop, categories, search, related) */
    .dorri-product-list .pdct-item .card-body {
        padding: 0 14px 18px;
    }
    .dorri-product-list .prdt-title {
        font-size: 15px;
        line-height: 1.45;
    }
    .dorri-product-list .pdct-price {
        font-size: 17px;
        line-height: 1.4;
        margin-bottom: 14px;
    }

    .turkish-delight-box {
        padding: 40px 24px;
    }
    .trksd-price {
        font-size: 17px;
        margin-bottom: 14px;
    }

    .top-footer {
        padding: 70px 0 40px;
    }

    /*------------------------- Side menu (hamburger) -------------------------*/
    .sidebar {
        width: min(86vw, 340px);
        box-shadow: 0 0 30px rgba(0, 0, 0, .18);
    }
    .sidebar .mobile-container .mobile-bar,
    .sidebar .mobile-container .mobile-nav {
        min-height: 0;
        padding: 0;
        background: #fff;
    }
    .sidebar .mobile-container .mobile-bar,
    .sidebar .mobile-container .mobile-bar * {
        box-sizing: border-box;
    }
    .sidebar .mobile-container .mobile-nav {
        border-top: 1px solid #e6eadf;
    }
    .sidebar .mobile-nav #mega-menu-wrap-primary,
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary {
        background: #fff;
    }

    /* Categories */
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item {
        border-bottom: 1px solid #e6eadf;
    }
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link {
        float: none;
        width: 100%;
        height: auto;
        min-height: 52px;
        padding: 15px 64px 15px 20px;
        border: 0;
        background: transparent;
        color: #224612;
        font-size: 15px;
        font-weight: 500;
        line-height: 22px;
        text-transform: none;
    }
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link .mega-indicator {
        display: none;
    }

    /* Open/close button: a chevron instead of the dark "+" / "-" box */
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary li > a.mobile-expand {
        position: absolute;
        top: 0;
        right: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 56px !important;
        height: 52px !important;
        margin: 0;
        padding: 0 !important;
        border: 0 !important;
        border-left: 1px solid #e6eadf !important;
        background: transparent;
        color: transparent;
        font-size: 0 !important;
        opacity: 1;
    }
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary li > a.mobile-expand::before {
        content: "";
        width: 9px;
        height: 9px;
        margin-top: -4px;
        border-right: 2px solid #3a6f23;
        border-bottom: 2px solid #3a6f23;
        transform: rotate(45deg);
        transition: transform .2s ease, margin .2s ease;
    }
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary li > a.mobile-expand.mobile-clicked::before {
        margin-top: 4px;
        transform: rotate(-135deg);
    }
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary li > a.mobile-expand:hover {
        background: #f3f7ec;
    }

    /* Sub-groups ("Shop By Type" ...) */
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu {
        padding: 0;
        background: #f6f8f2;
        border-top: 1px solid #e6eadf;
    }
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item {
        float: none;
        width: 100%;
        padding: 0;
        border-bottom: 1px solid #e6eadf;
    }
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item:last-child {
        border-bottom: 0;
    }
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link {
        float: none;
        width: 100%;
        height: auto;
        min-height: 48px;
        margin: 0;
        padding: 14px 64px 14px 28px;
        border: 0;
        background: transparent;
        color: #3a6f23;
        font-size: 13px;
        font-weight: 600;
        line-height: 20px;
        letter-spacing: .04em;
        text-transform: uppercase;
        opacity: 1;
    }
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link::before,
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link .mega-indicator {
        display: none;
    }
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > a.mobile-expand {
        height: 48px !important;
    }

    /* Links */
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu {
        padding: 0 0 8px;
        background: #fff;
    }
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item {
        float: none;
        width: 100%;
        padding: 0;
    }
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link {
        float: none;
        width: 100%;
        height: auto;
        margin: 0;
        padding: 11px 20px 11px 36px;
        border: 0;
        background: transparent;
        color: #333;
        font-size: 14px;
        font-weight: 400;
        line-height: 20px;
        text-transform: none;
        opacity: 1;
    }
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link:hover,
    .sidebar .mobile-nav #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link:focus {
        background: #f3f7ec;
        color: #224612;
    }

    /* Phone: a rounded call button instead of a full-width green block */
    .sidebar .top-phone {
        float: none;
        clear: both;
        padding: 24px 20px 32px;
        background: transparent;
    }
    .sidebar .top-phone .tp-phone-box {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 12px 20px;
        border-radius: 40px;
        background: #3a6f23;
    }
    .sidebar .top-phone .tp-phone-numb a {
        color: #fff;
    }
}

/*---------------------------------- Tablet ----------------------------------*/
@media (min-width: 768px) and (max-width: 991px) {
    /* Three narrow blog columns: smaller type and a 4-line excerpt. */
    .from-our-blog .dflt-header .btnstyle {
        margin-top: 20px !important;
    }
    .from-our-blog .post-item .card-body {
        padding: 18px 2px 0;
    }
    .from-our-blog .post-title {
        margin-bottom: 10px !important;
        font-size: 17px;
        line-height: 1.35;
    }
    .from-our-blog .post-header p {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 4;
        overflow: hidden;
        margin-bottom: 0;
        font-size: 14px;
        line-height: 1.6;
    }
    .from-our-blog .post-header .btnstyle {
        padding-top: 18px;
    }
    .from-our-blog .post-header .btn_green {
        padding: 8px 16px;
        white-space: nowrap;
    }
}

/*---------------------------------- Mobile ----------------------------------*/
@media (max-width: 767px) {
    /* Footer: "Quick Links" sat directly under the category list. */
    .ftr-clm-cnt {
        margin-bottom: 24px;
    }
    .ftr-clm-cnt h4 {
        margin-bottom: 18px;
    }

    .contact-map iframe {
        height: 320px;
    }

    .turkish-delight-box {
        padding: 30px 12px;
    }
    .trksd-title {
        font-size: 14px;
        line-height: 1.4;
    }
    .trksd-item .card-body {
        padding: 12px 4px;
    }
    .trksd-item .btn_green {
        padding: 8px 18px;
        font-size: 13px;
    }
}

/*------------------------------- Small mobile -------------------------------*/
@media (max-width: 575px) {
    /* Home carousels were centred here; left-align to match the rating. */
    .product-item.owl-carousel .card-body {
        text-align: left;
    }

    /* Two products per row: compact cards so titles and buttons fit. */
    .dorri-product-list .row {
        --bs-gutter-x: 12px;
    }
    .dorri-product-list .pdct-item .card-body {
        padding: 0 10px 14px;
    }
    .dorri-product-list .pdct-item-img {
        padding: 12px 8px 0;
    }
    .dorri-product-list .prdt-title {
        font-size: 14px;
        line-height: 1.4;
    }
    .dorri-product-list .pdct-price {
        font-size: 15px;
        margin-bottom: 12px;
    }
    /* Overrides the parent's "14px 14px !important" button padding. */
    .dorri-product-list .pdct-item .btnstyle .button,
    .dorri-product-list .pdct-item .btnstyle .btn {
        display: block;
        width: 100%;
        padding: 10px 6px !important;
        font-size: 12px !important;
        line-height: 1.3;
        text-align: center;
        white-space: nowrap;
    }
}

/*=====================================================================
  1.1.0 - Shop filters (Dorri Core "Product filters")
  Panel beside the products from 992px; below that the plugin shows a
  "Filter products" button that opens the panel as a drawer.
=====================================================================*/

.dorri-filters {
    --dorri-filters-accent: #1d2327;
}

@media (min-width: 992px) {
    .dorri-shop-layout:has(> .dorri-filters) {
        display: grid;
        grid-template-columns: 260px minmax(0, 1fr);
        gap: 2rem;
        align-items: start;
    }

    .dorri-shop-layout > .dorri-filters {
        position: sticky;
        top: 1rem;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }

    /* Narrower list next to the filters: three cards per row instead of four. */
    .dorri-shop-layout:has(> .dorri-filters) .dorri-product-list .row > .col-lg-3 {
        flex: 0 0 33.3333%;
        max-width: 33.3333%;
    }
}

@media (min-width: 1400px) {
    .dorri-shop-layout:has(> .dorri-filters) .dorri-product-list .row > .col-lg-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
}
