/* ==========================================================================
   Osama Salem — academic site
   Restrained single-column layout; tokens adapted from baranowskibrt.github.io
   ========================================================================== */

:root {
  --bg: #ffffff;
  --fg: #1b1f24;
  --muted: #5b6570;
  --line: #e7e9ee;
  --card: #f6f7f9;
  --accent: #7a1f2b;
  --accent-soft: #a83a48;
  --accent-tint: rgba(122, 31, 43, 0.07);
  --shadow: 0 22px 50px -26px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --wrap: 960px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1216;
  --fg: #e6e9ee;
  --muted: #9aa4b0;
  --line: #252b33;
  --card: #161b21;
  --accent: #e0899a;
  --accent-soft: #f0a9b7;
  --accent-tint: rgba(224, 137, 154, 0.1);
  --shadow: 0 22px 50px -26px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216; --fg: #e6e9ee; --muted: #9aa4b0; --line: #252b33; --card: #161b21;
    --accent: #e0899a; --accent-soft: #f0a9b7; --accent-tint: rgba(224, 137, 154, 0.1);
    --shadow: 0 22px 50px -26px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 0.18em; }
a:hover { color: var(--accent-soft); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
p { margin: 0 0 1rem; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
strong, b { font-weight: 650; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.5rem; }
main.wrap { padding-top: 2.6rem; padding-bottom: 3.5rem; outline: none; }

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  background: var(--fg); color: var(--bg); padding: 0.5rem 0.9rem; border-radius: 8px;
}
.skip-link:focus { top: 0.75rem; color: var(--bg); }

.icon { width: 1.05em; height: 1.05em; flex: none; vertical-align: -0.15em; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 1rem; height: 3.6rem; }
.nav-brand { color: var(--fg); font-size: 1.05rem; letter-spacing: -0.01em; margin-right: auto; }
.nav-brand b { font-weight: 800; }
.nav-brand:hover { color: var(--fg); text-decoration: none; }
.nav-links { display: flex; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: block; padding: 0.35rem 0.7rem; border-radius: 8px;
  color: var(--muted); font-size: 0.93rem; font-weight: 500;
}
.nav-links a:hover { color: var(--fg); background: var(--card); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--accent); background: var(--accent-tint); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 2.25rem; height: 2.25rem; padding: 0;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--fg); cursor: pointer;
  font-size: 1rem;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.nav-toggle { display: none; }
.when-dark { display: none; }
:root[data-theme="dark"] .when-dark { display: contents; }
:root[data-theme="dark"] .when-light { display: none; }

@media (max-width: 640px) {
  .nav-toggle { display: inline-grid; order: 2; }
  .theme-toggle { order: 1; }
  .nav-links {
    display: none; position: absolute; left: 0; right: 0; top: 3.6rem;
    flex-direction: column; gap: 0; padding: 0.5rem 1rem 1rem;
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.7rem 0.75rem; font-size: 1rem; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; padding-top: 1.4rem; padding-bottom: 2rem; }
.site-footer p { margin: 0; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); }

/* ---------- Shared typography ---------- */
.section-title {
  font-size: 0.95rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted); margin: 2.6rem 0 1.3rem;
}
.page-title { font-size: 2.1rem; letter-spacing: -0.015em; font-weight: 750; margin-bottom: 0.6rem; }
.lead { color: var(--muted); font-size: 1.08rem; margin-bottom: 2rem; }
.eyebrow { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.6rem; }
.eyebrow a { color: var(--muted); text-decoration: none !important; }
.eyebrow a:hover { color: var(--accent); }

/* ---------- Home intro ---------- */
.intro { display: flow-root; }
.portrait img {
  float: right; width: 330px; height: auto; aspect-ratio: 4 / 5; object-fit: cover;
  margin: 0.3rem 0 1rem 2.2rem;
  border-radius: 18px; border: 1px solid var(--line);
  box-shadow: 0 20px 54px -22px rgba(0, 0, 0, 0.45);
}
.name { font-size: 2.6rem; font-weight: 400; letter-spacing: -0.015em; margin: 0.4rem 0 0.2rem; }
.name .last { font-weight: 800; }
.role { color: var(--muted); font-size: 1.08rem; margin-bottom: 1.4rem; }

.pills { display: flex; flex-wrap: wrap; gap: 0.55rem; list-style: none; padding: 0; margin: 1.4rem 0 0; }
.pill {
  position: relative;
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.38rem 0.9rem; border: 1px solid var(--line); border-radius: 999px;
  color: var(--fg); font-size: 0.9rem; background: var(--bg);
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.pill:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.pill.copied::after {
  content: "Copied!"; position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  background: var(--fg); color: var(--bg); font-size: 0.75rem; padding: 0.15rem 0.5rem; border-radius: 6px; white-space: nowrap;
}

@media (max-width: 640px) {
  .portrait img { float: none; width: min(260px, 70%); margin: 0 auto 1.4rem; }
  .name { font-size: 2.2rem; }
}

/* ---------- Project cards ---------- */
.cards { display: grid; gap: 1.4rem; }
.card {
  display: grid; grid-template-columns: 300px 1fr;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  overflow: hidden; transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-thumb { display: flex; align-items: center; background: #fff; border-right: 1px solid var(--line); }
.card-thumb img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: contain; }
.card-body { padding: 1.2rem 1.4rem 1.25rem; }
.card-title { font-size: 1.05rem; font-weight: 700; line-height: 1.35; margin-bottom: 0.35rem; }
.card-title a { color: var(--fg); }
.card-title a:hover { color: var(--accent); }
.card-authors, .card-venue { font-size: 0.92rem; margin: 0; }
.card-authors { color: var(--fg); }
.card-venue { color: var(--muted); font-style: italic; margin-bottom: 0.55rem; }
.card-summary { font-size: 0.95rem; margin-bottom: 0.75rem; }
.me { font-weight: 650; }

@media (max-width: 720px) {
  .card { grid-template-columns: 1fr; }
  .card-thumb { border-right: 0; border-bottom: 1px solid var(--line); }
  .card-thumb img { aspect-ratio: 3 / 2; min-height: 0; height: auto; }
}

/* ---------- Buttons ---------- */
.link-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0; margin: 1.1rem 0 0; }
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.45rem 0.95rem; border-radius: 999px;
  background: var(--fg); color: var(--bg); font-size: 0.9rem; font-weight: 550;
  border: 1px solid var(--fg); transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; text-decoration: none; transform: translateY(-1px); }
:root[data-theme="dark"] .btn:hover { color: #0f1216; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:hover { color: #0f1216; } }
.link-buttons.compact { margin-top: 0; gap: 0.4rem; }
.link-buttons.compact .btn {
  background: transparent; color: var(--fg); border-color: var(--line);
  padding: 0.25rem 0.7rem; font-size: 0.84rem; font-weight: 500;
}
.link-buttons.compact .btn:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

/* ---------- Project page ---------- */
.project-head { text-align: center; max-width: 820px; margin: 0 auto 2.2rem; }
.project-head .link-buttons { justify-content: center; margin-top: 1.4rem; }
.project-title { font-size: 2rem; font-weight: 750; letter-spacing: -0.015em; line-height: 1.22; margin-bottom: 0.6rem; }
.project-subtitle { color: var(--muted); font-size: 0.98rem; margin-bottom: 0.9rem; }
.project-authors { font-size: 1.06rem; margin-bottom: 0.2rem; }
.project-venue { color: var(--muted); font-style: italic; margin-bottom: 0.5rem; }
.project-people { font-size: 0.95rem; margin: 0.15rem 0; }
.label {
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
  color: var(--muted); margin-right: 0.4rem;
}

.teaser { margin: 0 0 2.2rem; }
.teaser img {
  width: 100%; height: auto; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem;
}
.teaser figcaption, .slides-hint { color: var(--muted); font-size: 0.9rem; margin-top: 0.7rem; line-height: 1.55; }
.teaser figcaption strong { color: var(--fg); }

.tldr {
  border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); background: var(--card);
  padding: 1.3rem 1.6rem 0.6rem;
}
.tldr h2 { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--accent); margin-bottom: 0.9rem; }
.tldr dl { margin: 0; display: grid; grid-template-columns: 8.5rem 1fr; gap: 0 1.2rem; }
.tldr dt { font-weight: 700; padding-top: 0.05rem; }
.tldr dd { margin: 0 0 0.9rem; }
@media (max-width: 640px) {
  .project-title { font-size: 1.6rem; }
  .tldr { padding: 1.1rem 1.1rem 0.4rem; }
  .tldr dl { grid-template-columns: 1fr; }
  .tldr dd { margin-bottom: 0.8rem; }
}
.project-note { margin-top: 1.6rem; }

/* ---------- Timeline (experience / education) ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.entry {
  display: grid; grid-template-columns: 10.5rem 1fr; gap: 1.5rem;
  padding: 1.4rem 0; border-top: 1px solid var(--line);
}
.entry:first-child { border-top: 0; padding-top: 0.2rem; }
.entry-dates { color: var(--muted); font-size: 0.92rem; margin: 0.15rem 0 0; white-space: nowrap; }
.entry-title { font-size: 1.1rem; font-weight: 650; }
.entry-org { color: var(--muted); margin: 0.1rem 0 0.6rem; }
.entry-points { margin: 0; padding-left: 1.1rem; font-size: 0.97rem; }
.entry-points li { margin-bottom: 0.3rem; }
.entry-points li::marker { color: var(--muted); }
.entry-more { margin: 0.6rem 0 0; font-size: 0.93rem; }
.thesis {
  margin-top: 1rem; padding: 0.9rem 1.1rem; border-radius: 10px;
  background: var(--card); border: 1px solid var(--line);
}
.thesis p { margin: 0 0 0.15rem; }
.thesis-label { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--muted); }
.thesis-title { font-weight: 650; font-size: 1.02rem; }
.thesis-where { color: var(--muted); font-size: 0.93rem; margin-bottom: 0.4rem !important; }
@media (max-width: 640px) {
  .entry { grid-template-columns: 1fr; gap: 0.3rem; }
}

/* ---------- Slide viewer ---------- */
.slides-meta { color: var(--muted); margin-bottom: 1.4rem; }
.viewer { outline: none; }
.viewer-stage {
  position: relative; width: 100%; overflow: hidden;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  touch-action: pan-y;
}
.slide { position: absolute; inset: 0; margin: 0; visibility: hidden; opacity: 0; transition: opacity 0.2s ease; }
.slide.is-active { visibility: visible; opacity: 1; }
.slide > img { width: 100%; height: 100%; object-fit: contain; }
.slide-media { position: absolute; object-fit: contain; background: transparent; }
.slide[data-sequence] .slide-media { opacity: 0; }
.slide[data-sequence] .slide-media.is-current { opacity: 1; }
.viewer-controls { display: flex; align-items: center; justify-content: center; gap: 0.8rem; margin-top: 0.9rem; }
.viewer-count { min-width: 5rem; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); }
.viewer-fs { margin-left: 0.8rem; }
.viewer:fullscreen { background: #000; display: flex; flex-direction: column; justify-content: center; padding: 1rem; }
.viewer:fullscreen .viewer-stage { max-height: calc(100vh - 5rem); width: auto; margin: 0 auto; border: 0; }
.viewer:fullscreen .viewer-count { color: #ddd; }
.slides-hint { text-align: center; }
/* Without JS every slide is shown in a column. */
.no-js .slide { position: static; visibility: visible; opacity: 1; }
.no-js .viewer-stage { aspect-ratio: auto !important; }
.no-js .viewer-controls { display: none; }

/* ---------- Generic page content ---------- */
.page > p, .page > ul { max-width: 46rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .card:hover, .pill:hover, .btn:hover { transform: none; }
}

@media print {
  .site-header, .site-footer, .theme-toggle { display: none; }
  body { font-size: 12pt; }
}

/* Links inside running text get an underline so they don't rely on colour alone. */
main :is(p, dd, figcaption, .entry-points li) a,
.site-footer a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
}
main :is(p, dd, figcaption, .entry-points li) a:hover { text-decoration-color: currentColor; }
