/*
Theme Name: Sindyanna of Galilee
Theme URI: https://he.sindyanna.com
Author: Forcemedia
Author URI: https://forcemedia.co.il
Description: Custom WooCommerce theme for Sindyanna of Galilee — fair trade olive oil cooperative. Features dual pricing for club members, ACF Pro content management, popup system, and full RTL Hebrew support.
Version: 1.3.6
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sindyanna
Tags: rtl, woocommerce, custom-menu, featured-images, theme-options, translation-ready
*/

@import url('css/style.css');

/* Screen-reader-only utility.
   .screen-reader-text is the WordPress/WooCommerce core class (used by
   searchform.php and WC templates); aliased here because the default
   WooCommerce stylesheet — which normally defines it — is dequeued. */
.sr-only,
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Reveal screen-reader text when it receives keyboard focus (WP core pattern). */
.screen-reader-text:focus {
    clip: auto;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0.75rem 1.5rem;
    z-index: 100000;
    background: var(--color-cream-light, #F7F6EE);
    color: var(--color-black, #1D1D1B);
    font-weight: 700;
    text-decoration: none;
}

/* Skip-to-content link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    z-index: 10000;
    padding: 0.75rem 1.5rem;
    background: var(--color-gold, #C9A84C);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0;
}

/* Remove gap between header and hero */
.home .hero {
    margin-block-start: 0;
    padding-block-start: var(--header-total-height);
}

/* CTA Banner — video variant */
.cta-banner--video {
    background-image: none;
}
.cta-banner__video-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}
.cta-banner__video-wrap iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 177.78vh; /* 16:9 */
    height: 100vh;
    min-width: 100%;
    min-height: 100%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    border: 0;
}
.cta-banner--video .cta-banner__inner {
    position: relative;
    z-index: 2;
}
.cta-banner--video::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1;
}

/* ------------------------------------------------------------------
   Mega menu — allow the category tab row to wrap.
   The live catalog has many top-level categories with long names; the
   prototype's single non-wrapping row overflowed and looked broken. Let
   the tabs flow onto a second row and tighten the spacing a touch so the
   panel of thumbnails below still reads as the focus.
   ------------------------------------------------------------------ */
.mega-menu__tabs {
    flex-wrap: wrap;
    row-gap: 0.25rem;
    column-gap: 0.25rem;
}
.mega-menu__tab {
    padding-inline: 12px;
}
/* Give the panel's product row breathing room on both sides and let it wrap
   instead of clipping the last tile when a category has many sub-categories. */
.mega-menu__products {
    flex-wrap: wrap;
    padding-inline: var(--space-lg);
}

/* ------------------------------------------------------------------
   Default page template wrapper — keep cart / checkout / account and
   other plain pages clear of the fixed header and give them breathing
   room at the bottom. (page.php renders the_content() here.)
   ------------------------------------------------------------------ */
.site-main--page {
    padding-block-start: calc(var(--header-total-height, 120px) + var(--space-xl, 2rem));
    padding-block-end: var(--space-3xl, 4rem);
}

/* ------------------------------------------------------------------
   Shop / category grid — WooCommerce wraps every product in
   <li class="product">, but the prototype's grid/list rules expect
   .cat-card to BE the grid item. Make the <li> a transparent flex cell
   so .cat-card fills it identically in every view mode (5/4/3 columns,
   2-up and list). Without this the <li> wrapper broke the list layout
   (misaligned images, wrapped text) and the column switcher.
   ------------------------------------------------------------------ */
.cat-grid__items {
    list-style: none;
    margin: 0;
    padding: 0;
}
.cat-grid__items > li.product {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
}
.cat-grid__items > li.product::before,
.cat-grid__items > li.product::marker {
    content: none;
}
.cat-grid__items > li.product > .cat-card {
    flex: 1 1 auto;
    width: 100%;
}

/* ── View-switcher: grid column variations + list view ──
   The base modifier rules also live in css/style.css; these !important
   copies guarantee the dropdown's chosen layout wins over the 4-column
   default and the <li> wrapper in every view mode. */
.cat-grid__items--cols-5 { grid-template-columns: repeat(5, 1fr) !important; gap: var(--space-md); }
.cat-grid__items--cols-3 { grid-template-columns: repeat(3, 1fr) !important; gap: var(--space-xl); }
.cat-grid__items--cols-2 { grid-template-columns: repeat(2, 1fr) !important; gap: var(--space-lg); }

.cat-grid__items--list { grid-template-columns: 1fr !important; gap: var(--space-sm); }
.cat-grid__items--list > li.product { display: block; }
.cat-grid__items--list .cat-card { flex-direction: row; align-items: center; border-radius: 8px; }
.cat-grid__items--list .cat-card__img { flex: 0 0 180px; aspect-ratio: 4 / 3; border-radius: 8px 0 0 8px; }
.cat-grid__items--list .cat-card__body { flex-direction: row; align-items: center; gap: var(--space-lg); padding: var(--space-md) var(--space-lg); }
.cat-grid__items--list .cat-card__name { flex: 1; margin-bottom: 0; font-size: 1.15rem; }
.cat-grid__items--list .cat-card__volume { margin-bottom: 0; }
.cat-grid__items--list .cat-card__price-row { margin-bottom: 0; min-width: 80px; }
.cat-grid__items--list .cat-card__actions { margin-top: 0; flex-shrink: 0; gap: var(--space-md); }
.cat-grid__items--list .cat-card__add-btn { min-width: 140px; height: 42px; font-size: 0.95rem; padding-inline: var(--space-lg); }
.cat-grid__items--list .cat-card__badge { inset-block-start: var(--space-xs); inset-inline-start: var(--space-xs); font-size: 0.7rem; }

@media (max-width: 1024px) {
    .cat-grid__items--cols-5 { grid-template-columns: repeat(3, 1fr) !important; }
}

@media (max-width: 768px) {
    .cat-grid__items--cols-5,
    .cat-grid__items--cols-4,
    .cat-grid__items--cols-3,
    .cat-grid__items--cols-2 { grid-template-columns: repeat(2, 1fr) !important; gap: var(--space-md); }

    .cat-grid__items--list { grid-template-columns: 1fr !important; gap: var(--space-md); }
    .cat-grid__items--list .cat-card { flex-direction: column; align-items: stretch; }
    .cat-grid__items--list .cat-card__img { flex: none; width: 100%; aspect-ratio: 16 / 9; border-radius: 8px 8px 0 0; }
    .cat-grid__items--list .cat-card__body { flex-direction: column; align-items: stretch; gap: var(--space-sm); padding: var(--space-lg); }
    .cat-grid__items--list .cat-card__name { font-size: 1.15rem; margin-bottom: 0; }
    .cat-grid__items--list .cat-card__price-row { margin-bottom: var(--space-sm); }
    .cat-grid__items--list .cat-card__actions { flex-direction: row; gap: var(--space-md); }
    .cat-grid__items--list .cat-card__qty { align-self: auto; }
    .cat-grid__items--list .cat-card__add-btn { width: auto; flex: 1; height: 42px; font-size: 0.95rem; }
}

/* ------------------------------------------------------------------
   Filter toolbar — WooCommerce renders the sort control and result
   count with its own markup (form.woocommerce-ordering > select.orderby
   and p.woocommerce-result-count). Give them the prototype's
   .cat-filters__select / .cat-filters__count appearance so the toolbar
   matches category.html.
   ------------------------------------------------------------------ */
.cat-filters .woocommerce-ordering {
    margin: 0;
}
.cat-filters .orderby {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--color-black);
    padding: var(--space-xs) var(--space-md);
    padding-inline-start: 2rem;
    border: 1.5px solid var(--color-cream);
    border-radius: 6px;
    background-color: var(--color-white);
    cursor: pointer;
    transition: border-color var(--transition-fast);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.75rem center;
}
.cat-filters .orderby:hover,
.cat-filters .orderby:focus {
    border-color: var(--color-gold);
    outline: none;
}
.cat-filters .woocommerce-result-count {
    margin: 0;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--color-olive-400);
}

/* ------------------------------------------------------------------
   Order notes on the CHECKOUT page — WooCommerce renders the notes
   textarea (#order_comments) inside the additional-fields section. The
   notes field was removed from the cart, so it lives only here; style it
   to match the Sindyanna form fields.
   ------------------------------------------------------------------ */
.woocommerce-checkout .woocommerce-additional-fields h3,
.woocommerce-checkout .order-notes-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-black);
    margin-bottom: var(--space-sm);
}
.woocommerce-checkout #order_comments_field label {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-black);
    margin-bottom: var(--space-xs);
    display: block;
}
.woocommerce-checkout #order_comments {
    width: 100%;
    min-height: 100px;
    border: 1px solid var(--color-cream);
    border-radius: 8px;
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-black);
    background: var(--color-white);
    resize: vertical;
    transition: border-color var(--transition-fast);
}
.woocommerce-checkout #order_comments:focus {
    border-color: var(--color-gold);
    outline: none;
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
}
.woocommerce-checkout #order_comments::placeholder {
    color: var(--color-olive-300);
    font-family: var(--font-body);
}

/* ------------------------------------------------------------------
   Product-card action button — normalize across product types. Simple
   products render a <button class="cat-card__add-btn">, while variable /
   grouped / external (and out-of-stock) products render an <a> ("בחר
   אפשרויות" / "קרא עוד"). The base rule didn't reset <a> defaults, so
   those looked underlined and top-aligned. Make both render identically.
   ------------------------------------------------------------------ */
.cat-card__add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    line-height: 1;
    padding-inline: var(--space-md);
}
.cat-card__add-btn:hover,
.cat-card__add-btn:focus {
    color: var(--color-white);
    text-decoration: none;
}

/* Sale price markup inside the card price (variable ranges / on-sale). */
.cat-card__price del {
    color: var(--color-olive-400);
    font-weight: 400;
    font-size: 0.9em;
    margin-inline-end: 0.25rem;
}
.cat-card__price ins {
    text-decoration: none;
    color: var(--color-gold-dark);
}

/* ------------------------------------------------------------------
   Member ("חברי מועדון") price row on product cards — was unstyled.
   ------------------------------------------------------------------ */
.cat-card__member-price {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--color-olive-500);
    margin-bottom: var(--space-sm);
}
.cat-card__member-label {
    font-family: var(--font-body);
}
.cat-card__member-value {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-gold);
}

/* ------------------------------------------------------------------
   Single product — keep the variable-product variations UI inside the
   info column. The variations form/table has no theme styling of its own,
   so cap its width and let long option lists wrap rather than push the
   layout edge-to-edge.
   ------------------------------------------------------------------ */
.product__purchase .variations_form,
.product__purchase .variations,
.product__purchase .single_variation_wrap,
.product__purchase .woocommerce-variation-add-to-cart {
    max-width: 100%;
}
.product__purchase .variations {
    width: 100%;
    border-collapse: collapse;
}
.product__purchase .variations th,
.product__purchase .variations td {
    padding-block: var(--space-xs);
    text-align: start;
    vertical-align: middle;
}
.product__purchase .variations .label {
    font-family: var(--font-body);
    font-weight: 600;
    color: var(--color-black);
    padding-inline-end: var(--space-md);
    white-space: nowrap;
}
.product__purchase .variations select {
    max-width: 100%;
    width: 100%;
    height: 40px;
    border: 1px solid var(--color-cream);
    border-radius: 8px;
    padding-inline: var(--space-md);
    font-family: var(--font-body);
    background: var(--color-white);
}
.product__purchase .reset_variations {
    font-size: 0.85rem;
    color: var(--color-olive-500);
}

/* ------------------------------------------------------------------
   Out-of-stock product cards — badge + dimmed image + restyled button so
   it's clear WHY the button says "מידע נוסף" instead of "הוספה לסל".
   ------------------------------------------------------------------ */
/* OOS badge styling + positioning lives in the badge block further down
   (it sits on the opposite corner from new/sale, so no stacking needed). */
.cat-card--oos .cat-card__img {
    position: relative;
}
.cat-card--oos .cat-card__img img {
    opacity: 0.55;
    filter: grayscale(30%);
}
.cat-card--oos .cat-card__img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.25);
    pointer-events: none;
}
.cat-card--oos .cat-card__add-btn {
    background: var(--color-olive-300);
    color: var(--color-white);
}
.cat-card--oos .cat-card__add-btn:hover,
.cat-card--oos .cat-card__add-btn:focus {
    background: var(--color-olive-500);
    color: var(--color-white);
}

/* ------------------------------------------------------------------
   Single product stock status (WooCommerce renders <p class="stock
   out-of-stock"> / "in-stock"). The OOS line shows for our backorder-
   purchasable products that are currently out of stock.
   ------------------------------------------------------------------ */
.product .stock.out-of-stock,
.product__stock--oos {
    display: inline-block;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-olive-700);
    background: var(--color-cream-light);
    padding: var(--space-xs) var(--space-md);
    border-radius: 6px;
    margin-bottom: var(--space-md);
}
.product .stock.in-stock,
.product__stock--in {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--color-olive-500);
    margin-bottom: var(--space-sm);
}

/* ------------------------------------------------------------------
   Variable product add-to-cart (WooCommerce variable.php renders the
   .single_variation_wrap button with default classes, not our
   .product__add-to-cart). Style it + the "select an option" disabled
   state. The variations <select> styling lives in the .product__purchase
   block above.
   ------------------------------------------------------------------ */
.single-product .single_variation_wrap .single_add_to_cart_button {
    width: 100%;
    height: 48px;
    margin-top: var(--space-sm);
    background: var(--color-gold);
    color: var(--color-white);
    border: none;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition-fast);
}
.single-product .single_variation_wrap .single_add_to_cart_button:hover {
    background: var(--color-gold-dark);
}
.single-product .single_variation_wrap .single_add_to_cart_button.disabled,
.single-product .single_variation_wrap .single_add_to_cart_button.wc-variation-selection-needed,
.single-product .single_variation_wrap .single_add_to_cart_button:disabled {
    background: var(--color-olive-300);
    cursor: not-allowed;
}
/* Variations table layout: label + select on one row, reset link, and the
   add-to-cart row (qty + button) laid out like the rest of the product UI. */
.single-product .variations tr {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}
.single-product .variations th { flex: 0 0 auto; }
.single-product .variations td { flex: 1; }
.single-product .variations .reset_variations {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--color-olive-400);
    text-decoration: underline;
    margin-top: var(--space-xs);
    display: inline-block;
}
.single-product .single_variation .woocommerce-variation-price {
    margin-bottom: var(--space-md);
}
.single-product .woocommerce-variation-add-to-cart {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}
.single-product .woocommerce-variation-add-to-cart .quantity {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--color-cream);
    border-radius: 8px;
    overflow: hidden;
}
.single-product .woocommerce-variation-add-to-cart .quantity .qty {
    width: 50px;
    height: 44px;
    border: none;
    text-align: center;
    font-family: var(--font-body);
    font-size: 1rem;
}

/* ------------------------------------------------------------------
   Product card badges — larger, higher-contrast. "מסיק חדש" goes dark
   olive green (was gold), "מבצע" black, "אזל מהמלאי" olive.
   ------------------------------------------------------------------ */
.cat-card__badge {
    padding: 0.3em 0.85em;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
}
.cat-card__badge--new {
    background: #2c3723;
    color: var(--color-white);
}
.cat-card__badge--sale {
    background: var(--color-black);
    color: var(--color-white);
}
/* OOS badge on the OPPOSITE corner from new/sale: top-left in RTL
   (inset-inline-end), so the two never overlap or stack. */
.cat-card__badge--oos {
    inset-block-start: var(--space-sm);
    inset-inline-end: var(--space-sm);
    inset-inline-start: auto;
    background: var(--color-olive-500);
    color: var(--color-white);
}
/* WooCommerce's own sale flash, if it ever renders, matches the card badges. */
.woocommerce span.onsale,
ul.products li.product .onsale,
.single-product .product .onsale {
    position: absolute;
    inset-block-start: var(--space-sm);
    inset-inline-start: var(--space-sm);
    margin: 0;
    padding: 0.3em 0.85em;
    border-radius: 4px;
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: normal;
    min-width: auto;
    min-height: auto;
    background: var(--color-black);
    color: var(--color-white);
    z-index: 1;
}

/* ------------------------------------------------------------------
   WooCommerce notices — constrain to container width + brand styling.
   On the cart these render via woocommerce_before_cart, which fires
   BEFORE our .container, so they were edge-to-edge. Constraining the
   wrapper (and the messages, for cases with no wrapper) fixes it.
   ------------------------------------------------------------------ */
.woocommerce-notices-wrapper,
.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--container-padding);
}
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
    border-radius: 8px;
    padding: var(--space-md) var(--space-lg);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-black);
    margin-bottom: var(--space-lg);
}
.woocommerce-message {
    background: var(--color-cream-light);
    border: 1px solid var(--color-cream);
    border-inline-start: 4px solid var(--color-gold);
}
.woocommerce-message::before { color: var(--color-gold); }
.woocommerce-message a { color: var(--color-gold-dark); font-weight: 600; }

.woocommerce-info {
    background: var(--color-cream-light);
    border: 1px solid var(--color-cream);
    border-inline-start: 4px solid var(--color-olive-500);
}
.woocommerce-info::before { color: var(--color-olive-500); }

.woocommerce-error {
    background: #fff5f5;
    border: 1px solid #fecaca;
    border-inline-start: 4px solid #dc2626;
}
.woocommerce-error::before { color: #dc2626; }

/* Buttons inside notices (e.g. "צפה בעגלה"). */
.woocommerce-message .button,
.woocommerce-info .button {
    float: inline-start;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.85rem;
    padding: var(--space-xs) var(--space-md);
    border: 1px solid var(--color-gold);
    border-radius: 6px;
    background: transparent;
    color: var(--color-gold-dark);
    text-decoration: none;
    transition: all var(--transition-fast);
}
.woocommerce-message .button:hover,
.woocommerce-info .button:hover {
    background: var(--color-gold);
    color: var(--color-white);
}
