/* ==========================================================================
   Windhorse Products Display – Wireframe CSS
   Phase 1: Layout only (no JS behaviour)
   ========================================================================== */

/* Overide Div theme builder styles */
.et-db #et-boc .et-l .windhorse-products-header-breadcrumb a {
    text-decoration: none;
    color: #767676;
}
.et-db #et-boc .et-l .windhorse-product-title a,
.et-db #et-boc .et-l .windhorse-product-author a {
    text-decoration: none;
    color: #3E3E3E;
}
.et-db #et-boc .et-l .windhorse-products .windhorse-product-cart .add_to_cart_button,
.et-db #et-boc .et-l .windhorse-products .windhorse-product-cart .windhorse-select-options {
    background-color: #378085;
    border-color: #378085;
}
.et-db #et-boc .et-l .windhorse-products .windhorse-product-cart .add_to_cart_button.is-added,
.et-db #et-boc .et-l .windhorse-products .windhorse-product-cart .add_to_cart_button.added {
    background-color: #878787;
    border-color: #878787;
}
@media (hover: hover) {
    .et-db #et-boc .et-l .windhorse-products .windhorse-product-cart .add_to_cart_button:hover,
    .et-db #et-boc .et-l .windhorse-products .windhorse-product-cart .windhorse-select-options:hover {
        background-color: #e76161;
        border-color: #e76161;
    }
}
.et-db #et-boc .et-l .windhorse-pagination ul.page-numbers {
    padding: 2rem 1rem;
}

/* Header container
   -------------------------------------------------------------------------- */
.windhorse-products-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
}

.windhorse-products-header-title h2 {
    margin: 0;
    font-weight: 500;
    font-size: 22px;
    color: #3E3E3E !important;
    font-family: 'Merriweather',Helvetica,Arial,Lucida,sans-serif;
    padding-bottom: 0 !important;
    line-height: 1em;
}

.windhorse-products-header-view-all a {
    font-weight: 700;
    letter-spacing: 0.5px;
    text-decoration: none;
    color: #3E3E3E !important;
    text-transform: uppercase;
    font-family: 'Gidole',Helvetica,Arial,Lucida,sans-serif;
    font-size: 14px;
}

.windhorse-products-sort {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
}

.windhorse-products-sort select {
    padding: 0.3rem 0.5rem;
}

/* Base container
   -------------------------------------------------------------------------- */

.windhorse-display-row {
    position: relative;
    width: calc(100% + 1.2rem);
    margin-left: -1.2rem;
}
.windhorse-display-grid {
    position: relative;
    width: 100%;
}

/* Inner wrapper (shared)
   -------------------------------------------------------------------------- */

.windhorse-products-inner {
    display: flex;
    will-change: transform;
    align-items: stretch;
}

/* ==========================================================================
   Grid display
   ========================================================================== */

.windhorse-display-grid .windhorse-products-inner {
    display: grid;
    grid-template-columns: repeat(var(--windhorse-visible), 1fr);
    gap: 1.5rem;
}

.windhorse-display-grid {
    --windhorse-visible: 6;
}

@media (min-width: 1601px) {
    .windhorse-display-grid-no-large-desktop.windhorse-display-grid,
    body.is-authors-archive .windhorse-display-grid,
    body.is-author-category .windhorse-display-grid {
        --windhorse-visible: 4;
    }
}

/* Tablet */
@media (max-width: 1600px) {
    .windhorse-display-grid {
        --windhorse-visible: 4;
    }
}

/* Tablet */
@media (max-width: 980px) {
    .windhorse-display-grid {
        --windhorse-visible: 2;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .windhorse-display-grid {
        --windhorse-visible: 1;
    }
}

/* ==========================================================================
   Row display (slider-ready, but static for now)
   ========================================================================== */

.windhorse-display-row {
    overflow: hidden;
    position: relative; /* already good for absolute buttons */
}

.windhorse-display-row .windhorse-products-inner {
    flex-wrap: nowrap;
    overflow: hidden;
}

/* Row display: size items based on visible count */
.windhorse-display-row .windhorse-product {
    width: calc(100% / var(--windhorse-visible));
    margin-left: 1.2rem;
}

/* Tablet */
@media (max-width: 980px) {
    .windhorse-display-row {
        --windhorse-visible: 2; /* default tablet */
    }
}

/* Mobile */
@media (max-width: 767px) {
    .windhorse-display-row {
        --windhorse-visible: 1; /* default mobile */
    }
}

/* ==========================================================================
   Product card
   ========================================================================== */

.windhorse-product {
    display: flex;
    flex-direction: column;
    height: 100%;
    font-family: "Gidole", Helvetica, Arial, Lucida, sans-serif;
    border-bottom: 1px solid #3e3e3e;
    padding-bottom: 1px;
}

/* Image row with padding + background */
.windhorse-product-image {
    padding: 2.4rem 2rem;
    background-color: #f4f4f4;
}

/* NEW inner frame that controls height */
.windhorse-product-image-inner {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 767px) {
    .windhorse-product-image-inner {
        height: auto;
    }
}

.windhorse-product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;        /* keeps full book visible */
    display: block;
}

/* Title */
.windhorse-product-title {
    margin-top: 0.75rem;
    font-weight: 500;
    font-size: 1em;
    line-height: 1.2em;
    color: #3E3E3E;
    font-family: 'Merriweather',Helvetica,Arial,Lucida,sans-serif;
}

.windhorse-product-title a {
    text-decoration: none;
    color: #3E3E3E;
}

@media (min-width: 768px) {
    .windhorse-product-title {
        min-height: 3.6em; /* approx 3 lines */
    }
    .windhorse-product-title a {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;   /* limit to 3 lines */
        overflow: hidden;
    }
}

/* Author */
.windhorse-product-author {
    margin-top: 0.25rem;
    font-size: 0.9em;
    opacity: 0.8;
    min-height: 2.6em; /* approx 2 lines */
    line-height: 1.2em;
}
.windhorse-product-author a {
    color: #3E3E3E;
}

/* ==========================================================================
   Price + add to cart row
   ========================================================================== */

.windhorse-product-purchase {
    margin-top: auto; /* pushes purchase row to bottom */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    position: relative;
    top: 1px; /* fix for edge case where border dissapears */
}

/* Price */
.windhorse-product-price {
    font-weight: 500;
}

/* Cart button wrapper */
.windhorse-product-cart {
    text-align: right;
}

/* Cart button */
.windhorse-products .windhorse-product-cart .add_to_cart_button,
.windhorse-products .windhorse-product-cart .windhorse-select-options {
    background-color: #378085;
    border-width: 1px !important;
    border-color: #378085;
    text-transform: uppercase;
    font-weight: 700 !important;
    display: block;
    margin-left: auto;
    width: fit-content;
    max-width: 100%;
    border-radius: 0;
    color: white;
    padding: 0.3em 1em;
}
.windhorse-products .windhorse-product-cart .add_to_cart_button.is-added,
.windhorse-products .windhorse-product-cart .add_to_cart_button.added {
    background-color: #878787;
    border-width: 1px !important;
    border-color: #878787;
}

@media (hover: hover) {
    .windhorse-products .windhorse-product-cart .add_to_cart_button:hover,
    .windhorse-products .windhorse-product-cart .windhorse-select-options:hover {
        background-color: #e76161;
        border-color: #e76161;
    }
}

/* ==========================================================================
   Slider controls (visual only for now)
   ========================================================================== */

.windhorse-slider-control {
    position: absolute;
    top: 37%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 2;
}

.windhorse-slider-control:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.windhorse-slider-prev {
    left: 2.2rem;
}

.windhorse-slider-next {
    right: 1rem;
}

.arrow {
  display: inline-block;
  width: 17px;
  height: 17px;
  border: solid currentColor;
  border-width: 0 2px 2px 0; /* controls thickness */
  padding: 6px;
}

.arrow--right {
  transform: rotate(-45deg);
}

.arrow--left {
  transform: rotate(135deg);
}

.windhorse-slider-control {
  color: #000;
}

.windhorse-slider-control:hover {
  color: #666;
}

.windhorse-slider-control:hover .arrow {
  transform: translateX(2px) rotate(-45deg);
}

.windhorse-slider-control.windhorse-slider-prev:hover .arrow {
  transform: translateX(-2px) rotate(135deg);
}

/* Hide controls when not a slider */
.windhorse-products:not(.windhorse-is-slider) .windhorse-slider-control {
    display: none;
}

/* Add to cart */
.added_to_cart.wc-forward {
    display: none !important;
}
.windhorse-add-to-cart.is-loading {
    pointer-events: none;
    opacity: 0.6;
}

/* ==========================================================================
   Windhorse Products Display - Authors Grid
   ========================================================================== */
body.is-author-category #main-content .et_pb_section .et_pb_row {
    max-width: 1080px !important;
}
body.is-authors-archive #main-content {
    max-width: 1080px;
    margin: 0 auto;
    padding-left: 0;
    padding-right: 0;
    padding-top: 90px;
}
@media (max-width: 1100px) {
    body.is-authors-archive #main-content,
    body.is-author-category #main-content .et_pb_section .et_pb_row {
        padding: 5% 1.9rem;
    }
}

.windhorse-authors-grid .windhorse-product,
.windhorse-author {
    text-align: center;
}

.windhorse-authors-grid .windhorse-product-title {

}

.windhorse-author-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
    align-items: flex-start;
}

.windhorse-author-header-image img {
    width: 400px;
    max-width: 100%;
    height: auto;
    display: block;
}

@media (min-width: 768px) {
    .windhorse-author-header-image {
        margin-right: 6em;
    }
}

.windhorse-author-header-title {
    margin: 0 0 0.75rem;
}

.windhorse-author-header-description {
    max-width: 700px;
}
.windhorse-author-header-description.windhorse-author-header-no-thumb {
    max-width: 100%;
}
.windhorse-author-header-description > * {
    padding-left: 0 !important;
}

/* Stack on mobile */
@media (max-width: 767px) {
    .windhorse-author-header {
        flex-direction: column;
    }
}

/* ==========================================================================
   Windhorse Products Display - Pagination Styles
   ========================================================================== */

.windhorse-pagination {
    margin: 2rem 0;
    clear: both;
    text-align: center;
}

.windhorse-pagination ul.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0 auto;
    padding: 2rem 1rem;
    border: 1px solid #ddd;
    border-radius: 0;
    background: #f9f9f9;
}

.windhorse-pagination ul.page-numbers li {
    margin: 0;
    padding: 0;
}

.windhorse-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 0;
    background: #fff;
    color: #3E3E3E;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.windhorse-pagination .page-numbers:hover {
    background: #f5f5f5;
    border-color: #999;
    color: #000;
}

.windhorse-pagination .page-numbers.current {
    background: #378085;
    border-color: #378085;
    color: #fff;
    cursor: default;
    pointer-events: none;
}

.windhorse-pagination .page-numbers.dots {
    border: none;
    background: transparent;
    cursor: default;
    pointer-events: none;
    color: #999;
}

.windhorse-pagination .page-numbers.prev,
.windhorse-pagination .page-numbers.next {
    font-size: 1.25rem;
    font-weight: 400;
}

.windhorse-pagination .page-numbers.prev:hover,
.windhorse-pagination .page-numbers.next:hover {
    background: #378085;
    border-color: #378085;
    color: #fff;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .windhorse-pagination ul.page-numbers {
        gap: 0.25rem;
    }

    .windhorse-pagination .page-numbers {
        min-width: 2.25rem;
        height: 2.25rem;
        padding: 0.375rem 0.625rem;
        font-size: 0.875rem;
    }

    .windhorse-pagination .page-numbers.prev,
    .windhorse-pagination .page-numbers.next {
        font-size: 1.125rem;
    }
}

@media screen and (max-width: 480px) {
    .windhorse-pagination ul.page-numbers {
        gap: 0.125rem;
    }

    .windhorse-pagination .page-numbers {
        min-width: 2rem;
        height: 2rem;
        padding: 0.25rem 0.5rem;
        font-size: 0.8125rem;
    }
}

/* WooCommerce theme compatibility */
.woocommerce .windhorse-pagination .page-numbers {
    line-height: 1;
}

/* Ensure pagination appears below products grid */
.windhorse-products + .windhorse-pagination {
    margin-top: 3rem;
}
