/* ============================================================
   Ceyhun Elgin — Academic Website
   Modern, responsive, dependency-free design
   ============================================================ */

:root {
  --brand: #16233c;
  --brand-light: #22345a;
  --navy: #16233c;
  --navy-light: #22345a;
  --gold: #b98a2f;
  --gold-soft: #d9b25f;
  --gold-text: #8a651f;
  --ink: #1d2433;
  --muted: #5b6474;
  --bg: #f7f6f2;
  --bg-alt: #efede6;
  --card: #ffffff;
  --line: #e2ded2;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(22, 35, 60, 0.08);
  --hover: #faf8f2;
  --font-serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
  --navy: #b3c2dc;
  --navy-light: #c6d2e8;
  --gold: #d9b25f;
  --gold-soft: #e3c37e;
  --gold-text: #e3c37e;
  --ink: #e3e7ee;
  --muted: #9aa3b5;
  --bg: #10141c;
  --bg-alt: #151a24;
  --card: #1b2230;
  --line: #2c3547;
  --hover: #222a3a;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: min(1120px, 92%);
  margin-inline: auto;
}

a { color: var(--navy-light); text-decoration-color: var(--gold); text-underline-offset: 3px; }
a:hover { color: var(--gold); }

/* ---------- Icon system (stroke SVG) ---------- */
.ic {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
  flex-shrink: 0;
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(22, 35, 60, 0.97);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.nav__brand {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.nav__brand:hover { color: var(--gold-soft); }

.nav__links {
  display: flex;
  gap: 1.6rem;
  list-style: none;
}

.nav__links a {
  color: #d7dce6;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.nav__links a:hover,
.nav__links a.active {
  color: #fff;
  border-bottom-color: var(--gold);
}

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 8px;
}
.nav__toggle span {
  width: 24px;
  height: 2px;
  background: #fff;
  transition: transform 0.25s, opacity 0.25s;
}

.nav__actions { display: flex; align-items: center; gap: 0.6rem; }

.lang-switch {
  display: flex;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  overflow: hidden;
}
.lang-switch button {
  background: none;
  border: 0;
  color: #d7dce6;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.lang-switch button.active { background: var(--gold); color: #16233c; }
.lang-switch button:not(.active):hover { color: #fff; }

.theme-toggle {
  display: grid;
  place-items: center;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, transform 0.15s;
}
.theme-toggle .ic { width: 18px; height: 18px; }
.theme-toggle:hover { border-color: var(--gold-soft); color: var(--gold-soft); transform: rotate(15deg); }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(185, 138, 47, 0.18), transparent 60%),
    linear-gradient(160deg, var(--brand) 0%, var(--brand-light) 100%);
  color: #eef1f6;
  padding: 5.5rem 0 4.5rem;
}

.hero__grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 3.5rem;
  align-items: center;
}

.hero__kicker {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold-soft);
  margin-bottom: 0.8rem;
}

.hero__name {
  font-family: var(--font-serif);
  font-size: clamp(2.6rem, 6vw, 4rem);
  line-height: 1.05;
  margin-bottom: 1.1rem;
  color: #fff;
}

.hero__bio {
  font-size: 1.08rem;
  color: #cdd5e1;
  max-width: 56ch;
  margin-bottom: 1.6rem;
}

.hero__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  list-style: none;
  margin-bottom: 2rem;
}
.hero__tags li {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border: 1px solid rgba(217, 178, 95, 0.5);
  border-radius: 999px;
  color: var(--gold-soft);
  background: rgba(185, 138, 47, 0.08);
}

.hero__actions { display: flex; flex-wrap: wrap; gap: 0.9rem; }

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
}
.btn--primary {
  background: var(--gold);
  color: #16233c;
}
.btn--primary:hover { background: var(--gold-soft); color: #16233c; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(185, 138, 47, 0.35); }
.btn--ghost {
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #eef1f6;
}
.btn--ghost:hover { border-color: var(--gold-soft); color: var(--gold-soft); transform: translateY(-2px); }

.hero__card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  padding: 2rem;
  backdrop-filter: blur(6px);
}

.hero__photo {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  border: 3px solid var(--gold);
  margin-bottom: 1.4rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.hero__facts div { padding: 0.55rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.hero__facts div:last-child { border-bottom: 0; }
.hero__facts dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-soft);
  font-weight: 700;
}
.hero__facts dd { color: #e6eaf1; font-size: 0.95rem; }
.hero__facts a { color: #e6eaf1; }
.hero__facts a:hover { color: var(--gold-soft); }

/* ---------- Stats band ---------- */
.stats {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 2rem 0;
}

.stats__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  text-align: center;
}

.stat__num {
  display: block;
  font-family: var(--font-serif);
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--gold);
  line-height: 1.1;
}
.stat__label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* ---------- Sections ---------- */
.section { padding: 4.5rem 0; }
.section--alt { background: var(--bg-alt); }

.section__title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  color: var(--navy);
  margin-bottom: 0.6rem;
  position: relative;
  padding-bottom: 0.7rem;
}
.section__title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 64px;
  height: 3px;
  background: var(--gold);
  border-radius: 2px;
}

.section__intro { color: var(--muted); margin-bottom: 2rem; }

/* ---------- Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 1.4rem;
  margin-top: 2rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.18s, box-shadow 0.18s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 16px 36px rgba(22, 35, 60, 0.14); }

.card__icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(185, 138, 47, 0.12);
  color: var(--gold);
  margin-bottom: 0.4rem;
}
.card__icon .ic { width: 22px; height: 22px; }

.card__label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-text);
}

.card__title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  line-height: 1.35;
  color: var(--navy);
}

.card__note { color: var(--muted); font-size: 0.92rem; }

.card__link {
  margin-top: auto;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  color: var(--navy-light);
}
.card__link:hover { color: var(--gold); }

/* ---------- Publications ---------- */
.year {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 0.9rem;
  overflow: hidden;
}

.year summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 1.05rem 1.4rem;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  list-style: none;
  user-select: none;
  transition: background 0.2s;
}
.year summary::-webkit-details-marker { display: none; }
.year summary::before {
  content: "▸";
  color: var(--gold);
  margin-right: 0.7rem;
  transition: transform 0.2s;
}
.year[open] summary::before { transform: rotate(90deg); }
.year summary:hover { background: var(--hover); }

.year__label { display: flex; align-items: center; margin-right: auto; }

.year__count {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold-text);
  background: rgba(185, 138, 47, 0.12);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
}

.pubs {
  padding: 0.4rem 1.6rem 1.4rem 2.9rem;
  color: var(--ink);
}
.pubs li {
  padding: 0.55rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.96rem;
}
.pubs li:last-child { border-bottom: 0; }
.pubs em { color: var(--muted); font-style: italic; }

.pub-src {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-left: 0.3rem;
  vertical-align: -2px;
  font-size: 0;
  background: var(--gold);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17L17 7M8 7h9v9'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17L17 7M8 7h9v9'/%3E%3C/svg%3E") center / contain no-repeat;
  border-radius: 4px;
  transition: transform 0.15s;
}
.pub-src:hover { transform: translateY(-1px) scale(1.15); }

.pubs li a:not(.pub-src) { font-weight: 500; }

/* ---------- Teaching ---------- */
.teach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 1.4rem;
  margin-top: 2rem;
}

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

.teach h3 {
  font-family: var(--font-serif);
  color: var(--navy);
  font-size: 1.15rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--gold);
}

.teach ul { list-style: none; }
.teach li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.4rem 0;
  font-size: 0.94rem;
  border-bottom: 1px dashed var(--line);
}
.teach li:last-child { border-bottom: 0; }

.teach__level {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gold-text);
  background: rgba(185, 138, 47, 0.12);
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
}

/* ---------- Contact ---------- */
.contact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: 1.4rem;
  margin-top: 2rem;
}

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

.contact__item h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--gold-text);
  margin-bottom: 0.5rem;
}
.contact__item p { font-size: 0.95rem; }

/* ---------- Publication toolbar ---------- */
.pub-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

.pub-toolbar__search {
  flex: 1 1 320px;
  min-width: 0;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pub-toolbar__search:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(185, 138, 47, 0.18);
}

.pub-toolbar__btns { display: flex; gap: 0.5rem; }

.toolbar-btn {
  padding: 0.65rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--navy-light);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.toolbar-btn:hover { border-color: var(--gold); color: var(--gold); }

.pub-status {
  min-height: 1.4rem;
  font-size: 0.88rem;
  color: var(--gold-text);
  font-weight: 600;
  margin-bottom: 0.8rem;
}

/* ---------- Back to top ---------- */
.to-top {
  position: fixed;
  right: 1.4rem;
  bottom: 1.4rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  background: var(--gold);
  color: #16233c;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  z-index: 90;
}
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { background: var(--gold-soft); }

/* ---------- Accessibility ---------- */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 200;
  padding: 0.6rem 1rem;
  background: var(--gold);
  color: #16233c;
  font-weight: 700;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; color: #16233c; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Footer ---------- */
.footer {
  background: var(--brand);
  color: #aab4c6;
  padding: 2.6rem 0 1.4rem;
}

.footer__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer__name {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}
.footer__tag { font-size: 0.9rem; color: #8b96ab; }

.footer__nav { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.footer__nav a {
  color: #aab4c6;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}
.footer__nav a:hover { color: var(--gold-soft); }

.footer__bottom {
  padding-top: 1.2rem;
  text-align: center;
  font-size: 0.82rem;
  color: #78839a;
}

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 400px) {
  .nav__brand { font-size: 1.05rem; }
  .nav__actions { gap: 0.35rem; }
  .lang-switch button { padding: 0.3rem 0.5rem; font-size: 0.7rem; }
  .theme-toggle { width: 32px; height: 32px; }
  .hero__actions .btn { padding: 0.7rem 1.1rem; font-size: 0.88rem; }
}

@media (max-width: 300px) {
  .nav__brand { font-size: 0.92rem; }
  .nav__actions { gap: 0.25rem; }
  .lang-switch button { padding: 0.28rem 0.42rem; font-size: 0.68rem; }
  .theme-toggle { width: 30px; height: 30px; }
}

@media (max-width: 260px) {
  .nav__brand { font-size: 0.82rem; }
  .theme-toggle { width: 28px; height: 28px; }
  .nav__toggle { padding: 6px; }
}

@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; gap: 2.2rem; }
  .hero { padding: 3.5rem 0; }
  .stats__grid { grid-template-columns: repeat(2, 1fr); gap: 1.4rem; }

  .nav__toggle { display: flex; }
  .nav__links {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--brand);
    padding: 0.6rem 4%;
    display: none;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
  }
  .nav__links.open { display: flex; }
  .nav__links li { border-top: 1px solid rgba(255, 255, 255, 0.08); }
  .nav__links a { display: block; padding: 0.85rem 0.2rem; }

  .nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .pubs { padding-left: 2.2rem; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .hero__actions, .footer, .to-top, .pub-toolbar, .pub-status, .skip-link { display: none; }
  .year { border: 0; break-inside: avoid; }
  .year summary { pointer-events: none; }
  .year:not([open]) .pubs { display: block; }
  .reveal { opacity: 1 !important; transform: none !important; }
  body { background: #fff; }
}
