/* 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;
  --caramel: #f4e4c9;
  --caramel-line: #dcc29a;

  --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: center; gap: 10px; }
.controls button { background: none; border: 0; padding: 0; cursor: pointer; line-height: 0; }
.lang-flag .flag { display: block; width: 26px; height: auto; border: 1px solid var(--rule); border-radius: 2px; opacity: .45; transition: opacity .15s; }
.lang-flag:hover .flag, .lang-flag[aria-pressed="true"] .flag { opacity: 1; }
.lang-flag[aria-pressed="true"] .flag { outline: 1.5px solid var(--ink); outline-offset: 1.5px; }
#theme-toggle { margin-left: 8px; padding: 3px; }
.theme-dot { display: block; width: 15px; height: 15px; border-radius: 50%; background: #d7191c; box-shadow: 0 0 0 1.5px var(--bg), 0 0 0 2.5px #d7191c; transition: transform .15s; }
#theme-toggle:hover .theme-dot { transform: scale(1.15); }

.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 34px; display: grid; grid-template-columns: minmax(0, 1fr) 172px; gap: 32px; align-items: start; }
.intro-text { min-width: 0; align-self: stretch; display: flex; flex-direction: column; }
/* signature + reading list: the row fills the rest of the intro, so the box ends level with the music box */
.intro-row { flex: 1; display: flex; align-items: stretch; gap: 12px; }
.sig-col { flex: none; width: 232px; display: flex; flex-direction: column; }
.sig-col .signature { align-self: flex-start; }
/* macroeconomic indicators card: pushed to the bottom of the column, its foot level with "daily-musiclog" */
.doc-card { position: relative; flex: 1; display: flex; flex-direction: column; margin: 10px 0 -31px; }
.doc-thumb { position: relative; flex: 1; min-height: 110px; display: block; width: 100%; padding: 0; border: 1px solid var(--caramel-line); background: #fff; cursor: zoom-in; overflow: hidden; }
.doc-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; transition: opacity .15s; }
.doc-thumb:hover img { opacity: .85; }
.doc-dl { position: absolute; right: 5px; bottom: 33px; display: block; width: 25px; height: 29px; padding: 2px 2px 1px; background: var(--caramel); color: #1f3a5f; border: 1px solid var(--caramel-line); line-height: 0; }
.doc-dl svg { width: 100%; height: 100%; }
.doc-dl:hover { background: #fff; border-color: #1f3a5f; }
.doc-note { flex: none; display: flex; align-items: flex-start; justify-content: flex-end; gap: 4px; margin-top: 2px; padding-right: 12px; font-size: .86rem; font-style: italic; color: var(--muted); white-space: nowrap; }
.doc-note .doc-arrow { width: 42px; height: 27px; transform: scaleX(-1); margin-top: -3px; }
.fields { margin: 3px 0 0; font-size: .8rem; }
.doc-note-text { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.doc-note-text small { font-size: .78em; }
/* both languages are in the page; the hidden one keeps its space, so switching language never moves the layout */
.stack { display: grid; }
.stack > [lang] { grid-area: 1 / 1; }
html[lang="tr"] .stack > [lang="en"], html:not([lang="tr"]) .stack > [lang="tr"] { visibility: hidden; }
.fields .sep { color: var(--muted); margin: 0 .25em; }
.doc-lb { display: block; overflow-y: auto; padding: 0 12px 24px; cursor: default; }
.doc-bar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 14px; max-width: 1300px; margin: 0 auto 12px; padding: 10px 2px; background: rgba(0,0,0,.86); color: #fff; font-size: .85rem; }
.doc-bar-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-bar-dl { color: #fff; border: 1px solid rgba(255,255,255,.6); padding: 3px 9px; font-size: .8rem; white-space: nowrap; }
.doc-bar-dl:hover { background: #fff; color: #1f3a5f; text-decoration: none; }
.doc-bar-close { background: none; border: 0; color: #fff; font-size: 1.9rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.doc-pages img { display: block; width: 100%; max-width: 1300px; height: auto; margin: 0 auto 14px; background: #fff; box-shadow: 0 6px 30px rgba(0,0,0,.5); }
.reading-box { flex: 1; min-width: 0; height: 150px; align-self: flex-start; margin: 8px -16px 0 0; display: flex; flex-direction: column; }
.reading-scroll { flex: 1 1 auto; height: 0; }
.reading-ul li { font-size: .74rem; line-height: 1.32; padding: 1px 0 1px 10px; text-indent: -10px; color: #1a1a1a; }
.reading-ul li i { color: #1f3a5f; }
.book-orig { font-family: "Geeza Pro", "Noto Naskh Arabic", "Times New Roman", serif; font-size: .9rem; color: #1f3a5f; unicode-bidi: isolate; }
.book-author { color: var(--muted); }
/* light caramel in both themes, with its own dark text colours */
.side { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; align-content: start; }
.side > * { min-width: 0; }
.links-box { border: 1px solid var(--caramel-line); background: var(--caramel); padding: 6px 0 0; color-scheme: light; --link: #0033a0; --head: #1f3a5f; --muted: #6b5a43; }
.links-title { font-size: .8rem; color: var(--head); padding: 0 7px 4px; border-bottom: 1px solid var(--caramel-line); margin: 0; }
.links-scroll { height: 150px; overflow-y: auto; scrollbar-width: thin; padding: 0 7px; }
.links-scroll:focus-visible { outline-offset: -2px; }
.links-group { font-size: .68rem; color: var(--muted); font-variant-caps: all-small-caps; letter-spacing: .05em; margin: 8px 0 2px; }
.links-scroll ul { list-style: none; margin: 0; padding: 0; }
.links-scroll li a { display: flex; align-items: flex-start; gap: 5px; padding: 1px 0; font-size: .74rem; line-height: 1.3; }
.fav { width: 13px; height: 13px; margin-top: 1px; flex: none; border-radius: 3px; background: #fff; }
.music-head { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-head a { color: inherit; }
.music-body { padding: 7px 7px 6px; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 2px 7px; align-items: start; }
.music-body.is-playing { grid-template-columns: minmax(0, 1fr); }
.music-play { display: block; position: relative; width: 100%; padding: 0; border: 1px solid var(--caramel-line); background: #000; cursor: pointer; }
.music-play img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; opacity: .92; }
.music-play:hover img { opacity: 1; }
.music-btn { position: absolute; left: 50%; top: 50%; width: 22px; height: 15px; margin: -7.5px 0 0 -11px; border-radius: 4px; background: #d7191c; }
.music-btn::after { content: ""; position: absolute; left: 8px; top: 4px; border-style: solid; border-width: 3.5px 0 3.5px 6px; border-color: transparent transparent transparent #fff; }
.music-frame { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }
.music-meta { color: var(--muted); font-size: .64rem; line-height: 1.3; }
.music-note { display: flex; align-items: flex-end; gap: 5px; font-size: 1rem; font-style: italic; color: var(--muted); padding-left: 26px; position: absolute; top: 100%; left: 0; margin-top: 2px; width: max-content; }
.music-note:hover { color: var(--link); text-decoration: none; }
.music-note:hover span { text-decoration: underline; }
.music-arrow { width: 42px; height: 27px; flex: none; color: var(--mark); }
.fav-letter { display: inline-grid; place-items: center; font-size: .62rem; font-weight: 700; color: var(--bg); background: var(--head); }
.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) {
  .intro { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .links-scroll { height: 150px; }
  .intro-row { flex-direction: column; gap: 10px; }
  .sig-col { width: auto; }
  .doc-card { margin: 10px 0 0; width: 232px; flex: none; }
  .doc-thumb { flex: none; height: 140px; }
  .reading-scroll { flex: none; height: 150px; }
  .reading-box { align-self: stretch; height: auto; margin: 0; }
  .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%; }
}
