/* ==========================================================================
   Maher Kassar — Academic CV Site
   Theme: "Ivory & Ink" — warm ivory, deep navy ink, muted scholar gold
   ========================================================================== */

:root {
  --bg: #FAF9F6;
  --bg-alt: #F3F1EA;
  --surface: #FFFFFF;
  --ink: #1E2A3A;
  --ink-soft: #46536A;
  --muted: #7A8194;
  --accent: #A67C2E;
  --accent-soft: #C9A55C;
  --accent-tint: #F5EDDC;
  --border: #E6E2D6;
  --shadow: 0 1px 2px rgba(30, 42, 58, 0.04), 0 6px 20px rgba(30, 42, 58, 0.05);
  --shadow-hover: 0 2px 4px rgba(30, 42, 58, 0.06), 0 12px 32px rgba(30, 42, 58, 0.09);
  --nav-bg: rgba(250, 249, 246, 0.88);

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #14181F;
  --bg-alt: #181D26;
  --surface: #1E242F;
  --ink: #EAE6DC;
  --ink-soft: #C3BFB4;
  --muted: #8C93A3;
  --accent: #C9A55C;
  --accent-soft: #A67C2E;
  --accent-tint: #2A2618;
  --border: #2C333F;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 6px 20px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.25), 0 12px 32px rgba(0, 0, 0, 0.35);
  --nav-bg: rgba(20, 24, 31, 0.88);
}

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

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

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.35s ease, color 0.35s ease;
}

::selection { background: var(--accent-tint); color: var(--ink); }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; }
em { font-style: normal; }
a { color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); font-weight: 400; }

/* ==========================================================================
   Navigation
   ========================================================================== */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.35s ease;
}

.nav__inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav__brand {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.nav__brand span { color: var(--ink); }

.nav__links {
  display: flex;
  gap: 4px;
}

.nav__links a {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  padding: 6px 11px;
  border-radius: 6px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav__links a:hover { color: var(--ink); background: var(--accent-tint); }
.nav__links a.active { color: var(--accent); background: var(--accent-tint); }

.nav__actions { display: flex; align-items: center; gap: 8px; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent-soft); transform: rotate(15deg); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.nav__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  padding: 8px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.nav__burger span {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.nav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  background:
    radial-gradient(ellipse 900px 420px at 85% -10%, var(--accent-tint) 0%, transparent 60%),
    var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.hero__inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 88px 24px 76px;
  display: flex;
  align-items: flex-start;
  gap: 64px;
}

.hero__profile {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero__photo-ring {
  position: relative;
  width: 232px;
  height: 232px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(140deg, var(--accent-soft), var(--accent) 55%, var(--ink));
  box-shadow: var(--shadow-hover);
}

.hero__photo,
.hero__monogram {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid var(--bg);
}

.hero__photo { object-fit: cover; display: block; }
.hero__photo.is-hidden { display: none; }

.hero__monogram {
  display: none;
  place-items: center;
  background: linear-gradient(150deg, #26344A, #1E2A3A 60%, #16202E);
  color: var(--accent-soft);
  font-family: var(--serif);
  font-size: 4.2rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  user-select: none;
}
.hero__monogram.is-visible { display: grid; }

.hero__profile-name {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  font-weight: 600;
  line-height: 1.08;
  margin-top: 30px;
  margin-bottom: 6px;
}

.hero__profile-title {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--muted);
  margin-bottom: 4px;
}

.hero__profile-school {
  max-width: 300px;
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.35;
  color: var(--accent);
  margin-bottom: 28px;
}

.hero__profile-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.hero__profile-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  color: var(--ink-soft);
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.hero__profile-link:hover {
  color: var(--accent);
  transform: translateY(-1px);
}

.hero__profile-link--text {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.hero__profile-link--linkedin {
  width: 44px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--accent-soft);
  font-size: 1.95rem;
  font-family: Arial, Helvetica, sans-serif;
}

.hero__profile-link--linkedin:hover {
  background: var(--accent);
  color: var(--bg);
}

.hero__text {
  flex: 1;
  padding-top: 28px;
}

.hero__bio {
  max-width: 560px;
  color: var(--ink-soft);
  margin-bottom: 22px;
}
.hero__bio strong { color: var(--ink); font-weight: 600; }
.hero__bio em { color: var(--accent); }

/* ==========================================================================
   Sections
   ========================================================================== */

.section { padding: 40px 0; }
.section--alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section__inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
}

.section__title {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: 1.8rem;
  margin-bottom: 30px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--accent-soft);
}

.section__note {
  margin: -18px 0 26px;
  font-family: var(--serif);
  color: var(--muted);
}

.subheading {
  font-size: 0.82rem;
  font-family: var(--sans);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin: 40px 0 18px;
}
.subheading:first-of-type { margin-top: 0; }

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

.timeline {
  position: relative;
  padding-left: 26px;
}

.timeline__item { position: relative; padding-bottom: 34px; }
.timeline__item:last-child { padding-bottom: 0; }

.timeline__marker {
  position: absolute;
  left: -26px;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
}

.timeline__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.timeline__head h3 { font-size: 1.18rem; }

.timeline__date {
  font-family: var(--serif);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink);
  white-space: nowrap;
}

.timeline__org {
  font-size: 0.92rem;
  color: var(--muted);
  margin-top: 3px;
}

.timeline--divided .timeline__item {
  padding-bottom: 26px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--border);
}

.timeline--divided .timeline__item:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

/* ==========================================================================
   Publications
   ========================================================================== */

.pub-list {
  list-style: none;
  display: grid;
  gap: 14px;
}

.pub {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-soft);
  border-radius: 10px;
  padding: 18px 22px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

.pub:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  border-left-color: var(--accent);
}

.pub__title {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.4;
}

.pub__title a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--accent-soft), var(--accent-soft));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1px;
  transition: background-size 0.2s ease, color 0.2s ease;
}
.pub__title a:hover {
  color: var(--accent);
  background-size: 100% 1px;
}

.pub__journal {
  color: var(--ink);
  font-weight: 400;
  font-style: italic;
}
.pub__journal-label {
  font-style: normal;
}

.pub__authors {
  font-size: 0.87rem;
  color: var(--muted);
  margin-top: 4px;
}

.pub__details {
  margin-top: 10px;
}

.pub__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  user-select: none;
}
.pub__toggle::-webkit-details-marker { display: none; }

.pub__toggle::after {
  content: "▾";
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}
.pub__details[open] .pub__toggle::after {
  transform: rotate(180deg);
}

.pub__details:not([open]) .pub__abstract {
  display: none;
}

.pub__abstract {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink-soft);
  text-align: justify;
  text-justify: inter-word;
}

/* ==========================================================================
   Presentations
   ========================================================================== */

.pres-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.pres {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.pres:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }

.pres__paper {
  font-size: 1rem;
  line-height: 1.4;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}

.pres__venues { list-style: none; display: grid; gap: 6px; }

.pres__venues li {
  font-size: 0.86rem;
  color: var(--ink-soft);
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.pres__year {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--ink);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Honors & Service
   ========================================================================== */

.line-list { list-style: none; display: grid; gap: 14px; }

.line-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.line-list strong { font-family: var(--serif); font-size: 0.98rem; font-weight: 600; }

.line-list__sub {
  display: block;
  font-size: 0.83rem;
  color: var(--muted);
  margin-top: 2px;
}

.line-list__date {
  font-family: var(--serif);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#honors .subheading {
  margin: 20px 0 10px;
}
#honors .subheading:first-of-type {
  margin-top: 0;
}
#honors .line-list {
  gap: 8px;
}
#honors .line-list li {
  padding-bottom: 8px;
}

/* ==========================================================================
   Teaching
   ========================================================================== */

.timeline--teaching .timeline__item {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.timeline--teaching .timeline__item:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.teach__roles {
  list-style: none;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.teach__roles li {
  position: relative;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

/* Smaller version of .timeline__marker, reused for supporting-role bullets */
.timeline__marker--sm,
.teach__roles li::before {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}

.teach__roles li::before {
  left: -20px;
  top: 8px;
}

.teach__role-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.teach__role {
  font-weight: 600;
  color: var(--ink-soft);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer-min {
  background: var(--ink);
  color: #D8D4C8;
  text-align: center;
  padding: 22px 24px;
}
[data-theme="dark"] .footer-min { background: #10141B; border-top: 1px solid var(--border); }

.footer-min__copy {
  font-size: 0.78rem;
  opacity: 0.6;
}

/* ==========================================================================
   Reveal animation
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.in-view { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .pub, .pres, .theme-toggle, .footer__btn { transition: none; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 920px) {
  .nav__links {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 10px 24px 18px;
    display: none;
  }
  .nav__links.open { display: flex; }
  .nav__links a { padding: 10px 12px; font-size: 0.95rem; }
  .nav__burger { display: flex; }

  .hero__inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 36px;
    padding: 64px 24px 56px;
  }
  .hero__profile { flex-basis: auto; width: 100%; max-width: 340px; }
  .hero__photo-ring { width: 196px; height: 196px; }
  .hero__profile-name { margin-top: 24px; }
  .hero__text { padding-top: 0; }
  .hero__bio { margin-left: auto; margin-right: auto; }

  .pres-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .section { padding: 32px 0; }
  .section__title { font-size: 1.5rem; }
  .hero__profile-name { font-size: 2.25rem; }
  .hero__profile-school { font-size: 1rem; }
  .hero__profile-links { gap: 12px; }
  .hero__profile-link--text { font-size: 2rem; }
  .pub { padding: 16px 18px; }
  .timeline { padding-left: 22px; }
  .timeline__marker { left: -22px; }
}

/* ==========================================================================
   Print — renders as a clean CV
   ========================================================================== */

@media print {
  .nav, .theme-toggle, .nav__burger { display: none !important; }
  body { background: #fff; color: #111; font-size: 12px; }
  .hero, .section--alt { background: #fff; border: none; }
  .hero__inner, .section { padding: 18px 0; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .pub, .pres { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .footer-min { background: #fff; color: #111; padding: 12px 0; }
  .hero__photo-ring { box-shadow: none; }
  a { color: #111; }
}
