/* ============================================
   LYRE WHOLESALE — Main Stylesheet
   Lyre Digital
   --------------------------------------------
   Brand-specific colour/font tokens are defined here as DEFAULTS and
   overridden per brand by inc/theme-styles.php (from ACF Brand Settings).
   This file currently ports CHROME ONLY (reset, type, utilities, header,
   footer). Homepage / about / catalogue modules land in later sessions.
   ============================================ */

/* ── WEB FONTS ────────────────────────────────
   Google fonts are enqueued dynamically in inc/enqueue.php from the ACF
   heading/body font selection (no render-blocking @import here). ── */

/* ── FONTS (local) ────────────────────────── */
@font-face {
    font-family: 'Satoshi';
    src: url('../fonts/Satoshi-Variable.woff2') format('woff2'),
         url('../fonts/Satoshi-Variable.woff') format('woff');
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Satoshi';
    src: url('../fonts/Satoshi-VariableItalic.woff2') format('woff2'),
         url('../fonts/Satoshi-VariableItalic.woff') format('woff');
    font-weight: 200 900;
    font-style: italic;
    font-display: swap;
}

/* ── CSS VARIABLES ────────────────────────── */
:root {
    /* Brand tokens — DEFAULTS. Overridden by inc/theme-styles.php from ACF. */
    --primary:    #1A1A1A;
    --secondary:  #555555;
    --accent:     #B8956A;
    --background: #FFFFFF;
    --text:       #1A1A1A;

    --heading-font: 'Cormorant Garamond', Georgia, serif;
    --body-font:    'Satoshi', 'Helvetica Neue', Arial, sans-serif;

    /* Footer (inverted block). Overridable per brand via ACF. */
    --footer-bg:   var(--primary);
    --footer-text: var(--background);

    /* CTA button. Overridable per brand via ACF — keeps the button visible
       when a brand's primary and background are near-identical. */
    --cta-bg:   var(--primary);
    --cta-text: var(--background);

    /* Neutral scale — static (not brand-configurable). */
    --bark:   #555555;   /* muted body text */
    --muted:  #888888;
    --border: #E2E2E2;

    /* Spacing scale. */
    --space-xs:  8px;
    --space-sm:  16px;
    --space-md:  32px;
    --space-lg:  64px;
    --space-xl:  100px;
    --space-2xl: 140px;

    /* Layout. */
    --max-width:     1280px;
    --gutter:        80px;
    --gutter-mobile: 24px;
}

/* ── RESET ────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--background);
    color: var(--text);
    font-family: var(--body-font);
    font-size: 17px;
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

button, input, textarea, select {
    font: inherit;
    border: none;
    outline: none;
    background: none;
}

button {
    cursor: pointer;
}

/* ── TYPOGRAPHY BASE ──────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--heading-font);
    font-weight: 300;
    line-height: 1.05;
    color: var(--text);
}

h1 { font-size: clamp(48px, 6vw, 80px); }
h2 { font-size: clamp(36px, 4vw, 56px); }
h3 { font-size: clamp(24px, 3vw, 36px); }
h4 { font-size: clamp(20px, 2vw, 26px); }

p {
    font-family: var(--body-font);
    font-size: 15px;
    color: var(--bark);
    line-height: 1.85;
}

em {
    font-style: italic;
    color: var(--accent);
}

/* ── UTILITY CLASSES ──────────────────────── */

/* Accessibility: skip-to-content link — off-screen until keyboard-focused. */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    padding: 0.75rem 1.25rem;
    background: #1A1A1A;
    color: #FFFFFF;
    font-size: 0.875rem;
    text-decoration: none;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 1rem;
}

/* Global visually-hidden utility (the scoped catalogue.css rule predates this). */
.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;
}

.eyebrow {
    font-family: var(--body-font);
    font-size: 10px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--accent);
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.btn-primary {
    display: inline-block;
    font-family: var(--heading-font);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--primary);
    color: var(--accent);
    padding: 15px 38px;
    border-radius: 1px;
    transition: background 0.25s, transform 0.2s, color 0.25s;
}
.btn-primary:hover {
    background: var(--accent);
    color: var(--primary);
    transform: translateY(-1px);
}

.btn-ghost {
    display: inline-block;
    font-family: var(--body-font);
    font-size: 12px;
    color: var(--accent);
    letter-spacing: 0.06em;
    border-bottom: 1px solid currentColor;
    padding-bottom: 2px;
    transition: color 0.25s;
}
.btn-ghost:hover {
    color: var(--primary);
}

.section-divider {
    width: 48px;
    height: 1px;
    background: var(--border);
}

/* ── ANIMATIONS ───────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── RESPONSIVE (base) ────────────────────── */
@media (max-width: 768px) {
    :root {
        --gutter: var(--gutter-mobile);
    }
}

/* ── HEADER & NAV ─────────────────────────── */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--background) 97%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.nav-inner {
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-family: var(--heading-font);
    font-size: 21px;
    color: var(--text);
    letter-spacing: 0.02em;
    text-decoration: none;
    flex-shrink: 0;
}
.nav-logo img {
    max-height: 40px;
    width: auto;
}
.nav-logo em {
    font-style: italic;
    color: var(--accent);
}

/* Primary menu (wp_nav_menu output: ul.nav-links > li.menu-item > a [+ ul.sub-menu]) */
.nav-links {
    display: flex;
    gap: 36px;
    list-style: none;
    align-items: center;
    margin: 0;
}
.nav-links > li {
    position: relative;
}
.nav-links a {
    font-family: var(--body-font);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bark);
    text-decoration: none;
    transition: color 0.25s;
}
.nav-links a:hover { color: var(--accent); }

/* Desktop dropdown — WordPress submenu */
.nav-links .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: color-mix(in srgb, var(--background) 97%, transparent);
    backdrop-filter: blur(8px);
    min-width: 160px;
    padding: 10px 0;
    list-style: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border-radius: 2px;
    z-index: 100;
}
.nav-links .menu-item-has-children:hover > .sub-menu {
    display: block;
}
.nav-links .sub-menu a {
    display: block;
    padding: 8px 22px;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-login {
    font-family: var(--body-font);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--cta-text);
    background: var(--cta-bg);
    padding: 10px 22px;
    text-decoration: none;
    transition: background 0.25s;
    border-radius: 1px;
}
.nav-login:hover { background: var(--accent); }

/* Retailer auth indicator (Sign In / My Account · Sign Out) */
.lw-header__auth {
    display: inline-flex;
    gap: 16px;
    align-items: center;
}
.lw-header__auth-link {
    color: var(--text);
    text-decoration: none;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.lw-header__auth-link:hover { text-decoration: underline; }

.nav-hamburger {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
    min-width: 44px;
    min-height: 44px;
    background: none;
    border: none;
}
.nav-hamburger span {
    display: block;
    width: 22px;
    height: 1.5px;
    background: var(--text);
    transition: all 0.25s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Mobile menu */
.nav-mobile-menu {
    display: none;
    position: fixed;
    top: 68px;
    left: 0;
    right: 0;
    background: color-mix(in srgb, var(--background) 98%, transparent);
    border-bottom: 1px solid var(--border);
    padding: 24px 28px 32px;
    z-index: 99;
    backdrop-filter: blur(8px);
    flex-direction: column;
}
.nav-mobile-menu.open { display: flex; }

.nav-mobile-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    margin: 0;
}
.nav-mobile-links a {
    display: block;
    font-family: var(--body-font);
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bark);
    text-decoration: none;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    transition: color 0.2s;
}
.nav-mobile-links a:hover { color: var(--accent); }
.nav-mobile-links .sub-menu {
    list-style: none;
}
.nav-mobile-links .sub-menu a {
    padding-left: 20px;
    font-size: 12px;
}
/* Auth links inside the mobile menu — match the nav-mobile-links row pattern. */
.nav-mobile-auth {
    display: flex;
    flex-direction: column;
}
.nav-mobile-auth-link {
    display: block;
    font-family: var(--body-font);
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bark);
    text-decoration: none;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    transition: color 0.2s;
}
.nav-mobile-auth-link:hover { color: var(--accent); }

.nav-mobile-login {
    margin-top: 20px;
    background: var(--cta-bg);
    color: var(--cta-text);
    text-align: center;
    padding: 14px;
    border-radius: 1px;
    font-family: var(--body-font);
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
}

@media (max-width: 1080px) {
    .nav-logo {
        max-width: 150px;
        line-height: 1.15;
    }
    .nav-links { gap: 20px; }
    .nav-links a { line-height: 1.3; }
    .nav-right { gap: 28px; }
}

@media (max-width: 820px) {
    .nav-links { display: none; }
    .nav-login { display: none; }
    .lw-header__auth { display: none; } /* moves into the mobile menu (.nav-mobile-auth) */
    .nav-hamburger { display: flex; }
}

/* ── FOOTER ───────────────────────────────────
   Inverted block. Colours come from --footer-bg / --footer-text, which default
   to --primary / --background but can be overridden per brand via ACF. Muted
   variants are derived with color-mix so they track whatever --footer-text is. */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 64px 0 40px;
}

.footer-top {
    display: flex;
    flex-wrap: wrap;
    gap: 48px;
    padding-bottom: 48px;
    border-bottom: 1px solid color-mix(in srgb, var(--footer-text) 12%, transparent);
    margin-bottom: 32px;
}

.footer-brand {
    flex: 1 1 280px;
    max-width: 420px;
}

.footer-columns {
    flex: 2 1 360px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 32px;
}

.footer-logo {
    font-family: var(--heading-font);
    font-size: 24px;
    color: var(--footer-text);
    margin-bottom: 16px;
    display: block;
    text-decoration: none;
}
.footer-logo img {
    max-height: 44px;
    width: auto;
}
.footer-logo em {
    font-style: italic;
    color: var(--accent);
}

.footer-tagline {
    font-family: var(--body-font);
    font-size: 13px;
    color: color-mix(in srgb, var(--footer-text) 55%, transparent);
    line-height: 1.75;
    margin-bottom: 20px;
}

.footer-contact {
    font-family: var(--body-font);
    font-size: 12px;
    color: color-mix(in srgb, var(--footer-text) 45%, transparent);
    line-height: 1.8;
    letter-spacing: 0.04em;
}
.footer-contact a { color: inherit; transition: color 0.25s; }
.footer-contact a:hover { color: var(--accent); }

.footer-col-heading {
    font-family: var(--body-font);
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 18px;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.footer-links a {
    font-family: var(--body-font);
    font-size: 13px;
    color: color-mix(in srgb, var(--footer-text) 55%, transparent);
    text-decoration: none;
    letter-spacing: 0.03em;
    transition: color 0.25s;
}
.footer-links a:hover { color: var(--accent); }

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-copy {
    font-family: var(--body-font);
    font-size: 11px;
    color: color-mix(in srgb, var(--footer-text) 40%, transparent);
    letter-spacing: 0.06em;
}

@media (max-width: 768px) {
    .footer-top {
        flex-direction: column;
        gap: 36px;
    }
    .footer-bottom {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

/* ── WORDPRESS ADMIN BAR FIX ──────────────── */
.admin-bar .site-header { top: 32px; }
.admin-bar .nav-mobile-menu { top: 100px; }

@media screen and (max-width: 782px) {
    /* At <=782px WordPress makes the admin bar position:absolute (it scrolls away),
       so a fixed header offset by the bar's height leaves a gap at the top once the
       page scrolls. Pin the fixed header (and the mobile menu) to the viewport. */
    .admin-bar .site-header { top: 0; }
    .admin-bar .nav-mobile-menu { top: 68px; }
}

/* ── BODY OFFSET FOR FIXED HEADER ─────────── */
body { padding-top: 68px; }

.admin-bar body,
body.admin-bar { padding-top: 100px; }

/* ── CATALOGUE HOMEPAGE INTRO ──────────────
   A quiet brand mark (logo + headline) above the catalogue grid on the homepage. */
.lw-catalogue-intro {
    text-align: center;
    padding: var(--space-sm) var(--space-sm);
}
.lw-catalogue-intro img {
    max-width: 280px;
    height: auto;
    display: block;
    margin: 0 auto var(--space-sm);
}
.lw-catalogue-intro__brand-name {
    font-family: var(--heading-font);
    font-size: 1.5rem;
    letter-spacing: 0.05em;
    margin: 0 auto var(--space-sm);
    color: var(--text);
}
.lw-catalogue-intro__headline {
    font-family: var(--heading-font);
    font-size: 0.875rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0;
}

/* ── PRICE DISPLAY ──────────────────────────
   Bare-symbol amount ($16.00) with the ISO currency code in smaller, muted text
   ($16.00 CAD). Output by lw_price_html(); applies everywhere prices are shown. */
.lw-price {
    white-space: nowrap;
}
.lw-price__code {
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: #8a8070;
    margin-left: 2px;
}

/* ── MOBILE ORDER BAR ─────────────────────────
   Below 820px the header's retailer controls are display:none (they move into the
   hamburger), so a rep working a booth loses the running order count — the one
   signal a scan -> add -> scan-next loop depends on. This bar restores it: fixed to
   the bottom, retailer-only (gated in PHP), mobile-only (gated here). Desktop never
   displays it, so the desktop layout is unchanged.
   z-index sits below the fixed header (100) and the mobile menu (99) so neither is
   ever covered; the menu drops from the top, so they don't overlap in practice. */
.lw-order-bar {
    display: none;
}

@media (max-width: 820px) {
    .lw-order-bar {
        display: flex;
        align-items: stretch;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 98;
        border-top: 1px solid var(--border);
    }
    .lw-order-bar__cart {
        flex: 1 1 auto;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        min-height: 52px;
        padding: 8px var(--space-sm);
        background: var(--text);
        color: var(--background);
        font-family: var(--body-font);
        font-size: 13px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        text-decoration: none;
    }
    .lw-order-bar__count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 24px;
        height: 24px;
        padding: 0 6px;
        border-radius: 999px;
        background: var(--background);
        color: var(--text);
        font-size: 13px;
        letter-spacing: 0;
        font-variant-numeric: tabular-nums;
    }
    /* Reserve the bar's height so it never covers the last element on a page —
       notably the add-to-cart submit buttons at the end of the style page. */
    body.lw-has-order-bar {
        padding-bottom: 60px;
    }
}
