/* Layout: a single left-aligned text column (max 860px), like a LaTeX article page.
   Colours are taken from the author's own notes and figures:
   section headings #1F3A5F, links #0033a0 (figure blue), marks #9B2226, box background #EEF2F6. */
:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #5f5f5f;
  --rule: #cfcfcf;
  --head: #1f3a5f;
  --link: #0033a0;
  --mark: #9b2226;
  --box: #eef2f6;
  --fig-bg: #ffffff;

  --serif: "Latin Modern", "CMU Serif", "Computer Modern Serif", Georgia, "Times New Roman", serif;
  --wrap: 860px;
  --gutter: clamp(16px, 4vw, 28px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161616; --ink: #e6e6e6; --muted: #a3a3a3; --rule: #3a3a3a;
    --head: #a9c1de; --link: #8fb0ff; --mark: #f08a8d; --box: #22262b; --fig-bg: #f4f4f4;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161616; --ink: #e6e6e6; --muted: #a3a3a3; --rule: #3a3a3a;
  --head: #a9c1de; --link: #8fb0ff; --mark: #f08a8d; --box: #22262b; --fig-bg: #f4f4f4;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.5 var(--serif);
  font-kerning: normal;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; margin: 0; text-wrap: balance; }
p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 1px dotted var(--ink); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--bg); padding: 4px 8px; z-index: 10; }
.skip:focus { left: 8px; }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.eyebrow { font-size: .85rem; color: var(--muted); font-variant-caps: all-small-caps; letter-spacing: .04em; }

/* MASTHEAD */
.masthead { padding-block: 14px 0; }
.topline {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 18px;
  font-size: .95rem; padding-bottom: 6px; border-bottom: 1px solid var(--rule);
}
.nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.controls { display: flex; align-items: baseline; gap: 4px; color: var(--muted); }
.controls button { background: none; border: 0; padding: 0 2px; cursor: pointer; color: var(--link); }
.controls button[aria-pressed="true"] { color: var(--ink); font-weight: 700; }
#theme-toggle { margin-left: 12px; }

.titleblock { display: flex; gap: 18px; align-items: center; padding-block: 20px 16px; }
.titleblock > div { flex: 1 1 0; min-width: 0; }
.jale { margin: 0 0 0 auto; flex: none; text-align: center; }
.jale-grid { display: grid; grid-template-columns: repeat(3, 46px); gap: 4px; }
.jale-thumb { padding: 0; border: 1px solid var(--rule); background: none; cursor: zoom-in; display: block; }
.jale-thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; transition: opacity .15s; }
.jale-thumb:hover img { opacity: .8; }
.jale figcaption { white-space: nowrap; font-size: .82rem; font-style: italic; color: var(--muted); margin-top: 3px; }
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.86); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 92vh; width: auto; height: auto; box-shadow: 0 6px 30px rgba(0,0,0,.5); }
.lb-close { position: absolute; top: 10px; right: 16px; background: none; border: 0; color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; }
.portrait { width: 96px; height: 96px; object-fit: cover; border: 1px solid var(--rule); flex: none; }
.titleblock h1 { font-size: clamp(1.8rem, 4.4vw, 2.3rem); line-height: 1.1; }
.affil { color: var(--muted); margin-top: 4px; }
.contact { display: flex; flex-wrap: wrap; gap: 2px 16px; margin-top: 6px; font-size: .95rem; }
.contact a, .footer-links a { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.ico { width: 1em; height: 1em; flex: none; }
.contact .ico { width: 1.05em; height: 1.05em; }

/* QUOTE LINE: moves on its own, slowly; pauses under the pointer */
.ticker { overflow: hidden; border-block: 1px solid var(--rule); }
.ticker-track {
  display: flex; width: max-content; gap: 64px; padding: 5px 0; will-change: transform;
  animation: ticker var(--ticker-duration, 400s) linear infinite;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
.quote { white-space: nowrap; font-style: italic; font-size: .95rem; color: var(--ink); }
.quote cite { font-style: normal; color: var(--muted); margin-left: 8px; font-size: .88rem; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* INTRO */
.intro { padding-block: 18px 6px; }
.lede { max-width: 68ch; }
.signature { width: 160px; margin-top: 8px; opacity: .9; }
:root[data-theme="dark"] .signature { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .signature { filter: invert(1); } }

/* SECTIONS — styled like \section in the author's notes */
.block { padding-block: 22px 6px; }
.block h2 {
  font-size: 1.3rem; color: var(--head);
  padding-bottom: 3px; border-bottom: 1px solid var(--rule); margin-bottom: 12px;
}
.block-head h2 { margin-bottom: 4px; }
#writing .block-head h2, #projects .block-head h2 { margin-bottom: 12px; }
.block-note { color: var(--muted); font-size: .92rem; margin-bottom: 14px; }

/* PROJECTS: two-column grid of figure + caption */
.repo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 26px; }
.repo-grid.featured { margin-bottom: 22px; }
.repo-grid > p:only-child { grid-column: 1 / -1; }
.repo { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.repo-fig { display: block; background: var(--fig-bg); border: 1px solid var(--rule); padding: 6px; margin-bottom: 4px; }
.repo-fig img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; }
.repo h3 { font-size: 1.05rem; line-height: 1.3; overflow-wrap: anywhere; }
.repo p { font-size: .93rem; line-height: 1.45; }
.repo-meta { color: var(--muted); font-size: .85rem !important; }
.more-row { grid-column: 1 / -1; }
.more { background: none; border: 0; padding: 0; cursor: pointer; color: var(--link); }
.more:hover { text-decoration: underline; }

/* WRITING */
.filters { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: .95rem; }
.chip { background: none; border: 0; padding: 0; cursor: pointer; color: var(--link); }
.chip[aria-selected="true"] { color: var(--ink); font-weight: 700; }
.chip .count { color: var(--muted); font-weight: 400; margin-left: 3px; }
.chip .count::before { content: "("; }
.chip .count::after { content: ")"; }
.search input {
  font: inherit; font-size: .92rem; padding: 2px 6px; width: 200px; max-width: 100%;
  border: 0; border-bottom: 1px solid var(--rule); background: transparent; color: var(--ink);
}
.search input:focus { outline: none; border-bottom-color: var(--ink); }
.post-list { list-style: none; margin: 0; padding: 0; }
.post { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 0 14px; padding: 7px 0; }
.post time { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.post .post-title { font-weight: 700; }
.post .post-cat { grid-column: 2; color: var(--mark); font-size: .85rem; font-variant-caps: all-small-caps; letter-spacing: .03em; }
.post .post-sum { grid-column: 2; font-size: .93rem; }
.empty { padding: 6px 0; color: var(--muted); font-style: italic; }

/* RESEARCH */
#research { padding-block: 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr); gap: 0 34px; }
.two-col > div { padding-block: 22px 6px; min-width: 0; }
.tags { margin: 0; padding-left: 1.2em; display: grid; gap: 2px; }
.pubs { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.pubs li { display: grid; grid-template-columns: 4.2em minmax(0, 1fr); gap: 10px; }
.pub-year { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.pub-title { font-style: italic; line-height: 1.4; }
.pub-meta { color: var(--muted); font-size: .88rem; margin-top: 2px; }

/* EDUCATION */
.cv-grid { display: grid; grid-template-columns: 7em minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.cv-grid dt { color: var(--muted); font-variant-caps: all-small-caps; letter-spacing: .04em; }
.cv-grid dd { margin: 0; display: grid; gap: 2px; }
.pills { display: block !important; }
.pills span + span::before { content: " · "; color: var(--muted); }

/* FOOTER */
.footer { margin-top: 26px; padding-block: 0 22px; color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.footer-inner::before { content: ""; flex: 0 0 100%; height: 1px; background: var(--rule); margin-bottom: 2px; }
.footer-links { display: flex; gap: 14px; }

/* POST PAGES — the web version of the author's LaTeX "Bilgi Notu" template */
.note { max-width: 760px; padding-block: 18px 40px; }
.note-nav { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: .92rem; margin-bottom: 26px; }
.note-nav-r { display: flex; align-items: baseline; gap: 18px; }
.ver-switch { color: var(--muted); }
.ver-switch button { background: none; border: 0; padding: 0 2px; cursor: pointer; color: var(--link); font: inherit; }
.ver-switch button[aria-pressed="true"] { color: var(--ink); font-weight: 700; }
.post-lang { letter-spacing: .06em; }
.note-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px;
  font-size: .9rem; padding-bottom: 3px; border-bottom: 0.5px solid var(--ink);
}
.note-title { border-collapse: collapse; margin: 18px 0 14px; width: 100%; }
.note-title th { text-align: left; vertical-align: baseline; white-space: nowrap; padding: 2px 10px 2px 0; font-weight: 700; width: 1%; }
.note-title td { padding: 2px 0; vertical-align: baseline; }
.note-title h1 { font-size: 1.32rem; line-height: 1.3; }
.simple-title { font-size: clamp(1.5rem, 4vw, 1.9rem); line-height: 1.2; margin: 18px 0 14px; }
.draft-flag { color: var(--mark); font-size: .8em; letter-spacing: .05em; }

.note-body { font-size: 1.04rem; line-height: 1.55; counter-reset: sec; }
.note-body > * + * { margin-top: .6em; }
.note-body h2 { font-size: 1.04rem; color: var(--head); margin-top: 1.3em; }
.note-note h2::before { counter-increment: sec; content: counter(sec) ".\2002"; }
.note-body h3 { font-size: 1rem; font-style: italic; margin-top: 1em; }
.note-body ul, .note-body ol { padding-left: 1.4em; margin-block: .4em; }
.note-body li + li { margin-top: .15em; }
.note-body mark { background: #fff36b; color: #111; padding: 0 .1em; }
.note-body .name { color: var(--mark); }
.note-body a { text-decoration: underline; text-decoration-thickness: .5px; text-underline-offset: 2px; }
.note-body blockquote { margin: 0; padding-left: 14px; border-left: 1px solid var(--rule); font-style: italic; }
.box { border: 1px solid var(--head); background: var(--box); padding: 8px 12px; }
.box.cols { column-count: 2; column-gap: 22px; }
.box-title { column-span: all; color: var(--head); font-weight: 700; margin-bottom: 4px; }
.box > p + p { margin-top: .5em; }
.scope { font-size: .92rem; margin-top: 1.2em !important; }
.note-body figure { margin: 1em 0; }
.note-body figure img { margin-inline: auto; border: 1px solid var(--rule); background: var(--fig-bg); }
.note-body figcaption { font-size: .9rem; margin-top: 5px; }
.note-body table:not(.note-title) { border-collapse: collapse; display: block; overflow-x: auto; font-size: .95rem; }
.note-body th, .note-body td { padding: 3px 12px 3px 0; text-align: left; }
.note-body thead th { border-top: 1px solid var(--ink); border-bottom: 0.5px solid var(--ink); }
.note-body tbody tr:last-child td { border-bottom: 1px solid var(--ink); }
.note-body pre { overflow-x: auto; background: var(--box); padding: 10px; font-size: .86rem; }
.note-body code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .86em; }
.note-body .katex-display { overflow-x: auto; overflow-y: hidden; padding-block: 2px; }
.footnote { font-size: .88rem; margin-top: 1.6em !important; }
.footnote hr { display: none; }
.fn-head { font-weight: 700; border-top: 0.5px solid var(--ink); padding-top: 6px; width: 40%; }
.footnote ol { padding-left: 1.3em; margin-top: 4px; }
.footnote-backref { text-decoration: none !important; margin-left: 4px; }
sup a.footnote-ref { text-decoration: none !important; }
.note-foot { margin-top: 28px; padding-top: 8px; border-top: 1px solid var(--rule); font-size: .9rem; display: grid; gap: 4px; }
.note-meta { color: var(--muted); }
.note-pn { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; margin-top: 14px; font-size: .9rem; }
.post .post-title .draft-flag { font-weight: 400; }

/* NARROW SCREENS */
@media (max-width: 720px) {
  .repo-grid, .two-col { grid-template-columns: minmax(0, 1fr); }
  .two-col > div + div { padding-top: 6px; }
  .portrait { width: 72px; height: 72px; }
  .titleblock { flex-wrap: wrap; }
  .jale { margin-left: 0; flex-basis: 100%; text-align: left; }
  .jale-grid { grid-template-columns: repeat(3, 52px); }
  .titleblock { gap: 14px; }
}
@media (max-width: 560px) {
  .box.cols { column-count: 1; }
  .note-title th, .note-title td { display: block; width: auto; padding: 0; }
  .note-title td { margin-bottom: 6px; }
}
@media (max-width: 480px) {
  .post { grid-template-columns: minmax(0, 1fr); }
  .post .post-cat, .post .post-sum { grid-column: 1; }
  .cv-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cv-grid dd { margin-bottom: 10px; }
  .search, .search input { width: 100%; }
}
