/* ---------- Tokens ---------- */
:root {
  --bg: #fcfcfb;
  --surface: #f3f3f1;
  --text: #1c1c1e;
  --muted: #6b6b70;
  --border: #e6e6e3;
  --accent: #3b5bdb;
  --accent-soft: rgba(59, 91, 219, 0.1);
  --code-bg: #f3f3f1;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --measure: 42rem;
}
[data-theme="dark"] {
  --bg: #111113;
  --surface: #1a1a1d;
  --text: #ececee;
  --muted: #9a9aa1;
  --border: #2a2a2e;
  --accent: #8ea4ff;
  --accent-soft: rgba(142, 164, 255, 0.12);
  --code-bg: #1a1a1d;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.7 var(--font);
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
::selection { background: var(--accent-soft); }

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.25rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding: 3rem 0 4rem; }
.muted { color: var(--muted); }

/* ---------- Header / footer ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border);
}
.site-title { color: var(--text); font-weight: 600; letter-spacing: -0.01em; }
.site-title:hover { text-decoration: none; opacity: .75; }
.site-nav { display: flex; align-items: center; gap: 1.25rem; font-size: .95rem; }
.site-nav a { color: var(--muted); }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--text); text-decoration: none; }

.theme-toggle {
  display: grid; place-items: center;
  width: 2.1rem; height: 2.1rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.theme-toggle:hover { color: var(--text); background: var(--surface); }
[data-theme="dark"] .icon-moon, [data-theme="light"] .icon-sun { display: none; }

.site-footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem 1.5rem;
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: .875rem;
}
.site-footer .social a { color: var(--muted); }
.site-footer .social a:hover { color: var(--text); }

.social { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }

/* ---------- Home ---------- */
.intro { margin-bottom: 3.5rem; }
.intro h1 { font-size: clamp(2rem, 5vw, 2.6rem); line-height: 1.15; letter-spacing: -0.03em; margin: 0 0 1rem; font-weight: 700; }
.lead { font-size: 1.15rem; color: var(--muted); margin: 0 0 1.25rem; max-width: 36rem; }
.ai-note { font-size: .875rem; color: var(--muted); margin: -.5rem 0 1.25rem; max-width: 36rem; opacity: .85; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: .5rem; }
.section-head h2, .year h2 {
  font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 0;
}
.section-head a { font-size: .9rem; }

/* ---------- Post lists ---------- */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li { padding: .9rem 0; border-bottom: 1px solid var(--border); }
.post-list li:last-child { border-bottom: 0; }
.post-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.post-list a:hover { text-decoration: none; }
.post-title { color: var(--text); font-weight: 500; transition: color .15s ease; }
a.post-title:hover { color: var(--accent); }
/* Link to a post's translation, next to its title in lists */
.lang-pill { display: inline-block; margin-left: .45rem; padding: .1rem .45rem; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: .6875rem; font-weight: 600; letter-spacing: .06em; line-height: 1.4; vertical-align: .12em; transition: color .15s ease, border-color .15s ease, background-color .15s ease; }
.lang-pill:hover { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); }
.post-list time { color: var(--muted); font-size: .875rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.excerpt { margin: .25rem 0 0; color: var(--muted); font-size: .95rem; line-height: 1.55; }
.year { margin-bottom: 2.5rem; }
.year h2 { margin-bottom: .25rem; }

/* ---------- Pages & posts ---------- */
.page-title { font-size: clamp(1.8rem, 4.5vw, 2.3rem); line-height: 1.2; letter-spacing: -0.025em; margin: 0 0 1.5rem; font-weight: 700; }
.post-header { margin-bottom: 2.5rem; }
/* Banner image above a post's title (front matter `banner`, optional `banner_dark`) */
.post-banner { margin: 0 0 2rem; }
.post-banner img { display: block; width: 100%; height: auto; }
.post-banner .banner-dark { display: none; }
[data-theme="dark"] .post-banner .banner-light { display: none; }
[data-theme="dark"] .post-banner .banner-dark { display: block; }
.post-header .page-title { margin-bottom: .5rem; }
.meta { color: var(--muted); font-size: .9rem; margin: 0; }
.page-dates { display: flex; flex-wrap: wrap; column-gap: .5em; font-variant-numeric: tabular-nums; }
.page-dates > span:not(:last-child)::after { content: "·"; margin-left: .5em; }
main > .page-dates { margin: 3.5rem 0 0; color: var(--muted); font-size: .8125rem; opacity: .9; }
.file-note { margin-left: .35em; color: var(--muted); font-size: .8125rem; white-space: nowrap; }
.tags { list-style: none; padding: 0; margin: .9rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.tags li { font-size: .75rem; padding: .15rem .6rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

/* EN / TR switch on translated posts (_includes/lang-switch.html) */
.lang-switch { display: inline-flex; margin: 0 0 1rem; padding: 2px; border: 1px solid var(--border); border-radius: 999px; font-size: .75rem; font-weight: 600; letter-spacing: .06em; line-height: 1; }
.lang-switch > * { padding: .35rem .7rem; border-radius: 999px; color: var(--muted); transition: background-color .15s ease, color .15s ease; }
.lang-switch a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.lang-switch [aria-current] { background: var(--accent-soft); color: var(--accent); }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.post-nav a { display: flex; flex-direction: column; color: var(--text); font-weight: 500; line-height: 1.4; }
.post-nav a span { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-bottom: .25rem; }
.post-nav .next { text-align: right; grid-column: 2; }

/* ---------- Prose (Markdown content) ---------- */
.prose > :first-child { margin-top: 0; }
.prose h2, .prose h3, .prose h4 { line-height: 1.3; letter-spacing: -0.015em; margin: 2.4rem 0 .8rem; }
.prose h2 { font-size: 1.45rem; }
.prose h3 { font-size: 1.2rem; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table, .prose figure { margin: 0 0 1.25rem; }
.prose a { text-decoration: underline; text-decoration-color: var(--accent-soft); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose li + li { margin-top: .3rem; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 0 auto; }

/* Footnotes (kramdown) */
.prose sup[id^="fnref"] { line-height: 0; }
.prose a.footnote { text-decoration: none; font-size: .75em; padding: 0 .1em; }
.prose .footnotes { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: .875rem; color: var(--muted); }
.prose .footnotes ol { padding-left: 1.9rem; margin: 0; }
.prose .footnotes p { margin: 0; }
.prose a.reversefootnote { text-decoration: none; margin-left: .25em; }
.prose figure img { margin-bottom: .5rem; }
/* Inline SVG diagrams (_includes/figures/), coloured by the theme tokens above */
.prose figure.diagram { margin: 2rem 0; }
.prose figure.diagram .scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.prose figure.diagram svg { display: block; width: 100%; min-width: 34rem; height: auto; margin-bottom: .5rem; }
.prose figcaption { text-align: center; color: var(--muted); font-size: .875rem; }
.prose blockquote { margin-left: 0; padding: .1rem 0 .1rem 1.1rem; border-left: 3px solid var(--border); color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: .95rem; display: block; overflow-x: auto; }
.prose th, .prose td { padding: .5rem .75rem; border-bottom: 1px solid var(--border); text-align: left; }
.prose th { font-weight: 600; }

code, pre { font-family: var(--mono); font-size: .875em; }
:not(pre) > code { background: var(--code-bg); padding: .15em .4em; border-radius: 5px; border: 1px solid var(--border); }
pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.15rem; overflow-x: auto; line-height: 1.55; }
.highlighter-rouge .highlight { background: transparent; }
div.highlighter-rouge { margin-bottom: 1.25rem; }
div.highlighter-rouge pre { margin: 0; }

/* ---------- Syntax highlighting (Rouge) ---------- */
:root { --hl-comment: #8a8a91; --hl-keyword: #a626a4; --hl-string: #2f8a3e; --hl-number: #b76b01; --hl-func: #3b5bdb; --hl-type: #c18401; }
[data-theme="dark"] { --hl-comment: #6e6e76; --hl-keyword: #d19bf0; --hl-string: #9ad08a; --hl-number: #f0b36a; --hl-func: #8ea4ff; --hl-type: #e8c16a; }
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs, .highlight .cp { color: var(--hl-comment); font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kr, .highlight .kc, .highlight .ow { color: var(--hl-keyword); }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sd, .highlight .se, .highlight .si, .highlight .sx, .highlight .sr { color: var(--hl-string); }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .il { color: var(--hl-number); }
.highlight .nf, .highlight .fm, .highlight .nb, .highlight .bp { color: var(--hl-func); }
.highlight .nc, .highlight .kt, .highlight .nn { color: var(--hl-type); }
.highlight .gd { color: #d33; } .highlight .gi { color: var(--hl-string); }

/* ---------- Small screens ---------- */
@media (max-width: 34rem) {
  main { padding-top: 2.25rem; }
  .site-nav { gap: .9rem; }
  .post-row { flex-direction: column; gap: .1rem; }
}
