/* ---------------------------------------------------------------
   Fares J. Abu-Dakka — personal academic site
   Hand-built static theme (al-folio inspired: news feed, publication
   list, project grid, CV timeline, light/dark mode).
   --------------------------------------------------------------- */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f2f6;
  --text: #1f2937;
  --text-muted: #5b6472;
  --text-faint: #667085;
  --border: #e3e5ea;
  --accent: #3538cd;
  --accent-ink: #262a9e;
  --accent-tint: #eeedfe;
  --teal: #0f766e;
  --coral: #d85a30;
  --art-ink: #334155;
  --art-accent: #3538cd;
  --art-faint: #b9bfcc;
  --art-fill: #ffffff;
  --art-accent-fill: rgba(53, 56, 205, 0.10);
  --art-label: #6b7383;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 20px rgba(15, 23, 42, 0.05);
  --max-width: 900px;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #14161c;
  --surface: #1b1e26;
  --surface-2: #22252e;
  --text: #e7e9ee;
  --text-muted: #a3aab6;
  --text-faint: #8992a2;
  --border: #2c2f3a;
  --accent: #8b90f0;
  --accent-ink: #c2c5fa;
  --accent-tint: #22243a;
  --teal: #4fd1c5;
  --coral: #f0906a;
  --art-ink: #c3cad8;
  --art-accent: #8b90f0;
  --art-faint: #4b5263;
  --art-fill: #1b1e26;
  --art-accent-fill: rgba(139, 144, 240, 0.11);
  --art-label: #9aa3b2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:where(a, button):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  margin: 0 0 0.5em;
}

h1 { font-size: 2.1rem; }
h2 { font-size: 1.5rem; margin-top: 2.4em; }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; }

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

/* ---------- Nav ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  max-width: 980px;
}

.brand {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text);
  text-decoration: none;
  border-bottom-color: var(--accent);
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  margin-left: 8px;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

.nav-toggle {
  display: none;
  border: none;
  background: none;
  font-size: 1.4rem;
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius);
  line-height: 1;
}

/* ---------- Hero ---------- */
.hero {
  padding: 64px 0 40px;
}

.hero-grid {
  display: flex;
  gap: 36px;
  align-items: flex-start;
}

.avatar {
  flex: none;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: linear-gradient(155deg, var(--accent) 0%, var(--accent-ink) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: 1px;
  box-shadow: var(--shadow);
}

.hero-text .kicker {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.hero-text h1 { margin-bottom: 4px; }

.hero-text .role {
  color: var(--text-muted);
  font-size: 1.02rem;
  margin-bottom: 14px;
}

.hero-text .role strong { color: var(--text); font-weight: 600; }

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}
.pill:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* ---------- Sections ---------- */
section { padding-bottom: 8px; }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.section-title a.more { font-size: 0.85rem; font-weight: 500; }

/* ---------- News ---------- */
.news-list { margin: 18px 0 40px; }

.news-item {
  display: flex;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.93rem;
}
.news-item:last-child { border-bottom: none; }

.news-date {
  flex: none;
  width: 88px;
  color: var(--text-faint);
  font-size: 0.8rem;
  padding-top: 2px;
  font-family: var(--font-sans);
}

.news-body { color: var(--text); }
.news-body a { font-weight: 500; }

.tag-new {
  display: inline-block;
  background: var(--accent-tint);
  color: var(--accent-ink);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 7px;
  border-radius: 999px;
  margin-right: 8px;
  vertical-align: 2px;
}

/* ---------- Cards / grid (research) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin: 22px 0 44px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

/* Research drawings: inline SVG coloured only through the --art-* tokens. */
.card .art {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 4;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.card .art .art-label {
  font-family: var(--font-sans);
  font-size: 11px;
  fill: var(--art-label);
  letter-spacing: 0.01em;
}
.card .art .art-italic { font-style: italic; }

/* Looping entrance animations for the research figures. Inert unless JS has
   added .art-anim to <html> (skipped under prefers-reduced-motion) and the figure
   has scrolled into view (.is-visible); otherwise every element below renders in
   its finished, static state. */
.card .art .a-draw { stroke-dashoffset: 0; }

html.art-anim .art.is-visible .a-fade {
  animation: art-fade var(--t, .35s) cubic-bezier(.4, 0, .2, 1) var(--d, 0s) both;
}
html.art-anim .art.is-visible .a-draw {
  animation: art-draw var(--t, .5s) cubic-bezier(.4, 0, .2, 1) var(--d, 0s) both;
}
html.art-anim .art.is-visible .a-pop {
  transform-box: fill-box;
  transform-origin: center;
  animation: art-pop .15s cubic-bezier(.4, 0, .2, 1) var(--d, 0s) both;
}
html.art-anim .art.is-visible .a-rise {
  animation: art-rise .5s cubic-bezier(.4, 0, .2, 1) var(--d, 0s) both;
}

@keyframes art-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes art-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes art-pop { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: scale(1); } }
@keyframes art-rise { from { transform: translateY(-10px); } to { transform: translateY(0); } }

.card-body { padding: 16px 18px 20px; }
.card-body h3 { margin-bottom: 6px; }
.card-body p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0; }
.card-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ---------- Publications ---------- */
.pub-year {
  position: sticky;
  top: 61px;
  background: var(--bg);
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
  padding: 18px 0 8px;
  border-bottom: 1px solid var(--border);
  margin: 0 0 4px;
}

.pub-item {
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.pub-item:last-of-type { border-bottom: none; }

.pub-title { font-weight: 600; font-size: 0.98rem; }
.pub-venue { color: var(--text-muted); font-size: 0.88rem; font-style: italic; }
.pub-authors { color: var(--text-faint); font-size: 0.84rem; margin-top: 1px; }

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

.link-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.link-badge:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* Copy BibTeX: a button styled as a link badge; the BibTeX itself stays hidden. */
button.link-badge {
  font-family: inherit;
  background: none;
  cursor: pointer;
  line-height: inherit;
}
button.link-badge:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pub-bib { display: none; }

.note-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 18px 0 8px;
}

/* ---------- CV ---------- */
.cv-block { margin-bottom: 38px; }

.cv-row {
  display: flex;
  gap: 18px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.cv-row:last-child { border-bottom: none; }
.cv-when {
  flex: none;
  width: 108px;
  color: var(--text-faint);
  font-size: 0.82rem;
  padding-top: 1px;
}
.cv-what strong { font-weight: 600; }
.cv-what span.where { color: var(--text-muted); }

.cv-list { margin: 6px 0 0; padding-left: 20px; font-size: 0.92rem; color: var(--text-muted); }
.cv-list li { margin-bottom: 5px; }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding: 30px 0 50px;
  color: var(--text-faint);
  font-size: 0.85rem;
}
footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
footer a { color: var(--text-muted); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  /* With no JavaScript, keep every navigation link visible in a wrapped row. */
  .site-nav .wrap {
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
  }

  .nav-links {
    width: 100%;
    order: 3;
    flex-wrap: wrap;
    gap: 6px 18px;
    padding: 0 0 12px;
  }

  .nav-links a { display: inline-block; padding-block: 8px; }

  /* JavaScript adds .js before it turns the navigation into a disclosure. */
  .js .site-nav .wrap {
    height: 60px;
    min-height: 0;
    flex-wrap: nowrap;
  }

  .js .nav-links {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    width: auto;
    order: initial;
    background: var(--surface);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: none;
    gap: 14px;
  }

  .js .nav-links.open { display: flex; }
  .js .nav-toggle { display: inline-flex; }
  .js .nav-toggle[aria-expanded="true"] { background: var(--surface-2); }
  .hero-grid { flex-direction: column; align-items: flex-start; }
  h1 { font-size: 1.7rem; }
  .cv-row, .news-item { flex-direction: column; gap: 4px; }
  .cv-when, .news-date { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body { transition: none; }
}
