/* Global chrome: announcement bar, header, mobile drawer, WhatsApp fab,
   footer, buttons, icon buttons. Page-specific components (hero slider,
   product cards, filters, etc.) arrive with their pages in later phases. */

/* Buttons ------------------------------------------------------------
   One shared system for the whole project (storefront + admin, via
   assets/css/admin.css's thin danger/ghost/tiny additions on top of this).
   Every variant gets consistent rounding, a restrained brand-colour glow on
   hover/focus, and visible active/disabled states — no important action
   should ever be a plain unstyled link. */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: var(--fs-body);
    line-height: 1;
    min-height: 48px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast), opacity var(--transition-fast);
    border: 2px solid transparent;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring), var(--shadow-soft);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn[data-loading] {
    color: transparent;
    pointer-events: none;
    position: relative;
}

.btn[data-loading]::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    color: inherit;
    animation: btn-spin 0.7s linear infinite;
}

.btn--primary[data-loading]::after { color: #fff; }

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

.btn--primary {
    background: var(--color-orange);
    color: #fff;
    box-shadow: 0 2px 8px rgba(255, 138, 0, 0.25);
}

.btn--primary:hover {
    box-shadow: 0 6px 20px rgba(255, 138, 0, 0.4);
}

.btn--secondary {
    background: transparent;
    border-color: var(--text-on-dark);
    color: var(--text-on-dark);
}

.btn--secondary:hover {
    background: rgba(255, 246, 232, 0.08);
    box-shadow: 0 4px 16px rgba(255, 246, 232, 0.12);
}

.btn--secondary--on-light {
    /* text-primary (not the fixed --color-black token) so this stays
       readable in dark mode too — --bg-card/--bg-surface both flip to a
       near-black colour there, so a hardcoded black border/text became
       invisible (found during Phase 6 dark-mode audit: the product page's
       "Add to Bag" button disappeared entirely in dark mode). */
    border-color: var(--text-primary);
    color: var(--text-primary);
    background: transparent;
}

.btn--secondary--on-light:hover {
    background: var(--bg-surface);
    box-shadow: var(--shadow-soft);
}

/* Purple-tinted secondary — the admin area's default secondary action
   (Filter, Cancel, secondary form actions) alongside the orange primary. */
.btn--purple {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.35);
    color: var(--color-purple);
}

.btn--purple:hover {
    background: rgba(124, 58, 237, 0.16);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.25);
}

/* Announcement bar ----------------------------------------------------- */

.announcement-bar {
    background: var(--color-black);
    color: var(--color-cream);
    font-size: var(--fs-caption);
}

.announcement-bar__inner {
    height: var(--announcement-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.announcement-bar__region {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: inherit;
    white-space: nowrap;
}

.announcement-bar__region svg {
    width: 14px;
    height: 14px;
}

.announcement-bar__message {
    margin: 0;
    color: inherit;
    text-align: center;
    flex: 1;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.announcement-bar__links {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    white-space: nowrap;
}

.announcement-bar__links a {
    color: inherit;
    opacity: 0.85;
}

.announcement-bar__links a:hover {
    opacity: 1;
}

@media (max-width: 767px) {
    .announcement-bar__region span,
    .announcement-bar__links {
        display: none;
    }
}

/* Header --------------------------------------------------------------- */

.site-header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color var(--transition-base), border-color var(--transition-base);
}

.site-header__inner {
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

@media (min-width: 768px) {
    .site-header__inner {
        gap: var(--space-5);
    }
}

.site-header__menu-toggle {
    display: inline-flex;
    padding: var(--space-2);
}

@media (min-width: 1024px) {
    .site-header__menu-toggle {
        display: none;
    }
}

.logo {
    display: block;
    margin-right: auto;
}

@media (min-width: 1024px) {
    .logo {
        margin-right: var(--space-6);
    }
}

.logo img {
    display: block;
    width: auto;
    height: 40px;
    max-width: 220px;
    object-fit: contain;
}

@media (max-width: 767px) {
    .logo img {
        height: 32px;
        max-width: 180px;
    }
}

/* Scoped through .logo (not just the bare class) so this beats .logo img's
   display:block below in specificity — a bare .logo__image--dark selector
   (0,1,0) loses to the descendant selector .logo img (0,1,1), which was
   the actual cause of both logos rendering simultaneously in light mode. */
.logo .logo__image--dark { display: none; }

:root[data-theme="dark"] .logo .logo__image--light { display: none; }
:root[data-theme="dark"] .logo .logo__image--dark { display: block; }

.site-nav {
    display: none;
    align-items: center;
    gap: var(--space-5);
    font-weight: 600;
    font-size: var(--fs-small);
}

@media (min-width: 1024px) {
    .site-nav {
        display: flex;
    }
}

.site-nav a {
    padding: var(--space-2) 0;
    position: relative;
}

.site-nav a:hover {
    color: var(--color-purple);
}

.site-nav__sale {
    color: var(--color-pink);
}

.site-header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-left: auto;
}

@media (min-width: 768px) {
    .site-header__actions {
        gap: var(--space-2);
    }
}

/* Account/Wishlist stay in the compact top bar on desktop (PRD: "Search,
   Account, Wishlist, Bag and theme toggle"); below 1024px they move into
   the mobile drawer's utility nav instead — five 44px icon buttons plus
   the logo and menu toggle do not fit a 320-414px viewport. Scoped selector
   (rather than relying on source order against the base .icon-button rule
   below, which has equal specificity) so this always wins regardless of
   where either rule lives in the file. */
.site-header__actions .icon-button--desktop-only {
    display: none;
}

@media (min-width: 1024px) {
    .site-header__actions .icon-button--desktop-only {
        display: inline-flex;
    }
}

.icon-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.icon-button:hover {
    background: var(--bg-surface);
}

.icon-button svg {
    width: 20px;
    height: 20px;
}

.icon-button__badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--color-pink);
    color: #fff;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    font-weight: 700;
}

.theme-icon--dark { display: none; }
:root[data-theme="dark"] .theme-icon--light { display: none; }
:root[data-theme="dark"] .theme-icon--dark { display: block; }

/* Mobile drawer ---------------------------------------------------------- */

.mobile-drawer {
    position: fixed;
    inset: 0 0 0 auto;
    width: 75%;
    max-width: 360px;
    background: var(--bg-page);
    z-index: 210;
    transform: translateX(100%);
    transition: transform var(--transition-base);
    box-shadow: var(--shadow-lift);
}

.mobile-drawer__scrim {
    position: fixed;
    inset: 0;
    background: rgba(17, 17, 17, 0.5);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

body[data-menu-open] .mobile-drawer {
    transform: translateX(0);
}

body[data-menu-open] .mobile-drawer__scrim {
    opacity: 1;
    pointer-events: auto;
}

body[data-menu-open] {
    overflow: hidden;
}

.mobile-drawer__panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: var(--space-5);
    overflow-y: auto;
}

.mobile-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
}

.mobile-drawer__heading {
    font-family: var(--font-display);
    font-size: 1.5rem;
}

.mobile-drawer__nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    font-weight: 600;
}

.mobile-drawer__nav a {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.mobile-drawer__nav--utility {
    margin-top: var(--space-5);
    font-weight: 500;
    color: var(--text-secondary);
}

@media (min-width: 1024px) {
    .mobile-drawer,
    .mobile-drawer__scrim {
        display: none;
    }
}

/* WhatsApp floating button ------------------------------------------------ */

.whatsapp-fab {
    position: fixed;
    right: var(--space-5);
    bottom: var(--space-5);
    width: 56px;
    height: 56px;
    border-radius: 999px;
    background: #25D366;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lift);
    z-index: 150;
    transition: transform var(--transition-fast);
}

.whatsapp-fab:hover {
    transform: scale(1.06);
}

.whatsapp-fab svg {
    width: 26px;
    height: 26px;
}

/* Scroll to top ------------------------------------------------------------ */

.scroll-to-top {
    position: fixed;
    right: var(--space-5);
    bottom: calc(var(--space-5) + 68px);
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.scroll-to-top[data-visible] {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Footer ------------------------------------------------------------------- */

.site-footer {
    background: var(--bg-footer);
    color: var(--text-on-dark);
    margin-top: var(--space-9);
}

.site-footer a {
    color: var(--text-on-dark);
    opacity: 0.85;
}

.site-footer a:hover {
    opacity: 1;
}

.site-footer__newsletter {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding-block: var(--space-7);
    border-bottom: 1px solid rgba(255, 246, 232, 0.12);
}

.site-footer__newsletter h2 {
    color: var(--text-on-dark);
    font-size: var(--fs-h3);
    margin-bottom: var(--space-2);
}

.site-footer__newsletter p {
    color: rgba(255, 246, 232, 0.75);
    margin: 0;
}

@media (min-width: 768px) {
    .site-footer__newsletter {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* No email-list backend exists (WhatsApp-order-only scope), so the email
   field is a visual placeholder only — "Subscribe" is a plain link into
   /contact rather than a form that used to post to a /newsletter route
   that was never actually built (a 404 dead end). */
.newsletter-form {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.newsletter-form input {
    flex: 1;
    min-width: 220px;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 246, 232, 0.25);
    background: rgba(255, 246, 232, 0.06);
    color: var(--text-on-dark);
}

.newsletter-form__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 8px;
    background: var(--color-orange);
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
}

.site-footer__columns {
    display: grid;
    gap: var(--space-6);
    padding-block: var(--space-7);
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .site-footer__columns {
        grid-template-columns: 1.5fr 1fr 1fr 1fr;
    }
}

.site-footer__logo {
    height: 32px;
    width: auto;
    margin-bottom: var(--space-4);
}

.site-footer__brand p {
    color: rgba(255, 246, 232, 0.75);
    font-size: var(--fs-small);
    margin-bottom: var(--space-2);
}

.site-footer__nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    font-size: var(--fs-small);
}

.site-footer__nav h3 {
    color: var(--text-on-dark);
    font-family: var(--font-display);
    font-size: 1.1rem;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-1);
}

.site-footer__legal {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding-block: var(--space-5);
    border-top: 1px solid rgba(255, 246, 232, 0.12);
    font-size: var(--fs-caption);
    color: rgba(255, 246, 232, 0.6);
}

@media (min-width: 768px) {
    .site-footer__legal {
        flex-direction: row;
        justify-content: space-between;
        /* Clears the fixed WhatsApp button (56px, inset var(--space-5) from
           the right/bottom corner) so this row's rightmost item — whichever
           one that ends up being — never sits underneath it. */
        padding-right: 96px;
    }
}

.site-footer__credit {
    color: var(--color-danger);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* Form field ---------------------------------------------------------------
   Shared by every form on the site — storefront (checkout, contact) and
   admin alike, since both load this stylesheet. Keeping it here (rather
   than duplicated per-stylesheet) is what stacks label-above-input; admin
   pages don't load shop.css, so a field without this rule falls back to
   the browser's inline default and sits label-beside-input instead. */
.field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.field label {
    font-size: var(--fs-small);
    font-weight: 600;
}

.field input,
.field select,
.field textarea {
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: var(--bg-card);
    color: var(--text-primary);
}
