/* ============================================================
   Konu Anlatımları — dokümantasyon okuyucusu
   styles.css değişkenlerini miras alır
   ============================================================ */

.docs {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: calc(100vh - 58px);
  position: relative;
  z-index: 2;
}

/* ---------- SIDEBAR ---------- */
.side {
  border-right: 1px solid var(--line);
  background: var(--bg-1);
  position: sticky;
  top: 58px;
  height: calc(100vh - 58px);
  overflow-y: auto;
  padding: 18px 14px 60px;
}
.side::-webkit-scrollbar { width: 9px; }
.side::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }
.side::-webkit-scrollbar-track { background: transparent; }

.search-wrap { position: relative; margin-bottom: 16px; }
.search-wrap .sp {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--green); font-size: 13px; pointer-events: none;
}
.search {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 12px 10px 30px;
  outline: none;
  transition: border-color .15s;
}
.search:focus { border-color: var(--green); }
.search::placeholder { color: var(--fg-mute); }

.cat { margin-bottom: 6px; }
.cat-head {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  background: transparent; border: none;
  color: var(--fg);
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  letter-spacing: .01em;
  padding: 9px 10px; border-radius: 7px;
  cursor: pointer; text-align: left;
  transition: background .14s;
}
.cat-head:hover { background: var(--bg-2); }
.cat-head .tw {
  width: 12px; color: var(--fg-mute); font-size: 11px;
  transition: transform .18s; display: inline-block;
}
.cat.open .cat-head .tw { transform: rotate(90deg); }
.cat-head .dot { width: 7px; height: 7px; border-radius: 2px; background: var(--cat-accent, var(--green)); }
.cat-head .ct {
  margin-left: auto; font-size: 10.5px; color: var(--fg-mute);
  background: var(--bg); border: 1px solid var(--line); border-radius: 100px;
  padding: 2px 8px;
}
.cat-files { display: none; padding: 4px 0 8px 18px; }
.cat.open .cat-files { display: block; }

.file-link {
  display: flex; align-items: baseline; gap: 9px;
  padding: 7px 10px 7px 22px; border-radius: 5px;
  color: var(--fg-dim); font-size: 12.5px;
  cursor: pointer; transition: background .13s, color .13s;
  position: relative;
}
.file-link::before {
  content: ""; position: absolute; left: 9px; top: 50%;
  width: 6px; height: 6px; background: var(--magenta);
  transform: translateY(-50%) scale(0); transform-origin: center;
  transition: transform .14s ease;
}
.file-link:hover { background: var(--fg); color: var(--bg); }
.file-link.active { background: var(--fg); color: var(--bg); }
.file-link:hover::before, .file-link.active::before { transform: translateY(-50%) scale(1); }
.file-link .fn { font-size: 11px; color: var(--cat-accent); min-width: 20px; opacity: .9; }
.file-link:hover .fn, .file-link.active .fn { color: var(--magenta); opacity: 1; }
.file-link:hover .fl, .file-link.active .fl { color: var(--bg); }
.file-link .fl { line-height: 1.35; }

/* ---------- CONTENT ---------- */
.content {
  padding: 0;
  min-width: 0;
  background:
    radial-gradient(1100px 480px at 100% -10%, rgba(var(--glow),0.06), transparent 60%),
    var(--bg);
}
.reader {
  max-width: 860px;
  margin: 0 auto;
  padding: 42px 48px 110px;
}
@media (max-width: 720px){ .reader { padding: 28px 22px 90px; } }

/* breadcrumb + meta */
.crumb {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-size: 12px; color: var(--fg-mute); margin-bottom: 22px;
}
.crumb a { color: var(--fg-dim); }
.crumb a:hover { color: var(--green); }
.crumb .sep { color: var(--green-d); }
.crumb .cur { color: var(--fg); }
.gh-view {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--fg-mute);
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px;
  transition: all .14s;
}
.gh-view:hover { color: var(--fg); border-color: var(--line-2); }

/* ---------- WELCOME (no doc selected) ---------- */
.welcome { padding: 30px 0; }
.welcome h1 {
  font-size: clamp(28px, 4vw, 44px); font-weight: 800; letter-spacing: -0.02em;
  margin-bottom: 14px;
}
.welcome h1 .pp { color: var(--green); }
.welcome .lede { color: var(--fg-dim); font-size: 15px; max-width: 58ch; margin-bottom: 36px; }
.wcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 14px; }
.wcard {
  text-align: left; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line);
  border-left: 2px solid var(--wc-accent, var(--green));
  border-radius: 10px; padding: 18px;
  transition: transform .15s, border-color .15s;
  font-family: var(--mono);
}
.wcard:hover { transform: translateY(-3px); background: var(--fg); }
.wcard:hover .wt { color: var(--bg); }
.wcard:hover .wb { color: var(--bg-1); }
.wcard:hover .wf { color: var(--bg-1); }
.wcard:hover .wf .cnt { color: var(--magenta); }
.wcard .wt { font-size: 15px; font-weight: 700; color: var(--fg); margin-bottom: 6px; }
.wcard .wb { font-size: 12.5px; color: var(--fg-dim); line-height: 1.5; margin-bottom: 12px; }
.wcard .wf { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--fg-mute); }
.wcard .wf .cnt { color: var(--wc-accent); }

/* ---------- MARKDOWN BODY ---------- */
.md { color: var(--fg); font-size: 15px; line-height: 1.75; }
.md > *:first-child { margin-top: 0; }

.md h1 { font-size: clamp(26px, 3.4vw, 36px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin: 8px 0 18px; }
.md h2 {
  font-size: 22px; font-weight: 700; letter-spacing: -0.01em;
  margin: 44px 0 14px; padding-top: 22px; border-top: 1px solid var(--line);
  scroll-margin-top: 76px;
}
.md h3 { font-size: 17px; font-weight: 700; color: var(--fg); margin: 28px 0 10px; scroll-margin-top: 76px; }
.md h4 { font-size: 14px; font-weight: 700; color: var(--yellow); margin: 22px 0 8px; letter-spacing: .02em; }
.md h2::before { content: "# "; color: var(--green); font-weight: 800; }
.md h3::before { content: "## "; color: var(--green-d); }

.md p { margin: 14px 0; color: var(--fg); }
.md a { color: var(--green); text-decoration: none; border-bottom: 1px solid var(--line-2); transition: border-color .14s; }
.md a:hover { border-bottom-color: var(--green); }
.md strong { color: var(--fg); font-weight: 700; }
.md em { color: var(--yellow); font-style: normal; }

.md ul, .md ol { margin: 14px 0; padding-left: 24px; }
.md li { margin: 7px 0; color: var(--fg); }
.md li::marker { color: var(--magenta); }
.md ul ul, .md ol ol { margin: 6px 0; }

.md blockquote {
  margin: 20px 0; padding: 4px 18px;
  border-left: 3px solid var(--magenta);
  background: var(--bg-1);
  border-radius: 0 8px 8px 0;
  color: var(--fg-dim);
}
.md blockquote p { color: var(--fg-dim); }

/* inline code */
.md :not(pre) > code {
  font-family: var(--mono); font-size: 0.88em;
  background: var(--bg-2); border: 1px solid var(--line);
  color: var(--magenta);
  padding: 2px 6px; border-radius: 5px;
}

/* code blocks */
.md pre {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  margin: 18px 0;
  overflow: hidden;
}
.md pre code {
  display: block;
  font-family: var(--mono); font-size: 13px; line-height: 1.7;
  padding: 16px 18px;
  overflow-x: auto;
  background: transparent;
}
.code-copy {
  position: absolute; top: 8px; right: 8px;
  font-family: var(--mono); font-size: 11px;
  color: var(--fg-dim); background: var(--bg-2);
  border: 1px solid var(--line-2); border-radius: 6px;
  padding: 4px 9px; cursor: pointer; opacity: 0; transition: all .14s;
}
.md pre:hover .code-copy { opacity: 1; }
.code-copy:hover { color: var(--green); border-color: var(--green); }
.code-copy.ok { color: var(--green); border-color: var(--green); opacity: 1; }

/* tables */
.md table {
  width: 100%; border-collapse: collapse; margin: 20px 0;
  font-size: 13.5px;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.md thead { background: var(--bg-2); }
.md th { text-align: left; padding: 11px 14px; color: var(--green); font-weight: 700; border-bottom: 1px solid var(--line-2); }
.md td { padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--fg-dim); vertical-align: top; }
.md tbody tr:last-child td { border-bottom: none; }
.md tbody tr:hover { background: var(--bg-1); }
.md td code { white-space: nowrap; }

.md hr { border: none; border-top: 1px solid var(--line); margin: 32px 0; }
.md img { max-width: 100%; border-radius: 8px; }

/* prev / next nav */
.doc-nav { display: flex; justify-content: space-between; gap: 14px; margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--line); }
.doc-nav a {
  flex: 1; max-width: 49%;
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
  transition: border-color .15s; min-width: 0;
}
.doc-nav a:hover { border-color: var(--line-2); }
.doc-nav .dir { font-size: 11px; color: var(--fg-mute); margin-bottom: 4px; }
.doc-nav .dt { font-size: 13.5px; color: var(--fg); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-nav a.next { text-align: right; margin-left: auto; }
.doc-nav a.empty { visibility: hidden; }

/* loading / error */
.state { padding: 60px 0; color: var(--fg-mute); font-size: 14px; }
.state .blink { color: var(--green); animation: blink 1s steps(1) infinite; }

/* ---------- highlight.js token renkleri (palete uyumlu) ---------- */
.md .hljs { color: var(--fg); background: transparent; }
.md .hljs-comment, .md .hljs-quote { color: var(--fg-mute); font-style: italic; }
.md .hljs-keyword, .md .hljs-selector-tag, .md .hljs-built_in, .md .hljs-name, .md .hljs-meta-keyword { color: var(--magenta); }
.md .hljs-string, .md .hljs-attr, .md .hljs-regexp, .md .hljs-addition { color: var(--green); }
.md .hljs-number, .md .hljs-literal, .md .hljs-variable, .md .hljs-template-variable, .md .hljs-bullet, .md .hljs-link { color: var(--yellow); }
.md .hljs-title, .md .hljs-section, .md .hljs-function .hljs-title, .md .hljs-class .hljs-title { color: var(--cyan); }
.md .hljs-type, .md .hljs-symbol, .md .hljs-attribute { color: var(--cyan); }
.md .hljs-meta, .md .hljs-comment.hljs-doctag { color: var(--green-d); }
.md .hljs-deletion { color: var(--d-max); }
.md .hljs-emphasis { font-style: italic; }
.md .hljs-strong { font-weight: 700; }

/* ---------- mobile ---------- */
.side-toggle {
  display: none;
  position: fixed; bottom: 20px; right: 20px; z-index: 40;
  background: var(--magenta); color: var(--btn-ink);
  border: none; border-radius: 50px;
  font-family: var(--mono); font-weight: 700; font-size: 13px;
  padding: 12px 18px; cursor: pointer;
  box-shadow: 0 12px 30px -8px var(--magenta);
}
.scrim { display: none; }

@media (max-width: 880px){
  .docs { grid-template-columns: 1fr; }
  .side {
    position: fixed; left: 0; top: 58px; z-index: 45;
    width: 320px; max-width: 86vw;
    transform: translateX(-105%); transition: transform .25s ease;
    box-shadow: 0 0 60px rgba(0,0,0,.6);
  }
  .docs.nav-open .side { transform: none; }
  .docs.nav-open .scrim {
    display: block; position: fixed; inset: 58px 0 0 0; z-index: 44;
    background: rgba(0,0,0,.5);
  }
  .side-toggle { display: block; }
}

/* ---------- okuyucu: uzun içerik & mobil tipografi ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 20px 0; }
.table-wrap .md table, .md table { margin: 0; }
.md p, .md li, .md blockquote { overflow-wrap: anywhere; }
.md a { word-break: break-word; }
.md :not(pre) > code { overflow-wrap: anywhere; }

/* dokunmatik cihazlarda kod-kopyala butonu hep görünür */
@media (hover: none) {
  .code-copy { opacity: 1; }
}

@media (max-width: 720px) {
  .md { font-size: 14.5px; }
  .md h1 { font-size: 26px; }
  .md h2 { font-size: 20px; }
  .md h3 { font-size: 16px; }
  .md pre code { font-size: 12px; padding: 13px 14px; }
  .md table { font-size: 12.5px; }
  .md th, .md td { padding: 8px 10px; }
  /* alt köşedeki kenar-çubuğu düğmesi sesi engellemesin, dokunma hedefi büyük */
  .side-toggle { padding: 13px 20px; font-size: 14px; }
  /* breadcrumb'taki GitHub linki alta düşmesin diye sıkıştır */
  .gh-view { margin-left: 0; }
  .read-progress { top: 57px; }
}

@media (max-width: 880px) {
  /* kenar çubuğu açıkken arkaplan kaymasını kilitle (görsel netlik) */
  .side { padding-bottom: 80px; }
}
