/* ==========================================================================
   ercanezin.com: site styles
   Palette and type carried over from the previous site:
   primary #2c98f0, panel grey #f2f3f7, Quicksand throughout (one rounded family
   for body and headings; hierarchy comes from weight, size and spacing).
   ========================================================================== */

:root {
  --primary: #2c98f0;
  --primary-dark: #1677c9;
  --primary-tint: rgba(44, 152, 240, 0.1);

  --c1: #2c98f0;
  --c2: #ec5453;
  --c3: #f9bf3f;
  --c4: #a84cb8;
  --c5: #2fa499;
  --c6: #4054b2;

  --bg: #f2f3f7;
  --card: #ffffff;
  --line: #e6e8ef;
  --heading: #000000;
  --text: #4d4d4d;
  --muted: #767676;

  --font-body: "Quicksand", "Nunito", Arial, sans-serif;
  --font-head: var(--font-body);

  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 12px 32px rgba(24, 39, 75, 0.06), 0 2px 6px rgba(24, 39, 75, 0.04);
  --ease: 0.25s ease;
}

/* ---------- Base ---------- */

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }

a { color: var(--primary); text-decoration: none; transition: color var(--ease); }
a:hover { color: var(--primary-dark); }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

p { margin: 0 0 1.2em; }

h1, h2, h3, h4 {
  color: var(--heading);
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

ul, ol { margin: 0; padding: 0; list-style: none; }

.ic {
  width: 1em; height: 1em;
  flex: none;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.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;
}

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--primary); color: #fff;
  padding: 8px 16px; border-radius: 8px;
  font-weight: 600;
}
.skip-link:focus { top: 16px; color: #fff; }

/* ---------- Layout ---------- */

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 24px;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Sidebar ---------- */

/* The profile card scrolls with the page. site.js adds .is-sticky only when the whole card
   fits in the window, so it is never cut off and never gets a scrollbar of its own. */
.sidebar {
  padding: 0 26px 30px;
  text-align: center;
}
.sidebar.is-sticky { position: sticky; top: 40px; }

/* Photo frame: flat, flush with the top and sides of the card (the negative margins cancel
   the card's padding), rounded on all four corners to match the card. The photo is zoomed
   in a little and anchored on the face. */
.avatar-frame {
  margin: 0 -26px 22px;
  aspect-ratio: 4 / 3;
  border-radius: calc(var(--radius) - 1px);
  overflow: hidden;
  isolation: isolate;
  background: var(--primary-tint);
}
.avatar {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 45%;
  transform: scale(1.18);
  transform-origin: 50% 45%;
}

.name {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 14px;
}

.positions li {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 6px;
  color: var(--text);
}
.positions .role { color: var(--heading); font-weight: 700; }

.sidebar-toggle { display: none; }

.sidebar-more { text-align: left; }

.separator {
  height: 1px;
  background: var(--line);
  margin: 24px 0;
}

.side-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.contacts li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.contacts li:last-child { margin-bottom: 0; }

.icon-box {
  width: 38px; height: 38px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--primary-tint);
  color: var(--primary);
  font-size: 17px;
}

.contact-title {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.4;
}
.contacts a, .contacts address {
  display: block;
  font-size: 14px;
  font-style: normal;
  font-weight: 500;
  color: var(--heading);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.contacts a:hover { color: var(--primary); }

/* Email addresses: the "@" is drawn as an icon in a small square and the address is
   never written out in the HTML, so text scrapers and OCR do not pick it up.
   site.js turns it into a mailto: link when a visitor points at or focuses it. */
.email { cursor: pointer; overflow-wrap: anywhere; }
.at {
  display: inline-grid;
  place-items: center;
  width: 1.2em; height: 1.2em;
  margin: 0 0.12em;
  vertical-align: -0.22em;
  border-radius: 0.28em;
  background: var(--primary-tint);
  color: var(--primary);
}
.at .ic { font-size: 0.8em; stroke-width: 2.4; }

.profiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.profiles a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  transition: border-color var(--ease), background var(--ease), color var(--ease), transform var(--ease);
}
.profiles a:hover {
  border-color: var(--primary);
  background: var(--primary-tint);
  color: var(--heading);
  transform: translateY(-1px);
}
.profiles img { width: 24px; height: 24px; object-fit: contain; flex: none; }

/* ---------- Main + top navigation ---------- */

.main { min-width: 0; }

.topnav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}

.topnav ul {
  display: flex;
  gap: 30px;
  padding: 0 44px;
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav ul::-webkit-scrollbar { display: none; }

.topnav a {
  position: relative;
  display: block;
  padding: 22px 0 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text);
}
.topnav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}
.topnav a:hover { color: var(--primary); }
.topnav a[aria-current="page"] { color: var(--primary); }
.topnav a[aria-current="page"]::after { transform: scaleX(1); }

.tab {
  padding: 44px 44px 48px;
  scroll-margin-top: 90px;
}
.tab:focus { outline: none; }

/* With JavaScript, show one tab at a time; without it, all tabs stack. */
.js .tab { display: none; }
.js .tab.is-active { display: block; animation: fadeUp 0.35s ease both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* Footer: affiliation logos in one centred row, copyright underneath. */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 44px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.affiliations {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px clamp(8px, 2.4vw, 30px);
}
.affiliations a, .affiliations span { display: block; transition: transform var(--ease); }
.affiliations a:hover { transform: translateY(-2px); }
/* Each logo's --h (set inline) gives it roughly equal visual area; --u sets the overall size. */
.affiliations { --u: 1.25px; }
.affiliations .aff-break { display: none; }
@media (max-width: 720px) {
  /* Phones: two balanced rows (4 + 3) instead of shrinking the logos. */
  .affiliations { --u: clamp(0.95px, 0.3vw, 1.1px); gap: 14px clamp(10px, 4vw, 20px); }
  .affiliations .aff-break { display: block; flex-basis: 100%; height: 0; }
}
.affiliations img {
  display: block;
  height: calc(var(--h, 44) * var(--u));
  width: auto;
}
.copyright {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Section headings ---------- */

.section-head { margin-bottom: 36px; }

.section-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 5px;
  text-transform: uppercase;
  line-height: 1.6;
}
.section-title::after {
  content: "";
  display: block;
  width: 40px; height: 3px;
  margin-top: 14px;
  border-radius: 3px;
  background: var(--primary);
}

.sub-title {
  font-size: 21px;
  margin: 44px 0 22px;
}
.sub-title:first-child { margin-top: 0; }

.lead p:last-child { margin-bottom: 0; }

/* ---------- About ---------- */

.focus-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.focus-item {
  display: flex;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}
.focus-item:hover {
  border-color: transparent;
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.focus-item h4 {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}
.focus-item p { font-size: 14.5px; line-height: 1.65; margin: 0; }

.focus-icon {
  width: 46px; height: 46px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  font-size: 21px;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent);
}

/* ---------- Publications ---------- */

.pub-year {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 20px;
  color: var(--heading);
  margin: 34px 0 6px;
}
.pub-year:first-child { margin-top: 0; }
.pub-year::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.pub {
  position: relative;
  padding: 18px 0 18px 22px;
  border-bottom: 1px dashed var(--line);
}
.pub:last-child { border-bottom: 0; }
.pub::before {
  content: "";
  position: absolute;
  left: 0; top: 26px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-tint);
}

.pub-title {
  display: block;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--heading);
  margin-bottom: 4px;
}
a.pub-title:hover { color: var(--primary); }

.pub-authors { font-size: 15px; margin: 0; }
.pub-authors .me { color: var(--heading); font-weight: 700; }

.pub-venue { font-size: 14.5px; color: var(--muted); margin: 0; }
.pub-venue cite { font-style: italic; color: var(--text); }

.pub-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  line-height: 1.8;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
}
.tag-index { border-color: transparent; background: color-mix(in srgb, var(--c5) 14%, transparent); color: #1f7a71; }
a.tag-link { border-color: transparent; background: var(--primary-tint); color: var(--primary-dark); }
a.tag-link:hover { background: var(--primary); color: #fff; }
.tag .ic { font-size: 12px; }

/* ---------- Timeline (Experience, Education) ---------- */

.timeline { position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 18px; top: 10px; bottom: 10px;
  width: 4px;
  border-radius: 4px;
  background: var(--bg);
}

.tl-item {
  position: relative;
  padding-left: 66px;
  margin-bottom: 22px;
}
.tl-item:last-child { margin-bottom: 0; }

.tl-icon {
  position: absolute;
  left: 0; top: 4px;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--c, var(--primary));
  color: #fff;
  font-size: 17px;
  box-shadow: 0 0 0 5px var(--bg);
}
.tl-item:nth-child(6n+1) { --c: var(--c1); }
.tl-item:nth-child(6n+2) { --c: var(--c5); }
.tl-item:nth-child(6n+3) { --c: var(--c4); }
.tl-item:nth-child(6n+4) { --c: var(--c2); }
.tl-item:nth-child(6n+5) { --c: var(--c3); }
.tl-item:nth-child(6n+6) { --c: var(--c6); }

.tl-card {
  position: relative;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
}
.tl-card::before {
  content: "";
  position: absolute;
  left: -9px; top: 16px;
  border: 9px solid transparent;
  border-left: 0;
  border-right-color: var(--bg);
}

.tl-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}

.tl-title {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
}

.tl-date {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
  white-space: nowrap;
}

.tl-org { font-size: 15px; font-weight: 500; margin: 2px 0 0; }
.tl-org .loc { color: var(--muted); font-weight: 400; }

.tl-body { font-size: 15px; margin-top: 10px; }
.tl-body p { margin-bottom: 0.6em; }
.tl-body p:last-child { margin-bottom: 0; }
.tl-body ul { list-style: disc; padding-left: 1.2em; }
.tl-body li { margin-bottom: 0.3em; }
.tl-body li::marker { color: var(--c, var(--primary)); }

/* A role held inside a main job (e.g. an appointment while on a lecturer post). */
.tl-sub {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: 10px;
  background: var(--card);
}
.tl-sub .tl-title { font-size: 16px; }
.tl-sub .tl-body { margin-top: 6px; }

.facts { display: grid; gap: 4px; font-size: 15px; margin-top: 10px; }
.facts dt { display: inline; font-weight: 700; color: var(--heading); margin-right: 6px; }
.facts dt::after { content: ":"; }
.facts dd { display: inline; margin: 0; }

/* ---------- Teaching ---------- */

.notice {
  display: flex;
  gap: 18px;
  padding: 24px 26px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.notice .icon-box { background: var(--card); width: 44px; height: 44px; font-size: 20px; }
.notice h3 {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}
.notice p { margin-bottom: 0.7em; }
.notice p:last-child { margin-bottom: 0; }
.notice .email { white-space: nowrap; }
.notice .tr {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.course-group {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 20px 24px 8px;
  margin-bottom: 20px;
}
.course-group:last-child { margin-bottom: 0; }

.course-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.course-group-head h4 { font-size: 17px; }
.course-group-meta { font-size: 13px; font-weight: 700; color: var(--primary-dark); }
.course-group-sub { flex-basis: 100%; font-size: 14px; color: var(--muted); }

.course {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}
.course:last-child { border-bottom: 0; }
.course-name { display: block; font-weight: 700; color: var(--heading); line-height: 1.5; }
.course-tr, .course-meta { display: block; font-size: 14px; color: var(--muted); line-height: 1.5; }
.course-code { color: var(--muted); font-weight: 600; margin-right: 6px; }

.lang {
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  line-height: 1.8;
}
.lang-en { background: var(--primary-tint); color: var(--primary-dark); }
.lang-tr { background: color-mix(in srgb, var(--c2) 12%, transparent); color: #b8393a; }

/* ---------- Blog ---------- */

.reading { display: grid; gap: 14px; }
.reading li {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.reading li:hover { border-color: transparent; box-shadow: var(--shadow); }
.reading-title { font-weight: 700; font-size: 16.5px; color: var(--heading); line-height: 1.5; }
.reading-title:hover { color: var(--primary); }
.reading-meta { font-size: 13px; color: var(--muted); margin: 2px 0 0; }
.reading-note { font-size: 15px; margin: 8px 0 0; }

.empty-state {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 26px;
  border: 1px dashed color-mix(in srgb, var(--primary) 40%, transparent);
  border-radius: var(--radius-sm);
  color: var(--muted);
}
.empty-state .icon-box { width: 44px; height: 44px; font-size: 20px; }
.empty-state p { margin: 0; }
.reading-wrap:has(.reading li) .empty-state { display: none; }

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .page {
    grid-template-columns: minmax(0, 1fr);
    max-width: 820px;
    padding: 24px 20px 40px;
    gap: 20px;
  }

  .sidebar, .sidebar.is-sticky {
    position: static;
    padding: 0 24px 24px;
  }
  /* Single-column layout: the card is wide, so the photo becomes a short banner. */
  .avatar-frame { margin: 0 -24px 22px; aspect-ratio: 12 / 5; }
  .avatar { transform: none; }

  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    font: 700 11.5px/1.4 var(--font-body);
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--primary-dark);
    cursor: pointer;
  }
  .sidebar-toggle .ic { transition: transform var(--ease); }
  .sidebar-toggle[aria-expanded="true"] .ic { transform: rotate(180deg); }

  .js .sidebar-more { display: none; }
  .js .sidebar.is-open .sidebar-more { display: block; }

  .contacts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
  }
  .contacts li { margin: 0; }
  .profiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .topnav ul { padding: 0 32px; gap: 26px; }
  .tab { padding: 36px 32px 40px; }
  .site-footer { padding: 26px 32px 22px; }
}

@media (max-width: 640px) {
  body { font-size: 15.5px; }

  .page { padding: 16px 12px 32px; gap: 14px; }
  .card { border-radius: 16px; }
  .topnav { border-radius: 16px 16px 0 0; }

  .sidebar { padding: 0 20px 20px; }
  .avatar-frame { margin: 0 -20px 20px; aspect-ratio: 16 / 10; border-radius: 15px; }
  .avatar { transform: scale(1.18); }
  .name { font-size: 22px; }
  .positions li { font-size: 13.5px; }

  .profiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Fade hints that the nav strip scrolls sideways */
  .topnav::after {
    content: "";
    position: absolute;
    right: 0; top: 0; bottom: 1px;
    width: 32px;
    border-top-right-radius: 16px;
    background: linear-gradient(to right, rgba(255,255,255,0), #fff);
    pointer-events: none;
  }
  .topnav ul { padding: 0 32px 0 20px; gap: 22px; }
  .topnav a { padding: 17px 0 15px; font-size: 11.5px; letter-spacing: 1.2px; }

  .tab { padding: 28px 20px 32px; }
  .section-head { margin-bottom: 28px; }
  .section-title { font-size: 16px; letter-spacing: 4px; }
  .sub-title { font-size: 20px; margin-top: 36px; }

  .focus-grid { grid-template-columns: minmax(0, 1fr); }
  .course-group { padding: 18px 18px 6px; }
  .focus-item { padding: 18px; }

  .pub { padding-left: 18px; }
  .pub-title { font-size: 16px; }

  .timeline::before { left: 14px; }
  .tl-item { padding-left: 46px; }
  .tl-icon { width: 32px; height: 32px; font-size: 14px; top: 6px; }
  .tl-card { padding: 16px 18px; }
  .tl-card::before { top: 14px; }
  .tl-title { font-size: 16.5px; }

  .notice { flex-direction: column; gap: 12px; padding: 20px; }

  .site-footer { padding: 22px 20px 20px; gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Print: every tab, no chrome ---------- */

@media print {
  body { background: #fff; }
  .page { display: block; padding: 0; }
  .card { border: 0; box-shadow: none; }
  .sidebar, .sidebar.is-sticky { position: static; }
  .topnav, .sidebar-toggle, .skip-link { display: none !important; }
  .js .tab, .js .sidebar-more { display: block !important; animation: none; }
  a { color: inherit; }
}
