/* ============================================================
   soket.css — "3D Soket" görünümsüz çekirdek kabuğu.
   Sözleşme §2.5: tema SADECE CSS değişkeni override eder; markup +
   JS API beş temada bayt-bayt aynı.
   ============================================================ */

.urun-3d-soket {
  /* --- tema kancaları (override edilebilir) --- */
  --soket-bg: #f4efe9;                 /* sıcak kâğıt */
  --soket-bg-2: #ece4da;
  --soket-radius: 18px;
  --soket-shadow: 0 24px 60px -28px rgba(40, 28, 18, .45);
  --soket-aspect: 3 / 4;
  --soket-fg: #2a2118;
  --soket-muted: #8a7d6d;
  --soket-accent: #b0744a;             /* ceviz/terra */
  --soket-hotspot-font: 12px/1.2 "Manrope", system-ui, sans-serif;
  --soket-swatch-size: 30px;
  --soket-ar-buton: var(--soket-accent);
  --soket-glow: rgba(176, 124, 94, .26);

  position: relative;
  display: block;
  aspect-ratio: var(--soket-aspect);
  width: 100%;
  background:
    radial-gradient(120% 90% at 50% 18%, var(--soket-bg) 0%, var(--soket-bg-2) 100%);
  border-radius: var(--soket-radius);
  box-shadow: var(--soket-shadow);
  overflow: hidden;
  isolation: isolate;
  color: var(--soket-fg);
  -webkit-user-select: none; user-select: none;
  transform: translateZ(0);
  animation: soket-giris .9s cubic-bezier(.16,1,.3,1) both;
}

/* poster ve canvas tam kaplar, üst üste biner (poster altta = anında görüntü) */
.urun-3d-poster,
.urun-3d-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.urun-3d-poster {
  object-fit: cover;
  z-index: 1;
  opacity: 0;
  transition: opacity .5s ease;
}
.urun-3d-poster.soket-poster--yuklendi { opacity: 1; }
.urun-3d-soket.soket--yukleniyor .urun-3d-poster { opacity: .34; }

.urun-3d-canvas {
  z-index: 2;
  cursor: grab;
  touch-action: none;                  /* drag sayfayı kaydırmasın */
  background: transparent;             /* boş köşeler → kabuğun kâğıt zemini görünür */
}
.urun-3d-video { object-fit: cover; }  /* Apple §9a video-scrub modu */
.urun-3d-soket.soket--cevriliyor .urun-3d-canvas { cursor: grabbing; }

/* Üst mod (turntable/webgl) aktifken poster yalnızca yüklenmişse görünür base
   katmandır; src verilmediyse gizli kalır (kopuk-görsel ikonu sızmasın). */
.urun-3d-soket[data-mode="turntable"] .urun-3d-poster:not(.soket-poster--yuklendi),
.urun-3d-soket[data-mode="webgl-glb"] .urun-3d-poster:not(.soket-poster--yuklendi),
.urun-3d-soket[data-mode="webgl-glb-cinematic"] .urun-3d-poster:not(.soket-poster--yuklendi) { opacity: 0; }

/* --- yükleniyor shimmer --- */
.urun-3d-soket.soket--yukleniyor::after {
  content: "";
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background:
    linear-gradient(100deg, transparent 28%, rgba(255,255,255,.22) 48%, transparent 68%),
    radial-gradient(70% 50% at 50% 18%, var(--soket-glow), transparent 62%);
  background-size: 220% 100%;
  animation: soket-shimmer 1.2s ease-in-out infinite;
}
@keyframes soket-shimmer { from { background-position: 180% 0; } to { background-position: -80% 0; } }
@keyframes soket-giris {
  from { opacity: 0; transform: translateY(22px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.urun-3d-soket.soket--blur-ph { background-color: var(--soket-bg-2); }

.soket-etiket {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(10,8,6,.42);
  color: rgba(255,255,255,.82);
  font: 700 11px/1 "Manrope", system-ui, sans-serif;
  letter-spacing: .12em;
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 32px -24px #000;
}
.soket-etiket .nokta {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--soket-accent);
  box-shadow: 0 0 0 5px rgba(176,124,94,.15), 0 0 18px rgba(176,124,94,.55);
}

/* --- "döndür" ipucu (ilk etkileşime kadar) — turntable + webgl --- */
.urun-3d-soket[data-mode="turntable"]::before,
.urun-3d-soket[data-mode="webgl-glb"]::before,
.urun-3d-soket[data-mode="webgl-glb-cinematic"]::before {
  content: "↻ döndürmek için sürükleyin";
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  z-index: 6; pointer-events: none;
  font: 500 12px/1 "Manrope", system-ui, sans-serif; letter-spacing: .02em;
  color: var(--soket-fg);
  background: rgba(255,255,255,.7); backdrop-filter: blur(6px);
  padding: 7px 12px; border-radius: 999px;
  opacity: .9; transition: opacity .4s ease;
}
.urun-3d-soket.soket--cevriliyor::before { opacity: 0; }
/* R3: otomatik kontrol barı varken "döndür" ipucu yukarı kaysın (çakışma yok) */
.urun-3d-soket.soket--kontrollu::before { bottom: 68px; }

/* ============================================================
   KONTROL ÇUBUĞU (opsiyonel — site/kiosk markup'a koyarsa stillenir)
   ============================================================ */
.soket-kontrol {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 7;
  display: flex; flex-direction: column; gap: 9px; align-items: center;
  padding: 14px 14px 13px;
  background: linear-gradient(to top, rgba(0,0,0,.20), rgba(0,0,0,.04) 60%, transparent);
}
/* her grup (aksiyonlar · swatch'lar · görünüm chip'leri) kendi satırında ortalı */
.soket-kontrol > .soket-aksiyonlar,
.soket-kontrol > .soket-swatchlar,
.soket-kontrol > .soket-views { display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
/* R6: "Kapakları Aç" + "AR'da görün" yan yana (mobilde dikey yığılmayı azaltır) */
.soket-aksiyonlar { display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.soket-btn {
  font: 600 13px/1 "Manrope", system-ui, sans-serif;
  color: var(--soket-fg);
  background: rgba(255,255,255,.82); backdrop-filter: blur(8px);
  border: 1px solid rgba(0,0,0,.06);
  padding: 10px 16px; border-radius: 999px; cursor: pointer;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.soket-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -12px rgba(0,0,0,.46); }
.soket-btn:active { transform: translateY(0); }
.soket-btn[aria-pressed="true"] { background: var(--soket-accent); color: #fff; }
.soket-btn--ar { background: var(--soket-ar-buton); color: #fff; }

/* renk/malzeme swatch'leri */
.soket-swatchlar { display: inline-flex; gap: 8px; align-items: center; }
.soket-swatch {
  width: var(--soket-swatch-size); height: var(--soket-swatch-size);
  border-radius: 50%; cursor: pointer; padding: 0;
  border: 2px solid rgba(255,255,255,.9);
  box-shadow: 0 2px 8px -2px rgba(0,0,0,.5), inset 0 0 0 1px rgba(0,0,0,.08);
  transition: transform .15s ease;
}
.soket-swatch:hover { transform: translateY(-1px) scale(1.08); }
.soket-swatch[aria-pressed="true"] { outline: 2px solid var(--soket-accent); outline-offset: 2px; }

/* adlandırılmış görünüm "chip"leri (setView — Apple §9c kamera state-machine) */
.soket-views { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.soket-view-chip {
  font: 600 12px/1 "Manrope", system-ui, sans-serif;
  color: var(--soket-fg);
  background: rgba(255,255,255,.78); backdrop-filter: blur(8px);
  border: 1px solid rgba(0,0,0,.07);
  padding: 8px 13px; border-radius: 999px; cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.soket-view-chip:hover { transform: translateY(-2px); }
.soket-view-chip[aria-pressed="true"] { background: var(--soket-accent); color: #fff; }

/* hotspot 2D overlay (R3 · anchor2d) — soketin içinde, kareye göre konumlu noktalar */
.soket-hotspot-katman { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.soket-hotspot {
  position: absolute; transform: translate(-50%, -50%);
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
  padding: 0; border: 0; appearance: none; pointer-events: auto;
  background: #fff; box-shadow: 0 0 0 6px rgba(176,116,74,.25), 0 2px 6px -1px rgba(0,0,0,.4);
  font: var(--soket-hotspot-font);
  animation: soket-hotspot-nabiz 2.4s ease-out infinite;
}
.soket-hotspot::after {
  content: ""; position: absolute; inset: 5px; border-radius: 50%;
  background: var(--soket-accent);
}
.soket-hotspot:hover, .soket-hotspot:focus-visible { animation: none; box-shadow: 0 0 0 8px rgba(176,116,74,.32), 0 3px 9px -1px rgba(0,0,0,.45); }
@keyframes soket-hotspot-nabiz {
  0%   { box-shadow: 0 0 0 4px rgba(176,116,74,.30), 0 2px 6px -1px rgba(0,0,0,.4); }
  70%  { box-shadow: 0 0 0 12px rgba(176,116,74,0), 0 2px 6px -1px rgba(0,0,0,.4); }
  100% { box-shadow: 0 0 0 4px rgba(176,116,74,0), 0 2px 6px -1px rgba(0,0,0,.4); }
}
/* hotspot etiketi — hover/focus'ta beliren küçük künye */
.soket-hotspot__etiket {
  position: absolute; left: 50%; bottom: calc(100% + 9px); transform: translateX(-50%) translateY(4px);
  white-space: nowrap; pointer-events: none;
  font: 600 11px/1 "Manrope", system-ui, sans-serif; letter-spacing: .01em;
  color: #fff; background: rgba(28,20,12,.92); backdrop-filter: blur(4px);
  padding: 6px 9px; border-radius: 7px;
  opacity: 0; transition: opacity .18s ease, transform .18s ease;
}
.soket-hotspot:hover .soket-hotspot__etiket,
.soket-hotspot:focus-visible .soket-hotspot__etiket { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── TOGGLE-SCRUB KİLİDİ ── */
.soket-hotspot-katman { transition: opacity .3s cubic-bezier(.4,0,.2,1); }
.urun-3d-soket.soket--gecisli .soket-hotspot-katman { opacity: 0; }
.urun-3d-soket.soket--gecisli .soket-hotspot { pointer-events: none; }

/* a11y: klavye odağı her kontrolde görünür */
.soket-btn:focus-visible, .soket-view-chip:focus-visible { outline: 2px solid var(--soket-accent); outline-offset: 2px; }
.soket-swatch:focus-visible, .soket-hotspot:focus-visible { outline: 2px solid var(--soket-accent); outline-offset: 3px; }

/* ============================================================
   "Sıfır kırık görünüm" iskelesi
   ============================================================ */
.urun-3d-soket.soket--iskele { display: grid; place-items: center; }
.soket-iskele {
  position: absolute; inset: 0; z-index: 8;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; padding: 28px;
  background: radial-gradient(120% 90% at 50% 30%, var(--soket-bg) 0%, var(--soket-bg-2) 100%);
}
.soket-iskele__ikon { font-size: 30px; opacity: .55; animation: soket-don 3.2s linear infinite; }
.soket-iskele__bas  { font: 600 16px/1.3 "Manrope", system-ui, sans-serif; }
.soket-iskele__alt  { font: 400 13px/1.5 "Manrope", system-ui, sans-serif; color: var(--soket-muted); max-width: 30ch; }
@keyframes soket-don { to { transform: rotate(360deg); } }

/* ============================================================
   KİOSK — büyük dokunma hedefi (data-kiosk="true")
   ============================================================ */
.urun-3d-soket[data-kiosk="true"] { --soket-swatch-size: 44px; }
.urun-3d-soket[data-kiosk="true"] .soket-btn { font-size: 16px; padding: 14px 22px; }
.urun-3d-soket[data-kiosk="true"] .soket-hotspot { width: 26px; height: 26px; }

/* ============================================================
   prefers-reduced-motion — hareketi kıs (drag yine çalışır)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .urun-3d-poster { transition: none; }
  .urun-3d-soket { animation: none; transform: none !important; }
  .urun-3d-soket.soket--yukleniyor::after,
  .soket-iskele__ikon,
  .soket-hotspot { animation: none; }
  .soket-hotspot__etiket, .soket-btn, .soket-swatch, .soket-view-chip,
  .soket-hotspot-katman { transition: none; }
}

/* === ZENGİN POSTER ADAPTER (Faz-0 foto-gerçekçi) === */
.urun-3d-poster--arka { z-index: 1; }

.urun-3d-poster { transition: opacity .6s cubic-bezier(.4,0,.2,1); }

@keyframes soket-kenburns {
  0% { transform: scale(1.02) translate(0,0); }
  100% { transform: scale(1.09) translate(-1.5%, -1%); }
}
.soket-poster--canli { animation: soket-kenburns 16s ease-in-out infinite alternate; }
.urun-3d-soket.soket--detay-acik .soket-poster--canli { animation-play-state: paused; }

.soket-detay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(12,10,8,.62);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .32s ease, visibility 0s .32s;
}
.soket-detay.acik {
  opacity: 1;
  visibility: visible;
  transition: opacity .32s ease;
}
.soket-detay__gorsel,
.soket-detay__zoom {
  width: min(82%, 360px);
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  box-shadow: 0 30px 60px -28px rgba(0,0,0,.8);
  transform: translateY(10px) scale(.98);
  transition: transform .4s cubic-bezier(.16,1,.3,1);
  object-fit: cover;
}
.soket-detay.acik .soket-detay__gorsel,
.soket-detay.acik .soket-detay__zoom { transform: none; }
.soket-detay__zoom { background-repeat: no-repeat; }

.soket-detay__kunye {
  text-align: center;
  max-width: 34ch;
  color: #f3ede6;
}
.soket-detay__baslik {
  font: 600 17px/1.2 "Manrope",system-ui,sans-serif;
  letter-spacing: .01em;
  margin-bottom: 6px;
  color: #fff;
}
.soket-detay__metin {
  font: 400 13px/1.6 "Manrope",system-ui,sans-serif;
  color: rgba(243,237,230,.82);
}

.soket-detay__kapat {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #fff;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  cursor: pointer;
  transition: background .2s ease, transform .2s ease;
}
.soket-detay__kapat:hover {
  background: rgba(255,255,255,.22);
  transform: rotate(90deg);
}
.soket-detay__kapat:focus-visible {
  outline: 2px solid var(--soket-accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .urun-3d-poster { transition: none; }
  .soket-poster--canli { animation: none !important; }
  .soket-detay,
  .soket-detay__gorsel,
  .soket-detay__zoom,
  .soket-detay__kapat { transition: none; }
  .soket-detay__gorsel,
  .soket-detay__zoom { transform: none; }
}
