/* ==========================================================================
   M. Tamer Özsu — site stylesheet
   Single source of truth for every page. Edit here, not in the pages.
   ========================================================================== */

:root {
  --bg:            #ffffff;
  --bg-soft:       #f5f6f7;
  --bg-header:     #ffffff;
  --text:          #1d2125;
  --text-muted:    #5d666e;
  --rule:          #dfe3e7;
  --accent:        #1a5c7a;   /* links, headings */
  --accent-strong: #103e53;   /* hover / active nav */
  --accent-soft:   #e8f0f4;   /* nav hover background */
  --gold:          #c8a13a;   /* thin accent line under the header */
  --header-h:      3.5rem;   /* measured at runtime by site.js */
  --maxw:          1120px;
  --radius:        7px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #14181b;
    --bg-soft:       #1c2125;
    --bg-header:     #171c20;
    --text:          #e4e7ea;
    --text-muted:    #9aa4ad;
    --rule:          #2c3339;
    --accent:        #74b9d6;
    --accent-strong: #a8d6e9;
    --accent-soft:   #22303a;
    --gold:          #b08d2e;
  }
}

/* --------------------------------------------------------------- base --- */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* keeps in-page anchor targets clear of the sticky header */
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
        Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }

img { max-width: 100%; height: auto; }

/* ------------------------------------------------------------- header --- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-header);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.site-header::after {
  content: "";
  display: block;
  height: 3px;
  background: var(--gold);
}

.site-header__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: .55rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-header__name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.site-header__name:hover { color: var(--accent); }

.nav-toggle {
  display: none;
  margin-left: auto;
  padding: .45rem .7rem;
  font: inherit;
  font-size: .9rem;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
}

.site-nav { margin-left: auto; }

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .25rem;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: block;
  padding: .4rem .7rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background-color .12s ease, color .12s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.site-nav a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  .site-nav a[aria-current="page"] { color: #10181d; }
}

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    flex-basis: 100%;
    margin-left: 0;
    padding-bottom: .5rem;
  }
  .site-header__inner { flex-wrap: wrap; }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; justify-content: flex-start; gap: 0; }
  .site-nav a { padding: .6rem .7rem; font-size: .95rem; }
}

/* ---------------------------------------------------------- page head --- */

.page-head {
  border-bottom: 1px solid var(--rule);
  background: var(--bg-soft);
}

.page-head__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.6rem 1rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.page-head h1 {
  margin: 0;
  font-size: 1.85rem;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -.01em;
}

.page-head__logo { flex: 0 0 auto; }
.page-head__logo img { display: block; max-height: 62px; width: auto; }

@media (max-width: 700px) {
  .page-head__inner { flex-direction: column; align-items: flex-start; gap: .9rem; }
  .page-head h1 { font-size: 1.5rem; }
}

/* ----------------------------------------------------------- content --- */

.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.75rem 1rem 3rem;
}

.page h2 {
  margin: 2.4rem 0 .7rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--rule);
  font-size: 1.35rem;
  font-weight: 650;
  color: var(--accent);
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}

.page h3 {
  margin: 1.8rem 0 .5rem;
  font-size: 1.1rem;
  font-weight: 650;
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}

.page h4 {
  margin: 1.3rem 0 .4rem;
  font-size: 1rem;
  font-weight: 650;
  color: var(--text-muted);
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}

.page > :first-child { margin-top: 0; }

.page p { margin: .8rem 0; }

.page ul, .page ol { margin: .6rem 0; padding-left: 1.5rem; }
.page li { margin: .35rem 0; }
.page li > ul, .page li > ol { margin: .3rem 0; }

.page dl { margin: .6rem 0; }
.page dd { margin: .3rem 0 .3rem 1.5rem; }

.page blockquote {
  margin: 1rem 0;
  padding: .3rem 0 .3rem 1rem;
  border-left: 3px solid var(--rule);
  color: var(--text-muted);
}

.page hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }

/* Inline icon links (PDF / video badges beside a talk or paper) */
.page a > img { vertical-align: middle; }
.icon-link img { max-height: 26px; width: auto; }

/* ------------------------------------------------------------- cards --- */

.card {
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
}

.card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  margin: 1.25rem 0;
}

/* Home page identity block */
.profile {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 1.5rem;
}
.profile__photo img {
  display: block;
  width: 170px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
}
.profile__affiliations {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
.affiliation p { margin: .15rem 0; }
.affiliation p:first-child { margin-top: 0; }

@media (max-width: 620px) {
  .profile { grid-template-columns: 1fr; }
  .profile__photo img { width: 140px; }
}

/* Contact rows */
.contact { list-style: none; margin: 0; padding: 0; }
.contact li {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: .5rem 0;
}
.contact li img { max-height: 22px; width: auto; }

/* Profile / index links (ACM DL, DBLP, Scholar, …) */
.links-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .9rem 1.4rem;
  margin: .25rem 0;
}
.links-row a { display: inline-flex; align-items: center; }
.links-row img { max-height: 40px; width: auto; }

/* Books and other image + text rows */
.media {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  margin: .4rem 0 .8rem;
}
.media__figure { flex: 0 0 auto; }
.media__figure img { display: block; border: 1px solid var(--rule); border-radius: 4px; }
.media__body { min-width: 0; }
.media__body > :first-child { margin-top: 0; }

@media (max-width: 560px) {
  .media { flex-direction: column; }
}

/* Centred logo strips */
.logo-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 1.2rem 0;
}

/* Picture gallery */
.gallery figure {
  margin: 0 0 2.25rem;
  text-align: center;
}
.gallery img {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.gallery figcaption {
  margin-top: .6rem;
  font-size: .9rem;
  color: var(--text-muted);
}

/* ---------------------------------------------------- section jump nav --- */

.section-nav {
  position: sticky;
  top: var(--header-h);
  z-index: 10;
  margin: 0 0 1.5rem;
  padding: .7rem .9rem;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.section-nav::before {
  content: "";
  position: absolute;
  left: -1px;
  right: -1px;
  top: -1.8rem;
  height: 1.8rem;
  background: var(--bg);
}

.section-nav__label {
  display: block;
  margin-bottom: .45rem;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.section-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .5rem;
  margin: 0;
  padding: 0;
}
.section-nav li { margin: 0; }
.section-nav a {
  display: block;
  padding: .25rem .6rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg);
  font-size: .82rem;
  text-decoration: none;
}
.section-nav a:hover { background: var(--accent-soft); border-color: var(--accent); }

/* Back-to-top links sprinkled through the long publication pages */
.to-top {
  margin: .5rem 0 1.5rem;
  font-size: .82rem;
  text-align: right;
}

/* ------------------------------------------------------------ tables --- */

.page table {
  border-collapse: collapse;
  margin: 1rem 0;
}
.page th, .page td {
  padding: .45rem .7rem;
  border: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}
.page th { background: var(--bg-soft); font-weight: 650; }

.table-wrap { overflow-x: auto; }

/* ------------------------------------------------------------ footer --- */

.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--bg-soft);
}
.site-footer__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
  font-size: .85rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  justify-content: space-between;
}
.site-footer a { color: var(--text-muted); }

/* --------------------------------------------------------- utilities --- */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.note {
  margin: 1.25rem 0;
  padding: .8rem 1rem;
  background: var(--bg-soft);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .92rem;
}

.text-center { text-align: center; }

@media print {
  .site-header, .section-nav, .to-top { display: none; }
  body { color: #000; background: #fff; }
}

/* Secondary line hanging off a list entry (a thesis title under a name) */
.sub {
  margin-top: .15rem;
  padding-left: 1.1rem;
  font-size: .93rem;
  color: var(--text-muted);
}

/* Card headings sit tighter than the page's own h2 */
.card__title {
  margin: 0 0 .6rem !important;
  padding: 0 !important;
  border: 0 !important;
  font-size: .78rem !important;
  font-weight: 700 !important;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted) !important;
}

/* Text stand-in where a service no longer serves a logo image */
.pill {
  display: inline-block;
  padding: .3rem .8rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg);
  font-size: .85rem;
  text-decoration: none;
}
.pill:hover { background: var(--accent-soft); border-color: var(--accent); }

/* A news entry with a book cover sitting out to the right of the text */
.news-item {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}
.news-item__figure { flex: 0 0 auto; }
.news-item__figure img {
  display: block;
  border: 1px solid var(--rule);
  border-radius: 4px;
}

@media (max-width: 560px) {
  .news-item { flex-direction: column; gap: .6rem; }
}
