/* ===== Anasayfa açılış sekansı: ziyaretçinin soruları =====
   Three.js sahnesi (js/story3d.js): gün doğumunda GES sahası → tozlu panele yaklaşma →
   panelin katmanlarına ayrılması → fırçayla temizlik → saha turu → kuş bakışı → güneş.
   Sorular: kirli mi, ne kadar kayıp, temizlik zarar verir mi, ne sıklıkla, hangi iller,
   süreç ve fiyat.

   Performans sözleşmesi (mobil öncelikli):
   - 3D sadece scroll değişince çiziliyor; HTML katmanlarında kare başına sadece
     transform ve opacity yazılıyor. Layout, filter, blur animasyonu yok.
   - Three.js sayfa yüklendikten sonra iniyor; WebGL yoksa ya da veri tasarrufu açıksa
     sahne CSS gökyüzüyle 3D'siz çalışıyor.
   JS yoksa: sadece açılış karesi (gökyüzü + başlık) görünür, sabitleme kapalıdır. */

.story {
  --hdr: 88px;
  --bar: 0px; /* mobildeki sabit arama çubuğu */
  --stage-h: calc(100svh - var(--hdr) - var(--bar));
  --night: #071E2E;
  --ink-soft: rgba(226, 240, 246, 0.9);
  --ink-mute: rgba(214, 236, 244, 0.66);
  --line: rgba(79, 182, 206, 0.3);
  --card: rgba(7, 30, 46, 0.86);
  --accent: var(--color-primary-light);
  --dirt: #C9935A;
  position: relative;
  background: var(--night);
  color: var(--color-white);
}

.story-stage {
  position: relative;
  height: var(--stage-h);
  min-height: 520px; /* dar ekranda kaldırılıyor: sahne alttaki arama çubuğunun altına taşmasın */
  overflow: clip;
  isolation: isolate;
  background: var(--night);
}
.story.is-live { height: calc(var(--story-len, 10) * var(--stage-h)); }
.story.is-live .story-stage { position: sticky; top: var(--hdr); }
.story-anchor { display: block; scroll-margin-top: var(--hdr); }

/* --- 3D sahne --- */
/* Three.js yüklenene kadar (ya da hiç yüklenmezse) görünen gökyüzü */
.story-sky {
  position: absolute;
  inset: 0;
  z-index: -3;
  background: linear-gradient(180deg, #0B2A3D 0%, #2B6B8A 46%, #F2B77A 74%, #2A2D27 100%);
}
.story-canvas {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.story.has-3d .story-canvas { opacity: 1; }

/* Patlatılmış görünüm etiketleri (geniş ekran); konum JS'ten (3D noktanın ekrandaki yeri) */
.story-labels { position: absolute; inset: 0; pointer-events: none; }
.story-labels span {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: -0.7em;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 500;
  color: #fff;
  opacity: 0;
  text-shadow: 0 1px 2px rgba(7, 30, 46, 0.8);
}
.story-labels span::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--accent);
}
.story-labels span[data-key="dust"] { color: #F7D9A8; }
.story-labels span[data-key="dust"]::before { background: var(--dirt); }

/* Okunabilirlik: metnin olduğu taraf koyulaşıyor, fotoğrafın kalanı açık kalıyor (statik) */
.story-scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7, 30, 46, 0.55) 0%, rgba(7, 30, 46, 0) 22%),
    linear-gradient(90deg, rgba(7, 30, 46, 0.9) 0%, rgba(7, 30, 46, 0.72) 30%, rgba(7, 30, 46, 0.15) 58%, rgba(7, 30, 46, 0) 75%),
    linear-gradient(0deg, rgba(7, 30, 46, 0.45) 0%, rgba(7, 30, 46, 0) 30%);
}

/* --- Görsel alan (kartlar): konumu JS'ten gelen CSS değişkenleriyle --- */
.story-vis,
.story-rail,
.story-chs { display: none; }
.story.is-live .story-vis,
.story.is-live .story-rail,
.story.is-live .story-chs { display: block; }

.story-vis {
  position: absolute;
  left: var(--vis-x, 50%);
  top: var(--vis-y, 10%);
  width: var(--vis-w, 45%);
  height: var(--vis-h, 80%);
  pointer-events: none;
}
.story-vis > * {
  position: absolute;
  left: 0;
  right: 0;
  opacity: 0;
  visibility: hidden;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 2px 6px rgba(2, 12, 20, 0.25), 0 18px 40px rgba(2, 12, 20, 0.35);
}
.story-chart,
.story-map,
.story-steps { top: 50%; translate: 0 -50%; }

.story-meter { width: min(100%, 420px); left: auto; right: 0; bottom: 8%; padding: 18px 20px; }
.story-meter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.story-meter-head strong {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.story-meter-track { height: 8px; border-radius: 4px; background: rgba(214, 236, 244, 0.14); overflow: hidden; }
.story-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #2A8FAA, var(--accent));
  transform-origin: 0 50%;
}

.story-chart { display: grid; gap: 16px; }
.story-chart-clip { position: relative; overflow: hidden; }
.story-chart-inner svg { width: 100%; height: auto; display: block; overflow: visible; }
.story-chart-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 0.85rem; color: var(--ink-soft); }
.story-chart-legend span { display: inline-flex; align-items: center; gap: 8px; }
.story-chart-legend span::before { content: ''; width: 22px; height: 0; border-top: 2px dashed var(--dirt); }
.story-chart-legend .is-clean::before { border-top: 3px solid var(--accent); }

.story-map-wrap { display: grid; gap: 20px; }
.story-map-box { position: relative; width: 100%; }
.story-map-box > svg { width: 100%; height: 100%; display: block; }
.story-map-img { width: 100%; height: 100%; display: block; }
.story-map-box > svg { visibility: hidden; } /* sadece ölçüm için; görüntüye çevriliyor */
.story-map-label {
  position: absolute;
  transform: translate(-50%, calc(-100% - 14px));
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 3px rgba(7, 30, 46, 0.9);
  pointer-events: none;
}
.story-city { position: absolute; width: 0; height: 0; opacity: 0; }
.story-city::before {
  content: '';
  position: absolute;
  left: -6px;
  top: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--night);
}
.story-city.is-hub::before {
  left: -9px;
  top: -9px;
  width: 18px;
  height: 18px;
  background: #fff;
  border: 4px solid var(--accent);
}
.story-city span {
  position: absolute;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  transform: translate(-50%, calc(-100% - 12px));
}
.story-city-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
.story-city-list li {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #fff;
}
.story-city-list li:first-child { border-color: var(--accent); color: var(--accent); }

.story-steps ol {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  width: 100%;
  list-style: none;
}
.story-steps li { display: grid; gap: 6px; align-content: start; }
.story-steps b {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: var(--night);
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.story-steps strong { font-size: 1rem; line-height: 1.3; }
.story-steps span { font-size: 0.86rem; line-height: 1.5; color: var(--ink-soft); }
.story-steps-line {
  position: absolute;
  left: 44px;
  right: 22%;
  top: var(--steps-line-y, 42px);
  height: 1.5px;
  background: rgba(214, 236, 244, 0.16);
}
.story-steps-line > i {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* --- Açılış metni --- */
.story-hero {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  pointer-events: none;
}
.story-hero > .container { width: 100%; }
.story-hero-copy { max-width: 40rem; pointer-events: auto; }
.story-hero h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.6rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  text-wrap: balance;
}
.story-hero h1 .hero-kicker {
  display: block;
  font-size: clamp(0.95rem, 1.3vw, 1.1rem);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.4;
  color: #F7D9A8;
  margin-bottom: 14px;
}
.story-hero p {
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.3vw, 1.15rem);
  max-width: 44ch;
  margin-bottom: 32px;
}

/* Hareketli sahnenin üstünde backdrop-filter her karede yeniden hesaplanır; burada düz renk */
.story .btn--outline {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: rgba(7, 30, 46, 0.45);
}
.story .btn--outline:hover { background: rgba(7, 30, 46, 0.7); }

.story-hint {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 22px;
  translate: -50% 0;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(240, 248, 251, 0.85);
  white-space: nowrap;
}
.story.is-live .story-hint { display: flex; }
.story-hint-track {
  position: relative;
  width: 2px;
  height: 34px;
  border-radius: 2px;
  background: rgba(240, 248, 251, 0.25);
  overflow: hidden;
}
.story-hint-track::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff;
  transform: translateY(-100%);
}
.story.is-inview .story-hint-track::after { animation: story-hint 1.8s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
@keyframes story-hint {
  0% { transform: translateY(-100%); }
  60%, 100% { transform: translateY(100%); }
}

/* --- Soru çubuğu --- */
.story-rail {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  padding-top: 18px;
  opacity: 0;
  visibility: hidden;
}
.story-rail-inner { display: flex; align-items: flex-start; gap: 6px; }
.story-rail button {
  flex: 1 1 0;
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 4px 0 10px;
  border: 0;
  background: none;
  color: var(--ink-mute);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: color 0.2s ease;
}
.story-rail button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-rail button:hover,
.story-rail button.is-active { color: #fff; }
.story-rail button:focus-visible,
.story-skip:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.story-rail button > i {
  position: relative;
  display: block;
  height: 2px;
  border-radius: 2px;
  background: rgba(214, 236, 244, 0.22);
  overflow: hidden;
}
.story-rail button > i > i {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.story-skip {
  flex: none;
  padding: 4px 0 4px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-mute);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.story-skip:hover { color: #fff; }

/* --- Soru metinleri --- */
.story-chs { position: absolute; inset: 0; pointer-events: none; }
.story-chs > .container { position: relative; height: 100%; }
.story-ch {
  position: absolute;
  left: 24px;
  top: 50%;
  width: min(27rem, 38%);
  opacity: 0;
  visibility: hidden;
}
.story-ch.is-on { pointer-events: auto; }
.story-ch h2 {
  font-size: clamp(1.7rem, 2.8vw, 2.4rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin-bottom: 16px;
  text-wrap: balance;
}
.story-ch p { color: var(--ink-soft); font-size: 1.02rem; line-height: 1.6; }
.story-ch p strong { color: #fff; font-weight: 600; }
.story-ch .hero-actions { margin-top: 26px; }

.story-checks { display: grid; gap: 14px; margin-top: 20px; list-style: none; }
.story-checks li { display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; }
.story-checks svg {
  width: 22px;
  height: 22px;
  margin-top: 1px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.story-checks span { font-size: 0.95rem; line-height: 1.45; color: var(--ink-soft); }
.story-checks strong { display: block; color: #fff; font-weight: 600; }

.story-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- Dar ekran: fotoğraf tam ekran, kartlar üstte, metin altta --- */
@media (max-width: 899px) {
  .story-stage { min-height: 360px; }
  .story-labels span { flex-direction: row-reverse; font-size: 0.78rem; gap: 6px; }
  .story-labels span::before { width: 16px; }
  .story-scrim {
    background:
      linear-gradient(180deg, rgba(7, 30, 46, 0.6) 0%, rgba(7, 30, 46, 0) 18%),
      linear-gradient(0deg, rgba(7, 30, 46, 0.96) 0%, rgba(7, 30, 46, 0.88) 38%, rgba(7, 30, 46, 0.55) 55%, rgba(7, 30, 46, 0) 74%);
  }
  .story-hero { align-items: flex-end; padding-bottom: 28px; }
  .story-hint { display: none !important; }

  .story-rail { padding-top: 12px; }
  .story-rail-inner { gap: 4px; }
  .story-rail button { font-size: 0.75rem; gap: 7px; padding-bottom: 6px; }
  .story-rail button span { visibility: hidden; }
  .story-rail button.is-active span { visibility: visible; overflow: visible; }
  .story-skip { font-size: 0.75rem; padding-left: 8px; }

  .story-ch { left: 16px; right: 16px; top: auto; bottom: 20px; width: auto; }
  .story-ch h2 { font-size: 1.45rem; margin-bottom: 10px; }
  .story-ch p { font-size: 0.95rem; line-height: 1.55; }
  .story-checks { grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 14px; }
  .story-checks li { grid-template-columns: 18px 1fr; gap: 8px; }
  .story-checks svg { width: 18px; height: 18px; }
  .story-checks span { font-size: 0.82rem; line-height: 1.35; }
  .story-checks span strong { font-size: 0.86rem; }

  .story-vis > * { padding: 16px; border-radius: 12px; }
  .story-meter { width: auto; left: 0; bottom: auto; top: 0; padding: 14px 16px; }
  .story-meter-head strong { font-size: 1.5rem; }
  .story-chart,
  .story-map,
  .story-steps { top: 0; translate: none; }
  .story-steps ol { grid-template-columns: 1fr 1fr; gap: 16px 14px; }
  .story-steps b { width: 30px; height: 30px; margin-bottom: 2px; font-size: 0.85rem; }
  .story-steps strong { font-size: 0.9rem; }
  .story-steps span { font-size: 0.78rem; line-height: 1.4; }
  .story-steps-line { display: none; }
  .story-city span { font-size: 0.75rem; }
  .story-map-wrap { gap: 12px; }
  .story-city-list { gap: 6px; }
  .story-city-list li { padding: 4px 9px; font-size: 0.75rem; }
  .story-city::before { left: -4px; top: -4px; width: 8px; height: 8px; border-width: 1.5px; }
  .story-city.is-hub::before { left: -6px; top: -6px; width: 12px; height: 12px; border-width: 3px; }
}
/* Kısa telefon ekranı: ikinci cümleler ve adım açıklamaları görsel olarak gizli (ekran
   okuyucuda kalıyor); kartlar JS ile kalan alana sığacak şekilde ölçekleniyor. */
@media (max-width: 899px) and (max-height: 760px) {
  .story-more {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .story-steps span { display: none; }
  .story-steps ol { gap: 12px 14px; }
  .story-ch h2 { font-size: 1.3rem; }
  .story-ch p { font-size: 0.92rem; }
  .story-ch .hero-actions { margin-top: 16px; }
}
@media (max-width: 640px) {
  /* Alttaki arama/WhatsApp çubuğu sekans oynarken gizleniyor (JS: html.story-bar-hidden);
     sahne ekranın tamamını kullanıyor. Açılış karesinde çubuk görünür, metin onun üstünde. */
  .story { --bar: 0px; }
  .story-hero { padding-bottom: calc(28px + 76px); }
  .mobile-cta-bar {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0s;
  }
  .story-bar-hidden .mobile-cta-bar {
    transform: translateY(110%);
    visibility: hidden;
    transition: transform 0.22s ease-in, visibility 0s linear 0.22s;
  }
  .story-hero .hero-actions { justify-content: flex-start; gap: 12px; }
  .story-hero .hero-actions .btn { flex: 1 1 100%; justify-content: center; }
  /* Dar ekranda gerekçelerin sadece başlıkları; açıklama satırları sığmıyor */
  .story-checks span { font-size: 0; }
  .story-checks span strong { font-size: 0.86rem; }
}

/* Hareket azaltma: yakınlaşma ve kayma yok, bölümler arasında kısa bir geçiş var
   (JS sahneyi her bölümün sabit karesine kilitliyor). */
.story.is-stepped .story-vis > *,
.story.is-stepped .story-ch,
.story.is-stepped .story-hero-copy { transition: opacity 0.3s ease; }
@media (prefers-reduced-motion: reduce) {
  .story.is-inview .story-hint-track::after { animation: none; }
}
