/**
 * SITE LAYOUT - SLOB (Soaps, Lotions, Oils & Balms)
 * Light, airy, botanical — clean ingredients, clean design
 * Open layout with transparency and breathing room
 */

/* ========================================================================
   PAGE STRUCTURE
   ======================================================================== */

#outerFrame {
    max-width: 1200px;
    margin: 0 auto;
    background-color: var(--bg-base);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================================================
   HEADER
   ======================================================================== */

header {
    background-color: var(--surface-base);
    position: relative;
    color: var(--text-on-dark);
    padding: var(--spacing-xl) var(--spacing-lg) var(--spacing-md);
    text-align: center;
    border-bottom: 1px solid var(--border);
    border-radius: 50% 50% 0 0 / clamp(60px, 12vw, 160px) clamp(60px, 12vw, 160px) 0 0;
}

/* ===== SITE HEADER (Logo + Tagline) ===== */

.site-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.header-logo {
    width: 33vw;
    max-width: 350px;
    height: auto;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 20px rgba(74, 106, 24, 0.12);
    transition: box-shadow var(--transition-normal);
    margin: var(--spacing-lg) 0;
}

.header-logo:hover {
    box-shadow: 0 4px 30px rgba(74, 106, 24, 0.2);
}

.header-title {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--primary);
    margin-bottom: 0;
}

.site-tagline {
    font-size: var(--font-size-sm);
    color: var(--text-on-dark-secondary);
    letter-spacing: 0.08em;
    margin-bottom: 0;
    font-weight: 400;
}

/* ========================================================================
   NAVIGATION STRUCTURE
   ======================================================================== */

nav {
    background-color: var(--surface-base);
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 20;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: var(--spacing-md);
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
    display: block;
    text-decoration: none;
    color: var(--text-on-dark);
}

.nav-link:hover {
    background-color: var(--primary);
    color: var(--white);
    text-decoration: none;
}

.nav-link.active {
    background-color: var(--primary-dark);
    color: var(--white);
}

/* ========================================================================
   DROPDOWN MENUS
   ======================================================================== */

.nav-item.dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--surface-base);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    z-index: 1000;
    list-style: none;
    padding: var(--spacing-sm) 0;
    margin: 0;
}

.nav-item.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-item {
    color: var(--text-on-dark);
    padding: 0.75rem 1.25rem;
    display: block;
    text-decoration: none;
    transition: all var(--transition-normal);
}

.dropdown-item:hover {
    background-color: var(--primary);
    color: var(--white);
    text-decoration: none;
}

.dropdown-item.active {
    background-color: var(--primary-dark);
    color: var(--white);
}

/* Dropdown arrow indicator */
.nav-item.dropdown > .nav-link::after {
    content: ' ▼';
    font-size: 0.8rem;
    margin-left: var(--spacing-sm);
    transition: transform var(--transition-normal);
}

.nav-item.dropdown:hover > .nav-link::after {
    transform: rotate(180deg);
}

/* ========================================================================
   INSTAGRAM LINK (Site-Specific)
   ======================================================================== */

.instagram-link {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
    text-decoration: none;
}

.instagram-link:hover {
    background-color: var(--hover-darken);
    text-decoration: none;
}

.instagram-link:hover svg {
    transform: scale(1.1);
    transition: transform 0.2s;
}

/* ========================================================================
   CONTENT SECTIONS — Open, Airy, No Left Accent
   ======================================================================== */

.content-section {
    background: transparent;
    padding: var(--spacing-lg) 0;
    margin: var(--spacing-lg) 0;
    border-left: none;
    border-radius: 0;
}

.content-section:first-child {
    margin-top: 0;
}

.content-section:last-child {
    margin-bottom: 0;
}

/* ========================================================================
   HEADING HIERARCHY — Clear visual distinction per level
   ======================================================================== */

/* H1 — Page title: large, prominent, brand color */
#mainContent > h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-dark);
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--border);
    letter-spacing: 0.02em;
}

/* H2 section-title — Section heading: centered, medium, subtle separator */
.content-section .section-title {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: var(--spacing-xl);
    color: var(--primary);
    letter-spacing: 0.01em;
}

/* H2 inside expanding-body or fieldset — Sub-section heading */
.expanding-body h2,
.content-section fieldset h2:not(.section-title) {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-on-dark-accent);
    margin-bottom: var(--spacing-md);
}

/* H3 — Tertiary heading */
.content-section h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-on-dark-accent);
    margin-bottom: var(--spacing-sm);
}

/* H4 — Labels, small headings */
.content-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary-dark);
    margin-bottom: var(--spacing-xs);
}

/* --- Fieldset cards: surface background, zero padding, children handle spacing --- */
.content-section fieldset {
    margin-bottom: var(--spacing-lg);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-base);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: visible;
}

/* Legend — Fieldset label: small caps, sits on the border line */
.content-section fieldset legend {
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary-dark);
    padding: var(--spacing-xs) var(--spacing-md);
    margin-left: var(--spacing-md);
    background: var(--surface-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* Non-details content inside fieldsets gets inset margins and a subtle card feel */
.content-section fieldset > p,
.content-section fieldset > ul,
.content-section fieldset > ol,
.content-section fieldset > div:not(.expanding-body),
.content-section fieldset > a.button,
.content-section fieldset > img {
    margin-left: var(--spacing-xl);
    margin-right: var(--spacing-xl);
}

.content-section fieldset > p:first-of-type {
    margin-top: var(--spacing-lg);
}

.content-section fieldset > p:last-child,
.content-section fieldset > a.button:last-child,
.content-section fieldset > div:last-child {
    margin-bottom: var(--spacing-lg);
}

/* Forms inside fieldsets — inset padding so form-groups and buttons don't hug edges */
.content-section fieldset > form {
    padding: var(--spacing-lg) var(--spacing-xl) var(--spacing-md);
}

/* Expanding details inside fieldsets — edge to edge */
.content-section fieldset > .expanding-details {
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
}

.content-section fieldset > .expanding-details:first-of-type {
    border-top: none;
}

.content-section fieldset > .expanding-details:last-child {
    border-bottom: none;
}

/* ========================================================================
   RESPONSIVE - MOBILE FIRST
   ======================================================================== */

@media (max-width: 768px) {
    #outerFrame {
        margin: 0;
    }

    header {
        padding: var(--spacing-md);
    }

    .header-logo {
        width: 45vw;
        max-width: 320px;
    }

    .header-title {
        font-size: 1.4rem;
    }

    .site-tagline {
        font-size: var(--font-size-xs);
    }

    nav {
        padding: var(--spacing-md);
    }

    .nav-menu {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .nav-container {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }

    .instagram-link {
        align-self: flex-end;
        margin-top: var(--spacing-sm);
    }

    .content-section {
        padding: var(--spacing-md) 0;
        margin: var(--spacing-md) 0;
    }

    .content-section fieldset > p,
    .content-section fieldset > ul,
    .content-section fieldset > ol,
    .content-section fieldset > div:not(.expanding-body),
    .content-section fieldset > a.button,
    .content-section fieldset > img {
        margin-left: var(--spacing-md);
        margin-right: var(--spacing-md);
    }

    .content-section fieldset > form {
        padding-left: var(--spacing-md);
        padding-right: var(--spacing-md);
    }
}

@media (max-width: 480px) {
    .header-logo {
        width: 50vw;
        max-width: 250px;
    }

    .header-title {
        font-size: 1.2rem;
        letter-spacing: 0.1em;
    }

    .nav-link {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: var(--font-size-sm);
    }
}

/* ========================================================================
   FOOTER REFINEMENT
   ======================================================================== */

footer {
    border-top: 1px solid var(--border);
}

footer a {
    color: var(--primary);
}

footer a:hover {
    color: var(--primary-dark);
}

/* ========================================================================
   PRODUCT SHOWCASE — Grid of product cards with prominent images
   Transparent product images are the hero element.
   ======================================================================== */

.product-showcase {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-xl);
    padding: var(--spacing-lg) 0;
}

/* --- Product Card --- */
.product-card {
    background: var(--surface-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* --- Product Image: Transparent PNG/WebP, large and prominent --- */
.product-card__image {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl) var(--spacing-lg);
    /* Page bg shows through transparent images */
    background: var(--bg-base);
    min-height: 220px;
}

.product-card__image img {
    max-width: 100%;
    max-height: 280px;
    height: auto;
    object-fit: contain;
    /* Subtle lift effect on transparent product images */
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.08));
}

/* --- Flagship image slot (home page hero image for each flagship) --- */
.flagship-image {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg) 0;
    min-height: 240px;
}
.flagship-image img {
    max-width: 100%;
    max-height: 320px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.08));
}

/* --- Image-missing placeholder (SVG) ---
   Occupies the exact space a real image would, so layout stays stable
   once the image is added in admin. */
.image-missing {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    color: var(--text-on-dark-secondary, #888);
}
.image-missing svg {
    width: 100%;
    height: auto;
    max-width: 280px;
}
.image-missing--product {
    min-height: 220px;
}
.image-missing--highlight {
    min-height: 180px;
}
.image-missing--thumb {
    min-height: 60px;
}
.image-missing--thumb svg {
    max-width: 90px;
}

/* --- Product Info: Name, category, price, description --- */
.product-card__info {
    padding: var(--spacing-lg) var(--spacing-xl);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card__name {
    font-size: 1.25rem;
    color: var(--primary-dark);
    margin-bottom: var(--spacing-xs);
}

.product-card__category {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-on-dark-secondary);
    margin-bottom: var(--spacing-sm);
}

.product-card__price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--spacing-md);
}

.product-card__description {
    font-size: var(--font-size-sm);
    color: var(--text-on-dark-secondary);
    line-height: 1.5;
    margin-bottom: var(--spacing-md);
    flex: 1;
}

/* Ingredients expanding block inside product card */
.product-card__ingredients {
    margin-top: auto;
}

.product-card__ingredients .expanding-body {
    font-size: var(--font-size-xs);
    color: var(--text-on-dark-secondary);
}

/* --- Responsive: Single column on small screens --- */
@media (max-width: 600px) {
    .product-showcase {
        grid-template-columns: 1fr;
    }

    .product-card__image {
        min-height: 180px;
        padding: var(--spacing-lg) var(--spacing-md);
    }

    .product-card__image img {
        max-height: 220px;
    }
}

/* --- Two columns on tablet --- */
@media (min-width: 601px) and (max-width: 960px) {
    .product-showcase {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* ========================================================================
   NAV DROPDOWN CLOSE-ON-SELECT (mobile sticky :hover fix)
   Temporarily forces dropdown menus closed after a nav link is clicked,
   so the sticky hover state on touch devices releases cleanly.
   JS adds .nav-force-closed on click and removes it after 400ms.
   ======================================================================== */
nav.nav-force-closed .dropdown-menu,
nav.nav-force-closed .nav-item.dropdown:hover .dropdown-menu {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* ========================================================================
   AUTO-SELECT NESTED FORMS
   When makeSmartNestedForm() is called with 'auto_select' => true,
   the select triggers submission on change via data-ajax-change.
   The submit button stays in the DOM as a progressive-enhancement fallback
   but is hidden since no manual click is needed.
   ======================================================================== */
.nested-form.auto-select button[type="submit"],
.nested-form.auto-select .form-actions {
    display: none;
}

/* ========================================================================
   CANADIAN MAPLE LEAF ICON
   Always Canadian red. Works inline (vertical-align) and inside flex
   <summary> rows (universal.css sizes summary SVGs to 2rem; the
   `summary .canada-leaf` override in universal.css scales it back down
   to a word-space accent).
   ======================================================================== */
.canada-leaf {
    flex-shrink: 0;
    width: 1.4em;
    height: 1.4em;
    vertical-align: middle;
    color: #D52B1E;
}
