/* ===========================================================
   Z. Berkay Celik — academic site
   Professional academic style: Crimson Pro (serif) headings +
   Inter (sans) body, refined monochrome palette with a
   blue-first accent system. Light theme. Tasteful micro-interactions.
   =========================================================== */

:root {
  /* palette */
  --accent: #1f5fbf;          /* primary accent */
  --accent-bright: #4b87e5;   /* brighter accent for rules, underlines */
  --link: #1f5fbf;
  --ink: #14181d;             /* near-black headings/body */
  --soft: #3d4651;            /* body text */
  --muted: #6b7480;           /* meta text */
  --rule: #e6e8ec;
  --rule-soft: #eef0f3;
  --bg: #ffffff;
  --bg-band: #fafbfc;         /* subtle band (footer) */
  --navbg: #12171d;
  --navfg: #eceef1;

  /* type */
  --serif: "Crimson Pro", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* scale & layout */
  --maxw: 920px;
  --nav-h: 50px;
  --fs-body: 0.9375rem;       /* 15px */
  --fs-small: 0.8125rem;      /* small labels / metadata */
  --fs-xsmall: 0.75rem;       /* compact pills / badges */
  --fs-meta: 0.84rem;         /* ~13.5px */
}

html[data-theme="dark"] {
  --accent: #6ea8ff;
  --accent-bright: #9cc4ff;
  --link: #86bcff;
  --ink: #f2f4f7;
  --soft: #cad0d8;
  --muted: #97a0ab;
  --rule: #2c333c;
  --rule-soft: #242a32;
  --bg: #0d1117;
  --bg-band: #11161d;
  --navbg: #090d12;
  --navfg: #f3f6fa;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--soft);
  background: var(--bg);
  line-height: 1.55;
  font-size: var(--fs-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at top, rgba(110, 168, 255, 0.08), transparent 28%),
    var(--bg);
}

html[data-theme="dark"] body.homepage .content > section {
  background: color-mix(in srgb, var(--bg-band) 97%, var(--bg) 3%);
  border-color: color-mix(in srgb, var(--rule) 96%, transparent);
}

h1, h2, h3 { font-family: var(--serif); color: var(--ink); line-height: 1.2; font-weight: 700; }

a { color: var(--link); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* ---------- Top navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--navbg) 96%, transparent);
  backdrop-filter: saturate(160%) blur(8px);
  color: var(--navfg);
  height: var(--nav-h);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; height: 100%;
  padding: 0 28px; display: flex; align-items: center; gap: 20px;
}
.nav-links { display: flex; gap: 22px; align-items: center; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  color: #c2c7ce; font-family: var(--sans);
  font-size: 0.875rem; font-weight: 500; letter-spacing: 0.01em;
  padding: 4px 0; border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-links a:hover { color: #fff; text-decoration: none; }
.nav-links a.active { color: #fff; border-bottom-color: var(--accent-bright); }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  background: none; border: 1px solid #353a41; color: #c2c7ce;
  border-radius: 8px; cursor: pointer;
}
.theme-toggle:hover { color: #fff; border-color: var(--accent-bright); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
html[data-theme="dark"] .theme-toggle .moon { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: block; }
.nav-lab {
  font-family: var(--sans); font-weight: 600; color: #fff;
  font-size: 0.875rem; letter-spacing: 0.01em;
  display: inline-flex; align-items: center; gap: 6px;
}
.nav-lab:hover { color: var(--accent-bright); text-decoration: none; }

.nav-toggle {
  display: none; background: none; border: 1px solid #353a41; color: #c2c7ce;
  width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
  align-items: center; justify-content: center;
}
.nav-toggle:hover { color: #fff; border-color: var(--accent-bright); }
.nav-toggle svg { width: 18px; height: 18px; }

/* ---------- Page ---------- */
main { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 28px 28px 44px; }

/* screen-reader-only helper */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Layout: single column by default; two-column identity rail + content on desktop */
.layout { display: block; }
.identity { padding-bottom: 8px; }

/* entrance animation — only when JS is active, so content never hides without it */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.5s ease, transform 0.5s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Identity (name / photo / contact) ---------- */
.identity h1 { font-size: clamp(1.8rem, 1.5rem + 1.2vw, 2.2rem); margin: 0 0 3px; letter-spacing: -0.015em; }
.intro-photo {
  float: left; width: 132px; height: 158px; object-fit: cover;
  border-radius: 8px; margin: 4px 22px 12px 0;
  background: linear-gradient(135deg, #d7e6fb, var(--accent-bright));
  box-shadow: 0 1px 2px rgba(20,24,29,0.08), 0 10px 22px rgba(20,24,29,0.10);
}
.identity .role {
  font-family: var(--sans);
  color: var(--muted);
  margin: 0 0 12px;
  font-size: 0.94rem;
  display: grid;
  gap: 2px;
}
.identity .role-line { display: block; }
.identity .role a { color: var(--soft); font-weight: 500; }
.about p { margin: 0 0 10px; }

/* contact row with SVG icons */
.contact { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.contact a {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--sans); font-size: var(--fs-meta); font-weight: 500;
  color: var(--soft);
  padding: 0; border: 0; background: transparent;
  transition: color 0.15s ease, transform 0.15s ease;
}
.contact a:hover { color: var(--ink); transform: translateY(-1px); text-decoration: none; }
.contact svg { width: 16px; height: 16px; stroke-width: 1.75; }

/* ---------- Sections ---------- */
.section { padding-top: 6px; clear: both; }
.section > .subhead:first-of-type { margin-top: 16px; }
.section > .subhead + .members,
.section > .subhead + ul.list {
  margin-top: 4px;
}
.section-title {
  font-size: 1.28rem; margin: 24px 0 10px; padding-bottom: 6px;
  letter-spacing: -0.01em; position: relative;
}
.section-title::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 40px; height: 3px; background: var(--accent-bright); border-radius: 2px;
}
.section p { margin: 0 0 9px; max-width: 64ch; }

/* personal page */
.personal-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--rule-soft);
}
.personal-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.personal-title {
  font-size: 1.08rem;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.personal-copy { max-width: none; }
.personal-copy p { max-width: none; }
.personal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.personal-card {
  margin: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 94%, var(--bg-band) 6%), var(--bg));
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(20, 24, 29, 0.02);
}
.personal-card img,
.personal-card video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #0f141a;
}
.personal-card video { background: #0b0f14; }
.personal-card figcaption {
  padding: 10px 12px 11px;
  font-family: var(--sans);
  font-size: var(--fs-small);
  color: var(--muted);
  border-top: 1px solid var(--rule-soft);
}

body.homepage .content > section {
  background: color-mix(in srgb, var(--bg-band) 97%, var(--bg) 3%);
  border: 1px solid color-mix(in srgb, var(--rule) 96%, transparent);
  border-radius: 8px;
  padding: 18px 20px 16px;
  margin: 0 0 18px;
}
body.homepage .content > section .section-title {
  margin-top: 0;
}
body.homepage .content > section .sec-head .section-title {
  margin-top: 0;
}
body.homepage .content > section:last-child {
  margin-bottom: 0;
}
body.homepage .content > section > :not(.section-title):not(.sec-head) { max-width: none; }
body.homepage .section p { max-width: none; }
body.homepage .content > section ul.list,
body.homepage .content > section ul.news,
body.homepage .content > section ul.pubs,
body.homepage .content > section .course,
body.homepage .content > section .members { max-width: none; }

.pros-callout {
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-band) 95%, var(--bg) 5%), var(--bg));
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent-bright);
  border-radius: 10px;
  padding: 14px 16px 12px;
}
.pros-callout .section-title {
  margin: 0 0 6px;
}
.pros-lead {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.pros-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px 6px 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-bright) 12%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--accent-bright) 25%, var(--rule));
  color: var(--accent);
  font-family: var(--sans);
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 0.01em;
  vertical-align: middle;
  line-height: 1;
}
.pros-badge-icon {
  display: block;
  width: 0.9em;
  height: 0.9em;
  flex: none;
  stroke-width: 2.25;
}
.pros-callout p:last-child {
  margin-bottom: 0;
}

.subhead { font-family: var(--sans); font-size: var(--fs-small); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted);
  margin: 14px 0 6px; }

/* fact lists */
ul.list { list-style: none; margin: 0 0 2px; padding: 0; }
ul.list li {
  position: relative; padding: 4px 0 4px 18px; color: var(--soft);
  border-bottom: 1px solid var(--rule-soft); line-height: 1.5;
}
ul.list li:last-child { border-bottom: none; }
ul.list li::before {
  content: ""; position: absolute; left: 2px; top: 12px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent-bright);
}
ul.list .name { font-weight: 500; color: var(--ink); }
ul.list .yr {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--bg-band);
  color: var(--muted);
  font-size: var(--fs-xsmall);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  vertical-align: middle;
}
ul.list .note { color: var(--muted); font-size: var(--fs-meta); }

ul.tight li {
  position: relative; border-bottom: none; padding: 3px 0 3px 18px;
}
ul.tight {
  list-style: none;
  margin: 0;
  padding: 0;
}
ul.tight li::before {
  content: ""; position: absolute; left: 2px; top: 10px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent-bright);
}
ul.tight .year { color: var(--muted); font-variant-numeric: tabular-nums; }

/* research group (inline text variant) */
.group-line { margin: 0 0 7px; }
.group-line strong { color: var(--ink); font-weight: 600; }

/* section header with a "view all" link */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.sec-head .section-title { margin-top: 26px; margin-bottom: 0; }
.sec-more {
  font-family: var(--sans); font-size: var(--fs-small); font-weight: 600;
  white-space: nowrap; flex: none;
}
.sec-more::after { content: " \2192"; }

/* member cards with avatar placeholders */
.members {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 14px 12px; margin: 8px 0 4px;
}
.member { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.avatar {
  position: relative; width: 78px; height: 78px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: linear-gradient(135deg, #e3effd, #bfd4fb);
  color: #1f5fbf; font-family: var(--sans); font-weight: 700; font-size: 1rem;
  border: 1px solid var(--rule); box-shadow: 0 1px 2px rgba(20,24,29,0.07);
}
.avatar::before { content: attr(data-initials); }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.m-name a { color: var(--ink); }
.m-name { font-weight: 500; color: var(--ink); font-size: 0.86rem; line-height: 1.2; }
.m-role { color: var(--muted); font-size: 0.72rem; font-family: var(--sans); }

/* students page link accents */
.content #students .members .m-name a { color: #0b5fb8; }
.content #students .members .m-name a:hover { color: var(--accent-bright); }
.content #students .list a { color: var(--link); }
.content #students .list a:hover { color: var(--accent-bright); }
.content #students ul.list li { border-bottom: none; }

html[data-theme="dark"] .content #students .members .m-name a { color: #8cc4ff; }
html[data-theme="dark"] .content #students .members .m-name a:hover { color: var(--accent-bright); }
html[data-theme="dark"] .content #students .list a { color: #8cc4ff; }
html[data-theme="dark"] .content #students .list a:hover { color: var(--accent-bright); }

/* rich publication list (selected, Papernot-style) */
ul.pubs { list-style: none; margin: 4px 0 2px; padding: 0; }
ul.pubs > li { padding: 9px 0; border-bottom: 1px solid var(--rule-soft); }
ul.pubs > li:last-child { border-bottom: none; }
.pub-title { font-weight: 600; color: var(--ink); font-size: 0.97rem; line-height: 1.35; }
.pub-title a { color: var(--ink); }
.pub-title a:hover { color: var(--link); }
.pub-authors { font-family: var(--sans); font-size: var(--fs-meta); color: var(--soft); margin-top: 2px; line-height: 1.45; }
.pub-authors .me { color: var(--ink); font-weight: 600; }
.pub-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  margin-top: 4px;
}
.pub-venue { font-family: var(--sans); font-style: italic; font-size: var(--fs-meta); color: var(--muted); }
.pub-meta .pub-note {
  font-family: var(--sans);
  font-size: var(--fs-small);
  color: var(--accent);
  font-weight: 600;
  margin-top: 0;
}
.pub-rate {
  font-family: var(--sans);
  font-size: var(--fs-small);
  color: var(--muted);
  font-weight: 600;
}
.badge {
  font-family: var(--sans); font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 8px; border-radius: 4px;
  background: var(--rule-soft); color: var(--muted); border: 1px solid var(--rule);
}
.badge.award { background: #e7f0ff; color: #1f5fbf; border-color: #c5d7f7; }
.pub-year { font-family: var(--sans); font-size: var(--fs-small); font-weight: 700;
  letter-spacing: 0.05em; color: var(--accent); margin: 13px 0 2px; font-variant-numeric: tabular-nums; }

/* news */
ul.news { list-style: none; margin: 0; padding: 0; }
ul.news li {
  display: flex; gap: 14px; padding: 7px 0;
  border-bottom: 1px solid var(--rule-soft); line-height: 1.5;
}
ul.news li:last-child { border-bottom: none; }
ul.news .date {
  flex: 0 0 76px; color: var(--muted); font-family: var(--sans);
  font-size: var(--fs-meta); font-variant-numeric: tabular-nums; padding-top: 1px;
}
ul.news .n-body { flex: 1; min-width: 0; }

/* teaching */
.course { padding: 9px 0; border-bottom: 1px solid var(--rule-soft); }
.course:last-child { border-bottom: none; }
.course .chead { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.course .code {
  font-family: var(--sans); font-weight: 700; font-size: var(--fs-xsmall);
  letter-spacing: 0.04em; color: #fff; background: var(--accent);
  padding: 2px 7px; border-radius: 5px;
}
.course .ctitle { font-family: var(--serif); font-weight: 600; color: var(--ink); font-size: 1.06rem; }
.course .terms { font-family: var(--sans); color: var(--muted); font-size: var(--fs-meta); }
.course p { font-size: var(--fs-body); margin: 4px 0 0; max-width: 64ch; }

/* publications */
.pub-note { font-family: var(--sans); font-size: var(--fs-meta); color: var(--muted); margin-bottom: 10px; }
#publication-list { font-size: var(--fs-body); }
#publication-list .pub-note { margin-top: 8px; }
.pub-year-card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 92%, var(--bg-band) 8%), var(--bg));
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 16px 18px 10px;
  margin: 14px 0;
  box-shadow: 0 1px 0 rgba(20, 24, 29, 0.02);
}
.pub-year-card:first-child { margin-top: 6px; }
.pub-year-card:last-child { margin-bottom: 0; }
.pub-year {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule-soft);
}
.pub-year-label {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.pub-year-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.25rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--rule-soft);
  border: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--sans);
  font-size: var(--fs-xsmall);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pub-year-card ul.pubs { margin-top: 0; }

html[data-theme="dark"] .pub-year-card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-band) 94%, var(--bg) 6%), var(--bg));
  box-shadow: none;
}

/* ---------- Footer ---------- */
.footer {
  background: var(--bg-band); border-top: 1px solid var(--rule);
  padding: 16px 28px; color: var(--muted);
  font-family: var(--sans); font-size: var(--fs-meta);
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-left,
.footer-right { white-space: nowrap; }
.footer-right { text-align: right; }

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
  main { padding: 22px 20px 36px; }
  .nav-inner { padding: 0 20px; }
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    background: var(--navbg); padding: 4px 20px 10px; gap: 0; display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    display: block;
    width: 100%;
    padding: 10px 0;
    border-bottom: 1px solid #2a2f36;
    box-sizing: border-box;
  }
  .nav-links a.active { border-bottom-color: var(--accent-bright); }
  .intro-photo { width: 116px; height: 140px; margin: 4px 16px 12px 0; float: left; }
  ul.news li { flex-direction: column; gap: 2px; }
  ul.news .date { flex-basis: auto; }
  body.homepage .content > section {
    padding: 16px 16px 14px;
    border-radius: 7px;
    margin-bottom: 14px;
  }
  .pros-callout {
    padding: 12px 14px 10px;
  }
  .personal-grid { grid-template-columns: 1fr; }
  .pub-year-card {
    padding: 14px 14px 8px;
    border-radius: 10px;
  }
  .pub-year {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .footer-right { text-align: left; white-space: normal; }
}

/* ---------- Tablet: a touch wider ---------- */
@media (min-width: 768px) {
  :root { --maxw: 1040px; }
}

/* ---------- Desktop: two-column identity rail + content ---------- */
@media (min-width: 1024px) {
  :root { --maxw: 1200px; }

  .layout {
    display: grid;
    grid-template-columns: 208px minmax(0, 1fr);
    gap: 38px;
    align-items: start;
  }

  /* Identity becomes a sticky left rail */
  .identity {
    position: sticky;
    top: calc(var(--nav-h) + 18px);
    text-align: left;
  }
  .identity .intro-photo {
    float: none; display: block;
    width: 100%; height: auto; aspect-ratio: 1 / 1;
    margin: 0 0 12px;
  }
  .identity h1 { font-size: 1.6rem; line-height: 1.15; }
  .identity .role { font-size: 0.9rem; margin-bottom: 10px; }

  /* Contact stacks vertically in the rail */
  .contact { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* First content section shouldn't push down past the rail's top */
  .content > .section:first-child { padding-top: 0; }
  .content > .section:first-child .section-title:first-child { margin-top: 0; }
}

/* ---------- Large desktop: use more of the screen ---------- */
@media (min-width: 1440px) {
  :root { --maxw: 1320px; }
  .layout { grid-template-columns: 232px minmax(0, 1fr); gap: 46px; }
}
