/* ===========================================
   Zlatna Košnica — premium transitions layer
   =========================================== */

/* ---------- Page loader ---------- */
#page-loader {
  position: fixed;
  inset: 0;
  background: #F5EFE6;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.9s cubic-bezier(0.65, 0, 0.35, 1),
              visibility 0.9s cubic-bezier(0.65, 0, 0.35, 1);
}
#page-loader.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-mark {
  width: 100px;
  height: 100px;
  animation: loader-pulse 2.4s ease-in-out infinite;
}
@media (min-width: 640px) {
  .loader-mark { width: 130px; height: 130px; }
}
.loader-mark img { width: 100%; height: 100%; }
@keyframes loader-pulse {
  0%, 100% { transform: scale(0.92); opacity: 0.6; filter: drop-shadow(0 0 0 rgba(200, 155, 60, 0)); }
  50%      { transform: scale(1.0);  opacity: 1;   filter: drop-shadow(0 0 30px rgba(200, 155, 60, 0.35)); }
}
.loader-name {
  margin-top: 1.25rem;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  color: #3A2E2A;
  opacity: 0.4;
  animation: loader-name-fade 2.4s ease-in-out infinite;
  white-space: nowrap;
  text-align: center;
}
@media (min-width: 640px) {
  .loader-name {
    margin-top: 1.5rem;
    font-size: 1.5rem;
    letter-spacing: 0.4em;
  }
}
@keyframes loader-name-fade {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 0.8; }
}

/* Prevent body scroll while loading */
body.is-loading { overflow: hidden; }

/* ---------- Custom cursor (desktop only) ---------- */
@media (hover: hover) and (pointer: fine) {
  body.has-custom-cursor { cursor: none; }
  body.has-custom-cursor a,
  body.has-custom-cursor button { cursor: none; }
  #cursor-dot,
  #cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 10000;
    will-change: transform;
    mix-blend-mode: multiply;
  }
  #cursor-dot {
    width: 6px;
    height: 6px;
    background: #C89B3C;
    border-radius: 999px;
    transform: translate(-50%, -50%);
    transition: width 0.25s ease, height 0.25s ease, opacity 0.2s ease;
  }
  #cursor-ring {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(200, 155, 60, 0.5);
    border-radius: 999px;
    transform: translate(-50%, -50%);
    transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                height 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-color 0.3s ease,
                opacity 0.2s ease;
  }
  body.cursor-hover #cursor-dot {
    width: 0;
    height: 0;
  }
  body.cursor-hover #cursor-ring {
    width: 60px;
    height: 60px;
    border-color: #C89B3C;
    background: rgba(200, 155, 60, 0.08);
  }
}
@media (hover: none), (pointer: coarse) {
  #cursor-dot, #cursor-ring { display: none !important; }
  body.has-custom-cursor,
  body.has-custom-cursor * { cursor: auto !important; }
  /* Magnetic elements stay in place on touch — kill any JS-set transform */
  .magnetic, .magnetic-inner { transform: none !important; }
}

/* ---------- Word-by-word text reveal ---------- */
.split-text {
  display: inline-block;
}
.split-line {
  display: block;
  overflow: hidden;
  line-height: inherit;
}
.split-word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  line-height: inherit;
}
.split-word > .split-word-inner {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 0.95s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--word-index, 0) * 65ms);
  will-change: transform;
}
.split-text.is-revealed .split-word > .split-word-inner {
  transform: translateY(0);
}

/* ---------- Image clip-path reveal ---------- */
.clip-reveal {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.2s cubic-bezier(0.76, 0, 0.24, 1);
  will-change: clip-path;
}
.clip-reveal.is-revealed {
  clip-path: inset(0 0 0 0);
}
.clip-reveal-left {
  clip-path: inset(0 100% 0 0);
}
.clip-reveal-left.is-revealed {
  clip-path: inset(0 0 0 0);
}

/* ---------- Stagger reveal (children appear in sequence) ---------- */
.stagger-children > * {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.stagger-children.is-revealed > * {
  opacity: 1;
  transform: translateY(0);
}
.stagger-children.is-revealed > *:nth-child(1) { transition-delay: 0ms; }
.stagger-children.is-revealed > *:nth-child(2) { transition-delay: 120ms; }
.stagger-children.is-revealed > *:nth-child(3) { transition-delay: 240ms; }
.stagger-children.is-revealed > *:nth-child(4) { transition-delay: 360ms; }
.stagger-children.is-revealed > *:nth-child(5) { transition-delay: 480ms; }
.stagger-children.is-revealed > *:nth-child(6) { transition-delay: 600ms; }

/* ---------- Magnetic CTA buttons ---------- */
.magnetic {
  display: inline-block;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.magnetic-inner {
  display: inline-block;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Hero parallax ---------- */
.parallax {
  will-change: transform;
  transition: transform 0.15s linear;
}

/* ---------- Marquee scrolling strip ---------- */
.marquee {
  overflow: hidden;
  padding: 1.5rem 0;
  border-top: 1px solid rgba(200, 155, 60, 0.18);
  border-bottom: 1px solid rgba(200, 155, 60, 0.18);
  position: relative;
}
@media (min-width: 640px) {
  .marquee { padding: 2rem 0; }
}
.marquee-content {
  display: inline-flex;
  white-space: nowrap;
  animation: marquee-scroll 32s linear infinite;
  gap: 2.5rem;
  padding-right: 2.5rem;
  will-change: transform;
  transform: translate3d(0, 0, 0); /* GPU layer */
}
.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 1.25rem;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.5rem;
  color: #3A2E2A;
  letter-spacing: 0.02em;
}
.marquee-item .dot {
  width: 5px;
  height: 5px;
  background: #C89B3C;
  border-radius: 999px;
  flex-shrink: 0;
}
@keyframes marquee-scroll {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}
@media (hover: hover) {
  .marquee:hover .marquee-content { animation-play-state: paused; }
}

@media (min-width: 640px) {
  .marquee-item { font-size: 1.85rem; gap: 1.75rem; }
  .marquee-content { gap: 3.5rem; padding-right: 3.5rem; }
  .marquee-item .dot { width: 6px; height: 6px; }
}
@media (min-width: 1024px) {
  .marquee-item { font-size: 2.5rem; gap: 2.5rem; }
  .marquee-content { gap: 5rem; padding-right: 5rem; animation-duration: 40s; }
}

/* ---------- Section divider draw-in ---------- */
.divider-line {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}
.divider-line::before,
.divider-line::after {
  content: "";
  display: block;
  height: 1px;
  width: 0;
  background: #C89B3C;
  transition: width 1.1s cubic-bezier(0.76, 0, 0.24, 1) 0.3s;
}
.divider-line.is-revealed::before,
.divider-line.is-revealed::after {
  width: 3rem;
}

/* ---------- Product card entrance ---------- */
.product-card {
  opacity: 0;
  transform: translateY(50px) scale(0.97);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.9s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.4s ease,
              border-color 0.4s ease;
}
.collection-grid.is-revealed .product-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.collection-grid.is-revealed .product-card:nth-child(1) { transition-delay: 0ms; }
.collection-grid.is-revealed .product-card:nth-child(2) { transition-delay: 150ms; }
.collection-grid.is-revealed .product-card:nth-child(3) { transition-delay: 300ms; }
@media (hover: hover) {
  .collection-grid.is-revealed .product-card:hover {
    transform: translateY(-8px) scale(1);
  }
}

/* Hover effect on product image — subtle zoom */
@media (hover: hover) {
  .product-card .product-image img {
    transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .product-card:hover .product-image img {
    transform: scale(1.06);
  }
}

/* ---------- Anchor link smooth easing override ---------- */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ===========================================
   Phase 2 — desktop UI/UX layer
   =========================================== */

/* ---------- Scroll progress bar ---------- */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #C89B3C 0%, #DDD0BC 100%);
  z-index: 10001;
  pointer-events: none;
  transition: width 0.08s linear, opacity 0.3s ease;
  will-change: width;
  box-shadow: 0 0 8px rgba(200, 155, 60, 0.5);
}
body.is-loading #scroll-progress { opacity: 0; }

/* ---------- Cursor text label (desktop only) ---------- */
@media (hover: hover) and (pointer: fine) {
  #cursor-text {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 10001;
    transform: translate(-50%, -50%);
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.78rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #F5EFE6;
    opacity: 0;
    transition: opacity 0.25s ease;
    white-space: nowrap;
    will-change: transform;
    mix-blend-mode: difference;
  }
  body.cursor-has-text #cursor-text { opacity: 1; }

  /* When a cursor label is active, the ring fills with gold so the
     text is legible on top */
  body.cursor-has-text #cursor-ring {
    width: 84px;
    height: 84px;
    background: #C89B3C;
    border-color: #C89B3C;
  }
  body.cursor-has-text #cursor-dot { opacity: 0; }
}

/* ---------- Product card hover overlay ---------- */
.product-card { position: relative; cursor: pointer; }
.product-image { position: relative; overflow: hidden; }
.product-image::after {
  content: attr(data-hover-label);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(58, 46, 42, 0.0) 0%, rgba(58, 46, 42, 0.55) 100%);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.4rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #F5EFE6;
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}
@media (hover: hover) {
  .product-card:hover .product-image::after { opacity: 1; }
  .product-card .product-image img {
    transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1), filter 0.4s ease;
  }
  .product-card:hover .product-image img {
    transform: scale(1.08);
    filter: brightness(0.95);
  }
}
.product-card-soon { cursor: default; }
.product-card-soon .product-image::after { display: none; }

/* CTA & ingredients on card stay clickable on top of overlay */
.product-card .product-cta,
.product-card .product-ingredients {
  position: relative;
  z-index: 2;
}

/* ---------- Product Details Modal ---------- */
.product-modal {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.product-modal.is-open { opacity: 1; visibility: visible; }

.product-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(58, 46, 42, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.product-modal-panel {
  position: relative;
  background: #F5EFE6;
  border: 1px solid rgba(200, 155, 60, 0.3);
  width: 100%;
  max-width: 980px;
  max-height: 92vh;
  overflow-y: auto;
  transform: translateY(30px) scale(0.97);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 40px 80px -20px rgba(58, 46, 42, 0.4);
}
.product-modal.is-open .product-modal-panel { transform: translateY(0) scale(1); }

.product-modal-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(245, 239, 230, 0.85);
  border: 1px solid rgba(200, 155, 60, 0.3);
  color: #3A2E2A;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: background 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}
.product-modal-close:hover {
  background: #C89B3C;
  border-color: #C89B3C;
  color: #F5EFE6;
  transform: rotate(90deg);
}

.product-modal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
@media (min-width: 768px) {
  .product-modal-grid {
    grid-template-columns: 1fr 1fr;
    min-height: 500px;
  }
}

.product-modal-image {
  background: linear-gradient(180deg, rgba(221, 208, 188, 0.5) 0%, rgba(245, 239, 230, 0.2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  min-height: 260px;
}
@media (min-width: 768px) {
  .product-modal-image { padding: 3rem 2rem; }
}
.product-modal-image img {
  max-width: 100%;
  max-height: 380px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
@media (min-width: 768px) {
  .product-modal-image img { max-height: 440px; }
}

.product-modal-body {
  padding: 2rem 1.75rem 2.25rem;
  display: flex;
  flex-direction: column;
}
@media (min-width: 768px) {
  .product-modal-body { padding: 2.75rem 2.5rem 2.5rem; }
}

.product-modal-eyebrow {
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #C89B3C;
}
.product-modal-title {
  margin-top: 0.6rem;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.85rem;
  line-height: 1.1;
  color: #3A2E2A;
}
@media (min-width: 768px) {
  .product-modal-title { font-size: 2.3rem; }
}
.product-modal-volume {
  margin-top: 0.5rem;
  font-size: 0.68rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #667056;
}
.product-modal-divider {
  margin: 1.25rem 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.product-modal-divider span {
  height: 1px;
  flex: 1;
  background: rgba(200, 155, 60, 0.4);
}
.product-modal-divider i {
  display: block;
  width: 6px;
  height: 6px;
  background: #C89B3C;
  transform: rotate(45deg);
}

.product-modal-desc {
  color: rgba(58, 46, 42, 0.85);
  line-height: 1.65;
  font-size: 0.98rem;
}
.product-modal-section { margin-top: 1.5rem; }
.product-modal-section-label {
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #667056;
}
.product-modal-ing {
  margin-top: 0.5rem;
  font-style: italic;
  color: rgba(58, 46, 42, 0.75);
  font-size: 0.92rem;
  line-height: 1.55;
}
.product-modal-badges {
  margin-top: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.product-modal-badges .product-badge { background: rgba(245, 239, 230, 0.7); }

.product-modal-cta {
  margin-top: 1.75rem;
  display: inline-block;
  align-self: flex-start;
  padding: 1rem 2rem;
  background: #C89B3C;
  color: #F5EFE6;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  transition: background 0.3s ease;
}
.product-modal-cta:hover { background: #3A2E2A; }

body.modal-open { overflow: hidden; }

/* ---------- Reduced motion: kill all animations ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .clip-reveal { clip-path: none !important; }
  .stagger-children > * { opacity: 1 !important; transform: none !important; }
  .product-card { opacity: 1 !important; transform: none !important; }
  .split-word > .split-word-inner { transform: none !important; }
  .marquee-content { animation: none !important; }
  .product-image::after { display: none !important; }
  .product-modal-panel { transform: none !important; }
  #scroll-progress { display: none !important; }
}
