/* ============================================================
   style.css — Global base styles
   Brand: Sophia Collection (changeable)
   Palette: ivory, cream, champagne, beige, dusty rose,
            burgundy, muted gold (light luxury)
   Fonts : Playfair Display (headings) + Inter (body)
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
    /* Colours */
    --color-ivory:        #faf7f2;
    --color-cream:        #f6f1e8;
    --color-white-warm:   #fffdf9;
    --color-champagne:    #eadfc8;
    --color-beige:        #d8cbb2;
    --color-sand:         #c9b89a;
    --color-dusty-rose:   #b76e79;
    --color-rose-soft:    #f3e3e5;
    --color-burgundy:     #7a2430;
    --color-burgundy-600: #5f1b25;
    --color-gold:         #c9a86a;
    --color-gold-soft:    #f0e6d3;

    --color-charcoal:     #2b2b2b;
    --color-ink:          #201d19;
    --color-text:         #3d3a35;
    --color-muted:        #8d8578;
    --color-border:       #e8e1d4;

    --color-error:        #b3261e;
    --color-danger:       #b3261e;
    --color-success:      #2e7d5b;

    /* Type */
    --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Elevation */
    --shadow-sm: 0 1px 2px rgba(43, 40, 34, 0.06), 0 1px 3px rgba(43, 40, 34, 0.05);
    --shadow-md: 0 4px 14px rgba(43, 40, 34, 0.08), 0 2px 6px rgba(43, 40, 34, 0.05);
    --shadow-lg: 0 12px 32px rgba(43, 40, 34, 0.12), 0 4px 12px rgba(43, 40, 34, 0.06);

    /* Shape */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --radius-pill: 999px;

    /* Layout */
    --container: 1320px;
    --header-height: 82px;

    /* Motion */
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 0.3s var(--ease);
}

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

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

html,
body {
    overflow-x: hidden;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-ivory);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

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

ul,
ol {
    list-style: none;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    font-weight: 600;
    line-height: 1.2;
    color: var(--color-ink);
    letter-spacing: 0.01em;
}

h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.55rem); }
h4 { font-size: 1.15rem; }

p { margin-bottom: 1rem; }

.eyebrow {
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--color-gold);
    margin-bottom: 0.75rem;
    display: inline-block;
}

.text-center { text-align: center; }
.text-muted  { color: var(--color-muted); }

/* ---------- Container ---------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: 24px;
}

/* ---------- Section scaffolding ---------- */
.section {
    padding-block: clamp(3rem, 7vw, 5.5rem);
}

.section-head {
    max-width: 640px;
    margin-inline: auto;
    text-align: center;
    margin-bottom: clamp(2rem, 4vw, 3rem);
}

.section-head--left {
    margin-inline: 0;
    text-align: left;
}

.section-title {
    margin-bottom: 0.6rem;
}

.section-sub {
    color: var(--color-muted);
    font-weight: 300;
    font-size: 1.02rem;
}

.container--narrow {
    max-width: 760px;
}

/* ---------- Star ratings ---------- */
.stars {
    display: inline-flex;
    gap: 2px;
    color: var(--color-gold);
    font-size: 0.85rem;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 0.95rem 2.1rem;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    transition: background-color var(--transition), color var(--transition),
                border-color var(--transition), box-shadow var(--transition),
                transform var(--transition);
    white-space: nowrap;
}

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

.btn--primary {
    background: var(--color-burgundy);
    color: var(--color-ivory);
    box-shadow: 0 6px 18px rgba(122, 36, 48, 0.28);
}

.btn--primary:hover {
    background: var(--color-burgundy-600);
    box-shadow: 0 8px 24px rgba(122, 36, 48, 0.36);
    transform: translateY(-2px);
}

.btn--dark {
    background: var(--color-charcoal);
    color: var(--color-ivory);
}

.btn--dark:hover {
    background: var(--color-ink);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn--gold {
    background: var(--color-gold);
    color: var(--color-ivory);
    box-shadow: 0 6px 18px rgba(201, 168, 106, 0.35);
}

.btn--gold:hover {
    background: #b49155;
    transform: translateY(-2px);
}

.btn--outline {
    background: transparent;
    color: var(--color-charcoal);
    border-color: var(--color-charcoal);
}

.btn--outline:hover {
    background: var(--color-charcoal);
    color: var(--color-ivory);
    transform: translateY(-2px);
}

.btn--ghost {
    background: transparent;
    color: var(--color-burgundy);
    padding-inline: 0.5rem;
}

.btn--ghost::after {
    content: '';
    display: block;
    height: 1px;
    width: 100%;
    background: var(--color-burgundy);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition);
    margin-top: 2px;
}

.btn--ghost:hover::after { transform: scaleX(1); }

.btn--block {
    display: flex;
    width: 100%;
}

.btn--sm {
    padding: 0.6rem 1.2rem;
    font-size: 0.72rem;
}

.btn--lg {
    padding: 1.1rem 2.6rem;
    font-size: 0.88rem;
}

.btn:disabled,
.btn.is-disabled {
    opacity: 0.55;
    pointer-events: none;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    font-family: var(--font-sans);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.28rem 0.7rem;
    border-radius: var(--radius-pill);
    line-height: 1.4;
}

.badge--new   { background: var(--color-burgundy); color: var(--color-ivory); }
.badge--sale  { background: var(--color-gold);     color: var(--color-ivory); }
.badge--feat  { background: var(--color-charcoal); color: var(--color-ivory); }
.badge--ok    { background: #e5f1ea; color: var(--color-success); }
.badge--warn  { background: var(--color-gold-soft); color: #8a6a2f; }
.badge--err   { background: #fbe8e6; color: var(--color-error); }

/* ---------- Forms ---------- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 0.45rem;
    color: var(--color-ink);
}

.form-control {
    width: 100%;
    padding: 0.82rem 1rem;
    font-size: 0.95rem;
    color: var(--color-ink);
    background: var(--color-white-warm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control::placeholder { color: var(--color-muted); }

.form-control:focus {
    outline: none;
    border-color: var(--color-gold);
    box-shadow: 0 0 0 3px rgba(201, 168, 106, 0.18);
}

textarea.form-control {
    min-height: 130px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238d8578' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.4rem;
}

.form-control--error {
    border-color: var(--color-error);
}

.form-error {
    color: var(--color-error);
    font-size: 0.85rem;
    margin-top: 0.35rem;
}

.field-error {
    display: block;
    margin-top: 0.35rem;
    color: var(--color-error);
    font-size: 0.85rem;
}

/* ---------- Flash messages ---------- */
.flash-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(92vw, 380px);
}

.flash {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-md);
    background: var(--color-white-warm);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    font-size: 0.92rem;
    color: var(--color-ink);
    animation: flash-in 0.35s var(--ease);
}

.flash--success { border-left: 4px solid var(--color-success); }
.flash--error   { border-left: 4px solid var(--color-error); }
.flash--info    { border-left: 4px solid var(--color-gold); }

.flash__close {
    color: var(--color-muted);
    font-size: 1.1rem;
    line-height: 1;
    padding: 2px;
    transition: color var(--transition);
}

.flash__close:hover { color: var(--color-ink); }

@keyframes flash-in {
    from { opacity: 0; transform: translateX(16px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ---------- Reveal on scroll ---------- */
.js .reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.75s var(--ease), transform 0.75s var(--ease);
    will-change: opacity, transform;
}

.js .reveal.is-visible {
    opacity: 1;
    transform: none;
}

.reveal--delay-1 { transition-delay: 0.12s; }
.reveal--delay-2 { transition-delay: 0.24s; }
.reveal--delay-3 { transition-delay: 0.36s; }
.reveal--delay-4 { transition-delay: 0.48s; }

/* ---------- Empty states ---------- */
.empty-state {
    text-align: center;
    padding: clamp(2.5rem, 6vw, 4.5rem) 1.5rem;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-white-warm);
}

.empty-state__icon {
    font-size: 2.6rem;
    color: var(--color-sand);
    margin-bottom: 1rem;
}

.empty-state__title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-state__text {
    color: var(--color-muted);
    max-width: 420px;
    margin: 0 auto 1.5rem;
}

/* ---------- Utility ---------- */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 3rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.divider {
    height: 1px;
    background: var(--color-border);
    border: none;
    margin-block: 2rem;
}

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--color-muted);
    padding-block: 1.2rem 0;
}

.breadcrumbs a {
    transition: color var(--transition);
}

.breadcrumbs a:hover { color: var(--color-burgundy); }

.breadcrumbs__sep {
    color: var(--color-sand);
    font-size: 0.7rem;
}

.breadcrumbs__current {
    color: var(--color-ink);
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Product card (global component) ---------- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 26px 22px;
}

.product-card {
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card__media {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--color-white-warm);
    aspect-ratio: 3 / 4;
    box-shadow: var(--shadow-sm);
}

.product-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease);
}

.product-card:hover .product-card__media img {
    transform: scale(1.05);
}

.product-card__badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
    box-shadow: var(--shadow-sm);
}

.product-card__badge--right {
    left: auto;
    right: 12px;
}

.product-card__actions {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 10px;
    padding-bottom: 16px;
    background: linear-gradient(to top, rgba(32, 29, 25, 0.35), transparent 55%);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--transition), transform var(--transition);
}

.product-card:hover .product-card__actions,
.product-card:focus-within .product-card__actions {
    opacity: 1;
    transform: none;
}

.product-card__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 253, 249, 0.96);
    color: var(--color-ink);
    box-shadow: var(--shadow-md);
    font-size: 1rem;
    transition: background-color var(--transition), color var(--transition),
                transform var(--transition);
}

.product-card__action:hover {
    background: var(--color-burgundy);
    color: var(--color-ivory);
    transform: translateY(-3px);
}

.product-card__body {
    padding: 14px 4px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.product-card__title {
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.35;
    color: var(--color-ink);
}

.product-card__title a {
    transition: color var(--transition);
}

.product-card__title a:hover {
    color: var(--color-burgundy);
}

.product-card__price {
    font-size: 0.95rem;
    color: var(--color-ink);
}

.price--sale {
    color: var(--color-burgundy);
    font-weight: 600;
}

.price--old {
    color: var(--color-muted);
    text-decoration: line-through;
    margin-left: 8px;
    font-size: 0.85rem;
}

@media (hover: none), (max-width: 768px) {
    .product-card__actions {
        opacity: 1;
        transform: none;
        background: linear-gradient(to top, rgba(32, 29, 25, 0.28), transparent 55%);
    }

    .product-card__action {
        width: 40px;
        height: 40px;
    }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
