/* ============================================================
   amator.tr — Base Styles
   Typography, layout primitives, nav, footer, FAB
   ============================================================ */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { overflow-x: clip; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 880px; margin: 0 auto; padding: 0 16px; }

.site-nav {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}
.site-nav-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  max-width: 1100px;
  margin: 0 auto;
  flex-wrap: wrap;
}
.site-nav-brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.site-nav-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav-links a { color: var(--text-muted); font-size: 0.95rem; }
.site-nav-links a:hover,
.site-nav-links a.active { color: var(--accent); }
.site-nav-cta {
  margin-left: auto;
  padding: 6px 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-size: 0.9rem;
}
.site-nav-cta:hover { background: var(--accent); color: #fff; text-decoration: none; }

main { padding: 32px 16px; }
.breadcrumb {
  max-width: 720px;
  margin: 0 auto 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--text); }
.prose {
  max-width: 720px;
  margin: 0 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.prose h1 { font-size: 2rem; line-height: 1.25; margin: 0 0 8px; }
.prose h2 { font-size: 1.5rem; margin-top: 2em; }
.prose h3 { font-size: 1.2rem; margin-top: 1.5em; }
.prose p { margin: 1em 0; }
.prose code {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
}
.prose pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.prose pre code {
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  background: none;
  padding: 0;
}
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  margin-left: 0;
  color: var(--text-muted);
}
.prose img { max-width: 100%; height: auto; }
.prose .meta { color: var(--text-muted); font-size: 0.9rem; }
/* Tablolar mobil'de yatay kaydırılabilir, sayfayı taşırmaz */
.prose .table-wrap,
.prose table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1em 0;
}
.prose table {
  border-collapse: collapse;
  min-width: 100%;
}
.prose th, .prose td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  word-break: normal;
}
.prose th { background: var(--surface-2); }
/* Uzun URL'ler ve link'ler mobilde sayfayı taşırmasın */
.prose a { word-break: break-word; overflow-wrap: anywhere; }

.tutorials-list { display: grid; gap: 16px; max-width: 720px; margin: 0 auto; }
.tutorial-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
}
.tutorial-card h2 { margin: 0 0 6px; font-size: 1.25rem; }
.tutorial-card .meta { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 8px; }
.tutorial-card .tag {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  margin-right: 4px;
}

.hero {
  text-align: center;
  padding: 60px 16px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border-bottom: 1px solid var(--border);
}
.hero h1 { font-size: 2.4rem; margin: 0 0 12px; }
.hero p { color: var(--text-muted); font-size: 1.1rem; margin: 0 auto; max-width: 600px; }
.hero-cta { margin-top: 24px; display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.hero h1 span { white-space: nowrap; }

/* ── Category grid (landing) ─────────────────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
}
.cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
  display: block;
}
.cat-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-2px);
}
.cat-card .cat-icon { font-size: 1.6rem; margin-bottom: 10px; }
.cat-card h3 { margin: 0 0 8px; font-size: 1.1rem; color: var(--accent); }
.cat-card p { margin: 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; }

/* ── Featured tutorial grid ───────────────────────────── */
.feat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  max-width: 1100px;
  margin: 0 auto;
}
.feat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s;
  display: block;
}
.feat-card:hover { border-color: var(--accent); text-decoration: none; }
.feat-card h3 { margin: 0 0 6px; font-size: 1rem; color: var(--accent); }
.feat-card p { margin: 0; color: var(--text-muted); font-size: 0.85rem; line-height: 1.4; }
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.9; background: var(--accent); }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 16px 24px;
  margin-top: 64px;
  color: var(--text-muted);
  font-size: 0.88rem;
  background: var(--surface);
}
.footer-grid {
  max-width: 1200px;
  margin: 0 auto 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
}
.footer-grid h4 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 700;
}
.footer-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-grid li {
  margin-bottom: 5px;
  line-height: 1.5;
}
.footer-grid a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}
.footer-grid a:hover {
  color: var(--accent);
}
.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}
.footer-bottom em {
  color: var(--text-muted);
  font-style: normal;
}

.theme-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
  z-index: 1000;
  font-size: 1.2rem;
}
.theme-fab:hover { transform: scale(1.08); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45); }
.theme-fab:active { transform: scale(0.96); }

.theme-menu {
  position: fixed;
  right: 20px;
  bottom: 80px;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 1000;
}
.theme-menu[hidden] { display: none; }
.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.theme-option:hover { background: var(--surface-2); }
.theme-option.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.theme-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.page-header { max-width: 720px; margin: 0 auto 32px; }
.page-header h1 { margin: 0 0 8px; }

/* ── Reading progress bar (article sayfaları) ────────────── */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--accent);
  z-index: 100;
  transition: width 0.08s linear;
  pointer-events: none;
}

/* ── Anchor link (h2/h3 hover'da #) ──────────────────────── */
.prose h2,
.prose h3,
.prose h4 {
  position: relative;
  scroll-margin-top: 64px;
}
.prose .anchor-link {
  position: absolute;
  left: -1.2em;
  top: 0;
  padding-right: 0.3em;
  color: var(--text-muted);
  opacity: 0;
  text-decoration: none;
  font-weight: 400;
  transition: opacity 0.15s;
}
.prose h2:hover .anchor-link,
.prose h3:hover .anchor-link,
.prose h4:hover .anchor-link,
.prose .anchor-link:focus { opacity: 1; }
.prose .anchor-link:hover { color: var(--accent); }

/* ── Tutorial search ─────────────────────────────────────── */
.tutorial-search {
  max-width: 720px;
  margin: 16px auto 0;
}
.tutorial-search input[type="search"] {
  width: 100%;
  padding: 10px 14px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tutorial-search input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.tutorial-search .search-hint {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}
.tutorial-card.hidden { display: none; }

/* ── Utility classes — strict CSP friendly (no inline style attribs) ── */
.section-pad { padding: 32px 0; }
.list-plain { list-style: none; padding: 0; }
.error-page {
  padding: 64px 0;
  text-align: center;
}
.error-page h1 {
  font-size: 4rem;
  margin: 0;
}
.error-page p { color: var(--text-muted); }

@media (max-width: 600px) {
  .site-nav-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .site-nav-cta { margin-left: 0; }
  .hero h1 { font-size: 1.8rem; }
  main { padding: 24px 12px; }
  /* Mobil tablolar daha sıkı ve kelime sınırında kırılabilir → ekrana sığar */
  .prose table { font-size: 0.82rem; }
  .prose th, .prose td {
    padding: 5px 7px;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  .prose pre { font-size: 0.82rem; padding: 10px; }
  .prose pre code { font-size: 0.82rem; }
}

/* ── Skip to content (a11y) ──────────────────────────────── */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  z-index: 10000;
  text-decoration: none;
  border-radius: 0 0 6px 0;
  font-weight: 600;
}
.skip-link:focus {
  top: 0;
  text-decoration: none;
  color: #fff;
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* ── Tutorial layout with sidebar ToC ────────────────────── */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 1100px;
  margin: 0 auto;
  gap: 32px;
}
@media (min-width: 1000px) {
  .article-layout {
    grid-template-columns: minmax(0, 720px) 240px;
    align-items: start;
  }
}
.article-layout > * { min-width: 0; }
.article-layout .prose { margin: 0; }

.toc {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  font-size: 0.85rem;
  border-left: 2px solid var(--border);
  padding-left: 14px;
  display: none;
}
@media (min-width: 1000px) {
  .toc { display: block; }
}
.toc-title {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc li { margin: 4px 0; line-height: 1.4; }
.toc li.toc-h3 { padding-left: 14px; }
.toc a {
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  padding: 2px 0;
  border-left: 2px solid transparent;
  margin-left: -16px;
  padding-left: 14px;
  transition: color 0.12s, border-color 0.12s;
}
.toc a:hover { color: var(--accent); text-decoration: none; }
.toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* ── Code copy button ───────────────────────────────────── */
.prose pre { position: relative; }
.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}
.prose pre:hover .code-copy-btn,
.code-copy-btn:focus { opacity: 1; }
.code-copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.code-copy-btn.copied { color: var(--accent); border-color: var(--accent); }

/* ── Image lightbox ─────────────────────────────────────── */
.prose img { cursor: zoom-in; }
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: zoom-out;
}
.lightbox-overlay[hidden] { display: none; }
.lightbox-overlay img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 12px;
  font-family: inherit;
}
.lightbox-close:hover { color: var(--accent); }

/* ── Helpful vote button ────────────────────────────────── */
.helpful {
  margin: 40px auto 0;
  max-width: 720px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-align: center;
}
.helpful-question {
  margin: 0 0 12px;
  font-weight: 600;
  color: var(--text);
}
.helpful-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.helpful-btn:hover { border-color: var(--accent); color: var(--accent); }
.helpful-btn:disabled { cursor: default; opacity: 0.7; }
.helpful-btn.voted {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.helpful-count {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.helpful-thanks {
  margin: 12px 0 0;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

/* ── Previous / Next article navigation ─────────────────── */
.prev-next {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  max-width: 720px;
  margin: 40px auto 0;
}
.prev-next > * { min-width: 0; }
@media (max-width: 600px) {
  .prev-next { grid-template-columns: minmax(0, 1fr); }
}
.prev-next a {
  display: block;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s;
}
.prev-next a:hover { border-color: var(--accent); text-decoration: none; }
.prev-next .pn-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.prev-next .pn-title {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.95rem;
  line-height: 1.35;
}
.prev-next .pn-next { text-align: right; }
.prev-next .pn-prev:only-child { grid-column: 1; }

/* ── Print stylesheet ───────────────────────────────────── */
@media print {
  .site-nav,
  .site-footer,
  .theme-fab,
  .theme-menu,
  .reading-progress,
  .toc,
  .code-copy-btn,
  .helpful,
  .prev-next,
  .skip-link,
  .tutorial-search { display: none !important; }
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }
  .article-layout { grid-template-columns: 1fr !important; }
  .prose {
    max-width: 100%;
    margin: 0;
  }
  .prose a {
    color: #000;
    text-decoration: underline;
  }
  .prose a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
  }
  .prose pre, .prose code {
    background: #f4f4f4 !important;
    border: 1px solid #ddd;
    color: #000;
  }
  .prose h1, .prose h2, .prose h3 {
    page-break-after: avoid;
  }
  .prose img, .prose pre, .prose blockquote {
    page-break-inside: avoid;
  }
}
