/* ============================================
   CUSTOM CSS — Beyond Tailwind
   Maison Kachain Theme
   ============================================ */

/* ── Hero Entrance Animation (matches React Framer Motion) ── */
@keyframes heroZoomIn {
  from { transform: scale(1.05); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
#home .absolute.inset-0.z-0 {
  animation: heroZoomIn 2s ease-out forwards;
}

/* ── Product Card Hover Lift (matches React whileHover y:-15) ── */
#shop .group.cursor-pointer {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
#shop .group.cursor-pointer:hover {
  transform: translateY(-15px);
}

/* ── Designer Image 3D Tilt on Hover ── */
#story .lg\:col-span-5 .group {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
#story .lg\:col-span-5 .group:hover {
  transform: perspective(1000px) rotateY(10deg) rotateX(-5deg) scale(1.02);
}

/* ── Back-to-Top Hover ── */
#back-to-top:hover {
  background: #1a1a1a !important;
}

/* ── Scroll Indicator Delayed Fade-in ── */
@keyframes delayedFadeIn {
  0%, 60% { opacity: 0; }
  100% { opacity: 0.4; }
}
#home .absolute.bottom-16 {
  animation: delayedFadeIn 3s ease-out forwards;
}

/* ── Tagline Letter-Spacing Expand ── */
@keyframes letterExpand {
  from { letter-spacing: 0.2em; opacity: 0; }
  to { letter-spacing: 0.8em; opacity: 1; }
}
#home .text-brand-accent.block {
  animation: letterExpand 1.2s ease-out 0.8s both;
}

/* ---- WooCommerce Overrides ---- */

/* Product price styling */
.woocommerce .price {
    font-family: var(--font-body);
}

.woocommerce .price del {
    color: var(--color-grey);
    font-size: 0.875em;
    opacity: 0.7;
}

.woocommerce .price ins {
    text-decoration: none;
    color: var(--color-gold);
    font-weight: 600;
}

.woocommerce .price .amount {
    font-weight: 500;
}

/* Star rating */
.woocommerce .star-rating {
    color: var(--color-gold);
    font-size: 0.875rem;
    overflow: hidden;
    position: relative;
    height: 1.2em;
    line-height: 1.2;
    width: 5.4em;
}

.woocommerce .star-rating::before {
    color: var(--color-grey-light);
}

/* Sale flash */
.woocommerce span.onsale {
    background-color: var(--color-gold);
    color: var(--color-black);
    font-family: var(--font-body);
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 0;
    min-width: 0;
    min-height: 0;
    line-height: 1.4;
}

/* Quantity input */
.woocommerce .quantity .qty {
    width: 3rem;
    text-align: center;
    border: 1px solid var(--color-grey-light);
    padding: 6px 4px;
    font-size: 0.875rem;
    appearance: textfield;
    -moz-appearance: textfield;
}

.woocommerce .quantity .qty::-webkit-inner-spin-button,
.woocommerce .quantity .qty::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Add to cart button — see later block (lines ~700) for final styles */

/* WooCommerce messages */
.woocommerce .woocommerce-message,
.woocommerce .woocommerce-info,
.woocommerce .woocommerce-error {
    border-top: 2px solid var(--color-gold);
    background-color: var(--color-white);
    color: var(--color-black);
    font-size: 0.875rem;
    padding: 12px 16px;
    margin-bottom: 1rem;
}

.woocommerce .woocommerce-message::before,
.woocommerce .woocommerce-info::before {
    color: var(--color-gold);
}

.woocommerce .woocommerce-error {
    border-top-color: #dc2626;
}

/* WooCommerce tabs (default theme tabs override) */
.woocommerce div.product .woocommerce-tabs {
    padding: 0;
}

.woocommerce div.product .woocommerce-tabs ul.tabs {
    display: none; /* We use custom tabs */
}

/* Breadcrumbs */
.woocommerce .woocommerce-breadcrumb {
    font-size: 0.75rem;
    color: var(--color-grey);
}

.woocommerce .woocommerce-breadcrumb a {
    color: var(--color-grey);
    transition: color 0.3s ease;
}

.woocommerce .woocommerce-breadcrumb a:hover {
    color: var(--color-gold);
}

/* Checkout form fields */
.woocommerce-checkout .form-row label {
    font-size: 0.875rem;
    color: var(--color-grey-dark);
    font-weight: 500;
    margin-bottom: 4px;
}

.woocommerce-checkout .form-row .input-text,
.woocommerce-checkout .form-row select {
    border: 1px solid var(--color-grey-light);
    border-radius: 0;
    padding: 10px 14px;
    font-size: 0.875rem;
    transition: border-color 0.3s ease;
}

.woocommerce-checkout .form-row .input-text:focus,
.woocommerce-checkout .form-row select:focus {
    border-color: var(--color-gold);
    box-shadow: none;
    outline: none;
}

/* Order table */
.woocommerce-orders-table {
    width: 100%;
    border-collapse: collapse;
}

.woocommerce-orders-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-grey);
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-grey-light);
    text-align: left;
}

.woocommerce-orders-table td {
    font-size: 0.875rem;
    padding: 12px;
    border-bottom: 1px solid var(--color-grey-light);
}

/* Pagination */
.woocommerce nav.woocommerce-pagination ul {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: none;
}

.woocommerce nav.woocommerce-pagination ul li {
    border: none;
}

.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span.current {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 0.875rem;
    border: 1px solid var(--color-grey-light);
    color: var(--color-black);
    background: transparent;
    transition: all 0.3s ease;
}

.woocommerce nav.woocommerce-pagination ul li a:hover {
    border-color: var(--color-gold);
    color: var(--color-gold);
}

.woocommerce nav.woocommerce-pagination ul li span.current {
    background-color: var(--color-black);
    border-color: var(--color-black);
    color: var(--color-white);
}

/* WP pagination (blog) */
.nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.nav-links .page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    font-size: 0.875rem;
    border: 1px solid var(--color-grey-light);
    color: var(--color-black);
    transition: all 0.3s ease;
}

.nav-links .page-numbers:hover {
    border-color: var(--color-gold);
    color: var(--color-gold);
}

.nav-links .page-numbers.current {
    background-color: var(--color-black);
    border-color: var(--color-black);
    color: var(--color-white);
}

/* Sorting dropdown */
.woocommerce .woocommerce-ordering select {
    border: 1px solid var(--color-grey-light);
    padding: 8px 36px 8px 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-black);
    background-color: transparent;
    cursor: pointer;
}

.woocommerce .woocommerce-ordering select:focus {
    border-color: var(--color-gold);
    outline: none;
}

/* ---- Animation Keyframes ---- */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes goldPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(197, 160, 89, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(197, 160, 89, 0); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ---- Thai Font Fixes ---- */

/* Thai font support — Inter primary, Sarabun fallback for Thai glyphs */
:lang(th),
[lang="th"],
.font-thai {
    font-family: 'Plus Jakarta Sans', 'Sarabun', 'Noto Sans Thai', sans-serif;
    letter-spacing: 0;
}

/* Thai headings use Cormorant Garamond with Sarabun fallback */
h1:lang(th), h2:lang(th), h3:lang(th),
h4:lang(th), h5:lang(th), h6:lang(th) {
    font-family: 'Cormorant Garamond', 'Sarabun', 'Italiana', serif;
}

/* Thai text in inputs */
:lang(th) input,
:lang(th) select,
:lang(th) textarea {
    font-family: 'Inter', 'Sarabun', sans-serif;
}

/* ---- Parallax Effect ---- */

.parallax-bg {
    will-change: transform;
}

@media (prefers-reduced-motion: no-preference) {
    .parallax-bg {
        transition: transform 0.1s linear;
    }
}

/* ---- Lightbox Styles ---- */

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    background-color: rgba(20, 20, 20, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-lightbox.is-active {
    opacity: 1;
    pointer-events: auto;
}

.gallery-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

.gallery-lightbox .lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    color: rgba(253, 252, 249, 0.6);
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 0.5rem;
}

.gallery-lightbox .lightbox-close:hover {
    color: var(--color-white);
}

.gallery-lightbox .lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(253, 252, 249, 0.6);
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 1rem;
    font-size: 2rem;
}

.gallery-lightbox .lightbox-nav:hover {
    color: var(--color-gold);
}

.gallery-lightbox .lightbox-prev {
    left: 1rem;
}

.gallery-lightbox .lightbox-next {
    right: 1rem;
}

/* ---- Zoom on Hover ---- */

.zoom-container {
    overflow: hidden;
    cursor: zoom-in;
}

.zoom-container.is-zoomed {
    cursor: zoom-out;
}

.zoom-container img.is-zoomed {
    transform: scale(2);
    transform-origin: var(--zoom-x, center) var(--zoom-y, center);
}

/* ---- Loading Spinner ---- */

.kachain-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(197, 160, 89, 0.2);
    border-top-color: var(--color-gold);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ---- Cart Fragment Loading ---- */

.woocommerce .blockUI.blockOverlay {
    background-color: rgba(253, 252, 249, 0.7) !important;
}

.woocommerce .blockUI.blockOverlay::before {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    border: 2px solid rgba(197, 160, 89, 0.2);
    border-top-color: var(--color-gold);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -12px 0 0 -12px;
}

/* ---- Sticky Header Transitions ---- */

.site-header.is-scrolled {
    box-shadow: 0 2px 20px rgba(20, 20, 20, 0.06);
}

.site-header.is-hidden {
    transform: translateY(-100%);
}

/* ---- Src Design System Classes ---- */

/* 3D Perspective container */
.perspective-container {
    perspective: 1000px;
}

/* Immersive background (fixed gradient layers) */
.immersive-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, #ffffff 0%, #f0f0f0 100%);
    overflow: hidden;
}

.story-layer {
    position: absolute;
    pointer-events: none;
    opacity: 0.15;
    filter: blur(40px);
    border-radius: 50%;
}

/* Instagram-style grid item */
.ig-grid-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background-color: #f5f3ee;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.ig-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.ig-grid-item:hover img {
    transform: scale(1.05);
}

.ig-grid-item .ig-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.ig-grid-item:hover .ig-overlay {
    opacity: 1;
}

/* Product demo button (src pdm-btn) */
.pdm-btn {
    display: inline-block;
    padding: 0.625rem 1.5rem;
    background-color: var(--color-brand-text, #1a1a1a);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.pdm-btn:hover {
    background-color: var(--color-brand-muted, #5e574f);
    color: white;
}

.pdm-btn:active {
    transform: scale(0.95);
}

/* Hide scrollbar utility */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Cart drawer */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 28rem;
    background-color: var(--color-brand-bg, #f9f7f2);
    z-index: 160;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.1);
}

.cart-drawer.is-open {
    transform: translateX(0);
}

.cart-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.cart-drawer-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* Vertical text (for hero editorial labels) */
.writing-vertical-rl {
    writing-mode: vertical-rl;
}

/* Hero gradient text */
.text-gradient-white {
    -webkit-text-fill-color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    background-image: linear-gradient(to bottom, white, rgba(255,255,255,0.3));
}

/* Scroll indicator line */
.scroll-indicator-line {
    width: 1px;
    height: 5rem;
    background: linear-gradient(to bottom, var(--color-brand-accent, #a67c37), transparent);
}

/* Floating animation */
@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

/* WooCommerce overrides for src design */
.woocommerce .single_add_to_cart_button {
    background-color: var(--color-brand-accent) !important;
    color: white !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.4em !important;
    padding: 20px 32px !important;
    width: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    transition: all 0.3s ease !important;
}

.woocommerce .single_add_to_cart_button:hover {
    background-color: var(--color-brand-text) !important;
}

/* Checkout form inputs to match src border-b style */
.woocommerce-checkout .form-row .input-text:focus,
.woocommerce-checkout .form-row select:focus {
    border-color: var(--color-brand-accent);
}

/* ============================================
   CONTRAST FIX — Gold text on light backgrounds
   WCAG AA requires 4.5:1 for small text
   #a67c37 on #f9f7f2 = 3.2:1 (FAIL)
   #8a6628 on #f9f7f2 = 4.7:1 (PASS)
   ============================================ */

/* Small gold labels (< 14px) use darker gold for contrast */
.text-brand-accent {
    color: #8a6628;
}

/* Large text (headings, hero) can keep original gold */
h1 .text-brand-accent,
h2 .text-brand-accent,
.text-2xl.text-brand-accent,
.text-3xl.text-brand-accent,
.text-4xl.text-brand-accent,
.text-5xl.text-brand-accent,
.font-serif.text-brand-accent,
.font-display.text-brand-accent {
    color: #a67c37;
}

/* Interactive elements (buttons, links) keep original for visual pop */
a.text-brand-accent:hover,
button .text-brand-accent,
[data-magnetic] .text-brand-accent {
    color: #a67c37;
}

/* ============================================
   INDIGO COLOR FALLBACK (Tailwind modern syntax compat)
   ============================================ */

.bg-brand-indigo-dark {
    background-color: #1e2442 !important;
}
.bg-brand-indigo {
    background-color: #2d3561 !important;
}
.bg-brand-indigo-light {
    background-color: #3d4a7a !important;
}
.text-brand-indigo {
    color: #2d3561;
}
.text-brand-indigo-dark {
    color: #1e2442;
}
.border-brand-indigo {
    border-color: #2d3561;
}
.bg-brand-indigo\/5 {
    background-color: rgba(45, 53, 97, 0.05);
}

/* ============================================
   SIGNATURE DESIGN SYSTEM — Unique Identity
   ============================================ */

/* Staggered product grid */
.staggered-grid > *:nth-child(3n+2) {
    margin-top: 4rem;
}
.staggered-grid > *:nth-child(3n+3) {
    margin-top: 2rem;
}

/* Motif overlay on sections */
.motif-overlay {
    position: relative;
}
.motif-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background-size: 60px 60px;
    opacity: 0.03;
    pointer-events: none;
    z-index: 1;
}

/* Motif corner accents */
.motif-corner {
    position: relative;
}
.motif-corner::before,
.motif-corner::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    opacity: 0.2;
    pointer-events: none;
}
.motif-corner::before {
    top: 0;
    left: 0;
}
.motif-corner::after {
    bottom: 0;
    right: 0;
    transform: rotate(180deg);
}

/* Clip-path image reveal on product card hover */
.clip-reveal-container {
    position: relative;
    overflow: hidden;
}
.clip-reveal-container .clip-reveal-back {
    position: absolute;
    inset: 0;
    clip-path: inset(0 0 0 100%);
    transition: clip-path 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}
.clip-reveal-container:hover .clip-reveal-back {
    clip-path: inset(0 0 0 0);
}

/* Text outline effect */
.text-outline {
    -webkit-text-stroke: 1px currentColor;
    -webkit-text-fill-color: transparent;
}

/* Pattern-fill text */
.text-pattern-fill {
    -webkit-text-fill-color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
}

/* Dynamic shadow CSS custom properties */
:root {
    --shadow-angle: 135deg;
    --shadow-opacity: 0.08;
}

.dynamic-shadow {
    box-shadow: 0 10px 40px rgba(20, 20, 20, var(--shadow-opacity));
}

/* CTA gradient animation */
.cta-animated {
    background-size: 200% 100%;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.cta-animated:hover {
    background-position: 100% 0;
}

/* Page transition overlay */
#page-transition-overlay {
    background: linear-gradient(135deg, #a67c37 0%, #2d3561 100%);
}

/* Preloader styles */
#kachain-preloader svg path {
    transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .staggered-grid > * {
        margin-top: 0 !important;
    }
    #kachain-preloader {
        display: none !important;
    }
}

/* ---- Print Styles ---- */

@media print {
    .site-header,
    .site-footer,
    #announcement-bar,
    .mobile-nav,
    #mini-cart-dropdown,
    #search-overlay,
    .woocommerce-pagination,
    .cart-drawer,
    .cart-drawer-backdrop {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
    }

    a {
        color: black !important;
        text-decoration: underline;
    }
}
