/* ============================================================
   onurkonuk.net — tek CSS dosyası
   Konsept: sayfa, açık bir kod editörü penceresi.
   Koyu tema sitenin kimliğidir (varsayılan tasarım); açık tema
   [data-theme="light"] ile ya da sistem tercihiyle gelir.
   ============================================================ */

/* ---------- 1. Design token'ları ---------- */
:root {
  --bg:       #0D1117;
  --surface:  #161B22;
  --surface2: #1F2630;
  --border:   #30363D;
  --text:     #E6EDF3;
  --muted:    #8B949E;
  --accent:   #2DD4BF;
  --accent-ink: #0D1117;

  /* sözdizimi renkleri */
  --tk-k: #C678DD;  /* keyword   */
  --tk-s: #98C379;  /* string    */
  --tk-f: #61AFEF;  /* fonksiyon */
  --tk-v: #E06C75;  /* değişken  */
  --tk-n: #D19A66;  /* sayı      */
  --tk-c: #9198A1;  /* yorum — bilerek yüksek kontrast: gerçek içerik taşıyor */

  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --chrome-h: 84px;
  --statusbar-h: 44px;
  --radius: 10px;

  color-scheme: dark;
}

[data-theme="light"] {
  --bg:       #FFFFFF;
  --surface:  #F6F8FA;
  --surface2: #EFF2F5;
  --border:   #D0D7DE;
  --text:     #1F2328;
  --muted:    #59636E;
  --accent:   #0F766E;
  --accent-ink: #FFFFFF;

  --tk-k: #CF222E;
  --tk-s: #116329;
  --tk-f: #8250DF;
  --tk-v: #953800;
  --tk-n: #0550AE;
  --tk-c: #59636E;

  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg:       #FFFFFF;
    --surface:  #F6F8FA;
    --surface2: #EFF2F5;
    --border:   #D0D7DE;
    --text:     #1F2328;
    --muted:    #59636E;
    --accent:   #0F766E;
    --accent-ink: #FFFFFF;

    --tk-k: #CF222E;
    --tk-s: #116329;
    --tk-f: #8250DF;
    --tk-v: #953800;
    --tk-n: #0550AE;
    --tk-c: #59636E;

    color-scheme: light;
  }
}

@media (prefers-contrast: more) {
  :root { --border: #6E7681; --muted: #B1BAC4; }
  [data-theme="light"] { --border: #6E7781; --muted: #424A53; }
}
/* otomatik temada sistem açıksa da kontrast kuralı kazansın (özgüllük: 0,2,0) */
@media (prefers-contrast: more) and (prefers-color-scheme: light) {
  :root:not([data-theme]) { --border: #6E7781; --muted: #424A53; }
}

/* ---------- 2. Font ---------- */
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- 3. Reset + temel ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--chrome-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 clamp(1rem, 0.95rem + 0.25vw, 1.125rem)/1.65 var(--sans);
  padding-bottom: calc(var(--statusbar-h) + env(safe-area-inset-bottom, 0px));
}

img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.6em; }
p { margin: 0 0 1em; }
ul, ol, dl { margin: 0; padding: 0; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 8px; font: 600 0.85rem var(--mono);
  text-decoration: none; transform: translateY(-200%);
}
.skip-link:focus-visible { transform: none; }

/* ---------- 4. Editör kromu: üst bar + sekmeler ---------- */
.chrome-top {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.winbar {
  display: flex; align-items: center; gap: 12px;
  height: 38px; padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.win-dots { display: inline-flex; gap: 7px; }
.win-dots i {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--border);
}
.win-dots i:nth-child(1) { background: #EC6A5E; }
.win-dots i:nth-child(2) { background: #F4BF4F; }
.win-dots i:nth-child(3) { background: #61C554; }

.win-title {
  font: 400 0.78rem var(--mono);
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.tabbar { overflow-x: auto; scrollbar-width: none; }
.tabbar::-webkit-scrollbar { display: none; }
.tabbar ul { display: flex; list-style: none; }
.tabbar a {
  display: block; padding: 12px 16px;
  font: 400 0.8rem var(--mono);
  color: var(--muted); text-decoration: none;
  border-right: 1px solid var(--border);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabbar a:hover { color: var(--text); background: var(--surface); }
.tabbar a.active, .tabbar a[aria-current] {
  color: var(--text);
  background: var(--surface);
  border-bottom-color: var(--accent);
}

/* ---------- 5. Durum çubuğu ---------- */
.statusbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  height: calc(var(--statusbar-h) + env(safe-area-inset-bottom, 0px));
  padding: 0 16px env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-top: 1px solid var(--border);
  font: 400 0.75rem var(--mono);
  color: var(--muted);
}

.sb-progress {
  position: absolute; top: -2px; left: 0; width: 100%; height: 2px;
  background: var(--accent);
  transform: scaleX(0); transform-origin: 0 50%;
}

.sb-section { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sb-badge { color: var(--tk-s); opacity: 0; transition: opacity 0.3s ease; white-space: nowrap; }
.sb-badge.show { opacity: 1; }

.sb-lang { display: flex; gap: 2px; }
.sb-lang a {
  padding: 6px 8px; color: var(--muted); text-decoration: none; border-radius: 6px;
}
.sb-lang a:hover { color: var(--text); background: var(--surface2); }
.sb-lang a[aria-current] { color: var(--accent); font-weight: 700; }

.sb-theme {
  font: inherit; color: var(--muted);
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 10px; cursor: pointer; white-space: nowrap;
}
.sb-theme:hover { color: var(--text); border-color: var(--muted); }
html:not(.js) .sb-theme { display: none; }

/* ---------- 6. Bölüm düzeni ---------- */
.sec {
  max-width: 1060px;
  margin-inline: auto;
  padding: clamp(72px, 10vh, 120px) 20px;
}

.sec-file {
  font: 400 0.8rem var(--mono);
  color: var(--accent);
  margin-bottom: 4px;
}
.sec-file::before { content: "// "; color: var(--muted); }

h2 { font-size: clamp(1.5rem, 1.3rem + 1vw, 2.1rem); letter-spacing: -0.01em; }

.sec-grid {
  display: grid; gap: 32px;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: start; margin-top: 24px;
}

.prose { max-width: 62ch; }
.prose em { color: var(--accent); font-style: italic; }

/* ---------- 7. Kod panelleri ---------- */
.code-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 12px 40px -18px rgba(0, 0, 0, 0.5);
}

.code-head {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.code-head .code-file { font: 400 0.75rem var(--mono); color: var(--muted); }

.code {
  margin: 0; padding: 18px 20px;
  font: 400 0.84rem/1.75 var(--mono);
  color: var(--text);
  overflow-x: auto;
  tab-size: 4;
}

.tk-k { color: var(--tk-k); }
.tk-s { color: var(--tk-s); }
.tk-f { color: var(--tk-f); }
.tk-v { color: var(--tk-v); }
.tk-n { color: var(--tk-n); }
.tk-c { color: var(--tk-c); font-style: italic; }
.tk-p { color: var(--muted); }
.tk-ok { color: var(--tk-s); }

/* ---------- 8. Hero ---------- */
.hero {
  position: relative;
  max-width: none;
  min-height: calc(100vh - var(--statusbar-h));
  min-height: calc(100svh - var(--statusbar-h));
  display: grid; align-items: center;
  overflow: hidden;
  padding-top: 40px;
}

.hero-bg { position: absolute; inset: 0; z-index: -1; }

/* Sahne görseli (stüdyoda, laptop başında): renkleri siteyle aynı, belirgin durur;
   sola doğru zemine erir ki metin alanı temiz kalsın */
.hero-bg img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: 24% 28%;
  filter: brightness(0.92) saturate(1.05);
  opacity: 0.85;
  -webkit-mask-image: linear-gradient(100deg, transparent 8%, #000 40%);
  mask-image: linear-gradient(100deg, transparent 8%, #000 40%);
}

/* turkuaz parıltı */
.hero-bg::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(52% 44% at 76% 34%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 72%);
}

/* sol taraf metin için koyu kalır, alt kenar bir sonraki bölüme erir */
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(95deg, var(--bg) 10%, color-mix(in srgb, var(--bg) 55%, transparent) 40%, transparent 62%),
    linear-gradient(to top, var(--bg), transparent 16%);
}

:root[data-theme="light"] .hero-bg img { opacity: 0.45; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .hero-bg img { opacity: 0.45; }
}

/* etrafta süzülen kod glifleri */
.float-glyph {
  position: absolute;
  font: 700 1.2rem var(--mono);
  color: color-mix(in srgb, var(--accent) 55%, transparent);
  opacity: 0.35;
  animation: floatY 9s ease-in-out infinite;
}
.float-glyph.g1 { top: 16%; left: 40%; font-size: 2.1rem; }
.float-glyph.g2 { top: 66%; left: 48%; animation-delay: -3s; }
.float-glyph.g3 { top: 26%; right: 5%; animation-delay: -6s; }
@keyframes floatY { 50% { transform: translateY(-16px); } }

/* fotoğrafın etrafında yukarı süzülen kod akışı */
.code-stream {
  position: absolute; top: -10%; height: 120%;
  overflow: hidden; pointer-events: none;
  font: 400 0.72rem/2 var(--mono);
  color: color-mix(in srgb, var(--accent) 40%, transparent);
  opacity: 0.3;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 25%, #000 75%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 25%, #000 75%, transparent);
}
.code-stream pre { margin: 0; white-space: pre; }
.stream-inner { animation: streamUp 32s linear infinite; }
.code-stream.s1 { left: 2%; }
.code-stream.s2 { right: 1.5%; }
.code-stream.s2 .stream-inner { animation-duration: 44s; animation-delay: -12s; }
@keyframes streamUp { to { transform: translateY(-50%); } }

/* fotoğrafa çok yavaş sinematik zoom */
.hero-bg img { animation: kenburns 26s ease-in-out infinite alternate; }
@keyframes kenburns { to { transform: scale(1.06) translateY(-1.5%); } }

/* Geniş konteyner + büyük orta boşluk: metin solda, panel sağa yaslı,
   yüz ortadaki boşlukta açık kalır */
.hero-inner {
  max-width: 1400px; width: 100%;
  margin-inline: auto; padding: 0 20px;
  display: grid; gap: clamp(40px, 10vw, 240px);
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.82fr);
  align-items: center;
}

.hero-copy h1 {
  font-size: clamp(2.3rem, 1.5rem + 3.6vw, 3.9rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 0.45em;
}
.h1-accent { color: var(--accent); }

.tagline { color: var(--muted); font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem); max-width: 46ch; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font: 400 0.8rem var(--mono); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  padding: 6px 14px; border-radius: 999px;
  margin: 0 0 20px;
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin: 26px 0 22px; }
.btn {
  display: inline-flex; align-items: center;
  padding: 12px 24px; border-radius: 999px;
  font: 700 0.95rem var(--sans); text-decoration: none;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.hero-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.hero-chips li {
  font: 400 0.78rem var(--mono); color: var(--muted);
  border: 1px solid var(--border); border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  padding: 5px 12px;
}
.hero-note { margin: 0; }

/* sahnenin üstünde camsı editör paneli — sağa yaslı, yüzü kapatmaz */
.hero-code {
  justify-self: end;
  width: min(100%, 460px);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* typing sırasında yükseklik sabit kalır → CLS 0 */
.hero-code .code { min-height: 24.5em; }
html.enhance .hero-code:not(.ready) .code code { visibility: hidden; }

.type-cursor {
  display: inline-block;
  width: 0.55em; height: 1.15em;
  margin-left: 1px;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 1.06s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- 9. Uzmanlık ---------- */
.exp-list { list-style: none; display: grid; gap: 28px; margin-top: 24px; }
.exp-line {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px;
  font: 700 0.95rem var(--mono);
  margin-bottom: 6px;
}
.exp-name { color: var(--text); }
.exp-arrow { color: var(--accent); }
.exp-tag { color: var(--muted); font-weight: 400; }
.exp-desc { color: var(--muted); max-width: 68ch; margin: 0; }

/* ---------- 10. Stack ---------- */
.stack-json { padding: 18px 20px; }
.stack-json > span { display: block; }
.stack-group { padding-left: 1.5em; margin: 4px 0; }
.stack-group p { margin: 0; }
.stack-key { font-weight: 700; }
.stack-items { list-style: none; padding-left: 1.5em; }
.stack-item { white-space: nowrap; }

html.enhance .sec.in .stack-item { animation: rowIn 0.35s ease backwards; }
.sec.in .stack-item:nth-child(1)  { animation-delay: 0.05s; }
.sec.in .stack-item:nth-child(2)  { animation-delay: 0.11s; }
.sec.in .stack-item:nth-child(3)  { animation-delay: 0.17s; }
.sec.in .stack-item:nth-child(4)  { animation-delay: 0.23s; }
.sec.in .stack-item:nth-child(5)  { animation-delay: 0.29s; }
.sec.in .stack-item:nth-child(6)  { animation-delay: 0.35s; }
@keyframes rowIn { from { opacity: 0; transform: translateX(-6px); } }

/* ---------- 11. İlkeler ---------- */
.pr-list { list-style: none; counter-reset: pr; display: grid; gap: 26px; margin-top: 24px; }
.pr-list li { counter-increment: pr; position: relative; padding-left: 56px; }
.pr-list li::before {
  content: "0" counter(pr) ".";
  position: absolute; left: 0; top: 0.1em;
  font: 700 0.95rem var(--mono);
  color: var(--accent);
}
.pr-list h3 { font-size: 1.1rem; margin-bottom: 0.25em; }
.pr-list p { color: var(--muted); margin: 0; max-width: 68ch; }

/* ---------- 12. Hakkımda not satırı ---------- */
.code-note { font: 400 0.85rem var(--mono); color: var(--accent); }
.code-note::before { content: "// "; color: var(--muted); }

/* ---------- 13. İletişim + footer ---------- */
.sec-contact { padding-bottom: 48px; }
.con-shell {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin: 20px 0 24px;
  max-width: 480px;
}
.con-list { list-style: none; display: grid; gap: 12px; margin-bottom: 24px; }
.con-list li { font: 400 0.95rem var(--mono); }
.con-key { color: var(--muted); }
.con-list a { font-weight: 700; }

.site-footer {
  max-width: 1060px; margin-inline: auto;
  padding: 24px 20px 40px;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: 0.85rem;
}

/* ---------- 14. 404 ---------- */
.sec-404 {
  min-height: calc(100vh - var(--chrome-h) - var(--statusbar-h));
  min-height: calc(100svh - var(--chrome-h) - var(--statusbar-h));
  display: grid; align-content: center; gap: 20px;
}
.sec-404 .code-panel { max-width: 560px; }

/* ---------- 15. Bölüm reveal'ları (yalnız JS + hareket serbestken) ---------- */
html.enhance .sec:not(.hero):not(.in) > * {
  opacity: 0; transform: translateY(14px);
}
html.enhance .sec:not(.hero) > * {
  transition: opacity 0.5s ease, transform 0.5s ease;
}
html.enhance .sec.in > * { opacity: 1; transform: none; }
html.enhance .sec.in > *:nth-child(2) { transition-delay: 0.06s; }
html.enhance .sec.in > *:nth-child(3) { transition-delay: 0.12s; }
html.enhance .sec.in > *:nth-child(4) { transition-delay: 0.18s; }

/* ---------- 16. Mobil ---------- */
/* 861–1150 bandında yüz camlı panelin arkasında kalıyordu:
   hero bu genişlikte tek kolona iner, görsel soluklaşır */
@media (max-width: 1150px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); }
  .hero-code { justify-self: stretch; width: 100%; }
  .hero-bg img { object-position: 48% 24%; opacity: 0.3; animation: none; }
  .float-glyph, .code-stream { display: none; }
  :root[data-theme="light"] .hero-bg img { opacity: 0.22; }
}
@media (max-width: 1150px) and (prefers-color-scheme: light) {
  :root:not([data-theme]) .hero-bg img { opacity: 0.22; }
}

@media (max-width: 860px) {
  .sec-grid { grid-template-columns: minmax(0, 1fr); }
  .hero { padding-top: 24px; }
  /* min-height korunur (24.5em, em tabanlı küçülür) — typing sırasında CLS 0 */
  .hero-code .code { font-size: 0.78rem; }
  .sb-section { display: none; }
  .statusbar { gap: 10px; justify-content: space-between; }
  .sb-lang a, .sb-theme { padding: 10px 12px; } /* dokunma hedefi ≥44px */
}

/* ---------- 17. Hareket azaltma ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html.enhance .sec:not(.hero):not(.in) > * { opacity: 1; transform: none; }
  .type-cursor { animation: none; }
}
