/* ==========================================================
   ILMEXA | RESPONSIVE YAMASI
   Bu dosya en son yüklenir ve YALNIZCA media query içerir.
   Masaüstü (>1100px) görünümü hiçbir şekilde etkilenmez.
   ========================================================== */

/* ---------- TABLET VE ALTI (<=1100px) ---------- */
@media (max-width: 1100px) {

  /* Sayfa dışına taşan animasyon/3D dönüşlerin yatay kaydırma
     oluşturmasını engelle (sticky çalışmaya devam eder) */
  main { overflow-x: clip; }

  /* Scroll animasyonunun yatay başlangıç kayması taşma yaratmasın:
     tablet/telefonda yalnızca dikey (aşağıdan yukarı) belirsin */
  .reveal.fx-x:not(.in),
  .reveal.fx-x:nth-child(even):not(.in) {
    transform: translateY(22px);
  }

  /* Panel demonun 3D eğimi dar ekranda kenarlardan taşıp kesilmesin */
  .app { transform: none; }

  /* [1] Navbar ile hero arasındaki boşluk: sabit 120-150px yerine
     navbar yüksekliği (68px) + ekran yüksekliğine göre akışkan küçük pay */
  .hero {
    padding-top: 96px;
    padding-top: calc(68px + clamp(14px, 4.2svh, 44px));
  }

  /* [3] Hikâye bölümü: scroll alanı ekran yüksekliğiyle orantılı (svh) ve
     her sahneye yetecek kadar uzun; küçük ekranlarda alt sınır var */
  .story {
    height: 680vh;
    height: clamp(3600px, 680svh, 8400px);
  }
}

/* ---------- 1001px - 1100px: menü sığsın ---------- */
@media (min-width: 1001px) and (max-width: 1100px) {
  .menu { gap: 20px; font-size: .88rem; }
  .menu a { white-space: nowrap; }
  .nav-r .btn { padding-left: 18px; padding-right: 18px; white-space: nowrap; }
}

/* ---------- TABLET (<=1000px): hamburger menü ---------- */
@media (max-width: 1000px) {
  .menu {
    position: fixed;
    inset: 68px 0 auto;
    flex-direction: column;
    gap: 0;
    background: var(--bg2);
    border-bottom: 1px solid var(--bd);
    padding: 10px 24px;
    display: none;
    max-height: calc(100vh - 68px);
    max-height: calc(100dvh - 68px);
    overflow-y: auto;
    font-size: 1rem;
  }
  .menu.open { display: flex; }
  .menu a { padding: 14px 0; border-bottom: 1px solid var(--bd); }
  .menu a:last-child { border-bottom: 0; }
  .burger, .m-only { display: block; }
  .d-only { display: none; }
  .icon-btn { width: 44px; height: 44px; }
  .nav-in { gap: 12px; }
  .logo { white-space: nowrap; }
}

/* ---------- TABLET (<=980px) ---------- */
@media (max-width: 980px) {
  .hero { padding-bottom: 70px; }
  .hero-in { gap: 44px; }
  .mock { max-width: 640px; width: 100%; margin: 0 auto; }
  .sec { padding: 90px 0; }
  .foot-g { gap: 32px 24px; }
}

/* ---------- TELEFON (<=760px) ---------- */
@media (max-width: 760px) {
  .wrap { padding-left: 20px; padding-right: 20px; }
  .hero-in { gap: 36px; }
  .btns .btn { flex: 1 1 100%; }

  /* Fiyat kartları tek sütun */
  .pricing-grid {
    grid-template-columns: minmax(0, 1fr);
    max-width: 440px;
  }
  .plan { padding: 24px 20px; }

  /* Hero mini panel */
  .mock-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .m-card, .m-wide, .m-list, .m-ai { padding: 10px; min-width: 0; }
  .m-card b { font-size: 1.05rem; white-space: nowrap; }
  .mock .pop { font-size: .7rem; padding: 7px 11px; max-width: 100%; }

  /* Başlık ve metinler */
  h2 { margin-bottom: 32px; }
  .lead { font-size: 1.02rem; margin: 18px 0 24px; }
  .lead.c { margin-top: -14px; margin-bottom: 28px; }
  .toggle { margin: -12px 0 30px; flex-wrap: wrap; }

  .card { padding: 22px 20px; }
  .app-main { padding: 16px; }
  .kpi b { font-size: 1.2rem; }
  .cal { gap: 4px; }
  .cal div, .cal .day { min-height: 54px; padding: 4px; }

  /* Footer */
  .foot { padding: 48px 0 26px; }
  .foot-g { grid-template-columns: 1fr 1fr; gap: 28px 20px; }
  .foot-g > div:first-child { grid-column: 1 / -1; }
  .foot-g a { overflow-wrap: anywhere; }

  /* Modallar */
  .modal { padding: 14px; }
  .modal-box { padding: 26px 20px; max-height: 92vh; overflow-y: auto; }

  .toast { max-width: calc(100vw - 32px); text-align: center; }
}

/* ---------- HİKÂYE (SİNEMATİK) BÖLÜMÜ - TELEFON ---------- */
@media (max-width: 760px) {
  /* Başlık sabit menünün (68px) altında kalmasın */
  .cap { top: 84px; }
  .pin[data-s="5"] .cap { top: 84px; }
  .cap h2 { margin-bottom: 10px; }

  /* Telefon mockup'ı alttan sabit kalır, kısa ekranlarda küçülür */
  .phone { transform-origin: 50% 100%; }

  /* Son sahne: dashboard alta hizalı, ekran dışına taşmaz */
  .sdash {
    top: auto;
    bottom: 96px;
    transform: translateY(24px);
    padding: 12px;
    width: min(860px, 92vw);
  }
  .sdash.in { transform: none; }
  .sdash .kpis { gap: 8px; margin-bottom: 10px; }
  .sdash .kpi { padding: 10px 12px; }
  .sdash .kpi b { font-size: 1.1rem; }
  .sdash .chart { padding: 12px; }
  .sdash .bars { height: 84px; }
  .sd-top { margin-bottom: 10px; }
}
@media (max-width: 760px) and (max-height: 760px) { .phone { scale: .92; } }
@media (max-width: 760px) and (max-height: 720px) { .phone { scale: .84; } }
@media (max-width: 760px) and (max-height: 680px) { .phone { scale: .76; } }
@media (max-width: 760px) and (max-height: 640px) { .phone { scale: .68; } }
@media (max-width: 760px) and (max-height: 590px) { .phone { scale: .54; } }

/* ---------- KÜÇÜK TELEFON (<=430px) ---------- */
@media (max-width: 430px) {
  .foot-g a { font-size: .88rem; }
  .mock { padding: 10px; }
  .m-card b { font-size: .92rem; }
  .m-card, .m-wide, .m-list, .m-ai { padding: 8px; }
  h1 { font-size: clamp(2rem, 9.6vw, 2.4rem); }
  h2 { font-size: clamp(1.55rem, 7vw, 1.8rem); }
  .logo { font-size: 1.1rem; }
  .sec { padding: 68px 0; }
  .cta { padding: 90px 0; }
}

/* ---------- ÇOK DAR TELEFON (<=340px) ---------- */
@media (max-width: 340px) {
  .foot-g { grid-template-columns: 1fr; }
}

/* Hikâye son sahne - kısa telefon ekranları (örn. 320x568, 375x667) */
@media (max-width: 760px) and (max-height: 700px) {
  .cap h2 { font-size: 1.45rem; }
  .cap p { font-size: .9rem; }
  .sdash { padding: 10px; }
  .sdash .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .sdash .kpi { padding: 7px 6px; }
  .sdash .kpi small { font-size: .58rem; line-height: 1.2; display: block; }
  .sdash .kpi b { font-size: .95rem; }
  .sdash .chart { padding: 10px; }
  .sdash .bars { height: 56px; }
}


/* ==========================================================
   [2] SEKTÖR KARTLARI - TELEFON/TABLET: dokununca arka yüz açık kalır
   .is-flipped sınıfını yalnızca JS (cinema.js) dokunmatik cihazda
   yönetir (12 sn sonra otomatik kapanır, 2. dokunuşta hemen kapanır).
   Dönüş animasyonu mevcut .sector-inner geçişidir, değişmedi.
   Masaüstü hover davranışı etkilenmez.
   ========================================================== */
@media (hover: none) {
  /* Basılı tutunca geçici dönüş olmasın */
  #sectors .sector-card:active .sector-inner { transform: none; }
  /* Açık kalma durumu (yukarıdaki kuraldan SONRA gelmeli) */
  #sectors .sector-card.is-flipped .sector-inner { transform: rotateY(180deg); }
}

/* ==========================================================
   [3] HİKÂYE BÖLÜMÜ - YATAY (LANDSCAPE) KISA EKRANLAR
   Genişlikten bağımsız: yükseklik <=520px olan yatay telefonlar
   ========================================================== */
@media (max-width: 1100px) and (orientation: landscape) and (max-height: 520px) {
  .cap { left: 5%; right: auto; top: 50%; transform: translateY(-50%); width: min(440px, 42%); }
  .cap h2 { font-size: clamp(1.1rem, 3vw, 1.7rem); margin-bottom: 6px; }
  .cap p { font-size: clamp(.74rem, 1.8vw, .95rem); }
  .pin[data-s="5"] .cap { top: 50%; left: 5%; right: auto; width: min(440px, 34%); transform: translateY(-50%); text-align: left; }
  .pin[data-s="5"] .cap h2 { text-align: left; }

  .phone { --ty: 0; width: 228px; height: 440px; right: 7%; margin-right: 0; top: 72px; bottom: auto; transform-origin: 100% 0; }

  .sdash {
    top: 72px; bottom: auto; left: auto; right: 4%; margin-left: 0;
    width: min(56%, 560px); padding: 10px;
    transform: translateY(16px); transform-origin: 100% 0;
  }
  .sdash.in { transform: none; }
  .sd-grid { grid-template-columns: 1fr; }
  .sd-list { display: none; }
  .sdash .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
  .sdash .kpi { padding: 7px 6px; }
  .sdash .kpi small { font-size: .58rem; line-height: 1.2; display: block; }
  .sdash .kpi b { font-size: .95rem; }
  .sdash .chart { padding: 10px; }
  .sdash .bars { height: 50px; }
  .sd-top { margin-bottom: 8px; }

  .rail { bottom: 8px; }
  .rail li span { display: none; }
  .rail li { width: 30px; }
  .rail li i { width: 28px; height: 28px; margin-bottom: 0; font-size: .8rem; }
  .track { top: 14px; }
}
/* Yatay telefonda ekran yüksekliğine göre telefon maketi ölçeği */
@media (max-width: 1100px) and (orientation: landscape) and (max-height: 520px) { .phone { scale: .85; } .sdash { scale: 1; } }
@media (max-width: 1100px) and (orientation: landscape) and (max-height: 440px) { .phone { scale: .69; } }
@media (max-width: 1100px) and (orientation: landscape) and (max-height: 420px) { .phone { scale: .65; } }
@media (max-width: 1100px) and (orientation: landscape) and (max-height: 400px) { .phone { scale: .6; } }
@media (max-width: 1100px) and (orientation: landscape) and (max-height: 385px) { .phone { scale: .57; } }
@media (max-width: 1100px) and (orientation: landscape) and (max-height: 370px) { .phone { scale: .52; } }
@media (max-width: 1100px) and (orientation: landscape) and (max-height: 330px) { .phone { scale: .45; } .sdash { scale: .9; } }


/* ==========================================================
   [4] HİKÂYE BÖLÜMÜ - SAHNELERİN EKRANA SIĞMASI (telefon/tablet)
   Animasyonlar/JS aynı; yalnızca yerleşim değerleri.
   ========================================================== */

/* Dikey ekranda sahne illüstrasyonu (SVG "slice") ekran yüksekliğine göre
   aşırı yakınlaşıyor, karakterler kenarlarda kesiliyordu. Katman artık
   ekran genişliğine oranlı 4:3 kutu; SVG bu kutuda doğal oranında görünür. */
@media (max-width: 1100px) and (orientation: portrait) {
  .layer {
    inset: auto;
    left: 0;
    right: 0;
    top: calc(54% - 37.5vw);
    height: auto;
    aspect-ratio: 4 / 3;
  }
}

/* Telefon (dikey): telefon maketi ve dashboard kenarlara yapışmasın */
@media (max-width: 760px) and (orientation: portrait) {
  .phone { scale: .88; }
  .sdash {
    width: min(86vw, 560px);
    margin-left: calc(min(86vw, 560px) / -2);
  }
}
@media (max-width: 760px) and (orientation: portrait) and (max-height: 760px) { .phone { scale: .82; } }
@media (max-width: 760px) and (orientation: portrait) and (max-height: 720px) { .phone { scale: .76; } }
@media (max-width: 760px) and (orientation: portrait) and (max-height: 680px) { .phone { scale: .70; } }
@media (max-width: 760px) and (orientation: portrait) and (max-height: 640px) { .phone { scale: .64; } }
@media (max-width: 760px) and (orientation: portrait) and (max-height: 590px) { .phone { scale: .54; } }

/* Tablet: dashboard kenarlardan içeride dursun */
@media (min-width: 761px) and (max-width: 1100px) and (min-height: 521px) {
  .sdash {
    width: min(80vw, 720px);
    margin-left: calc(min(80vw, 720px) / -2);
  }
}

/* Tablet (dikey): başlık üstte, telefon ortada; illüstrasyonla çakışmasın */
@media (min-width: 761px) and (max-width: 1100px) and (orientation: portrait) {
  .cap { left: 6%; right: 6%; width: auto; top: 96px; transform: none; }
  .phone { right: 50%; margin-right: -135px; top: 58%; }
}

/* Yatay ekran (telefon/tablet): illüstrasyon sağ yarıda, başlık solda kalsın */
@media (max-width: 1100px) and (orientation: landscape) {
  .layer {
    inset: auto;
    left: auto;
    right: 0;
    width: 50%;
    height: auto;
    aspect-ratio: 16 / 9;
    top: calc(54% - 14.06vw);
  }
}
