/* ==========================================================================
   Hero — "Fikir sizden, <kod/> bizden."
   · Açılış perdesi (.intro): tüm ekranı kaplar, derleme sayacı 100'e
     ulaşınca yukarı doğru açılır
   · Tam ekran sahne: solda başlık, sağda canlı yazılan kod editörü ve
     kodun derlediği gerçek proje önizlemesi
   · İmlece tepki veren nokta ızgarası (canvas)
   · Kapanış: aşağı kaydırırken sahne küçülüp kartlaşır, satırlar ayrışarak
     yukarı süzülür, editör geriye yatar. JS --p (0→1) değişkenini yazar.
   ========================================================================== */

/* ==========================================================================
   Açılış perdesi
   ========================================================================== */
.intro { display: none; }
.js .intro {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: var(--c-graphite);
  color: var(--c-on-dark);
  clip-path: inset(0 0 0 0);
  transition: clip-path 1.15s var(--ease-io);
  cursor: pointer;
}
.js .intro.is-out { clip-path: inset(0 0 100% 0); }
.js .intro.is-gone { display: none; }
.intro__grid {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(245, 245, 242, 0.09) 1px, transparent 1.2px);
  background-size: 26px 26px;
  background-position: 13px 13px;
  mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
}
.intro__in {
  position: relative;
  display: grid; justify-items: center; gap: 18px;
  transition: transform 1s var(--ease-io), opacity 0.6s ease;
}
.intro.is-out .intro__in { transform: translateY(-12vh); opacity: 0; }
.intro__cmd { color: var(--c-on-dark-3); text-transform: none; letter-spacing: 0.02em; }
.intro__cmd span { color: var(--c-accent); margin-right: 6px; }
.intro__cmd b { font-weight: 400; color: var(--c-on-dark); margin-left: 6px; }
.intro__count {
  display: flex; align-items: flex-start;
  font-family: var(--f-display);
  font-weight: 500;
  font-size: clamp(88px, 15vw, 220px);
  line-height: 0.9;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
}
.intro__count small { font-size: 0.24em; margin: 0.35em 0 0 0.12em; color: var(--c-accent); letter-spacing: 0; }
.intro__bar { position: relative; width: min(420px, 70vw); height: 1px; background: var(--c-line-dark-strong); overflow: hidden; }
.intro__bar i { position: absolute; inset: 0; background: var(--c-accent); transform: scaleX(var(--k, 0)); transform-origin: left; }
.intro__brand { display: inline-flex; align-items: center; gap: 10px; color: var(--c-on-dark-3); }
.intro__mark { width: 16px; height: 16px; color: var(--c-on-dark); }

/* ==========================================================================
   Sahne iskeleti
   ========================================================================== */
.hero-wrap { position: relative; }
.hero {
  --p: 0;
  position: relative;
  height: calc(100svh - 64px);
  min-height: 620px;
  background: var(--c-paper);
}
/* Kapanırken sahneyi çevreleyen ince çerçeve */
.hero::before {
  content: "";
  position: absolute; z-index: 2;
  inset: calc(var(--p) * 4.5vh) calc(var(--p) * 3.5vw);
  border: 1px solid var(--c-line);
  border-radius: min(20px, calc(var(--p) * 80px));
  opacity: min(1, calc(var(--p) * 6));
  pointer-events: none;
}
.hero__stage {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--c-paper);
  clip-path: inset(calc(var(--p) * 4.5vh) calc(var(--p) * 3.5vw) round min(20px, calc(var(--p) * 80px)));
}

/* Nokta ızgarası + imleç ışığı */
.hero__grid { position: absolute; inset: 0; width: 100%; height: 100%; opacity: calc(1 - var(--p) * 0.6); }
.hero__glow {
  --mx: 70%; --my: 40%;
  position: absolute; inset: 0;
  background: radial-gradient(520px circle at var(--mx) var(--my), rgba(105, 108, 255, 0.08), transparent 70%);
  pointer-events: none;
  opacity: calc(1 - var(--p) * 3);
}

.hero__inner {
  position: relative;
  flex: 1; min-height: 0;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(40px, 5vw, 88px);
  padding-top: clamp(24px, 4vh, 56px);
}

/* ---------- Giriş animasyonu (perde açılınca) ---------- */
.js .hero-in { opacity: 0; transform: translateY(18px); transition: opacity 0.9s ease, transform 1.1s var(--ease-out); transition-delay: calc(0.2s + var(--i) * 0.09s); }
.js .is-loaded .hero-in { opacity: 1; transform: none; }

/* ---------- Metin ---------- */
.hero__copy { display: grid; gap: 28px; justify-items: start; }
.hero__kicker { display: inline-flex; align-items: center; gap: 10px; color: var(--c-ink-3); }
.hero__kicker .status__dot { flex: none; }

.hero__title {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: clamp(46px, 6vw, 96px);
  line-height: 1.0;
  letter-spacing: -0.048em;
}
.hero__title .line { display: block; overflow: hidden; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.hero__title .line > span { display: block; }
.js .hero__title .line > span {
  transform: translateY(110%) rotate(2deg);
  transform-origin: left bottom;
  transition: transform 1.3s var(--ease-out);
  transition-delay: calc(0.12s + var(--i) * 0.12s);
}
.js .is-loaded .hero__title .line > span { transform: none; }
.hero__dot { display: inline-block; width: 0.15em; height: 0.15em; margin-left: 0.05em; background: var(--c-accent); }

/* Kapanış: satırlar farklı hızlarda ayrışarak yukarı süzülür */
.hero__title .line { will-change: transform; }
.hero__title .line:nth-child(1) { transform: translate3d(0, calc(var(--p) * -70px), 0); opacity: calc(1 - var(--p) * 0.85); }
.hero__title .line:nth-child(2) { transform: translate3d(calc(var(--p) * -30px), calc(var(--p) * -48px), 0); opacity: calc(1 - var(--p) * 0.75); }
.hero__title .line:nth-child(3) { transform: translate3d(0, calc(var(--p) * -26px), 0); opacity: calc(1 - var(--p) * 0.65); }

[data-hero-fade], .hero__kicker { translate: 0 calc(var(--p) * -36px); }
/* Giriş bittikten sonra (is-settled) opaklığı kaydırma yönetir */
.js .is-settled .hero-in { transition: none; opacity: calc(1 - var(--p) * 1.1); }
.js .is-settled .hero__rail { opacity: calc(1 - var(--p) * 1.8); }

/* Ortadaki kod etiketi */
.hero__tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 0.74em;
  letter-spacing: -0.04em;
  color: var(--c-ink);
  white-space: nowrap;
}
.hero__tag b { font-weight: 400; color: var(--c-accent); }
.hero__caret {
  display: inline-block;
  width: 0.08em; height: 0.95em;
  margin: 0 0.04em 0 0.06em;
  background: var(--c-accent);
  animation: caret 1s steps(2, jump-none) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.hero__lead { max-width: 44ch; font-size: var(--fs-lead); line-height: 1.5; color: var(--c-ink-2); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Alt şerit ---------- */
.hero__rail {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding-block: 22px clamp(22px, 3.4vh, 34px);
}
.hero__rail::before { content: ""; position: absolute; top: 0; left: var(--gutter); right: var(--gutter); height: 1px; background: var(--c-line); }
.hero__scroll { display: inline-flex; align-items: center; gap: 12px; color: var(--c-ink-3); justify-self: start; }
.hero__scroll-line { position: relative; width: 1px; height: 28px; background: var(--c-line-strong); overflow: hidden; }
.hero__scroll-line::after {
  content: ""; position: absolute; left: 0; top: -40%;
  width: 1px; height: 40%;
  background: var(--c-accent);
  animation: hero-scroll 2.2s var(--ease-io) infinite;
}
@keyframes hero-scroll { to { top: 100%; } }
.hero__kinds { display: flex; gap: 22px; color: var(--c-ink-3); list-style: none; margin: 0; padding: 0; }
.hero__kinds li { position: relative; display: flex; gap: 8px; padding-bottom: 6px; transition: color 0.5s ease; }
.hero__kinds li b { font-weight: 400; color: var(--c-line-strong); transition: color 0.5s ease; }
.hero__kinds li::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px; background: var(--c-accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.7s var(--ease-out);
}
.hero__kinds li.is-on { color: var(--c-ink); }
.hero__kinds li.is-on b { color: var(--c-accent); }
.hero__kinds li.is-on::after { transform: scaleX(1); }
.hero__stack { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 14px; color: var(--c-ink-3); justify-self: end; }
.hero__stack span + span::before { content: "·"; margin-right: 14px; color: var(--c-line-strong); }

/* ==========================================================================
   Sahne — editör + derlenen önizleme + "Yayında" kartı
   ========================================================================== */
.hero__scene {
  --rx: 0deg; --ry: 0deg;
  position: relative;
  perspective: 1400px;
  padding: 24px 0 64px;
}
.hero__scene-in {
  position: relative;
  transform-origin: 50% 0%;
  transform: translate3d(0, calc(var(--p) * -40px), 0) scale(calc(1 - var(--p) * 0.1)) rotateX(calc(var(--p) * 10deg));
  opacity: calc(1 - max(0, var(--p) - 0.35) * 1.1);
}

.editor {
  position: relative;
  width: 88%;
  background: var(--c-white);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-m);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 50px 90px -50px rgba(23, 25, 29, 0.35), 0 12px 24px -16px rgba(23, 25, 29, 0.12);
  overflow: hidden;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.8s var(--ease-out);
}
.js .editor { opacity: 0; transform: translateY(40px) rotateX(10deg); transition: opacity 1s ease 0.45s, transform 1.4s var(--ease-out) 0.45s; }
.js .is-loaded .editor { opacity: 1; transform: rotateX(var(--rx)) rotateY(var(--ry)); }
.js .is-loaded .editor.is-ready { transition: transform 0.8s var(--ease-out); }

.editor__bar {
  display: flex; align-items: center; gap: 14px;
  height: 42px; padding: 0 16px;
  border-bottom: 1px solid var(--c-line);
  background: var(--c-paper);
}
.editor__dots { display: flex; gap: 6px; }
.editor__dots i { width: 9px; height: 9px; border-radius: 2px; background: var(--c-paper-3); }
.editor__tab {
  position: relative;
  align-self: stretch;
  display: flex; align-items: center;
  padding: 0 14px;
  margin-bottom: -1px;
  background: var(--c-white);
  border-left: 1px solid var(--c-line);
  border-right: 1px solid var(--c-line);
  color: var(--c-ink);
  text-transform: none;
}
.editor__tab::before { content: ""; position: absolute; left: -1px; right: -1px; top: -1px; height: 2px; background: var(--c-accent); }
.editor__meta { margin-left: auto; color: var(--c-ink-3); }

.editor__code {
  margin: 0;
  padding: 20px 0 22px;
  min-height: calc(9 * 1.75em + 42px);
  font-family: var(--f-mono);
  font-size: clamp(12px, 0.92vw, 14px);
  line-height: 1.75;
  color: var(--c-ink-2);
  counter-reset: ln;
  overflow: hidden;
}
.editor__code code { display: block; }
.ln { display: block; padding: 0 20px 0 0; white-space: pre; }
.ln::before {
  counter-increment: ln;
  content: counter(ln);
  display: inline-block;
  width: 44px;
  padding-right: 16px;
  text-align: right;
  color: var(--c-paper-3);
}
.ln.is-active { background: rgba(105, 108, 255, 0.05); }
.ln.is-active::before { color: var(--c-ink-3); }
.cur {
  display: inline-block;
  width: 2px; height: 1.15em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--c-accent);
  animation: caret 1s steps(2, jump-none) infinite;
}
.editor.is-typing .cur { animation: none; }

/* Sözdizimi renkleri — gri tonlar + tek vurgu */
.t-kw  { color: var(--c-accent); }
.t-str { color: var(--c-ink); }
.t-com { color: var(--c-ink-3); font-style: italic; }
.t-key { color: var(--c-ink-2); }
.t-fn  { color: var(--c-ink); font-weight: 500; }
.t-bool { color: var(--c-accent); }
.t-pun { color: var(--c-ink-3); }

/* Terminal (derleme çıktısı) */
.editor__term {
  display: grid; gap: 4px;
  min-height: 112px;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--c-line);
  background: var(--c-graphite);
  color: var(--c-on-dark-3);
  font-size: 11.5px;
  text-transform: none;
  letter-spacing: 0.01em;
}
.term__line { display: flex; gap: 10px; animation: term-in 0.4s var(--ease-out) both; }
.term__line b { width: 12px; font-weight: 400; color: var(--c-on-dark-3); }
.term__line.is-ok b { color: var(--c-accent); }
.term__line.is-ok span { color: var(--c-on-dark-2); }
.term__line.is-final span { color: var(--c-on-dark); }
@keyframes term-in { from { opacity: 0; transform: translateY(4px); } }

/* ---------- Derlenen önizleme ---------- */
.preview {
  position: absolute; z-index: 3;
  right: 0; bottom: 18px;
  width: 31%;
  opacity: 0;
  transform: translateY(30px) rotate(1.5deg);
  transition: opacity 0.7s ease, transform 1s var(--ease-out), width 0.6s var(--ease-out);
}
/* Bilgisayar önizlemesi: web, SaaS ve özel yazılım projeleri.
   Laptop kapağı açılarak gelir, kapanarak gider. */
.preview[data-frame="laptop"] { width: 70%; right: -9%; bottom: -30px; }
.preview[data-frame="window"] { width: 66%; right: -7%; bottom: -14px; }
.preview[data-frame="laptop"] .preview__dev { clip-path: none; }
.preview[data-frame="laptop"], .preview[data-frame="window"] { display: flex; flex-direction: column-reverse; align-items: flex-end; }
.preview[data-frame="laptop"] .preview__label, .preview[data-frame="window"] .preview__label { margin: 14px 0 0; }
.preview[data-frame="laptop"] .preview__dev, .preview[data-frame="window"] .preview__dev { width: 100%; }
.preview[data-frame="laptop"] .preview__scan { display: none; }
.preview[data-frame="laptop"] .device { perspective: 1600px; }
.preview[data-frame="laptop"] .device__frame {
  transform-origin: 50% 100%;
  transform: rotateX(-88deg);
  transition: transform 1.4s var(--ease-io);
}
.preview[data-frame="laptop"] .device__screen { opacity: 0; transition: opacity 0.6s ease; }
.preview[data-frame="laptop"].is-built .device__frame { transform: none; }
.preview[data-frame="laptop"].is-built .device__screen { opacity: 1; transition-delay: 0.6s; }
.preview[data-frame="laptop"] .device__base { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 40px 60px -26px rgba(23, 25, 29, 0.5); }
.preview.is-on { opacity: 1; transform: none; }
.preview__label {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 10px;
  padding: 5px 10px;
  background: var(--c-white);
  border: 1px solid var(--c-line);
  border-radius: 999px;
  color: var(--c-ink-2);
  text-transform: none;
  font-size: 10.5px;
  white-space: nowrap;
}
.preview__live { width: 6px; height: 6px; border-radius: 50%; background: var(--c-ink-3); transition: background 0.4s ease; }
.preview.is-built .preview__live { background: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); }
.preview__dev {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.2s var(--ease-io);
}
.preview.is-built .preview__dev { clip-path: inset(-20% -20% -20% -20%); }
.preview__dev .device, .preview__dev .sc-card { --w: 100%; width: 100%; }
/* Derleme çizgisi: önizleme oluşurken yukarıdan aşağı geçer */
.preview__scan {
  position: absolute; left: -6%; right: -6%; top: 34px;
  height: 2px;
  background: var(--c-accent);
  box-shadow: 0 0 18px 2px rgba(105, 108, 255, 0.45);
  opacity: 0;
  pointer-events: none;
}
.preview.is-scanning .preview__scan { animation: preview-scan 1.2s var(--ease-io) both; }
@keyframes preview-scan {
  0% { opacity: 0; transform: translateY(0); }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { opacity: 0; transform: translateY(var(--scan, 380px)); }
}

/* "Yayında" kartı */
.ship {
  position: absolute; z-index: 4;
  left: -28px; bottom: -44px;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px 12px 12px;
  background: var(--c-white);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-m);
  box-shadow: 0 24px 48px -24px rgba(23, 25, 29, 0.35);
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  transition: opacity 0.5s ease, transform 0.6s var(--ease-out);
}
.ship.is-on { opacity: 1; transform: none; }
.ship__icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--radius-s); background: var(--c-paper-2); color: var(--c-ink); }
.ship__icon svg { width: 20px; height: 20px; }
.ship__text { display: grid; gap: 2px; }
.ship__text b { font-weight: 500; font-size: 14px; }
.ship__text small { font-size: 10.5px; color: var(--c-ink-3); text-transform: none; letter-spacing: 0.01em; }
.ship__live { position: relative; width: 8px; height: 8px; margin-left: 8px; background: var(--c-accent); border-radius: 50%; }
.ship__live::after { content: ""; position: absolute; inset: -4px; border: 1px solid var(--c-accent); border-radius: 50%; animation: status-ping 2s var(--ease-out) infinite; }

/* ==========================================================================
   Kaydırma ile kapanış — yalnızca geniş ekranda sahne sabitlenir
   ========================================================================== */
@media (min-width: 1025px) and (min-height: 640px) and (prefers-reduced-motion: no-preference) {
  .hero-wrap { height: calc(100svh - 64px + 50svh); }
  .hero { position: sticky; top: 64px; }
  .hero-wrap + .sc-scroll { margin-top: 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .hero { height: auto; min-height: calc(100svh - 64px); display: flex; }
  .hero::before { display: none; }
  .hero__stage { position: relative; inset: auto; flex: 1; clip-path: none; }
  .hero__inner { grid-template-columns: 1fr; align-content: center; padding-block: 48px 24px; }
  .hero__scene { max-width: 640px; padding-left: 28px; }
  .hero__rail { grid-template-columns: auto 1fr; }
  .hero__kinds { display: none; }
}
@media (max-width: 640px) {
  .hero__title { font-size: clamp(38px, 10.5vw, 52px); }
  .hero__tag { font-size: 0.7em; }
  .hero__scene { padding: 8px 0 72px; }
  .editor { width: 100%; }
  .editor__code { font-size: 11px; }
  .ln::before { width: 32px; padding-right: 10px; }
  .preview { width: 36%; right: -4px; bottom: 30px; }
  .preview[data-frame="laptop"], .preview[data-frame="window"] { width: 78%; right: -4px; bottom: 24px; }
  .ship { left: 12px; bottom: 0; }
  .hero__stack { display: none; }
  .hero__rail { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .js .intro { display: none; }
  .js .editor { opacity: 1; transform: none; }
  .js .hero-in { opacity: 1; transform: none; }
  .js .hero__title .line > span { transform: none; }
  .preview__dev { transition: none; }
  .hero__scroll-line::after { animation: none; }
}
