/* ============================================================
   Weefcraft — Stylesheet
   Colorful, tie-dye inspired e-commerce theme
   ============================================================ */

/* ---- Reset & Variables ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-primary:   #e05a2b;
    --color-secondary: #8a2be2;
    --color-accent:    #f7b731;
    --color-teal:      #1abc9c;
    --color-bg:        #faf8f5;
    --color-surface:   #ffffff;
    --color-text:      #1a1a1a;
    --color-muted:     #666;
    --color-border:    #e8e0d8;
    --radius:          12px;
    --shadow:          0 4px 20px rgba(0,0,0,.10);
    --shadow-lg:       0 8px 40px rgba(0,0,0,.15);
    --transition:      .22s ease;
    --nav-height:      82px;
    --drawer-width:    400px;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

img { display: block; max-width: 100%; }
a  { color: inherit; text-decoration: none; }

/* ---- Navigation ---- */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-height);
    background: #0c0614;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(1rem, 4vw, 3rem);
    box-shadow: 0 2px 16px rgba(0,0,0,.4);
}

.nav-brand { display: flex; align-items: center; flex-shrink: 0; }
.nav-brand svg { height: 72px; width: auto; display: block; }

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    font-size: .95rem;
    font-weight: 500;
    color: rgba(255,255,255,.72);
    transition: color var(--transition);
}
.nav-links a:hover { color: #f7c948; }

.nav-right { display: flex; align-items: center; gap: 1rem; }

.cart-icon-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background var(--transition);
    color: rgba(255,255,255,.85);
    display: flex;
    align-items: center;
}
.cart-icon-btn:hover { background: rgba(255,255,255,.1); }

.cart-icon-btn svg { width: 26px; height: 26px; }

#cart-count {
    position: absolute;
    top: 2px; right: 2px;
    background: var(--color-primary);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ---- Hero ---- */
.hero {
    position: relative;
    min-height: 520px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 10% 50%, rgba(224,90,43,.35) 0%, transparent 55%),
        radial-gradient(ellipse at 90% 20%, rgba(138,43,226,.30) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 90%, rgba(26,188,156,.25) 0%, transparent 55%),
        radial-gradient(ellipse at 70% 60%, rgba(247,183,49,.30) 0%, transparent 50%),
        #1a0a2e;
}

.hero-content {
    position: relative;
    z-index: 1;
    padding: clamp(2rem, 6vw, 5rem);
    max-width: 480px;
    flex-shrink: 0;
}

/* Tie-dye canvas visual */
.hero-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem clamp(1rem, 4vw, 3rem) 2rem 0;
    flex-shrink: 0;
}

#tiedye-img {
    border-radius: 50%;
    width: min(42vw, 460px);
    height: min(42vw, 460px);
    object-fit: cover;
    display: block;
    box-shadow:
        0 0 0 6px rgba(255,255,255,.08),
        0 0 0 12px rgba(255,255,255,.04),
        0 20px 60px rgba(0,0,0,.5);
}

.hero-canvas-label {
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    font-weight: 900;
    background: linear-gradient(90deg, #f7b731, #e05a2b, #e91e8c, #8a2be2, #1abc9c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -.02em;
    text-align: center;
}

@media (max-width: 760px) {
    .hero {
        flex-direction: column;
        justify-content: center;
        padding-bottom: 2rem;
    }
    .hero-content { max-width: 100%; padding-bottom: 0; }
    .hero-visual { padding: 0 2rem 1.5rem; }
    #tiedye-img { width: min(75vw, 320px); height: min(75vw, 320px); }
}

.hero-tag {
    display: inline-block;
    background: rgba(255,255,255,.15);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: .35rem .85rem;
    border-radius: 20px;
    margin-bottom: 1.25rem;
}

.hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 900;
    color: #fff;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.hero h1 span {
    background: linear-gradient(90deg, var(--color-accent), var(--color-primary), #ff6eb4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    color: rgba(255,255,255,.80);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    max-width: 420px;
}

.btn-primary {
    display: inline-block;
    background: linear-gradient(135deg, var(--color-primary), #c0392b);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    padding: .85rem 2rem;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 4px 16px rgba(224,90,43,.4);
    text-decoration: none;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(224,90,43,.5); }

/* ---- Section ---- */
.section {
    padding: clamp(3rem, 6vw, 5rem) clamp(1rem, 4vw, 3rem);
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: 800;
    margin-bottom: .5rem;
}

.section-header p {
    color: var(--color-muted);
    font-size: 1.05rem;
}

/* ---- Product Grid ---- */
#product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.75rem;
}

.product-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.product-badge {
    position: absolute;
    top: 12px; left: 12px;
    background: var(--color-primary);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .3rem .7rem;
    border-radius: 20px;
    z-index: 1;
}

.product-img-wrap {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: linear-gradient(135deg, #f0e8ff, #ffe8e0);
}

.product-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}
.product-card:hover .product-img-wrap img { transform: scale(1.06); }

.product-info {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.product-name {
    font-size: 1.05rem;
    font-weight: 700;
}

.product-desc {
    font-size: .88rem;
    color: var(--color-muted);
    flex: 1;
    line-height: 1.5;
}

.product-footer {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-top: .5rem;
}

.product-price {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--color-primary);
}

.product-size-wrap {
    display: flex;
    gap: .5rem;
    align-items: center;
}

.size-label {
    font-size: .85rem;
    color: var(--color-muted);
    white-space: nowrap;
}
.size-label strong {
    color: var(--color-secondary);
    font-weight: 700;
}
.add-to-cart-btn:disabled {
    background: #a68dcc;
    cursor: default;
    transform: none;
}

.size-select {
    flex: 0 0 80px;
    padding: .55rem .5rem;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    font-size: .88rem;
    background: #fff;
    cursor: pointer;
    color: var(--color-text);
    transition: border-color var(--transition);
}
.size-select:focus { outline: none; border-color: var(--color-primary); }
.size-select.shake {
    animation: shake .35s;
    border-color: #e74c3c;
}

@keyframes shake {
    0%,100% { transform: translateX(0); }
    25%      { transform: translateX(-5px); }
    75%      { transform: translateX(5px); }
}

.add-to-cart-btn {
    flex: 1;
    padding: .6rem 1rem;
    background: var(--color-secondary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}
.add-to-cart-btn:hover { background: #7122c0; transform: translateY(-1px); }

/* ---- Cart Drawer ---- */
#cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}
#cart-overlay.visible { opacity: 1; pointer-events: all; }

#cart-drawer {
    position: fixed;
    top: 0; right: 0;
    width: min(var(--drawer-width), 100vw);
    height: 100vh;
    background: var(--color-surface);
    z-index: 201;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: -4px 0 30px rgba(0,0,0,.15);
}
#cart-drawer.open { transform: translateX(0); }

.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.cart-header h2 { font-size: 1.15rem; font-weight: 700; }

.cart-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--color-muted);
    padding: 4px 8px;
    border-radius: 6px;
    transition: background var(--transition);
    line-height: 1;
}
.cart-close-btn:hover { background: #f0ebe4; color: var(--color-text); }

#cart-items {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#cart-empty {
    text-align: center;
    color: var(--color-muted);
    padding: 3rem 1rem;
    font-size: .95rem;
}

.cart-item {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: .85rem;
    align-items: start;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.cart-item img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    background: #f0e8ff;
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.cart-item-name { font-weight: 600; font-size: .92rem; }
.cart-item-meta { font-size: .8rem; color: var(--color-muted); }

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-top: .4rem;
}

.qty-btn {
    width: 26px; height: 26px;
    border: 1.5px solid var(--color-border);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    transition: border-color var(--transition), background var(--transition);
}
.qty-btn:hover { border-color: var(--color-primary); background: #fff5f2; }

.qty-val { font-size: .9rem; font-weight: 600; min-width: 20px; text-align: center; }

.remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: .75rem;
    color: var(--color-muted);
    text-decoration: underline;
    padding: 0 2px;
    transition: color var(--transition);
}
.remove-btn:hover { color: #e74c3c; }

.cart-item-price {
    font-weight: 700;
    font-size: .95rem;
    white-space: nowrap;
}

#cart-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--color-border);
    display: none;
    flex-direction: column;
    gap: .85rem;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
}

#cart-total { font-size: 1.25rem; font-weight: 800; }

#checkout-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--color-primary), #c0392b);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition);
    box-shadow: 0 4px 14px rgba(224,90,43,.35);
}
#checkout-btn:hover:not(:disabled) { transform: translateY(-1px); opacity: .92; }
#checkout-btn:disabled { opacity: .6; cursor: wait; }

.cart-note {
    font-size: .75rem;
    color: var(--color-muted);
    text-align: center;
}

/* ---- Features strip ---- */
.features {
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-primary) 100%);
    padding: 3rem clamp(1rem, 4vw, 3rem);
}

.features-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    text-align: center;
}

.feature-item { color: #fff; }
.feature-icon { font-size: 2rem; margin-bottom: .5rem; }
.feature-item h3 { font-size: 1rem; font-weight: 700; margin-bottom: .25rem; }
.feature-item p  { font-size: .85rem; opacity: .85; }

/* ---- About / Story ---- */
.about-section {
    padding: clamp(3rem, 6vw, 5rem) clamp(1rem, 4vw, 3rem);
    background: var(--color-surface);
}

.about-inner {
    max-width: 760px;
    margin: 0 auto;
}

.about-text h2 { font-size: 2rem; font-weight: 800; margin-bottom: 1rem; }
.about-text p  { color: var(--color-muted); margin-bottom: 1rem; line-height: 1.7; }

.about-swatch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.swatch-block {
    aspect-ratio: 1;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ---- Footer ---- */
footer {
    background: #1a0a2e;
    color: rgba(255,255,255,.70);
    text-align: center;
    padding: 2rem 1rem;
    font-size: .85rem;
}

footer a { color: rgba(255,255,255,.50); margin: 0 .5rem; }
footer a:hover { color: #fff; }

footer .footer-brand {
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(90deg, var(--color-accent), var(--color-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: .5rem;
}

/* ---- Responsive ---- */
@media (max-width: 700px) {
    .nav-links { display: none; }
    .about-inner { grid-template-columns: 1fr; gap: 2rem; }
    .about-swatch { grid-template-columns: repeat(4, 1fr); }
    .about-swatch .swatch-block:nth-child(n+5) { display: none; }
}

@media (max-width: 480px) {
    #product-grid { grid-template-columns: 1fr; }
}
