/* ============================================================
   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ı. Burası "Sıcak Minimalist"
   nötr varsayılanı; tema bu değişkenleri ezer.
   ============================================================ */

.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);

  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;
}

/* 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-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 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  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; } }

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

/* --- "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; }
/* R7: kontrol barı 3 satıra (aksiyon+swatch+görünüm) çıkınca alttaki ipucu barla
   ÇAKIŞIYORDU → ipucunu ÜSTE taşı; ilk etkileşimden (drag/dokunuş) sonra
   kalıcı gizle (.soket--etkilesildi) — premium, dağınık değil. */
.urun-3d-soket.soket--kontrollu::before { top: 12px; bottom: auto; }
.urun-3d-soket.soket--etkilesildi::before { opacity: 0 !important; visibility: hidden; }

/* ============================================================
   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(-1px); box-shadow: 0 8px 20px -8px rgba(0,0,0,.4); }
.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; }

/* R7: seçili malzeme/finish adı (Apple-pattern künye, swatch'ların üstünde) */
.soket-malzeme-ad {
  font: 600 11px/1.2 "Manrope", system-ui, sans-serif;
  letter-spacing: .05em; text-transform: uppercase;
  color: rgba(255,255,255,.94); text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,.45);
  min-height: 13px; transition: opacity .2s ease;
}

/* 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: 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(-1px); }
.soket-view-chip[aria-pressed="true"] { background: var(--soket-accent); color: #fff; }

/* CİLA (akıcılık — kayarken takılmanın gerçek-GPU kök sebebi):
   Frosted pill'lerin (buton/chip/ipucu) backdrop-filter blur'u, ALTINDAKİ canvas
   her kare yeniden çizilirken (kapak slide / 360° / fly-to) compositor'da pill başına
   gaussian blur'u TEKRARLATIR → kare düşüşü = takılma. Adaptör render aktifken
   `.soket--render-aktif` ekler; o anda blur'u kapatırız (pill arka planı zaten ~%78-82
   opak → okunur, görünüm korunur), hareket bitince blur geri döner → frosted his sürer.
   Net: slide sırasında compositor başına-kare blur maliyeti SIFIR. */
.urun-3d-soket.soket--render-aktif .soket-btn,
.urun-3d-soket.soket--render-aktif .soket-view-chip {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.urun-3d-soket.soket--render-aktif::before { backdrop-filter: none; -webkit-backdrop-filter: none; }
/* hareketi-azalt: blur geçişlerini hiç oynatma (additive, a11y) */
@media (prefers-reduced-motion: reduce) {
  .urun-3d-soket .soket-btn,
  .urun-3d-soket .soket-view-chip { transition: none; }
}

/* 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); }

/* 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 (websiteks WebsiteksCokme karşılığı)
   ============================================================ */
.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.soket--yukleniyor::after,
  .soket-iskele__ikon,
  .soket-hotspot { animation: none; }
  .soket-hotspot__etiket, .soket-btn, .soket-swatch, .soket-view-chip { transition: none; }
}
