/*
   SCRAPD - DESIGN SYSTEM
   A highly aesthetic, premium, Depop-inspired styling.
*/

:root {
    /* Color Palette - SCRAPD */
    /* New SCRAPD brand tokens (preferred — use these going forward) */
    --color-primary:    #324224;   /* dark olive green */
    --color-accent:     #CE522A;   /* burnt orange / terra cotta */
    --color-accent-2:   #b1431f;   /* darker terra cotta for AA contrast */
    --color-background: #F5F0E4;   /* warm cream */
    --color-text:       #1E1A14;   /* near-black warm */
    --color-muted:      #6F6147;   /* AA-passing muted text */
    --color-shadow:     #E1D9CA;   /* light warm shadow */

    /* Legacy variable names mapped to the new SCRAPD palette
       (kept so existing selectors continue to work without rewrites) */
    --bg-primary: #F5F0E4;        /* was olive — now warm cream */
    --bg-secondary: #FFFFFF;       /* white surface */
    --text-primary: #1E1A14;       /* near-black warm */
    --text-secondary: #6F6147;     /* muted warm brown (AA passing) */

    /* Bold Eclectic Accents */
    --accent-primary: #CE522A;     /* burnt orange / terra cotta */
    --accent-hover: #b1431f;       /* darker terra cotta */
    --nav-bg: #324224;             /* dark olive green nav */
    --btn-beige: #E1D9CA;          /* warm shadow tone */

    --border-color: #1E1A14;       /* near-black warm */
    --border-color-dark: #1E1A14;

    /* Typography - SCRAPD */
    --font-heading: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
    --font-body: 'Work Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    --font-accent: 'Big Shoulders Display', sans-serif;
    --font-logo: 'Big Shoulders Display', sans-serif;

    /* Elegant Shapes */
    /* Fluid nav height: ~64px on small phones, scales to 160px on desktop */
    --nav-height: clamp(64px, 9vw, 160px);
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 16px;

    /* Refined Shadows */
    --shadow-sm: 0 4px 12px rgba(44, 42, 41, 0.04);
    --shadow-md: 0 8px 24px rgba(44, 42, 41, 0.06);
    --shadow-hover: 0 12px 32px rgba(44, 42, 41, 0.1);

    /* Layout */
    --border-width: 1px;

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-smooth: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    background-image: none;
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    padding-top: var(--nav-height);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.01em;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

/* Navigation Bar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background: var(--nav-bg);
    border-bottom: 4px solid var(--accent-primary);
    z-index: 1000;
    display: flex;
    justify-content: center;
}

.nav-container {
    width: 100%;
    max-width: 1200px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.nav-left,
.nav-center,
.nav-right {
    display: flex;
    align-items: center;
}

.nav-center {
    gap: 32px;
}

.nav-right {
    gap: 16px;
}

.brand-logo-link {
    display: flex;
    align-items: center;
    transition: transform 0.3s ease-in-out;
}

.brand-logo {
    height: clamp(40px, 7vw, 140px);
    max-height: calc(var(--nav-height) - 16px);
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.brand-logo-link:hover {
    transform: scale(1.03) rotate(-2deg);
}

.search-bar {
    flex: 1;
    max-width: 400px;
    margin: 0 32px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-bar i {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
}

.search-bar input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border-radius: var(--border-radius-sm);
    border: var(--border-width) solid var(--text-primary);
    background-color: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--text-primary);
    background-color: var(--bg-secondary);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    color: #FFFFFF;
    transition: var(--transition-fast);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-body);
}

.nav-btn:hover {
    color: var(--accent-primary);
}

.nav-btn.active {
    color: var(--accent-primary);
}

.sell-btn {
    background-color: var(--accent-primary);
    color: #FFFFFF;
    border: none;
    border-radius: 0;
    padding: 12px 32px;
    font-size: 1rem;
    font-weight: 700;
    transition: var(--transition-smooth);
}

.sell-btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.login-btn-style {
    background-color: var(--btn-beige);
    color: var(--text-primary);
    border: none;
    padding: 12px 24px;
    font-weight: bold;
    font-size: 1rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: background-color 0.2s;
}
.login-btn-style:hover {
    background-color: var(--color-shadow);
}

/* Layout Core */
main {
    min-height: calc(100vh - var(--nav-height));
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Utility Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* ---------- Hamburger button (hidden on desktop, visible on mobile) ---------- */
.nav-hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.nav-hamburger .hamburger-bar {
    display: block;
    position: absolute;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav-hamburger {
    position: relative;
}

.nav-hamburger .hamburger-bar:nth-child(1) { transform: translateY(-7px); }
.nav-hamburger .hamburger-bar:nth-child(2) { transform: translateY(0); }
.nav-hamburger .hamburger-bar:nth-child(3) { transform: translateY(7px); }

.nav-hamburger.is-open .hamburger-bar:nth-child(1) { transform: translateY(0) rotate(45deg); }
.nav-hamburger.is-open .hamburger-bar:nth-child(2) { opacity: 0; }
.nav-hamburger.is-open .hamburger-bar:nth-child(3) { transform: translateY(0) rotate(-45deg); }

/* ---------- Cart icon button (always visible top-right) ---------- */
.nav-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: #fff;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: var(--transition-fast);
}

.nav-icon-btn i {
    font-size: 1.4rem;
    color: #fff;
}

.nav-icon-btn:hover i {
    color: var(--accent-primary);
}

.cart-count-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--accent-primary);
    color: #fff;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    pointer-events: none;
    display: none;
}

.cart-count-badge.has-items { display: inline-block; }

/* ---------- Mobile drawer ---------- */
.mobile-drawer {
    position: fixed;
    inset: 0;
    z-index: 1500;
    pointer-events: none;
    visibility: hidden;
}

.mobile-drawer.open {
    pointer-events: auto;
    visibility: visible;
}

.mobile-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(30, 26, 20, 0.55);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.mobile-drawer.open .mobile-drawer-backdrop {
    opacity: 1;
}

.mobile-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(85vw, 340px);
    background: var(--nav-bg);
    color: #fff;
    box-shadow: -8px 0 24px rgba(0,0,0,0.25);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-drawer.open .mobile-drawer-panel {
    transform: translateX(0);
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.mobile-drawer-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
}

.mobile-drawer-close {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    border-radius: 4px;
}

.mobile-drawer-close:hover { color: var(--accent-primary); }

.mobile-drawer-nav {
    display: flex;
    flex-direction: column;
    padding: 12px 0;
}

.drawer-link {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 52px;
    padding: 12px 24px;
    background: transparent;
    border: 0;
    color: #fff;
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.drawer-link:hover,
.drawer-link:focus-visible {
    background: rgba(255,255,255,0.06);
    color: var(--accent-primary);
    outline: none;
}

.drawer-link-cta {
    margin: 16px 24px;
    padding: 14px 16px;
    width: calc(100% - 48px);
    min-height: 48px;
    background: var(--accent-primary);
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 700;
    text-align: center;
    justify-content: center;
    border-radius: 2px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.drawer-link-cta:hover {
    background: var(--accent-hover);
    color: #fff;
}

body.drawer-open {
    overflow: hidden;
}

/* ---------- Mobile breakpoint: collapse desktop nav, show hamburger ---------- */
@media (max-width: 767px) {
    .mobile-hide {
        display: none;
    }

    .search-bar {
        display: none;
    }

    /* Desktop center links + auth/CTA hide on mobile */
    .nav-center {
        display: none;
    }
    .nav-desktop-only {
        display: none !important;
    }

    .nav-container {
        padding: 0 16px;
        gap: 8px;
    }

    .nav-right {
        gap: 4px;
    }

    .nav-hamburger {
        display: inline-flex;
    }

    /* Logo sizing on mobile — sit comfortably inside the shorter bar */
    .brand-logo {
        height: clamp(32px, 8vw, 48px);
    }
}

@media (min-width: 768px) {
    /* Drawer is mobile-only; hamburger hidden on desktop */
    .nav-hamburger { display: none; }
    .mobile-drawer { display: none; }
}

#app-root {
    padding-top: 32px;
}

/* Views & Layouts */
.view-header {
    margin-top: 0;
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.view-header h2 {
    font-size: clamp(2.25rem, 7vw, 5.6rem);
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: var(--text-primary);
    text-align: center;
    width: 100%;
    margin-top: 0;
    margin-bottom: clamp(20px, 4vw, 32px);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.sustainability-explainer {
    margin: 32px 0 40px;
    background: var(--bg-primary);
    padding: 24px;
    border-radius: 4px;
    border: 3px solid var(--text-primary);
    outline: 2px dashed #4ade80; /* Eco green stitching */
    outline-offset: -8px;
    box-shadow: 8px 8px 0 var(--text-primary);
    position: relative;
    overflow: hidden;
    color: var(--text-primary);
}

.auth-view {
    max-width: 400px;
    margin: 40px auto;
    background: var(--bg-primary);
    padding: 32px;
    border-radius: 4px;
    border: 3px solid var(--text-primary);
    outline: 2px dashed var(--accent-primary);
    outline-offset: -8px;
    box-shadow: 8px 8px 0 var(--text-primary);
    position: relative;
    color: var(--text-primary);
}

.filters {
    display: flex;
    gap: 8px;
    padding-bottom: 8px;
    flex-wrap: wrap;
}

.chip {
    padding: 8px 24px;
    border-radius: 2px;
    /* Ragged fabric cut */
    background: var(--bg-primary);
    border: 2px dashed var(--accent-primary);
    /* Stitched look */
    box-shadow: 3px 3px 0 var(--text-primary);
    /* Solid flat shadow */
    font-size: 0.95rem;
    font-family: var(--font-heading);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
    color: var(--text-primary);
    outline: 2px solid transparent;
}

.chip.active,
.chip:hover {
    background: var(--accent-secondary);
    color: var(--bg-secondary);
    border: 2px dashed var(--accent-tertiary);
    border-radius: 4px;
    box-shadow: 5px 5px 0 var(--text-primary);
    transform: translateY(-2px) rotate(-1deg);
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
}

.product-card {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 0;
    padding: 0;
    transition: var(--transition-smooth);
    border: 3px solid var(--border-color);
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translate(-2px, -2px) rotate(1deg);
    box-shadow: 8px 8px 0 rgba(0,0,0,1);
}

.product-img-wrapper {
    position: relative;
    aspect-ratio: 4/5;
    overflow: hidden;
    background: var(--border-color);
    border-bottom: 3px solid var(--border-color);
    border-radius: 0;
}

.product-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Restored Core Components and Featured Artist */
.sustainability-explainer {
    margin: 32px 0 40px;
    background: var(--bg-primary);
    padding: 24px;
    border-radius: 0;
    border: 3px solid var(--border-color);
    box-shadow: 8px 8px 0 var(--border-color);
    position: relative;
    overflow: hidden;
    color: var(--text-primary);
}

.artisan-spotlight {
    position: relative;
    background-size: cover;
    background-position: center;
    background-image: url('assets/featured_patchwork.png');
    border: 3px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 40px;
}

.spotlight-content {
    position: relative;
    padding: 32px;
    color: #FFF;
    z-index: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    gap: 24px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.1));
}

.artisan-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #FFF;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.spotlight-text {
    flex: 1;
}

.spotlight-text h3 {
    margin-top: 4px;
    margin-bottom: 8px;
    font-size: 1.8rem;
}

.spotlight-label {
    display: inline-block;
    background: var(--accent-primary);
    color: #FFFFFF;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 6px 12px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 2px solid var(--border-color);
}

.product-card:hover .product-img-wrapper img {
    transform: scale(1.08);
}

.spotlight-content {
    position: relative;
    padding: 32px;
    color: #FFFFFF;
    z-index: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    gap: 24px;
}

.artisan-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bg-secondary);
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.spotlight-text {
    flex: 1;
}

.spotlight-label {
    display: inline-block;
    background: var(--accent-tertiary);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 12px;
    margin-bottom: 8px;
    border-radius: var(--border-radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.product-info {
    padding: 16px;
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.price {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.size {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 700;
    background: var(--bg-primary);
    padding: 4px 8px;
    border-radius: 6px;
}

.brand {
    font-size: 0.8rem;
    color: var(--accent-tertiary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.title {
    font-size: 0.95rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-primary);
}

/* Profiles */
.profile-header {
    display: flex;
    gap: 32px;
    align-items: center;
    margin-bottom: 32px;
    padding: 32px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 3px solid var(--text-primary);
    outline: 2px dashed var(--accent-secondary);
    outline-offset: -8px;
    border-radius: 4px;
    box-shadow: 8px 8px 0 var(--text-primary);
}

.avatar img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg-primary);
    box-shadow: var(--shadow-md);
}

.profile-stats h2 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.bio {
    color: var(--text-secondary);
    margin-bottom: 16px;
    max-width: 400px;
    line-height: 1.6;
    font-size: 1.05rem;
}

.stats-row {
    display: flex;
    gap: 24px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px dotted var(--border-color);
}

.stat {
    font-size: 1rem;
}

.stat strong {
    font-weight: 800;
    color: var(--text-primary);
}

.stat span {
    color: var(--text-secondary);
}

.profile-tabs {
    display: flex;
    gap: 32px;
    margin-bottom: 32px;
    padding-bottom: 12px;
}

.profile-tabs .tab {
    padding: 12px 0;
    font-weight: 600;
    color: var(--text-secondary);
    position: relative;
    font-size: 1.1rem;
}

.profile-tabs .tab.active {
    color: var(--text-primary);
}

.profile-tabs .tab.active::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 10%;
    width: 80%;
    height: 3px;
    border-radius: 2px;
    background: var(--accent-primary);
}

/* Cart View Styles */
.cart-layout {
    display: flex;
    flex-direction: column;
    gap: 32px;
    margin-top: 24px;
}

@media (min-width: 768px) {
    .cart-layout {
        flex-direction: row;
        align-items: flex-start;
    }

    .cart-items-section {
        flex: 1.5;
    }

    .cart-summary-section {
        flex: 1;
        position: sticky;
        top: 100px;
    }
}

.cart-item {
    display: flex;
    gap: 24px;
    padding: 24px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--text-primary);
    outline: 2px dashed var(--accent-tertiary);
    outline-offset: -6px;
    border-radius: 4px;
    margin-bottom: 24px;
    box-shadow: 6px 6px 0 var(--text-primary);
    transition: var(--transition-smooth);
}

.cart-item:hover {
    transform: translate(-2px, -2px);
    box-shadow: 8px 8px 0 var(--accent-primary);
}

.cart-item-img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cart-item-brand {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    margin-bottom: 8px;
}

.cart-item-title {
    font-size: 1.25rem;
    margin-bottom: 8px;
    cursor: pointer;
}

.cart-item-title:hover {
    color: var(--accent-primary);
}

.cart-item-size {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: auto;
}

.cart-item-price {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}

.remove-btn {
    align-self: flex-start;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: underline;
    margin-top: 16px;
    transition: var(--transition-fast);
}

.remove-btn:hover {
    color: var(--accent-hover);
    /* Darker terra cotta for remove action hover */
}

/* Sell & Checkout Views */
.sell-form,
.checkout-view {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 40px;
    border-radius: 4px;
    border: 3px solid var(--text-primary);
    outline: 2px dashed var(--accent-primary);
    outline-offset: -8px;
    box-shadow: 8px 8px 0 var(--text-primary);
}

.checkout-layout {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

@media (min-width: 768px) {
    .checkout-layout {
        flex-direction: row;
        align-items: flex-start;
    }

    .checkout-form-section {
        flex: 1.5;
    }

    .checkout-summary-section {
        flex: 1;
        position: sticky;
        top: 100px;
    }
}

.checkout-box {
    margin-bottom: 24px;
}

.checkout-box h3 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px dotted var(--border-color);
}

.summary-box {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 4px;
    border: 2px dashed var(--text-primary);
    box-shadow: 4px 4px 0 var(--accent-secondary);
}

.summary-item-layout {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.summary-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
}

.summary-item-details {
    flex: 1;
}

.summary-brand {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.summary-title {
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.2;
}

.summary-size {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.summary-divider {
    border: none;
    border-top: 1px dotted var(--border-color);
    margin: 16px 0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.total-row {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-top: 16px;
}

.checkout-btn {
    margin-top: 24px;
    border-radius: 2px;
    background: var(--text-primary);
    color: var(--bg-secondary);
    border: 2px solid var(--text-primary);
    outline: 2px dashed var(--accent-tertiary);
    outline-offset: -4px;
    font-size: 1.25rem;
    box-shadow: 4px 4px 0 var(--accent-primary);
    padding: 12px 24px;
    font-family: var(--font-heading);
    font-weight: 700;
    transition: var(--transition-smooth);
}

.checkout-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--accent-primary);
    background: var(--accent-secondary);
}

.trust-badges {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 16px;
}

.trust-badges p {
    margin-bottom: 4px;
}

.trust-badges i {
    color: var(--accent-secondary);
    margin-right: 4px;
}

.form-group {
    margin-bottom: 24px;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.split {
    flex: 1;
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 1rem;
    background: rgba(253, 251, 247, 0.5);
    transition: var(--transition-smooth);
}

.form-control:focus {
    outline: none;
    border-color: var(--text-primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 2px rgba(163, 130, 118, 0.2);
}

.photo-upload {
    border: 2px dashed rgba(163, 130, 118, 0.4);
    /* subtle terracotta */
    padding: 48px;
    text-align: center;
    border-radius: 40px 15px 40px 15px;
    cursor: pointer;
    transition: var(--transition-smooth);
    background: rgba(253, 251, 247, 0.4);
}

.photo-upload:hover {
    border-color: var(--accent-primary);
    background: rgba(212, 197, 185, 0.2);
    /* warm sand */
    border-radius: 15px 40px 15px 40px;
}

.photo-upload i {
    font-size: 2.8rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.photo-upload h3 {
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.photo-upload p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.hashtag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.hash-pill {
    background: rgba(140, 154, 134, 0.15);
    /* Soft Sage background */
    border: 1px solid var(--accent-secondary);
    padding: 6px 16px;
    border-radius: 10px 25px 10px 25px;
    /* Unique organic shape */
    font-size: 0.85rem;
    font-family: var(--font-heading);
    font-style: italic;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: 2px 2px 0 rgba(140, 154, 134, 0.4);
    transition: var(--transition-smooth);
}

.hash-pill:hover {
    background: var(--accent-secondary);
    color: var(--bg-primary);
    border-radius: 25px 10px 25px 10px;
    /* Toggle shape */
    box-shadow: 3px 4px 0 rgba(140, 154, 134, 0.6);
    transform: translateY(-2px);
}

.submit-btn {
    width: 100%;
    padding: 16px;
    background: var(--text-primary);
    color: var(--bg-secondary);
    font-weight: 600;
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.25rem;
    border: 1px solid var(--text-primary);
    border-radius: 30px 10px 30px 10px;
    transition: var(--transition-smooth);
    margin-top: 8px;
    box-shadow: 2px 3px 0 rgba(44, 42, 41, 0.2);
    cursor: pointer;
}

.submit-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    transform: translateY(-3px);
    box-shadow: 4px 5px 0 rgba(44, 42, 41, 0.3);
    border-radius: 10px 30px 10px 30px;
}

/* Search Categories */
.category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.pill {
    padding: 12px 28px;
    background: rgba(212, 197, 185, 0.2);
    /* Soft sand background */
    border: 1px solid var(--accent-tertiary);
    border-radius: 30px 10px 30px 10px;
    font-weight: 600;
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 2px 3px 0 rgba(212, 197, 185, 0.5);
    backdrop-filter: blur(2px);
}

.pill:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-radius: 10px 30px 10px 30px;
    transform: translateY(-3px);
    box-shadow: 4px 5px 0 rgba(212, 197, 185, 0.6);
}

.search-hero input {
    width: 100%;
    padding: 16px 24px;
    font-size: 1.1rem;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    background: var(--bg-secondary);
    transition: var(--transition-fast);
}

.search-hero input:focus {
    outline: none;
    border-color: var(--text-primary);
    box-shadow: var(--shadow-md);
}

/* Edgy Image Graphics Removed */

.search-hero {
    position: relative;
    padding: 80px 40px;
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    background-image: url('assets/search_banner.png');
    background-size: cover;
    background-position: center;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.artisan-spotlight {
    position: relative;
    width: 100%;
    height: 480px;
    margin-top: 24px;
    margin-bottom: 48px;
    border: var(--border-width) solid var(--text-primary);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    background-image: url('./assets/artisan_spotlight.png');
    background-size: cover;
    background-position: center;
    background-color: var(--text-primary);
    display: flex;
    align-items: flex-end;
    box-shadow: 4px 4px 0 var(--text-primary);
}

@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
        padding: 24px 16px;
        gap: 16px;
    }

    .stats-row {
        justify-content: center;
    }

    .sell-form {
        padding: 24px;
    }

    .photo-upload {
        padding: 32px 16px;
    }

    .product-detail-layout {
        flex-direction: column;
        gap: 24px;
    }

    .product-detail-info {
        max-width: 100%;
    }
}

/* Product Detail View */
.back-btn {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.back-btn:hover {
    color: var(--text-primary);
    transform: translateX(-4px);
}

.product-detail-layout {
    display: flex;
    gap: 48px;
    align-items: flex-start;
}

.product-detail-img {
    flex: 1;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    background: #f0f0f0;
    box-shadow: var(--shadow-md);
}

.product-detail-img img {
    width: 100%;
    height: auto;
    display: block;
}

.product-detail-info {
    flex: 1;
    max-width: 450px;
    padding-top: 16px;
}

.seller-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px 8px 8px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.seller-badge:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.seller-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: block;
}

.product-detail-info h2 {
    font-size: clamp(1.6rem, 5vw, 2.5rem);
    line-height: 1.2;
    margin-bottom: 16px;
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.product-detail-info .price {
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.brand-size {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 24px;
}

.product-detail-info hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 32px 0;
}

.product-detail-info .description {
    line-height: 1.7;
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 40px;
}

.buy-btn {
    background: var(--accent-primary);
    margin-top: 0;
}

.buy-btn:hover {
    background: var(--text-primary);
    color: var(--bg-secondary);
}

.message-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--text-primary);
}

.message-btn:hover {
    background: var(--bg-primary);
}

/* New Elegant CSS Badges */
.css-badge {
    position: absolute;
    top: -12px;
    right: -12px;
    padding: 6px 14px;
    border-radius: 20px 4px 20px 4px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.8rem;
    font-style: italic;
    color: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    z-index: 10;
    border: 1px solid var(--text-primary);
}

.staff-pick-badge {
    background: var(--text-primary);
}

.trending-badge {
    background: var(--accent-primary);
    border-color: var(--text-primary);
}

/* Offer Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 42, 41, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-primary);
    width: 90%;
    max-width: 500px;
    padding: 32px;
    border-radius: 30px 10px 30px 10px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    position: relative;
    transform: translateY(20px);
    transition: var(--transition-smooth);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px dotted var(--border-color);
    padding-bottom: 16px;
}

.modal-header h3 {
    font-size: 1.8rem;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-style: italic;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.close-modal:hover {
    color: var(--accent-primary);
    transform: scale(1.1);
}

/* Messages & Seller Offer View */
.messages-view {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(253, 251, 247, 0.7);
    border-radius: 30px 10px 30px 10px;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(4px);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 600px;
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 24px;
    background: rgba(253, 251, 247, 0.9);
    border-bottom: 1px dashed var(--border-color);
}

.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 16px;
    border: 2px solid var(--accent-tertiary);
}

.chat-header-info h3 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.chat-header-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    font-family: var(--font-heading);
}

.chat-history {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-bubble {
    max-width: 70%;
    padding: 16px;
    position: relative;
    box-shadow: 2px 2px 0 rgba(44, 42, 41, 0.1);
}

.chat-bubble p {
    margin-bottom: 8px;
    line-height: 1.4;
}

.chat-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.chat-bubble.received {
    align-self: flex-start;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px 20px 20px 5px;
    /* Organic leaf chat */
}

.chat-bubble.sent {
    align-self: flex-end;
    background: rgba(140, 154, 134, 0.2);
    /* Soft sage */
    border: 1px solid var(--accent-secondary);
    border-radius: 20px 20px 5px 20px;
}

.chat-input-area {
    padding: 16px 24px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-input {
    flex: 1;
    padding: 14px 20px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    font-family: var(--font-body);
}

.chat-input:focus {
    outline: none;
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px rgba(163, 130, 118, 0.1);
}

.icon-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 1.1rem;
}

.icon-btn:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
    transform: scale(1.05);
}

.send-btn {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
}

.send-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    background: rgba(253, 251, 247, 0.7);
    border: 1px dashed var(--border-color-dark);
    border-radius: 40px 15px 40px 15px;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(4px);
    margin: 24px auto;
    max-width: 600px;
    color: var(--text-primary);
}

.empty-state h3 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    font-family: var(--font-heading);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(44, 42, 41, 0.85); /* rgba(--bg-primary, 0.85) roughly */
    backdrop-filter: blur(5px);
    overflow: auto;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    position: relative;
    box-shadow: var(--shadow-md);
}

.narrative-modal h2 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

.narrative-modal .modal-body {
    font-family: var(--font-body);
    color: var(--text-primary);
    font-size: 1.1rem;
    line-height: 1.6;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 12px;
}

.narrative-modal .narrative-intro {
    font-style: italic;
    font-size: 1.2rem;
    margin-bottom: 20px;
    text-align: center;
}

.narrative-modal h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--accent-primary);
}

.narrative-modal ul {
    list-style-type: none;
    padding-left: 0;
    margin-bottom: 25px;
}

.narrative-modal ul li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 10px;
}

.narrative-modal ul li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    font-weight: bold;
}

.narrative-modal .narrative-outro {
    font-weight: 600;
    text-align: center;
    margin-bottom: 30px;
    padding: 15px;
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.btn-cancel {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-heading);
    transition: var(--transition-fast);
}

.btn-cancel:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.btn-confirm {
    padding: 10px 20px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 600;
    transition: var(--transition-fast);
}

.btn-confirm:hover {
    background: var(--accent-primary);
}

/* =============================================================
   M9 — Mobile responsiveness pass
   Touch targets, fluid grid, footer stack, layout overflow guards
   ============================================================= */

/* Ensure tappable controls clear the 44px minimum on touch devices */
@media (max-width: 767px) {
    .chip,
    .pill,
    .nav-btn,
    .login-btn-style,
    .sell-btn,
    .btn-cancel,
    .btn-confirm,
    .checkout-btn,
    .submit-btn,
    .icon-btn,
    .send-btn,
    .remove-btn {
        min-height: 44px;
    }

    /* Chips: keep visual identity, ensure tap area */
    .chip {
        padding: 10px 18px;
        font-size: 0.95rem;
    }

    /* Form controls comfortable on touch */
    .form-control,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="search"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px; /* prevents iOS zoom on focus */
        min-height: 44px;
    }

    /* Two-up product grid on phones (was wide single column) */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* Tighter card chrome on small viewports */
    .product-card { border-width: 2px; }
    .product-info { padding: 12px; }
    .title { font-size: 0.9rem; }
    .price { font-size: 1rem; }

    /* View shell: edge breathing room, kill brutal shadows that overflow */
    main {
        padding: 16px 12px 32px;
    }

    /* Auth/sell/checkout cards: don't let brutalist shadow create horizontal scroll */
    .auth-view,
    .sell-form,
    .checkout-view,
    .profile-header,
    .sustainability-explainer,
    .cart-item,
    .summary-box {
        box-shadow: 4px 4px 0 var(--text-primary);
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
    }

    .auth-view {
        margin: 16px auto;
        padding: 24px 20px;
    }

    .sell-form,
    .checkout-view {
        padding: 24px 16px;
    }

    .profile-header {
        padding: 20px 16px;
    }

    /* Section headings tighter on mobile */
    .view-header {
        margin-bottom: 16px;
    }

    /* Filters scroll-row instead of wrapping into a wall */
    .filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }
    .filters::-webkit-scrollbar { display: none; }

    /* Spotlight stack vertically */
    .spotlight-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 20px;
    }
    .artisan-avatar {
        width: 72px;
        height: 72px;
    }
    .spotlight-text h3 { font-size: 1.4rem; }
    .artisan-spotlight { height: auto; min-height: 320px; }

    /* Search hero compresses */
    .search-hero {
        padding: 40px 20px;
    }

    /* Cart item stacks */
    .cart-item {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }
    .cart-item-img {
        width: 100%;
        height: 180px;
    }

    /* Product detail layout already collapses; tidy the back-btn */
    .back-btn { font-size: 0.95rem; }

    /* Footer columns stack */
    footer > div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 12px !important;
    }

    /* Form rows stack */
    .form-row {
        flex-direction: column;
        gap: 16px;
    }
    .form-row .split { width: 100%; }
}

/* Extra-small phones (≤360px) need a touch more breathing room */
@media (max-width: 360px) {
    .nav-container { padding: 0 12px; }
    .product-grid { gap: 8px; }
    .product-info { padding: 10px; }
    .view-header h2 { font-size: clamp(1.85rem, 8vw, 2.4rem); }
}

/* Global guard: prevent unintentional horizontal scroll from rogue children */
html, body { max-width: 100%; }
img, video { max-width: 100%; height: auto; }
