/* =========================================================
   BK DİNAMİK LOGO
   • Açılış animasyonu (imleç → kod etiketi)
   • Fareyi takip eden 3B eğilme + parallax, yaklaşınca açılan parantezler
   • Sürekli canlı: süzülen kod, yanıp sönen imleç, ara ara glitch ve ışık
   • Tıkla/dokun: kod parçacığı patlaması + isim yeniden "çözülür"
   Ayarlar: --bk-size, renkler. Koyu tema için: class="bk-logo bk-logo--dark"
   ========================================================= */

.bk-logo {
  --bk-size: clamp(56px, 11vw, 140px);
  --bk-ink: #0B1F3A;
  --bk-accent: #2F5BD3;
  --bk-glow: #7FB2FF;
  --bk-bg: #F4F6FA;
  --bk-spot: rgba(47, 91, 211, .10);
  --bk-rain: .14;

  /* JS tarafından güncellenir */
  --mx: 0; --my: 0; --open: 0; --px: 50%; --py: 50%;

  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: .9em 1.3em 1em;
  font-size: var(--bk-size);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  color: var(--bk-ink);
  background: var(--bk-bg);
  overflow: hidden;
  isolation: isolate;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  outline: none;
}
.bk-logo:focus-visible { box-shadow: 0 0 0 .03em var(--bk-accent) inset; }

.bk-logo--dark {
  --bk-ink: #FFFFFF;
  --bk-accent: #5B8CFF;
  --bk-glow: #A9C8FF;
  --bk-bg: #0B1F3A;
  --bk-spot: rgba(91, 140, 255, .16);
  --bk-rain: .22;
}

/* fareyi takip eden yumuşak ışık (kenarlarda kaybolur) */
.bk-logo::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: radial-gradient(circle 2.2em at var(--px) var(--py), var(--bk-spot), transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 55%, transparent 100%);
          mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 55%, transparent 100%);
}

/* ---------- arka plan: süzülen kod (ters parallax) ---------- */
.bk-code-rain {
  position: absolute;
  inset: -.3em;
  z-index: -1;
  pointer-events: none;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  transform: translate(calc(var(--mx) * -.18em), calc(var(--my) * -.14em));
  animation: bk-fade-in 1.2s ease 2.6s both;
}
.bk-code-rain span {
  position: absolute;
  left: var(--x);
  top: 100%;
  font-size: var(--s, .16em);
  color: var(--bk-accent);
  opacity: 0;
  animation: bk-float var(--t, 9s) linear var(--d, 0s) infinite;
}

/* ---------- 3B sahne ---------- */
.bk-stage { perspective: 7em; }
.bk-tilt {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-style: preserve-3d;
  transform: rotateX(calc(var(--my) * -14deg)) rotateY(calc(var(--mx) * 18deg));
}

.bk-mark {
  position: relative;
  display: flex;
  align-items: center;
  gap: .06em;
  height: 1.45em;
  transform-style: preserve-3d;
}

/* açılıştaki imleç */
.bk-cursor {
  position: absolute;
  left: 50%; top: 50%;
  width: .07em; height: .95em;
  margin: -.475em 0 0 -.035em;
  background: var(--bk-ink);
  border-radius: .02em;
  opacity: 0;
  animation:
    bk-blink 1.1s steps(1) both,
    bk-cursor-out .32s cubic-bezier(.7,0,.3,1) 1.1s forwards;
}

/* < > — iki çubukla çizilir */
.bk-br { position: relative; width: .66em; height: .8em; }
.bk-br-l { transform: translate3d(calc(var(--mx) * .07em - var(--open) * .13em), calc(var(--my) * .05em), .45em); }
.bk-br-r { transform: translate3d(calc(var(--mx) * .07em + var(--open) * .13em), calc(var(--my) * .05em), .45em); }
.bk-br-in { position: absolute; inset: 0; }
.bk-br-in i {
  position: absolute;
  top: 50%;
  width: .74em; height: .085em;
  margin-top: -.0425em;
  background: var(--bk-accent);
  border-radius: .015em;
  transform: rotate(var(--r));
  animation: bk-draw .42s cubic-bezier(.2,.8,.2,1) 1.32s both;
}
.bk-br-l i { left: 0;  transform-origin: 0 50%; }
.bk-br-r i { right: 0; transform-origin: 100% 50%; }
.bk-br-l i:nth-child(1) { --r: -25deg; }
.bk-br-l i:nth-child(2) { --r:  25deg; }
.bk-br-r i:nth-child(1) { --r:  25deg; }
.bk-br-r i:nth-child(2) { --r: -25deg; }
.bk-br-l .bk-br-in { animation: bk-fly-l .62s cubic-bezier(.16,1,.3,1) 1.25s both; }
.bk-br-r .bk-br-in { animation: bk-fly-r .62s cubic-bezier(.16,1,.3,1) 1.25s both; }

/* BK */
.bk-word-par {
  position: relative;
  transform: translate3d(calc(var(--mx) * .035em), calc(var(--my) * .03em), .2em);
}
.bk-word {
  position: relative;
  display: flex;
  font-weight: 700;
  font-size: 1.12em;
  line-height: 1;
  letter-spacing: -.04em;
  margin: 0 .02em;
}
.bk-word b {
  display: block;
  font-weight: inherit;
  background: linear-gradient(110deg, var(--bk-ink) 0 40%, var(--bk-glow) 49%, #fff 50%, var(--bk-glow) 51%, var(--bk-ink) 60% 100%);
  background-size: 320% 100%;
  background-position: 0 0;
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  animation:
    bk-rise .62s cubic-bezier(.16,1,.3,1) calc(1.55s + var(--i) * .12s) both,
    bk-shine 1.1s cubic-bezier(.6,0,.2,1) calc(2.45s + var(--i) * .08s) both;
}
/* glitch katmanları */
.bk-g {
  position: absolute;
  inset: 0;
  font: inherit;
  letter-spacing: inherit;
  opacity: 0;
  pointer-events: none;
}
.bk-g1 { color: var(--bk-accent); animation: bk-glitch-a .55s steps(1) 1.6s both; }
.bk-g2 { color: var(--bk-glow);   animation: bk-glitch-b .55s steps(1) 1.62s both; }

/* / */
.bk-slash {
  position: relative;
  width: .5em; height: 1.12em;
  margin-right: .02em;
  transform: translate3d(calc(var(--mx) * .05em), 0, .32em) rotate(calc(var(--mx) * -9deg));
}
.bk-slash i {
  position: absolute;
  left: 72%; top: .16em;
  width: .085em; height: 1.36em;
  margin-left: -.0425em;
  background: var(--bk-accent);
  border-radius: .012em;
  transform-origin: 50% 0;
  transform: rotate(17deg);
  animation:
    bk-slash-drop .5s cubic-bezier(.3,1.5,.5,1) 2.02s both,
    bk-pulse 4.5s ease-in-out 3.6s infinite;
}
.bk-slash::after {
  content: "";
  position: absolute;
  left: 72%; top: .16em;
  width: .5em; height: 1.36em;
  margin-left: -.25em;
  background: radial-gradient(closest-side, var(--bk-glow), transparent);
  transform-origin: 50% 0;
  transform: rotate(17deg);
  opacity: 0;
  animation: bk-flash .7s ease-out 2.3s both;
}

/* ayraç + isim */
.bk-divider {
  width: .52em; height: .022em;
  margin: .2em 0 .26em;
  background: var(--bk-ink);
  transform: scaleX(calc(1 + var(--open) * .6));
  animation: bk-expand .7s cubic-bezier(.16,1,.3,1) 2.45s both;
}
.bk-name {
  display: flex;
  align-items: baseline;
  font-weight: 500;
  font-size: .2em;
  letter-spacing: .42em;
  line-height: 1;
  white-space: pre;
  transform: translate3d(calc(var(--mx) * -.15em), calc(var(--my) * -.1em), 0);
}
.bk-ch {
  display: inline-block;
  min-width: .62em;
  text-align: center;
  animation: bk-focus .7s cubic-bezier(.16,1,.3,1) calc(2.6s + var(--i) * .045s) both;
}
.bk-ch.is-scr { color: var(--bk-accent); font-family: 'JetBrains Mono', ui-monospace, monospace; }
.bk-caret {
  display: inline-block;
  width: .55em; height: .12em;
  margin-left: -.2em;
  background: var(--bk-accent);
  opacity: 0;
  animation: bk-caret 1.05s steps(1) 3.4s infinite;
}

/* tıklama patlaması */
.bk-burst {
  position: absolute;
  left: 0; top: 0;
  pointer-events: none;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: .17em;
  white-space: nowrap;
  color: var(--c, var(--bk-accent));
  animation: bk-burst .95s cubic-bezier(.12,.8,.3,1) forwards;
}
.bk-ring {
  position: absolute;
  width: .1em; height: .1em;
  margin: -.05em 0 0 -.05em;
  border: .02em solid var(--bk-accent);
  border-radius: 50%;
  pointer-events: none;
  animation: bk-ring .6s cubic-bezier(.2,.8,.2,1) forwards;
}

/* ---------- açılış bittikten sonra (JS .is-live ekler) ---------- */
.bk-logo.is-live .bk-cursor { display: none; }
.bk-logo.is-live .bk-br-in,
.bk-logo.is-live .bk-br-in i,
.bk-logo.is-live .bk-word b,
.bk-logo.is-live .bk-g,
.bk-logo.is-live .bk-divider,
.bk-logo.is-live .bk-ch { animation: none; }
.bk-logo.is-live .bk-slash i { animation: bk-pulse 4.5s ease-in-out infinite; }

/* tetiklenen efektler */
.bk-logo.is-live .bk-word.is-glitch .bk-g1 { animation: bk-glitch-a .45s steps(1) both; }
.bk-logo.is-live .bk-word.is-glitch .bk-g2 { animation: bk-glitch-b .45s steps(1) .02s both; }
.bk-logo.is-live .bk-word.is-glitch b      { animation: bk-jitter .45s steps(1) both; }
.bk-logo.is-live .bk-word.is-shine b       { animation: bk-shine 1.1s cubic-bezier(.6,0,.2,1) calc(var(--i) * .08s) both; }
.bk-logo.is-live .bk-slash.is-spin i       { animation: bk-spin .7s cubic-bezier(.5,-0.4,.3,1.4) both; }
.bk-logo.is-live .bk-mark.is-pop           { animation: bk-pop .45s cubic-bezier(.3,1.6,.5,1) both; }

/* ---------- keyframes ---------- */
@keyframes bk-blink { 0%{opacity:1} 22%{opacity:0} 44%{opacity:1} 66%{opacity:0} 82%,100%{opacity:1} }
@keyframes bk-cursor-out {
  0%   { opacity: 1; transform: none; }
  45%  { opacity: 1; transform: scaleY(1.15) scaleX(.6) rotate(17deg); }
  100% { opacity: 0; transform: scaleY(0) scaleX(.4) rotate(17deg); }
}
@keyframes bk-draw { from { transform: rotate(var(--r)) scaleX(0); } to { transform: rotate(var(--r)) scaleX(1); } }
@keyframes bk-fly-l { from { transform: translateX(1.25em) scale(.6); opacity: 0; } 30% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes bk-fly-r { from { transform: translateX(-1.25em) scale(.6); opacity: 0; } 30% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes bk-rise {
  from { clip-path: inset(100% 0 0 0); transform: translateY(.35em) skewY(6deg); }
  to   { clip-path: inset(-20% -10% -20% -10%); transform: none; }
}
@keyframes bk-shine { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes bk-glitch-a {
  0%   { opacity: .9; clip-path: inset(10% 0 62% 0); transform: translate(-.05em, 0); }
  18%  { opacity: .9; clip-path: inset(58% 0 14% 0); transform: translate(.04em, 0); }
  36%  { opacity: .9; clip-path: inset(30% 0 40% 0); transform: translate(-.03em, 0); }
  54%  { opacity: .9; clip-path: inset(75% 0 2% 0);  transform: translate(.05em, 0); }
  72%  { opacity: .9; clip-path: inset(4% 0 80% 0);  transform: translate(-.02em, 0); }
  90%, 100% { opacity: 0; }
}
@keyframes bk-glitch-b {
  0%   { opacity: .8; clip-path: inset(66% 0 8% 0);  transform: translate(.05em, 0); }
  18%  { opacity: .8; clip-path: inset(12% 0 70% 0); transform: translate(-.04em, 0); }
  36%  { opacity: .8; clip-path: inset(46% 0 30% 0); transform: translate(.03em, 0); }
  54%  { opacity: .8; clip-path: inset(20% 0 55% 0); transform: translate(-.05em, 0); }
  72%  { opacity: .8; clip-path: inset(85% 0 0 0);   transform: translate(.02em, 0); }
  90%, 100% { opacity: 0; }
}
@keyframes bk-jitter {
  0% { transform: translateX(.02em); } 20% { transform: translateX(-.025em) skewX(-6deg); }
  40% { transform: translateX(.015em); } 60% { transform: translateX(-.01em) skewX(4deg); } 80%, 100% { transform: none; }
}
@keyframes bk-slash-drop {
  from { transform: rotate(17deg) translateY(-1.2em) scaleY(0); opacity: 0; }
  40%  { opacity: 1; }
  to   { transform: rotate(17deg) translateY(0) scaleY(1); opacity: 1; }
}
@keyframes bk-spin { from { transform: rotate(17deg); } to { transform: rotate(377deg); } }
@keyframes bk-flash { 0% { opacity: 0; } 20% { opacity: .55; } 100% { opacity: 0; transform: rotate(17deg) scaleX(2.2); } }
@keyframes bk-pulse {
  0%, 70%, 100% { box-shadow: 0 0 0 0 transparent; }
  80% { box-shadow: 0 0 .18em .02em var(--bk-glow); }
}
@keyframes bk-expand { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes bk-focus {
  from { opacity: 0; filter: blur(.35em); transform: translateY(.6em) scale(1.4); }
  to   { opacity: 1; filter: blur(0); transform: none; }
}
@keyframes bk-caret { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes bk-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes bk-float {
  0%   { opacity: 0; transform: translateY(0) rotate(0); }
  15%, 85% { opacity: var(--bk-rain); }
  100% { opacity: 0; transform: translateY(-5.5em) rotate(var(--rot, 12deg)); }
}
@keyframes bk-burst {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(.4) rotate(0); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--rot)); }
}
@keyframes bk-ring { from { opacity: .8; transform: scale(1); } to { opacity: 0; transform: scale(14); } }
@keyframes bk-pop { 0% { transform: scale(1); } 35% { transform: scale(.94); } 100% { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .bk-logo *, .bk-logo *::before, .bk-logo *::after { animation: none !important; }
  .bk-cursor, .bk-code-rain, .bk-g, .bk-caret { display: none; }
}

/* =========================================================
   SİTEYE UYARLAMA (karabiyikberk.com)
   ========================================================= */

/* Sitenin temasına uyar: koyu temada koyu logo; zemin sayfaya karışır */
.bk-logo--auto {
  --bk-bg: transparent;
  --bk-spot: rgba(47, 91, 211, .08);
}
@media (prefers-color-scheme: dark) {
  .bk-logo--auto {
    --bk-ink: #FFFFFF;
    --bk-accent: #5B8CFF;
    --bk-glow: #A9C8FF;
    --bk-spot: rgba(91, 140, 255, .14);
    --bk-rain: .22;
  }
}

/* Sadece işaret: < BK/ > (isim, ayraç ve kod yağmuru yok) */
.bk-logo--mini {
  --bk-size: 30px;
  padding: .18em .2em;
}
.bk-logo--mini .bk-code-rain,
.bk-logo--mini .bk-divider,
.bk-logo--mini .bk-name { display: none; }
.bk-logo--mini::before { display: none; }

/* Ana sayfanın sol üst köşesi */
.site-mark {
  position: absolute;
  top: clamp(10px, 2.4vw, 22px);
  left: clamp(8px, 3vw, 30px);
  z-index: 2;
}

/* Lamba ışığında beliren logo */
.lamp-logo {
  position: absolute;
  left: var(--bulb-x);
  top: calc(var(--bulb-y) + min(34vh, 300px));
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
}
.lamp-logo .bk-logo {
  --bk-size: clamp(44px, 11vw, 96px);
  --bk-bg: transparent;
  cursor: default;
}
.lamp-logo .bk-logo::before { display: none; }
