/* ==========================================================================
   Said Gurbuz · personal site
   Two panes: a sticky profile (identity, links, section nav) and one
   readable content column. Same type system as the DeskForge project page.
   ========================================================================== */

:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --soft: #f3f1ec;
  --ink: #15171c;
  --ink-2: #3b414b;
  --muted: #6b717c;
  --line: #e7e3db;
  --line-strong: #d6d1c6;
  --accent: #1f5fbf;
  --accent-soft: #e8eff9;
  --media-bg: #0e1222;

  --venue-arxiv: #b31b1b;
  --venue-icml: #1e40af;
  --venue-icdar: #6d28d9;
  --venue-iccv: #047857;
  --venue-srmc: #5b6575;

  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius: 12px;
  --side: 300px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #111317;
  --surface: #171a1f;
  --soft: #1d2026;
  --ink: #eceef1;
  --ink-2: #c4c8cf;
  --muted: #8f959e;
  --line: #262a31;
  --line-strong: #353a43;
  --accent: #82adf0;
  --accent-soft: #1b2638;

  --venue-arxiv: #f28b82;
  --venue-icml: #8ab4f8;
  --venue-icdar: #c4b5fd;
  --venue-iccv: #6ee7b7;
  --venue-srmc: #a6b0bf;
  color-scheme: dark;
}

/* Without JavaScript, follow the system theme. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #111317; --surface: #171a1f; --soft: #1d2026; --ink: #eceef1; --ink-2: #c4c8cf;
    --muted: #8f959e; --line: #262a31; --line-strong: #353a43; --accent: #82adf0; --accent-soft: #1b2638;
    --venue-arxiv: #f28b82; --venue-icml: #8ab4f8; --venue-icdar: #c4b5fd; --venue-iccv: #6ee7b7; --venue-srmc: #a6b0bf;
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font: 400 16px/1.65 var(--sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
img, video { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
strong { color: var(--ink); font-weight: 600; }
p { margin: 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }
svg { width: 1em; height: 1em; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---------- layout ---------- */
.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  gap: 76px;
}

/* ---------- profile (sticky left pane) ---------- */
.profile {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 56px 0 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  scrollbar-width: none;
}
.profile::-webkit-scrollbar { display: none; }
.profile > * { flex-shrink: 0; }

.portrait-link { display: block; width: fit-content; border-radius: 20px; }
.portrait {
  width: 212px;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 10px 28px -12px rgba(20, 30, 60, .35);
}
.profile-id { margin-top: 20px; }
.name {
  margin: 0;
  font: 600 2.05rem/1.1 var(--serif);
  letter-spacing: -.01em;
  color: var(--ink);
}
.role { margin-top: 6px; color: var(--ink-2); font-weight: 500; }
.affil { margin-top: 14px; display: grid; gap: 8px; font-size: .9rem; color: var(--muted); line-height: 1.45; }
.affil li { display: grid; grid-template-columns: 70px minmax(0, 1fr); align-items: start; gap: 10px; }
.aff-logo { height: 1.45em; display: flex; align-items: center; justify-content: center; }
.aff-logo img { flex: none; max-width: none; }
.aff-logo img[src*="eth-zurich"] { width: 66px; height: 11px; }
.aff-logo img[src*="ibm"] { width: 35px; height: 13px; }
.aff-logo img[src*="docling"] { width: 20px; height: 20px; }
:root[data-theme="dark"] .aff-logo img.mono { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .aff-logo img.mono { filter: invert(1); } }
.affil a { color: var(--ink); font-weight: 500; }

.contact { display: flex; flex-wrap: wrap; gap: 8px; }
.contact a {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2); font-size: .84rem; font-weight: 500;
  transition: border-color .15s, color .15s, background .15s;
}
.contact a:hover { text-decoration: none; color: var(--ink); border-color: var(--ink-2); }
.contact svg { font-size: 1.02rem; }
/* Wide desktop: labeled pills in two even columns, so six links make three tidy rows. */
@media (min-width: 1241px) and (min-height: 881px) {
  .contact { display: grid; grid-template-columns: 1fr 1fr; }
  .contact a { width: 100%; }
}

.toc { display: grid; gap: 2px; margin-top: 4px; }
.toc a {
  position: relative;
  padding: 5px 0 5px 18px;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 500;
}
.toc a::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 8px; height: 1.5px;
  background: var(--line-strong);
  transition: width .2s, background .2s;
}
.toc a:hover { color: var(--ink); text-decoration: none; }
.toc a.on { color: var(--ink); }
.toc a.on::before { width: 12px; background: var(--accent); }

.theme {
  position: fixed; top: 22px; right: 24px; z-index: 6;
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(6px);
  color: var(--muted); cursor: pointer;
}
.theme svg { width: 17px; height: 17px; }
.theme:hover { color: var(--ink); border-color: var(--ink-2); }
.t-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.theme .t-sun { display: none; }
[data-theme="dark"] .theme .t-sun { display: block; }
[data-theme="dark"] .theme .t-moon { display: none; }

/* ---------- content ---------- */
main { padding: 64px 0 40px; max-width: 780px; min-width: 0; }
section { padding-bottom: 52px; scroll-margin-top: 28px; }
section + section { padding-top: 4px; }
h2 {
  margin: 0 0 18px;
  font: 600 1.45rem/1.2 var(--serif);
  color: var(--ink);
  letter-spacing: -.005em;
  display: flex; align-items: center; gap: 14px;
}
h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sub {
  margin: 30px 0 8px;
  font: 600 .74rem/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* about */
#about p + p { margin-top: 12px; }
.lead { font: 400 1.22rem/1.55 var(--serif); color: var(--ink); margin-bottom: 14px !important; }
.lead strong { font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tags li {
  padding: 3px 11px; border-radius: 999px;
  background: var(--soft); color: var(--ink-2);
  font-size: .8rem; font-weight: 500;
}

/* news */
.news li {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.news li:last-child { border-bottom: 0; }
.news time { font: 500 .76rem/1.9 var(--mono); color: var(--muted); white-space: nowrap; }
.news p { font-size: .95rem; }
.more { margin-top: 4px; }
.more summary {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; list-style: none;
  color: var(--muted); font-size: .84rem; font-weight: 500; padding: 4px 0;
}
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: "↓"; transition: transform .2s; }
.more[open] summary::after { transform: rotate(180deg); }
.more summary:hover { color: var(--ink); }
.more .news { margin-top: 4px; }

/* publications */
.pub {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  gap: 24px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}
.pub:first-of-type { border-top: 0; padding-top: 4px; }
.thumb {
  align-self: start;
  aspect-ratio: 16 / 10;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  padding: 6px;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.pub.compact .pub-body { grid-column: 2; }

.pub.featured { grid-template-columns: minmax(0, 1fr); gap: 18px; }
.media {
  display: block;
  border-radius: 14px;
  overflow: hidden;
  background: var(--media-bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 16px 40px -18px rgba(14, 18, 34, .55);
}
.promo { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }

.venue {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  font: 500 .72rem/1.5 var(--mono);
  letter-spacing: .02em;
  color: var(--v);
  background: color-mix(in srgb, var(--v) 11%, transparent);
}
.venue.arxiv { --v: var(--venue-arxiv); }
.venue.icml { --v: var(--venue-icml); }
.venue.icdar { --v: var(--venue-icdar); }
.venue.iccv { --v: var(--venue-iccv); }
.venue.srmc { --v: var(--venue-srmc); }

.pub h3 { margin: 0; font: 600 1.1rem/1.38 var(--serif); }
.pub.featured h3 { font-size: 1.28rem; }
.pub h3 a { color: var(--ink); }
.pub h3 a:hover { color: var(--accent); text-decoration: none; }
.authors { margin-top: 5px; font-size: .88rem; color: var(--ink-2); }
.authors strong { font-weight: 600; }
.summary { margin-top: 6px; font-size: .88rem; color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.links a, .links button {
  display: inline-flex; align-items: center;
  height: 27px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font: 500 .78rem var(--sans);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.links a:hover, .links button:hover { text-decoration: none; color: var(--accent); border-color: var(--accent); }

/* open source */
.oss { border-top: 1px solid var(--line); padding-top: 4px; }
.oss .sub { margin-top: 22px; }
.repos { display: flex; flex-wrap: wrap; gap: 8px; }
.repos a {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface);
  color: var(--ink); font: 500 .82rem var(--mono);
}
.repos a:hover { text-decoration: none; border-color: var(--ink-2); }
.repos svg { color: var(--muted); }
.stars:not(:empty) {
  display: inline-flex; align-items: center; gap: 3px;
  margin-left: 2px; padding-left: 8px;
  border-left: 1px solid var(--line-strong);
  color: var(--muted); font-size: .76rem;
}
.stars svg { width: .85em; height: .85em; color: #d4a017; }

/* experience / education */
.cv li {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.cv li:last-child { border-bottom: 0; }
.logo {
  width: 58px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 7px;
}
.logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo img[src*="ibm_logo"] { transform: scale(1.9); }
.logo img[src*="eth_logo"] { transform: scale(1.22); }
.logo.letter { font: 600 1.05rem var(--serif); color: #3b414b; }
.what { font-size: .95rem; color: var(--ink-2); }
.detail { font-size: .85rem; color: var(--muted); margin-top: 1px; }
.cv time { font: 500 .76rem var(--mono); color: var(--muted); white-space: nowrap; }

footer {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  color: var(--muted);
  font-size: .8rem;
}

/* ---------- BibTeX dialog ---------- */
dialog.bibtex {
  width: min(720px, calc(100vw - 32px));
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 18px 20px 20px;
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45);
}
dialog.bibtex::backdrop { background: rgba(10, 12, 18, .45); backdrop-filter: blur(2px); }
.bib-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.bib-head h2 { margin: 0; font-size: 1.05rem; }
.bib-head h2::after { display: none; }
.close { border: 0; background: none; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 2px 6px; }
.close:hover { color: var(--ink); }
dialog pre {
  margin: 0;
  max-height: 60vh; overflow: auto;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--soft);
  font: .78rem/1.55 var(--mono);
  color: var(--ink);
  white-space: pre;
}
.copy {
  margin-top: 12px;
  height: 32px; padding: 0 14px;
  border: 0; border-radius: 999px;
  background: var(--ink); color: var(--bg);
  font: 500 .82rem var(--sans); cursor: pointer;
}

/* ---------- laptop widths: tighter two-pane layout ---------- */
@media (max-width: 1240px) {
  .shell { gap: 52px; padding: 0 32px; }
  :root { --side: 270px; }
  .pub { grid-template-columns: 172px minmax(0, 1fr); gap: 20px; }
}

/* ---------- short or narrower desktop screens: keep the whole profile pane in view ---------- */
@media (min-width: 981px) and (max-height: 880px), (min-width: 981px) and (max-width: 1240px) {
  .contact { gap: 6px; }
  .contact a { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .contact span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (min-width: 981px) and (max-height: 880px) {
  .profile { padding-top: 40px; gap: 18px; }
  .portrait { width: 168px; }
  .profile-id { margin-top: 16px; }
}
@media (min-width: 981px) and (max-height: 720px) {
  .portrait { width: 132px; }
  .toc a { padding: 3px 0 3px 18px; }
}

/* ---------- narrow screens: profile on top, sticky section tabs ---------- */
@media (max-width: 980px) {
  .shell { display: block; padding: 0 20px; }
  .profile {
    position: static; height: auto; overflow: visible;
    padding: 28px 0 0; gap: 16px;
  }
  .profile-card { display: flex; align-items: center; gap: 18px; }
  .portrait { width: 96px; height: 96px; aspect-ratio: 1; object-position: 50% 22%; border-radius: 18px; }
  .profile-id { margin-top: 0; }
  .name { font-size: 1.7rem; }
  .affil { margin-top: 8px; font-size: .84rem; }
  .theme { position: absolute; top: 20px; right: 20px; }
  .toc {
    position: sticky; top: 0; z-index: 5;
    display: flex; gap: 4px; overflow-x: auto;
    margin: 0 -20px; padding: 10px 20px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .toc::-webkit-scrollbar { display: none; }
  .toc a { padding: 4px 12px; border-radius: 999px; white-space: nowrap; }
  .toc a::before { display: none; }
  .toc a.on { background: var(--soft); }
  main { padding-top: 28px; }
  section { scroll-margin-top: 64px; }
}

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .contact span { display: none; }
  .contact a { width: 38px; padding: 0; justify-content: center; }
  .pub { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .thumb { max-width: 320px; }
  .pub.compact .pub-body { grid-column: auto; }
  .news li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cv li { grid-template-columns: 50px minmax(0, 1fr); row-gap: 2px; }
  .logo { width: 50px; }
  .cv time { grid-column: 2; }
}
