/* =========================================================================
   M. Abdullah Canbaz — personal site
   Modern, responsive, no-build stylesheet. Light + dark themes.
   ========================================================================= */

:root {
  --purple: #46166B;       /* UAlbany purple */
  --purple-600: #5b2a86;
  --purple-300: #a884cf;
  --gold: #EEB211;         /* UAlbany gold */
  --gold-soft: #f6cf63;

  --bg: #ffffff;
  --bg-alt: #f6f4fa;
  --bg-card: #ffffff;
  --surface-border: #e7e2ef;
  --text: #1d1b22;
  --text-soft: #55505f;
  --text-faint: #837d90;
  --accent: var(--purple);
  --accent-contrast: #ffffff;
  --link: #6a2aa0;
  --shadow: 0 1px 2px rgba(20, 10, 40, .06), 0 10px 30px rgba(20, 10, 40, .06);
  --shadow-lg: 0 20px 50px rgba(30, 15, 60, .14);
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1100px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
}

html[data-theme="dark"] {
  --bg: #0e0c14;
  --bg-alt: #14111d;
  --bg-card: #18141f;
  --surface-border: #2a2435;
  --text: #ece9f1;
  --text-soft: #b6afc2;
  --text-faint: #8b8499;
  --accent: #b794e8;
  --accent-contrast: #0e0c14;
  --link: #c4a4ee;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
  --shadow-lg: 0 20px 50px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

a { color: var(--link); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.18; font-weight: 600; color: var(--text); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

.section { padding: 84px 0; }
.section--alt { background: var(--bg-alt); }

.section__head { margin-bottom: 40px; }
.section__eyebrow {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .72rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-block;
  margin-bottom: 10px;
}
.section__title { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin: 0 0 12px; }
.section__lead { color: var(--text-soft); max-width: 70ch; margin: 0; font-size: 1.05rem; }

/* ---------- Navbar ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, background .2s ease;
}
.nav.scrolled { border-bottom-color: var(--surface-border); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.nav__brand { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--text); letter-spacing: -.01em; }
.nav__brand span { color: var(--accent); }
.nav__links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav__links a {
  display: block; padding: 8px 12px; border-radius: 8px; font-size: .92rem; font-weight: 500;
  color: var(--text-soft);
}
.nav__links a:hover, .nav__links a.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

.nav__actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--surface-border);
  background: var(--bg-card); color: var(--text); cursor: pointer; transition: .15s ease;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .moon { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: none; }
html[data-theme="dark"] .theme-toggle .moon { display: block; }

.nav__toggle { display: none; }

/* ---------- Hero ---------- */
.hero { padding: 132px 0 72px; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; top: -180px; right: -140px; width: 520px; height: 520px;
  background: radial-gradient(circle at center, color-mix(in srgb, var(--purple) 30%, transparent), transparent 65%);
  filter: blur(20px); z-index: 0; pointer-events: none;
}
html[data-theme="dark"] .hero::before { background: radial-gradient(circle at center, color-mix(in srgb, var(--purple-300) 22%, transparent), transparent 65%); }
.hero__grid { position: relative; z-index: 3; display: grid; grid-template-columns: 260px 1fr; gap: 56px; align-items: center; }

.hero__photo-wrap { position: relative; }
.hero__photo {
  width: 100%; aspect-ratio: 1/1.16; object-fit: cover; object-position: top center;
  border-radius: 20px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--surface-border);
}
.hero__photo-wrap::after {
  content: ""; position: absolute; inset: 0; border-radius: 20px;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--gold) 60%, transparent);
  transform: translate(12px, 12px); z-index: -1;
}

.hero__name { font-size: clamp(2.1rem, 5vw, 3.1rem); margin: 0 0 6px; letter-spacing: -.02em; }
.hero__role { font-size: 1.18rem; color: var(--text-soft); margin: 0 0 4px; font-weight: 500; }
.hero__role b { color: var(--text); }
.hero__affil { color: var(--text-faint); font-size: .98rem; margin: 0 0 22px; }
.hero__tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 26px; }
.tag {
  font-size: .8rem; font-weight: 600; padding: 5px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
}
.tag--gold { background: color-mix(in srgb, var(--gold) 18%, transparent); color: #8a6400; border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
html[data-theme="dark"] .tag--gold { color: var(--gold-soft); }

.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 12px;
  font-weight: 600; font-size: .95rem; cursor: pointer; border: 1px solid transparent; transition: .15s ease;
}
.btn svg { width: 17px; height: 17px; }
.btn--primary { background: var(--accent); color: var(--accent-contrast); }
.btn--primary:hover { filter: brightness(1.08); color: var(--accent-contrast); transform: translateY(-1px); }
.btn--ghost { background: var(--bg-card); color: var(--text); border-color: var(--surface-border); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* ---------- "Meet KaFa-1500" terminal button + tooltip ---------- */
.btn--terminal {
  background: #15132a; color: #ece9f7; border-color: var(--purple);
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; font-size: .9rem; position: relative;
}
.btn--terminal:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 8px 26px rgba(70,22,107,.4); border-color: var(--purple-300); }
.btn--terminal .tg { color: #7ee787; font-weight: 700; }
.btn--terminal .cur { display: inline-block; width: .55em; height: 1.05em; background: #7ee787; margin-left: 1px; vertical-align: -2px; animation: kfblink 1s steps(1) infinite; }
@keyframes kfblink { 50% { opacity: 0; } }

.kafa-tip {
  position: absolute; left: 50%; top: calc(100% + 14px); transform: translateX(-50%) translateY(6px);
  width: 300px; max-width: 78vw; background: #0d0b18; color: #cdd2e6; border: 1px solid #2a2442; border-radius: 12px;
  padding: 14px 16px; font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; font-size: .76rem; line-height: 1.55;
  text-align: left; box-shadow: 0 24px 60px rgba(0,0,0,.55); opacity: 0; visibility: hidden; transition: opacity .18s ease, transform .18s ease; z-index: 80; pointer-events: none; white-space: normal; font-weight: 400;
}
.btn--terminal:hover .kafa-tip, .btn--terminal:focus-visible .kafa-tip { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.kafa-tip::before { content: ""; position: absolute; top: -6px; left: 50%; transform: translateX(-50%) rotate(45deg); width: 12px; height: 12px; background: #0d0b18; border-left: 1px solid #2a2442; border-top: 1px solid #2a2442; }
.kafa-tip .p { display: block; color: #7ee787; margin-bottom: 8px; }
.kafa-tip .h { display: block; color: #b794e8; font-weight: 700; margin-bottom: 4px; }
.kafa-tip .go { display: block; color: #8fb3ff; margin-top: 9px; }

/* compact nav pill */
.kafa-nav {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; font-size: .8rem; font-weight: 500;
  color: #ece9f7; background: #15132a; border: 1px solid var(--purple); border-radius: 10px; padding: 7px 12px; transition: .15s ease;
}
.kafa-nav:hover { color: #fff; box-shadow: 0 0 16px rgba(124,77,255,.45); border-color: var(--purple-300); }
.kafa-nav .tg { color: #7ee787; font-weight: 700; }

@media (prefers-reduced-motion: reduce) { .btn--terminal .cur { animation: none; } }
@media (max-width: 720px) { .kafa-nav { display: none; } }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; margin-top: 56px; position: relative; z-index: 1; }
.stat { background: var(--bg-card); border: 1px solid var(--surface-border); border-radius: var(--radius); padding: 22px 20px; box-shadow: var(--shadow); }
.stat__num { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; color: var(--accent); line-height: 1; }
.stat__label { font-size: .82rem; color: var(--text-soft); margin-top: 8px; }

/* ---------- About ---------- */
.about__grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 48px; align-items: start; }
.prose p { color: var(--text-soft); margin: 0 0 18px; }
.prose b { color: var(--text); }
.about__card { background: var(--bg-card); border: 1px solid var(--surface-border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.about__card h3 { font-size: 1.05rem; margin: 0 0 16px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--surface-border); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.timeline .yr { font-family: var(--font-display); font-weight: 600; font-size: .8rem; color: var(--accent); }
.timeline .what { display: block; font-weight: 600; font-size: .95rem; }
.timeline .where { display: block; color: var(--text-faint); font-size: .85rem; }

/* ---------- Research cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card {
  background: var(--bg-card); border: 1px solid var(--surface-border); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow); transition: transform .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 45%, var(--surface-border)); }
.card__icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); margin-bottom: 16px; }
.card__icon svg { width: 22px; height: 22px; }
.card h3 { font-size: 1.1rem; margin: 0 0 8px; }
.card p { color: var(--text-soft); font-size: .94rem; margin: 0; }

/* ---------- Publications ---------- */
.pub-controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-btn {
  font-family: var(--font-display); font-size: .85rem; font-weight: 500; padding: 7px 15px; border-radius: 999px;
  border: 1px solid var(--surface-border); background: var(--bg-card); color: var(--text-soft); cursor: pointer; transition: .15s ease;
}
.filter-btn:hover { color: var(--accent); border-color: var(--accent); }
.filter-btn.active { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.search-box { position: relative; }
.search-box input {
  width: 230px; max-width: 60vw; padding: 9px 14px 9px 36px; border-radius: 999px;
  border: 1px solid var(--surface-border); background: var(--bg-card); color: var(--text); font-size: 16px; font-family: var(--font-sans);
}
.search-box input:focus { outline: none; border-color: var(--accent); }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-faint); }

.pub-list { display: flex; flex-direction: column; gap: 4px; }
.pub {
  display: grid; grid-template-columns: 64px 1fr; gap: 18px; padding: 20px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; transition: background .15s ease, border-color .15s ease;
}
.pub:hover { background: var(--bg-card); border-color: var(--surface-border); }
.pub__year { font-family: var(--font-display); font-weight: 700; color: var(--accent); font-size: 1.05rem; padding-top: 1px; }
.pub__title { font-weight: 600; margin: 0 0 4px; color: var(--text); font-size: 1rem; line-height: 1.4; }
.pub__authors { color: var(--text-soft); font-size: .9rem; margin: 0 0 3px; }
.pub__authors .me { color: var(--text); font-weight: 600; }
.pub__venue { color: var(--text-faint); font-size: .88rem; font-style: italic; margin: 0; }
.pub__meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 9px; }
.badge { font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 6px; }
.badge--journal { background: color-mix(in srgb, var(--purple) 14%, transparent); color: var(--accent); }
.badge--conference { background: color-mix(in srgb, #1f7a8c 16%, transparent); color: #1f7a8c; }
.badge--chapter { background: color-mix(in srgb, var(--gold) 22%, transparent); color: #8a6400; }
html[data-theme="dark"] .badge--conference { color: #79c0d0; }
html[data-theme="dark"] .badge--chapter { color: var(--gold-soft); }
.badge--status { background: color-mix(in srgb, #2e9e5b 16%, transparent); color: #2e9e5b; }
.badge--review { background: color-mix(in srgb, #b9770e 16%, transparent); color: #b9770e; }
.pub__link { font-size: .82rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.pub__link svg { width: 13px; height: 13px; }
.pub-empty { text-align: center; color: var(--text-faint); padding: 40px 0; display: none; }
.legend { font-size: .82rem; color: var(--text-faint); margin-top: 24px; }
.legend b { color: var(--text-soft); }

/* ---------- Funding ---------- */
.fund-group { margin-bottom: 36px; }
.fund-group__title { font-size: 1.1rem; margin: 0 0 16px; display: flex; align-items: center; gap: 10px; }
.fund-group__title .count { font-size: .8rem; font-weight: 600; color: var(--text-faint); font-family: var(--font-sans); }
.fund-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.fund {
  background: var(--bg-card); border: 1px solid var(--surface-border); border-radius: var(--radius-sm);
  padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px;
}
.fund__top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.fund__amt { font-family: var(--font-display); font-weight: 700; color: var(--accent); white-space: nowrap; }
.fund__role { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gold); }
html[data-theme="dark"] .fund__role { color: var(--gold-soft); }
.fund__title { font-weight: 600; font-size: .96rem; line-height: 1.4; }
.fund__meta { color: var(--text-faint); font-size: .85rem; }

/* ---------- Teaching / Mentorship ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.block h3 { font-size: 1.15rem; margin: 0 0 16px; }
.course-list, .plain-list { list-style: none; margin: 0 0 26px; padding: 0; }
.course-list li { padding: 12px 0; border-bottom: 1px solid var(--surface-border); display: flex; gap: 12px; align-items: baseline; }
.course-list li:last-child { border-bottom: none; }
.course-code { font-family: var(--font-display); font-weight: 700; color: var(--accent); font-size: .82rem; flex: 0 0 84px; }
.course-name { font-size: .95rem; }
.course-name small { display: block; color: var(--text-faint); font-size: .8rem; }
.course-terms { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 7px; font-size: .82rem; align-items: baseline; }
.course-terms a { color: var(--accent); font-weight: 600; border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.course-terms a:hover { border-bottom-color: var(--accent); }
.course-terms span { color: var(--text-faint); }
.course-terms .sep { color: var(--surface-border); font-style: normal; }

.people { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.person { background: var(--bg-card); border: 1px solid var(--surface-border); border-radius: var(--radius-sm); padding: 14px 16px; }
.person__name { font-weight: 600; font-size: .95rem; }
.person__role { font-size: .8rem; color: var(--text-faint); }

.subhead { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .1em; font-size: .74rem; font-weight: 600; color: var(--text-faint); margin: 28px 0 12px; }

/* ---------- Service / consult ---------- */
.pill-list { display: flex; flex-wrap: wrap; gap: 10px; }
.pill { background: var(--bg-card); border: 1px solid var(--surface-border); border-radius: 999px; padding: 8px 16px; font-size: .88rem; color: var(--text-soft); }
.pill b { color: var(--text); }

/* ---------- Contact ---------- */
.contact__grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; }
.contact__card { background: var(--bg-card); border: 1px solid var(--surface-border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.contact__row { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--surface-border); }
.contact__row:last-child { border-bottom: none; }
.contact__row svg { width: 19px; height: 19px; color: var(--accent); flex: 0 0 19px; margin-top: 3px; }
.contact__row .label { font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); }
.contact__row .value { font-size: .98rem; }
.contact__vcard { text-align: center; }
.contact__vcard img { width: 150px; border-radius: 12px; border: 1px solid var(--surface-border); margin-bottom: 16px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--surface-border); padding: 32px 0; color: var(--text-faint); font-size: .88rem; }
.footer__inner { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.footer a { color: var(--text-soft); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; gap: 32px; text-align: left; }
  .hero__photo { max-width: 240px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .about__grid, .two-col, .contact__grid { grid-template-columns: 1fr; gap: 28px; }
  .cards { grid-template-columns: 1fr; }
  .fund-grid { grid-template-columns: 1fr; }
  .people { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .nav__links { position: fixed; inset: 64px 0 auto 0; flex-direction: column; gap: 0; background: var(--bg); border-bottom: 1px solid var(--surface-border); padding: 8px 16px 16px; transform: translateY(-130%); transition: transform .25s ease; box-shadow: var(--shadow); }
  .nav__links.open { transform: none; }
  .nav__links a { padding: 12px 8px; border-radius: 8px; }
  .nav__toggle { display: inline-flex; }
  .section { padding: 60px 0; }
  .hero { padding: 108px 0 56px; }
  .pub { grid-template-columns: 1fr; gap: 6px; }
  .pub__year { font-size: .9rem; }
}
