/*
  Ioannis Chatzis — personal academic site
  Typeface : Inter by Rasmus Andersson (github.com/rsms/inter) — SIL OFL 1.1, via Google Fonts
  Icons    : Simple Icons (CC0 1.0) · Feather Icons (MIT) · Lucide (MIT)
*/

:root {
  --blue:         #2563eb;
  --blue-dim:     #3b82f6;
  --blue-pale:    #eff6ff;
  --blue-ring:    #bfdbfe;
  --indigo:       #6366f1;
  --violet:       #7c3aed;
  --violet-pale:  #f5f3ff;
  --violet-ring:  #ddd6fe;
  --text:         #1f2937;
  --body:         #2d3442;
  --muted:        #6b7280;
  --border:       #e5e7eb;
  --bg:           #ffffff;
  --bg-off:       #f9fafb;
  --nav-bg:       rgba(255,255,255,0.88);
  --profile-bg:   linear-gradient(172deg,#dbeafe 0%,#e0e7ff 30%,#f5f7ff 65%,#ffffff 100%);
  --circle-ring:  #a5b4fc;
  --mono:         'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;
  --sans:         'Inter', system-ui, -apple-system, sans-serif;
  --max:          860px;
  --nav-h:        52px;
}

/* dark — auto */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --blue:        #60a5fa;
    --blue-dim:    #93c5fd;
    --blue-pale:   rgba(96,165,250,0.12);
    --blue-ring:   rgba(96,165,250,0.26);
    --indigo:      #a5b4fc;
    --violet:      #c4b5fd;
    --violet-pale: rgba(196,181,253,0.10);
    --violet-ring: rgba(196,181,253,0.26);
    --text:        #dde4ed;
    --body:        #a8b3c0;
    --muted:       #7a8694;
    --border:      #3a4157;
    --bg:          #282c3a;
    --bg-off:      #2e3247;
    --nav-bg:      rgba(40,44,58,0.93);
    --profile-bg:  linear-gradient(172deg,#1e2840 0%,#242d46 45%,#262e42 75%,#282c3a 100%);
    --circle-ring: rgba(96,165,250,0.28);
  }
}

/* dark — manual */
[data-theme="dark"] {
  --blue:        #60a5fa;
  --blue-dim:    #93c5fd;
  --blue-pale:   rgba(96,165,250,0.12);
  --blue-ring:   rgba(96,165,250,0.26);
  --indigo:      #a5b4fc;
  --violet:      #c4b5fd;
  --violet-pale: rgba(196,181,253,0.10);
  --violet-ring: rgba(196,181,253,0.26);
  --text:        #dde4ed;
  --body:        #a8b3c0;
  --muted:       #7a8694;
  --border:      #3a4157;
  --bg:          #282c3a;
  --bg-off:      #2e3247;
  --nav-bg:      rgba(40,44,58,0.93);
  --profile-bg:  linear-gradient(172deg,#1e2840 0%,#242d46 45%,#262e42 75%,#282c3a 100%);
  --circle-ring: rgba(96,165,250,0.28);
}

/* reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.25s, color 0.25s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 3px; }
strong { color: var(--text); font-weight: 600; }

/* layout */
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* nav */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
  transition: background 0.25s, border-color 0.25s;
}

.site-nav::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--indigo) 50%, var(--violet) 100%);
}

.site-nav .wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 3px;
}

.nav-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.015em;
  white-space: nowrap;
  transition: color 0.15s;
}
.nav-name:hover { text-decoration: none; color: var(--blue); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  list-style: none;
}

.nav-links a {
  display: block;
  padding: 0.3rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--blue);
  background: var(--blue-pale);
  text-decoration: none;
}

.theme-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
  margin-left: 0.375rem;
}
.theme-btn:hover { color: var(--blue); background: var(--blue-pale); }
.theme-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* theme icon — auto / light / dark states */
.icon-sun  { display: none; }
.icon-moon { display: none; }
.icon-auto {
  display: block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask-image: url('icon-auto.png');
  mask-image: url('icon-auto.png');
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
[data-theme="light"] .icon-sun  { display: block; }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="light"] .icon-auto { display: none; }
[data-theme="dark"]  .icon-sun  { display: none; }
[data-theme="dark"]  .icon-moon { display: block; }
[data-theme="dark"]  .icon-auto { display: none; }

/* profile */
.profile-band {
  background: var(--profile-bg);
  border-bottom: 1px solid var(--border);
  transition: background 0.25s, border-color 0.25s;
}

.profile { padding: 3rem 0 2.625rem; }

.profile-top {
  display: flex;
  align-items: center;
  gap: 1.625rem;
  margin-bottom: 1.125rem;
}

.photo-frame {
  width: 224px;
  height: 224px;
  flex-shrink: 0;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 1px 2px   rgba(0,0,0,0.10),
    0 4px 10px  rgba(0,0,0,0.11),
    0 14px 30px rgba(0,0,0,0.10),
    0 28px 48px rgba(0,0,0,0.05),
    inset 0 1px 0 rgba(255,255,255,0.22);
  transition: box-shadow 0.25s, transform 0.2s;
}
.photo-frame:hover {
  transform: translateY(-3px);
  box-shadow:
    0 2px 4px   rgba(0,0,0,0.10),
    0 8px 18px  rgba(0,0,0,0.13),
    0 24px 48px rgba(0,0,0,0.12),
    0 40px 64px rgba(0,0,0,0.06),
    inset 0 1px 0 rgba(255,255,255,0.22);
}
.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .photo-frame {
    box-shadow:
      0 1px 2px   rgba(0,0,0,0.50),
      0 4px 10px  rgba(0,0,0,0.45),
      0 14px 30px rgba(0,0,0,0.40),
      inset 0 1px 0 rgba(255,255,255,0.07);
  }
}
[data-theme="dark"] .photo-frame {
  box-shadow:
    0 1px 2px   rgba(0,0,0,0.50),
    0 4px 10px  rgba(0,0,0,0.45),
    0 14px 30px rgba(0,0,0,0.40),
    inset 0 1px 0 rgba(255,255,255,0.07);
}

.profile-name {
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.profile-role {
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.55;
  margin-top: 0.35rem;
}
.profile-role a { color: var(--muted); font-weight: 500; }
.profile-role a:hover { color: var(--blue); text-decoration: none; }

.profile-contact {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 0.45rem;
}

.profile-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.plink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: color 0.15s, border-color 0.15s, background 0.15s,
              transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.plink:hover {
  color: var(--blue);
  border-color: var(--blue-ring);
  background: var(--blue-pale);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37,99,235,0.15);
}

/* sections */
.section {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--blue);
  margin-bottom: 1.75rem;
}
.section-label::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--indigo) 100%);
  flex-shrink: 0;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* bio */
.bio p {
  font-size: 0.9375rem;
  line-height: 1.8;
  margin-bottom: 0.9rem;
  color: var(--body);
}
.bio p:last-child { margin-bottom: 0; }

/* education */
.edu-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-top: 2rem;
  margin-bottom: 0.6rem;
}

.edu-table { margin-top: 0; }

.edu-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 1rem;
  padding: 0.9rem 0.75rem;
  margin: 0 -0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
  transition: background 0.15s;
}
.edu-row:first-child { border-top: 1px solid var(--border); }
.edu-row:hover { background: var(--bg-off); }

.edu-degree { font-weight: 600; color: var(--text); line-height: 1.3; }
.edu-where  { font-size: 0.875rem; color: var(--muted); margin-top: 0.15rem; }
.edu-year   { font-size: 0.8125rem; font-family: var(--mono); color: var(--blue); white-space: nowrap; padding-top: 0.1rem; }

/* year headings */
.year-heading {
  font-size: 0.6875rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  margin-top: 1.25rem;
}
.year-heading:first-child { margin-top: 0; }

/* publications */
.pub-list { display: flex; flex-direction: column; gap: 0.125rem; }

.pub-entry {
  font-size: 0.9375rem;
  padding: 1.25rem 1rem;
  margin: 0 -1rem;
  border-radius: 10px;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-left-color 0.15s;
}
.pub-entry:hover {
  background: var(--bg-off);
  border-left-color: var(--blue);
}

.pub-badge {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue);
  background: var(--blue-pale);
  border: 1px solid var(--blue-ring);
  border-radius: 4px;
  padding: 0.15rem 0.6rem;
  margin-bottom: 0.5rem;
  vertical-align: middle;
}
.pub-badge.thesis {
  color: var(--violet);
  background: var(--violet-pale);
  border-color: var(--violet-ring);
}

.pub-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 0.3rem;
}
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--blue); text-decoration: none; }

.pub-authors { font-size: 0.875rem; color: var(--muted); margin-bottom: 0.2rem; }
.pub-authors .me { color: var(--text); font-weight: 600; }

.pub-venue { font-size: 0.875rem; color: var(--muted); font-style: italic; margin-bottom: 0.65rem; }

.pub-links { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.pub-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.175rem 0.625rem;
  background: var(--bg);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  cursor: pointer;
  font-family: inherit;
}
.pub-link:hover {
  color: var(--blue);
  border-color: var(--blue-ring);
  background: var(--blue-pale);
  text-decoration: none;
}

/* bibtex modal */
.bibtex-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.bibtex-overlay.open { display: flex; }

.bibtex-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  padding: 1.5rem;
  max-width: 560px;
  width: 100%;
}
.bibtex-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.875rem;
}
.bibtex-card-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.bibtex-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0.25rem;
  border-radius: 4px;
  font-size: 1rem;
  line-height: 1;
  transition: color 0.15s;
}
.bibtex-close:hover { color: var(--text); }

.bibtex-pre {
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--body);
  background: var(--bg-off);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.875rem 1rem;
  overflow-x: auto;
  white-space: pre;
  margin-bottom: 0.875rem;
}
.bibtex-copy-btn {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--blue);
  background: var(--blue-pale);
  border: 1px solid var(--blue-ring);
  border-radius: 6px;
  padding: 0.35rem 0.875rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.bibtex-copy-btn:hover { background: var(--blue-ring); }

/* news */
.news-list { display: flex; flex-direction: column; }

.news-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 1.25rem;
  padding: 0.9rem 0.75rem;
  margin: 0 -0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
  transition: background 0.15s;
}
.news-row:first-child { border-top: 1px solid var(--border); }
.news-row:last-child  { border-bottom: none; }
.news-row:hover { background: var(--bg-off); }

.news-date { font-family: var(--mono); font-size: 0.75rem; color: var(--blue); font-weight: 500; padding-top: 0.2rem; white-space: nowrap; }
.news-body { color: var(--body); line-height: 1.6; }
.news-body a { font-weight: 500; }

/* footer */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 0.875rem 0 1.25rem;
  transition: border-color 0.25s;
}
.site-footer .wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--muted);
  gap: 1rem;
  flex-wrap: wrap;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--blue); }

/* tablet */
@media (max-width: 680px) {
  .profile-name { font-size: 1.625rem; }
}

/* mobile */
@media (max-width: 600px) {
  .wrap { padding: 0 1rem; }

  .site-nav { height: auto; min-height: var(--nav-h); }
  .site-nav .wrap {
    flex-wrap: wrap;
    align-items: center;
    padding-bottom: 0.4rem;
  }
  .nav-right { flex-wrap: wrap; }
  .nav-links a { padding: 0.25rem 0.45rem; font-size: 0.8rem; }

  .profile { padding: 2rem 0 1.75rem; }
  .profile-top {
    flex-direction: column;
    align-items: center;
    gap: 1.125rem;
  }
  .profile-top > div:last-child { text-align: center; }
  .profile-name { font-size: 1.5rem; }
  .profile-role { text-align: center; }
  .profile-contact { text-align: center; }
  .profile-links { justify-content: center; }
  .photo-frame { width: 172px; height: 172px; border-radius: 15px; }

  .pub-entry { margin: 0 -0.5rem; padding: 1rem 0.75rem; }
  .news-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
    margin: 0 -0.5rem;
    padding: 0.75rem 0.5rem;
  }
  .news-date { padding-top: 0; }
  .edu-row {
    grid-template-columns: 1fr;
    gap: 0.1rem;
    margin: 0 -0.5rem;
    padding: 0.75rem 0.5rem;
  }
  .edu-year { padding-top: 0; }
}

/* small mobile */
@media (max-width: 400px) {
  .nav-name { font-size: 0.875rem; }
  .nav-links a { padding: 0.2rem 0.35rem; font-size: 0.75rem; }
  .profile-name { font-size: 1.375rem; }
  .photo-frame { width: 136px; height: 136px; border-radius: 13px; }
  .plink { width: 30px; height: 30px; }
}
