/*
 * SWAN DRY FRUITS — HAREKET KATMANI
 * Sitenin tüm ek animasyonları bu dosyada ve motion.js içindedir.
 * Bu iki dosya kaldırılırsa site eski, sade haliyle çalışmaya devam eder.
 * "Hareketi azalt" ayarı açık olan ziyaretçilerde animasyonlar kapanır.
 */

/* ---------- Sayfalar arası yumuşak geçiş ---------- */
@view-transition {
  navigation: auto;
}
header {
  view-transition-name: site-header;
}
.product-page .model-stage {
  view-transition-name: product-hero;
}
::view-transition-old(root) {
  animation: vt-out 0.3s cubic-bezier(0.4, 0, 1, 1) both;
}
::view-transition-new(root) {
  animation: vt-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
::view-transition-group(product-hero) {
  animation-duration: 0.55s;
  animation-timing-function: cubic-bezier(0.3, 0.9, 0.2, 1);
}
@keyframes vt-out {
  to {
    opacity: 0;
    transform: translateY(-14px);
  }
}
@keyframes vt-in {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
}

/* ---------- Açılış perdesi (oturumda bir kez) ---------- */
.intro-curtain {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: #fff;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 26px;
  animation: curtain-up 0.95s cubic-bezier(0.75, 0, 0.2, 1) 1.55s forwards;
}
.intro-curtain img {
  width: min(48vw, 240px);
  height: auto;
  animation: intro-logo 1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.intro-curtain span {
  width: 170px;
  height: 2px;
  background: #eef3e4;
  position: relative;
  overflow: hidden;
  border-radius: 2px;
}
.intro-curtain span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #ff9c19, #76a32b, #00a7e8);
  transform-origin: 0 50%;
  animation: intro-bar 1.25s 0.2s cubic-bezier(0.6, 0, 0.2, 1) both;
}
.no-intro .intro-curtain {
  display: none;
}
@keyframes curtain-up {
  to {
    transform: translateY(-101%);
    border-radius: 0 0 50% 50% / 0 0 18% 18%;
    visibility: hidden;
  }
}
@keyframes intro-logo {
  from {
    opacity: 0;
    transform: translateY(26px) scale(0.92);
  }
}
@keyframes intro-bar {
  from {
    transform: scaleX(0);
  }
}

/* Perde kalkarken giriş bölümünün sırayla belirmesi */
.journey-copy > .eyebrow,
.journey-copy > #scene-copy,
.journey-copy > .button,
.journey-copy > .scene-count,
.journey-art,
.journey-controls {
  animation: hero-in 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(var(--intro, 1.75s) + var(--o, 0) * 110ms);
}
.no-intro {
  --intro: 0.15s;
}
.journey-copy > #scene-copy {
  --o: 1;
}
.journey-copy > .button {
  --o: 2;
}
.journey-copy > .scene-count {
  --o: 3;
}
.journey-art {
  --o: 1;
  animation-name: hero-art-in;
  animation-duration: 1.3s;
}
.journey-controls {
  --o: 4;
}
@keyframes hero-in {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
}
@keyframes hero-art-in {
  from {
    opacity: 0;
    transform: scale(0.93) translateY(30px);
  }
}

/* ---------- Üstte kaydırma ilerleme çizgisi ---------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 200;
  background: linear-gradient(90deg, #ff9c19, #76a32b 55%, #00a7e8);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* ---------- Başlıkların satır satır açılması ---------- */
.motion-ready h2 .line {
  display: block;
  overflow: hidden;
  padding: 0 0.1em 0.18em 0;
  margin-bottom: -0.18em;
}
.motion-ready h2 .line > span {
  display: block;
  transform: translateY(112%) rotate(2.5deg);
  transform-origin: 0 100%;
  transition: transform 1.05s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition-delay: calc(var(--i, 0) * 130ms + 80ms);
}
.motion-ready h2.lines-in .line > span {
  transform: none;
}

/* ---------- Bölüm içi sıralı belirme ---------- */
.js-motion .steps article.reveal:nth-child(2) {
  transition-delay: 0.14s;
}
.js-motion .steps article.reveal:nth-child(3) {
  transition-delay: 0.28s;
}
.js-motion .spec-grid > div {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.7s,
    transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.js-motion .spec-grid.visible > div {
  opacity: 1;
  transform: none;
}
.spec-grid > div:nth-child(2) {
  transition-delay: 0.08s;
}
.spec-grid > div:nth-child(3) {
  transition-delay: 0.16s;
}
.spec-grid > div:nth-child(4) {
  transition-delay: 0.24s;
}
.spec-grid > div:nth-child(5) {
  transition-delay: 0.32s;
}
.spec-grid > div:nth-child(6) {
  transition-delay: 0.4s;
}
.spec-grid > div {
  position: relative;
}
.spec-grid > div::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--orange);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.spec-grid > div:hover::before {
  transform: scaleX(1);
}

/* ---------- Ürün kartları ---------- */
.product:nth-child(2) {
  --n: 1;
}
.product:nth-child(3) {
  --n: 2;
}
.product:nth-child(4) {
  --n: 3;
}
.product:nth-child(5) {
  --n: 4;
}
.product:nth-child(6) {
  --n: 5;
}
.motion-ready #products:not(.in-view) .product {
  opacity: 0;
  animation: none;
}
.motion-ready #products.in-view .product {
  animation: card-in 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(var(--n, 0) * 85ms);
}
.motion-ready #products.in-view .card-cutout {
  animation: cutout-in 0.95s cubic-bezier(0.25, 1.25, 0.4, 1) backwards;
  animation-delay: calc(var(--n, 0) * 85ms + 180ms);
}
.motion-ready #products.in-view .card-cutout:nth-child(2) {
  animation-delay: calc(var(--n, 0) * 85ms + 270ms);
}
.motion-ready #products.in-view .card-cutout:nth-child(3) {
  animation-delay: calc(var(--n, 0) * 85ms + 360ms);
}
@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.96);
  }
}
@keyframes cutout-in {
  from {
    opacity: 0;
    translate: 0 -90px;
  }
}
.product-clean-visual {
  transform: perspective(900px) rotateX(calc(var(--ty, 0) * -7deg)) rotateY(calc(var(--tx, 0) * 9deg));
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}
.product-clean-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at calc(50% + var(--tx, 0) * 45%) calc(50% + var(--ty, 0) * 45%),
    rgba(255, 186, 84, 0.26),
    transparent 58%
  );
  opacity: 0;
  transition: opacity 0.45s;
  pointer-events: none;
}
.product:hover .product-clean-visual::after {
  opacity: 1;
}
.product-clean-visual .card-cutout {
  translate: calc(var(--tx, 0) * var(--d, 10) * 1px) calc(var(--ty, 0) * var(--d, 10) * 1px);
  transition:
    transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
    translate 0.4s ease-out;
}
.product-clean-visual .card-cutout:nth-child(2) {
  --d: 18;
}
.product-clean-visual .card-cutout:nth-child(3) {
  --d: 28;
}
.product:hover .card-cutout:nth-child(2) {
  transform: translateY(-4px) rotate(21deg) scale(1.04);
}
.product:hover .card-cutout:nth-child(3) {
  transform: translateY(-9px) rotate(-10deg) scale(1.07);
}
.product-clean-visual > span {
  transition:
    transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
    background 0.3s,
    color 0.3s;
}
.product:hover .product-clean-visual > span {
  transform: rotate(45deg) scale(1.12);
  background: var(--orange);
  color: #fff;
}

/* ---------- Karşılaştırma sürgüsü (kuru kayısı / gün kurusu) ---------- */
.spotlight-photo.compare {
  --p: 50;
  position: relative;
  overflow: hidden;
  background: none;
  min-height: 560px;
  user-select: none;
  -webkit-user-select: none;
}
.compare-side {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.compare-gold {
  background: radial-gradient(circle at 50% 46%, #fffaea 0, #ffe9b4 62%, #ffd98a 100%);
  color: #7a4a00;
}
.compare-natural {
  background: radial-gradient(circle at 50% 46%, #7a5645 0, #4a3229 62%, #33211b 100%);
  color: #f7e6d3;
  clip-path: inset(0 0 0 calc(var(--p) * 1%));
}
.compare-side i {
  background: url(assets/clean-gold.png) 50% 50% / 300% 100% no-repeat;
  width: min(64%, 400px);
  aspect-ratio: 1;
  filter: drop-shadow(0 34px 26px rgba(70, 40, 10, 0.28));
  rotate: calc((var(--p) - 50) * 0.16deg);
  animation: compare-float 6s ease-in-out infinite;
}
.compare-natural i {
  /* dik gün kurusu: kuru kayısıyla aynı boyut ve konumda (geçişte üst üste oturur) */
  background: url(assets/compare-natural.png?v=2) center / 100% 100% no-repeat;
  filter: drop-shadow(0 34px 26px rgba(0, 0, 0, 0.45));
}
@keyframes compare-float {
  50% {
    transform: translateY(-14px);
  }
}
.compare-side span {
  position: absolute;
  bottom: 30px;
  left: 34px;
  font-size: 11px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
}
.compare-natural span {
  left: auto;
  right: 34px;
}
.compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--p) * 1%);
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.compare-handle b {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  display: grid;
  place-items: center;
  font:
    400 17px/1 Arial,
    sans-serif;
  letter-spacing: 3px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.22);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.compare:hover .compare-handle b,
.compare:has(input:active) .compare-handle b {
  transform: scale(1.13);
}
.compare:has(input:focus-visible) .compare-handle b {
  outline: 3px solid var(--blue, #00a7e8);
  outline-offset: 3px;
}
.compare input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: ew-resize;
  touch-action: pan-y;
  -webkit-appearance: none;
  appearance: none;
}
.compare-hint {
  position: absolute;
  top: 26px;
  left: 50%;
  translate: -50% 0;
  padding: 8px 15px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.5s;
}
.compare.touched .compare-hint {
  opacity: 0;
}

/* ---------- İş ortaklığı adımlarında ilerleyen çizgi ---------- */
.steps {
  position: relative;
}
.motion-ready .steps::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #ffab2d, #76a32b 55%, #00a7e8);
  transform: scaleX(var(--prog, 0));
  transform-origin: 0 50%;
  z-index: 1;
}
.motion-ready .steps article > span {
  display: inline-block;
  transform-origin: 0 100%;
  transition:
    transform 0.6s cubic-bezier(0.3, 1.5, 0.4, 1),
    opacity 0.5s;
  transform: scale(0.72);
  opacity: 0.35;
}
.motion-ready .steps article.on > span {
  transform: none;
  opacity: 1;
}

/* ---------- Mıknatıs butonlar ---------- */
.motion-ready .button,
.motion-ready .small-button {
  transition:
    transform 0.25s,
    background 0.25s,
    translate 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- Form onayı ---------- */
#form-status[data-state="ok"]:not(:empty) {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--green, #76a32b);
  animation: hero-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}
#form-status[data-state="ok"]:not(:empty)::before {
  content: "";
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green, #76a32b)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath d='M8.5 15.5l4.3 4.3 8.7-9.3' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
  animation: check-pop 0.7s cubic-bezier(0.3, 1.6, 0.4, 1) backwards;
}
@keyframes check-pop {
  from {
    transform: scale(0) rotate(-40deg);
  }
}

/* ---------- Küçük ekranlar ---------- */
@media (max-width: 1000px) {
  .spotlight-photo.compare {
    min-height: 0;
    height: 380px;
  }
  .motion-ready .steps::before {
    display: none;
  }
}
@media (max-width: 650px) {
  .spotlight-photo.compare {
    height: 340px;
  }
  .compare-side span {
    bottom: 20px;
    left: 20px;
  }
  .compare-natural span {
    left: auto;
    right: 20px;
  }
}

/* ---------- Hareketi azalt ayarı ---------- */
@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
  .intro-curtain,
  .scroll-progress {
    display: none;
  }
  .journey-copy > *,
  .journey-art,
  .journey-controls,
  .compare-side i,
  #form-status,
  #form-status::before {
    animation: none !important;
  }
  .product-clean-visual {
    transform: none;
  }
  .product-clean-visual .card-cutout {
    translate: none;
  }
}
