/**
 * Leewadee brand theme — overrides Hyva CSS variables and sets typography.
 * Loaded after Hyva's base CSS so all declarations here win the cascade.
 */

/* ── Brand palette ──────────────────────────────────────────────────────── */
:root {
    /* Terracotta primary */
    --color-primary:         196 113 79;
    --color-primary-lighter: 218 152 122;
    --color-primary-darker:  162 84 52;

    /* Sage-green secondary */
    --color-secondary:         125 155 118;
    --color-secondary-lighter: 157 184 150;
    --color-secondary-darker:   95 125  88;

    /* Warm-cream backgrounds */
    --color-background:         251 248 244;
    --color-container:          245 240 233;
    --color-container-lighter:  251 248 244;
    --color-container-darker:   230 222 210;
}

/* ── Base font scale ─────────────────────────────────────────────────────── */
/*
 * Raise the rem base from 16 px → 17 px so every Tailwind rem class
 * (text-sm, text-base, text-lg …) scales up ~6 % for better readability.
 * Headings are pinned to their original pixel sizes below so they don't grow.
 */
html {
    font-size: 17px;
}

/* ── Typography ─────────────────────────────────────────────────────────── */
body {
    font-family: 'DM Sans', ui-sans-serif, system-ui, sans-serif;
    background-color: rgb(var(--color-background));
    color: #3e281e;
}

h1, h2, h3, h4,
.font-serif,
.product-item-link,
.page-title span {
    font-family: 'Cormorant Garamond', Georgia, serif;
    letter-spacing: 0.01em;
}

/*
 * Pin heading sizes to their original pixel values so they do NOT grow
 * when the rem base changes. Body text and UI labels grow; headings stay.
 */
h1, h1.page-title               { font-size: 30px; }   /* = Tailwind text-3xl @ 16px */
h2                              { font-size: 24px; }   /* = text-2xl */
h3                              { font-size: 20px; }   /* = text-xl  */
h4                              { font-size: 18px; }   /* = text-lg  */
h5, h6                          { font-size: 16px; }

/* ── Product page title ─────────────────────────────────────────────────── */
.product-detail-title h1 {
    /* Use px so the clamp range is unaffected by rem-base changes */
    font-size: clamp(22px, 2.6vw, 30px);
    font-weight: 500;
    line-height: 1.2;
    color: #3e281e;
}

/* ── Buttons ─────────────────────────────────────────────────────────────  */
.btn-primary {
    background-color: rgb(var(--color-primary));
    color: #fff;
    border-radius: 2px;
    font-family: 'DM Sans', sans-serif;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: 500;
}
.btn-primary:hover {
    background-color: rgb(var(--color-primary-darker));
}

/* ── Category list cards ────────────────────────────────────────────────── */
.product-item-link {
    font-size: 1.1rem;
    font-weight: 400;
    color: #3e281e;
}

/*
 * Product card image — full-width square container with white background.
 * The <img> inside is generated at 720×720 (2× retina) so it looks crisp on
 * high-DPI screens. CSS controls the actual display size.
 */
.leewadee-card-img-wrap {
    aspect-ratio: 1 / 1;          /* square crop area */
    background: #fff;
}
.leewadee-card-img-wrap .product-item-photo {
    display: block;
    width: 100%;
    height: 100%;
}
.leewadee-product-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

/* ── Breadcrumbs ────────────────────────────────────────────────────────── */
.breadcrumbs {
    background-color: rgb(var(--color-container-lighter));
    font-size: 12px;   /* px so it doesn't grow with the rem-base change */
    letter-spacing: 0.03em;
}

/* ── Category pages: full-width layout ──────────────────────────────────── */
/*
 * The base layout is 2columns-left (CSS grid with 4 equal columns; sidebar
 * occupies col 1, .column.main spans cols 2–4). Since sidebar is never used
 * on category pages we make .column.main span all columns so the product grid
 * fills the full content width.
 */
.catalog-category-view .columns {
    grid-template-columns: 1fr !important;
}
.catalog-category-view .column.main {
    grid-column: 1 / -1 !important;
}

/* ── Toolbar / Pagination ────────────────────────────────────────────────── */
/* Space between "Items X–Y of Z" label and the page-number buttons.
 * mr-6 Tailwind class cannot be used here — it is not in Hyva's compiled styles.css. */
.toolbar-amount {
    margin-right: 1.5rem;
}

/* ── Category page ──────────────────────────────────────────────────────── */
/*
 * Hyva's compiled styles.css has two conflicting rules:
 *   .container { padding-left: 1.5rem; padding-right: 1.5rem; }
 *   #category-view-container { padding-left: 0; padding-right: 0; }  ← strips it
 * The H1 title wrapper uses .container (gets 1.5rem padding), but the description
 * container is targeted by the ID rule and loses its padding, causing misalignment.
 * Restore the padding here so the description aligns with the H1.
 */
#category-view-container {
    align-items: flex-start;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}
.category-description {
    text-align: left;
}

/* ── Product Detail Page layout ─────────────────────────────────────────── */
.leewadee-pdp {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

/* Hero row: single col mobile → 60/40 grid on md+ */
.leewadee-pdp-hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}
@media (min-width: 768px) {
    .leewadee-pdp-hero {
        grid-template-columns: 3fr 2fr;   /* 60 % / 40 % */
        gap: 3.5rem;
    }
    .leewadee-pdp-gallery {
        position: sticky;
        top: 1rem;
        /* Without an explicit z-index a sticky element creates a stacking
           context that ranks below the header's z-30, trapping the fullscreen
           overlay (z-50) underneath the header.  z-40 lifts this context above
           the header so the overlay covers the entire viewport when open. */
        z-index: 40;
    }
}

/* Title always left-aligned */
.leewadee-pdp-title,
.leewadee-pdp-title .page-title-wrapper,
.leewadee-pdp-title h1,
.leewadee-pdp-title .page-title {
    text-align: left !important;
}

/* Below-fold section — full width, separator above */
.leewadee-pdp-below {
    margin-top: 3rem;
    padding-top: 2.5rem;
    border-top: 1px solid rgb(var(--color-container-darker));
    width: 100%;
}

/* Description prose styles */
.leewadee-pdp-below .prose {
    max-width: 100%;
}

/* Dynamic variant description — preserve paragraph spacing and line breaks */
.leewadee-pdp-desc-dynamic p {
    margin-bottom: 0.85rem;
    line-height: 1.7;
}
.leewadee-pdp-desc-dynamic p:last-child {
    margin-bottom: 0;
}
.leewadee-pdp-desc-dynamic br {
    display: block;
    content: '';
    margin-top: 0.4rem;
}
.leewadee-pdp-desc-dynamic ul,
.leewadee-pdp-desc-dynamic ol {
    padding-left: 1.25rem;
    margin-bottom: 0.85rem;
}
.leewadee-pdp-desc-dynamic li {
    margin-bottom: 0.3rem;
    line-height: 1.6;
}

/*
 * Force any grid Hyva renders inside the below-fold section to collapse to
 * a single column. Hyva's product-sections template wraps sections in a
 * "grid lg:grid-cols-2 gap-8" container that we cannot override via template
 * (the theme layout XML processes after module layout XML). This CSS wins
 * the cascade because leewadee.css is loaded last.
 */
.leewadee-pdp-below .grid {
    display: block !important;
    grid-template-columns: none !important;
}
.leewadee-pdp-below .grid > * {
    width: 100% !important;
}

/* Image grid below description */
.leewadee-pdp-imgrid-wrap {
    margin-top: 3rem;
    padding-top: 2.5rem;
    border-top: 1px solid rgb(var(--color-container-darker));
}
.leewadee-pdp-imgrid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 768px) {
    .leewadee-pdp-imgrid {
        grid-template-columns: 1fr 1fr;
    }
}
.leewadee-pdp-imgrid-item {
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
}
.leewadee-pdp-imgrid-item img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

/* ── Buy on Amazon button ────────────────────────────────────────────────── */
.leewadee-buy-wrap {
    margin-top: 1.25rem;
    margin-bottom: 1.75rem;
}
.leewadee-buy-note {
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.45;
    margin-bottom: 0.75rem;
}
.leewadee-buy-btn {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: 6px;
    background-color: #f0a500;
    color: #111827;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    text-decoration: none;
    border: none;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
    letter-spacing: 0.01em;
}
.leewadee-buy-btn:hover {
    background-color: #d4900a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    text-decoration: none;
    color: #111827;
}
.leewadee-buy-btn:focus {
    outline: 3px solid #f0a500;
    outline-offset: 2px;
}
.leewadee-buy-unavailable {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f3f4f6;
    border-radius: 4px;
    font-size: 0.875rem;
    color: #6b7280;
    text-align: center;
}
.leewadee-affiliate-note {
    margin-top: 1.25rem;
    font-size: 0.6rem;
    color: #c4c9d1;
    line-height: 1.5;
}
.leewadee-affiliate-footer-note {
    font-size: 0.72rem;
    color: #9ca3af;
    line-height: 1.5;
    padding-top: 0.5rem;
}

/* ── PDP Price box ───────────────────────────────────────────────────────── */
.product-info-price {
    margin-top: 1.25rem;
}
.leewadee-price-box {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}
.leewadee-price-final .price-wrapper .price {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    font-family: 'DM Sans', sans-serif;
}
.leewadee-price-regular {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
}
.leewadee-price-was-label {
    font-size: 0.8rem;
    color: #9ca3af;
    font-style: italic;
}
.leewadee-price-regular .price-wrapper .price {
    font-size: 0.95rem;
    color: #9ca3af;
    text-decoration: line-through;
}
.leewadee-price-excl {
    font-size: 0.8rem;
    color: #6b7280;
}

/* ── Bullet list on PDP ─────────────────────────────────────────────────── */
.product-bullets {
    padding-left: 1.25rem;
    list-style-type: disc;
    list-style-position: outside;
}
.product-bullets li {
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    color: #374151;
    line-height: 1.5;
}

/* ── Legal / Policy pages ───────────────────────────────────────────────── */
/*
 * Targets both content wrappers used by the import scripts:
 *   .privacy-policy-content  — privacy policy pages
 *   .legal-page-content      — legal notice + terms of use
 *
 * Goals:
 *  · Constrain line length for readability (~780 px)
 *  · Generous top margin before headings so sections breathe
 *  · Comfortable paragraph/list spacing so dense legal text isn't suffocating
 *  · Subtle rule below each h2 to anchor section structure visually
 */
.privacy-policy-content,
.legal-page-content {
    max-width: 780px;
    margin: 0 auto;
    padding: 1rem 1.5rem 3.5rem;
    font-size: 0.95rem;
    line-height: 1.8;
    color: #3e281e;
}

/* Page / document title (h2 used as the top-level heading from docx Heading1) */
.privacy-policy-content h2,
.legal-page-content h2 {
    margin-top: 2.75rem;
    margin-bottom: 0.65rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgb(var(--color-container-darker));
    line-height: 1.25;
}

/* First h2 in the document needs no extra top margin */
.privacy-policy-content > h2:first-child,
.legal-page-content    > h2:first-child {
    margin-top: 0.5rem;
}

/* Sub-section headings */
.privacy-policy-content h3,
.legal-page-content h3 {
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.privacy-policy-content h4,
.legal-page-content h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.4rem;
    line-height: 1.35;
}

/* Body paragraphs */
.privacy-policy-content p,
.legal-page-content p {
    margin-bottom: 0.85rem;
}
.privacy-policy-content p:last-child,
.legal-page-content p:last-child {
    margin-bottom: 0;
}

/* Bullet lists */
.privacy-policy-content ul,
.legal-page-content ul {
    list-style: disc;
    padding-left: 1.5rem;
    margin-top: 0.4rem;
    margin-bottom: 1.1rem;
}
.privacy-policy-content li,
.legal-page-content li {
    margin-bottom: 0.35rem;
    line-height: 1.7;
}

/* ── Configurable product swatches ──────────────────────────────────────── */
.leewadee-swatches {
    margin-top: 1rem;
}

/* Attribute group (one per attribute: color / size / style) */
.leewadee-swatch-group {
    margin-bottom: 1.25rem;
}

/* Attribute heading row: "Color  — Auburn" */
.leewadee-swatch-group-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}
.leewadee-swatch-group-name {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #6b7280;
}
.leewadee-swatch-group-current {
    font-size: 0.875rem;
    font-weight: 500;
    color: #3e281e;
}

/* ── Image swatches (color) ─────────────────────────────────────────────── */
.leewadee-swatch-color-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.leewadee-swatch-img-btn {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.leewadee-swatch-img-btn:hover:not(:disabled) {
    border-color: rgb(var(--color-primary));
}
.leewadee-swatch-img-btn--on {
    border-color: rgb(var(--color-primary)) !important;
    box-shadow: 0 0 0 2px rgb(var(--color-primary));
}
.leewadee-swatch-img-btn--off,
.leewadee-swatch-img-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.leewadee-swatch-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* Fallback when no swatch image: show initials */
.leewadee-swatch-img-fallback {
    font-size: 0.65rem;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    line-height: 1;
    pointer-events: none;
}

/* ── Label swatches (size / style) ──────────────────────────────────────── */
.leewadee-swatch-label-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
/* ── Active filter pills ────────────────────────────────────────────────── */
.leewadee-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}
.leewadee-active-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 9999px;
    background-color: rgb(var(--color-primary) / 0.12);
    border: 1px solid rgb(var(--color-primary) / 0.35);
    color: rgb(var(--color-primary-darker));
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.leewadee-active-filter-pill:hover {
    background-color: rgb(var(--color-primary) / 0.22);
    border-color: rgb(var(--color-primary));
}
.leewadee-active-filter-x {
    flex-shrink: 0;
    opacity: 0.65;
}
.leewadee-active-filter-pill:hover .leewadee-active-filter-x {
    opacity: 1;
}

/* ── Subcategory tiles ───────────────────────────────────────────────────── */
.subcategory-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}
.subcategory-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    width: calc(20% - 0.8rem);
    border: 1px solid rgb(var(--color-container-darker));
    border-radius: 0.5rem;
    padding: 0.75rem;
    text-align: center;
    background-color: rgb(var(--color-container));
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.subcategory-tile:hover {
    border-color: rgb(var(--color-primary));
    box-shadow: 0 2px 8px rgb(var(--color-primary) / 0.15);
}
.subcategory-tile img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 0.375rem;
}
.subcategory-tile__placeholder {
    width: 100%;
    height: 120px;
    background-color: rgb(var(--color-container-darker));
    border-radius: 0.375rem;
}
.subcategory-tile span {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #3e281e;
    line-height: 1.4;
}
@media (max-width: 1024px) {
    .subcategory-tile { width: calc(25% - 0.75rem); }
}
@media (max-width: 768px) {
    .subcategory-tile { width: calc(33.333% - 0.667rem); }
}
@media (max-width: 480px) {
    .subcategory-tile { width: calc(50% - 0.5rem); }
}

.leewadee-swatch-label-btn {
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    border: 1.5px solid rgb(var(--color-container-darker));
    background-color: rgb(var(--color-container));
    color: #3e281e;
    font-size: 0.8rem;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    cursor: pointer;
    line-height: 1.4;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}
.leewadee-swatch-label-btn:hover:not(:disabled) {
    border-color: rgb(var(--color-primary));
    background-color: rgb(var(--color-primary-lighter) / 0.15);
}
.leewadee-swatch-label-btn--on {
    background-color: rgb(var(--color-primary)) !important;
    border-color: rgb(var(--color-primary-darker)) !important;
    color: #fff !important;
}
.leewadee-swatch-label-btn--off,
.leewadee-swatch-label-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}
