/* ---------- Temel ---------- */
:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #6b6b6b;
  --faint: #a3a3a3;
  --line: #ececec;
  --text: #1f1f1f;
  --hover: #f7f7f7;
  --header: rgba(255, 255, 255, 0.85);
  color-scheme: light;
  --sans: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar: 248px;
}

/* Koyu tema: sistem tercihi ya da elle seçim */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f0f;
    --fg: #ededed;
    --muted: #9b9b9b;
    --faint: #6b6b6b;
    --line: #232323;
    --text: #d4d4d4;
    --hover: #171717;
    --header: rgba(15, 15, 15, 0.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f0f;
  --fg: #ededed;
  --muted: #9b9b9b;
  --faint: #6b6b6b;
  --line: #232323;
  --text: #d4d4d4;
  --hover: #171717;
  --header: rgba(15, 15, 15, 0.8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Kısa ve uzun sayfalarda kaydırma çubuğu yeri aynı kalsın, düzen kaymasın */
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--fg); color: var(--bg); }

a { color: inherit; text-decoration: none; }

/* ---------- Sayfalar arası geçiş (View Transitions) ---------- */
@view-transition { navigation: auto; }

.sidebar { view-transition-name: sidebar; }
.nav a[aria-current="page"] .nav-indicator { view-transition-name: nav-indicator; }
main { view-transition-name: main; }

::view-transition-old(main) {
  animation: vt-out 0.15s ease-out both;
}
/* Yeni sayfa kendi "rise" animasyonuyla gelir */
::view-transition-new(main) {
  animation: none;
}
::view-transition-group(nav-indicator) {
  animation-duration: 0.5s;
  animation-timing-function: var(--ease);
}

@keyframes vt-out {
  to { opacity: 0; }
}

/* ---------- Yerleşim ---------- */
/* Yazı sütunu sayfanın tam ortasında, menü onun solunda */
.layout {
  display: grid;
  grid-template-columns: minmax(var(--sidebar), 1fr) minmax(0, 640px) minmax(24px, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  justify-self: end;
  width: var(--sidebar);
  height: 100vh;
  padding: 120px 40px 40px 24px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.brand {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  font-size: 15px;
  color: var(--muted);
  transition: color 0.3s var(--ease), transform 0.4s var(--ease);
}
.nav a:hover { color: var(--fg); transform: translateX(3px); }
.nav a[aria-current="page"] { color: var(--fg); }

.nav-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg);
  flex: none;
}
.nav a:not([aria-current="page"]) .nav-indicator { visibility: hidden; }

/* Tema düğmesi */
.theme-toggle {
  position: relative;
  margin-top: auto;
  width: 36px;
  height: 36px;
  margin-left: -9px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.3s var(--ease), background-color 0.3s var(--ease);
}
.theme-toggle:hover { color: var(--fg); background: var(--hover); }
.theme-toggle svg {
  grid-area: 1 / 1;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.45s var(--ease), opacity 0.3s var(--ease);
}
.icon-moon { opacity: 0; transform: rotate(-90deg) scale(0.6); }
:root[data-theme="dark"] .icon-sun { opacity: 0; transform: rotate(90deg) scale(0.6); }
:root[data-theme="dark"] .icon-moon { opacity: 1; transform: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { opacity: 0; transform: rotate(90deg) scale(0.6); }
  :root:not([data-theme="light"]) .icon-moon { opacity: 1; transform: none; }
}


.content {
  padding: 120px 0;
}
main {
  max-width: 640px;
}

/* ---------- Tipografi ---------- */
.page-title {
  font-weight: 600;
  font-size: clamp(34px, 5vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 20px;
}
.lede {
  font-size: 17px;
  color: var(--muted);
  margin: 0 0 72px;
  max-width: 34em;
}

.link {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.45s var(--ease);
}
.link:hover {
  background-size: 0% 1px;
  background-position: 100% 100%;
}

/* ---------- Yazı listesi ---------- */
.year {
  font-size: 13px;
  color: var(--faint);
  margin: 0 0 8px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.year:not(:first-of-type) { margin-top: 56px; }

.posts {
  list-style: none;
  padding: 0;
  margin: 0;
}
.posts a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.posts .title {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
  transition: transform 0.5s var(--ease);
}
.posts .date {
  font-size: 13px;
  color: var(--faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s var(--ease);
}
.posts a:hover .title { transform: translateX(6px); }
.posts a:hover .date { color: var(--fg); }

/* Liste hover: diğerleri hafifçe soluklaşır */
@media (hover: hover) {
  .posts:hover a { opacity: 0.4; }
  .posts a { transition: opacity 0.35s var(--ease); }
  .posts:hover a:hover { opacity: 1; }
}

/* ---------- Makale ---------- */
.post-meta {
  font-size: 13px;
  color: var(--faint);
  margin: 0 0 16px;
  font-variant-numeric: tabular-nums;
}
.prose {
  font-size: 18px;
  line-height: 1.75;
  color: var(--text);
}
.prose p { margin: 0 0 1.2em; }
.prose h2 {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 2.4em 0 0.6em;
}
.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose blockquote {
  margin: 1.6em 0;
  padding-left: 20px;
  border-left: 2px solid var(--fg);
  font-style: italic;
}
.prose ul { padding-left: 1.2em; margin: 0 0 1.2em; }
.prose li { margin-bottom: 0.4em; }
.prose hr {
  border: 0;
  height: 1px;
  background: var(--line);
  margin: 3em 0;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 64px;
  font-size: 14px;
  color: var(--muted);
  transition: color 0.3s var(--ease), gap 0.4s var(--ease);
}
.back:hover { color: var(--fg); gap: 12px; }
.lede + .back { margin-top: -24px; }

/* Okuma ilerleme çubuğu */
.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--fg);
  transform-origin: 0 50%;
  transform: scaleX(0);
  z-index: 10;
}

/* ---------- Giriş animasyonları ---------- */
/* Sayfa tek seferde, hızlı ve blursuz gelir */
main {
  animation: rise 0.3s var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
}

/* ---------- Benchmark tablosu ---------- */
.bench { margin: 0 0 64px; border-top: 1px solid var(--fg); }
.bench-row {
  display: grid;
  grid-template-columns: 160px 1fr 110px;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  transition: background-color 0.3s var(--ease), padding 0.4s var(--ease);
}
.bench-row:not(.bench-head):hover { background: var(--hover); padding-left: 10px; padding-right: 10px; }
.bench-head { font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 0; }
.bench-name { font-weight: 600; color: var(--fg); }
.bench-tag { font-size: 13px; color: var(--muted); text-align: right; }
.bench-head span:last-child { text-align: right; }

/* ---------- Mobil ---------- */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .content { grid-column: 1; }
  .sidebar {
    width: auto;
    justify-self: stretch;
    position: sticky;
    height: auto;
    z-index: 5;
    padding: 12px 16px 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    background: var(--header);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .theme-toggle { margin: 0 -8px 0 0; }
  .nav {
    order: 3;
    width: 100%;
    flex-direction: row;
    gap: 22px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav a { gap: 6px; font-size: 15px; padding: 10px 0 12px; white-space: nowrap; }
  .nav a:hover { transform: none; }
  .nav-indicator { display: none; }
  .nav a[aria-current="page"] { font-weight: 500; }
  .content { padding: 48px 16px 80px; }
  .page-title { font-size: 32px; }
  .lede { margin-bottom: 48px; }
  .posts a { flex-direction: column; gap: 2px; }
  .posts .title { font-size: 18px; }
  .prose { font-size: 17px; }
  .bench-row { grid-template-columns: 1fr; gap: 4px; }
  .bench-head { display: none; }
  .bench-tag { text-align: left; }
}

/* ---------- Hareket azaltma ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) {
    animation: none !important;
  }
}
