/* ==========================================================================
   Ali Shaer — personal portfolio
   Light, typography-led layout. No frameworks, no build step.
   ========================================================================== */

:root {
  --ink: #15181d;
  --ink-soft: #3d444f;
  --muted: #667085;
  --muted-light: #98a1af;
  --line: #e6e8ec;
  --line-soft: #eef0f3;
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --navy: #17325c;
  --navy-deep: #0f1c34;
  --accent: #1e4586;
  --accent-light: #6f92cf;

  --shell: 1120px;
  --radius: 14px;
  --radius-pill: 999px;

  --header-h: 72px;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* keeps anchored headings clear of the sticky header */
  scroll-padding-top: calc(var(--header-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

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

body.menu-open { overflow: hidden; }

h1, h2, h3, h4, h5 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: -0.022em;
  font-weight: 700;
}

p { margin: 0; }

ul, ol, dl, dd { margin: 0; padding: 0; }
li { list-style: none; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
a:hover { color: var(--navy); }

img, svg { max-width: 100%; }

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

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: 28px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 120;
  transform: translateY(-160%);
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: translateY(0); color: #fff; }

/* Icons -------------------------------------------------------------------- */
.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Buttons ------------------------------------------------------------------ */
.btn {
  --btn-py: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: var(--btn-py) 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease),
    border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.btn-primary {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 28, 52, 0.18);
}
.btn-primary:hover {
  background: #1e3f70;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 28, 52, 0.18);
}

.btn-ghost {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover {
  color: var(--navy);
  border-color: var(--muted-light);
  transform: translateY(-1px);
}

.btn-text {
  background: transparent;
  color: var(--ink-soft);
  padding-inline: 8px;
}
.btn-text:hover { color: var(--navy); }

.btn-sm { --btn-py: 10px; padding-inline: 20px; font-size: 0.875rem; }
.btn-block { width: 100%; }

/* Header ------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.site-header.is-stuck {
  border-bottom-color: var(--line);
  box-shadow: 0 1px 16px rgba(21, 24, 29, 0.04);
}

.header-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
}
.brand:hover { color: var(--navy); }

.nav-desktop {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 26px;
}

.nav-link {
  position: relative;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  padding: 6px 0;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s var(--ease);
}
.nav-link:hover { color: var(--ink); }
.nav-link.is-active { color: var(--accent); }
.nav-link.is-active::after { transform: scaleX(1); }

/* Mobile toggle + menu ----------------------------------------------------- */
.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.nav-toggle-bars {
  display: block;
  position: relative;
  width: 18px;
  height: 10px;
}
.nav-toggle-bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.6px;
  border-radius: 2px;
  background: var(--ink);
}
.nav-toggle-bars span:first-child { top: 0; }
.nav-toggle-bars span:last-child { bottom: 0; }

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(21, 24, 29, 0.28);
  padding: 14px;
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}
.mobile-menu.is-open { opacity: 1; }

.mobile-menu-panel {
  background: #fff;
  border-radius: 18px;
  padding: 18px 22px 24px;
  box-shadow: 0 24px 60px rgba(15, 28, 52, 0.22);
  transform: translateY(-10px);
  opacity: 0;
  transition: transform 0.24s var(--ease), opacity 0.24s var(--ease);
}
.mobile-menu.is-open .mobile-menu-panel {
  transform: translateY(0);
  opacity: 1;
}

.mobile-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
}

.mobile-close {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink);
}
.mobile-close svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.mobile-nav-list { margin: 8px 0 20px; }
.mobile-nav-list a {
  display: block;
  padding: 15px 2px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 1.0625rem;
}
.mobile-nav-list a:hover { color: var(--accent); }

/* Hero --------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #f7f8fa 0%, #fbfcfd 55%, #fff 100%);
  border-bottom: 1px solid var(--line-soft);
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(23, 50, 92, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(23, 50, 92, 0.05) 1px, transparent 1px);
  background-size: 96px 96px;
  mask-image: radial-gradient(120% 90% at 22% 0%, #000 0%, transparent 62%);
  -webkit-mask-image: radial-gradient(120% 90% at 22% 0%, #000 0%, transparent 62%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  padding-top: 92px;
  padding-bottom: 104px;
}

.eyebrow {
  margin: 0 0 22px;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow-dot { display: flex; align-items: center; gap: 9px; }
.eyebrow-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(30, 69, 134, 0.12);
}

.hero-title {
  font-size: clamp(2.75rem, 8vw, 4.75rem);
  letter-spacing: -0.035em;
  margin-bottom: 20px;
}

.hero-subtitle {
  font-size: clamp(1.0625rem, 2.4vw, 1.375rem);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.015em;
  margin-bottom: 26px;
}
.hero-subtitle .sep {
  color: var(--accent-light);
  margin-inline: 8px;
  font-weight: 400;
}

.hero-lede {
  max-width: 50ch;
  color: var(--ink-soft);
  font-size: 1.0625rem;
  margin-bottom: 36px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 38px;
}

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

.chip-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: #fff;
  color: var(--ink-soft);
  font-size: 0.875rem;
}
.chip-link:hover {
  color: var(--navy);
  border-color: var(--muted-light);
  transform: translateY(-1px);
}
.chip-link { transition: color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease); }

/* Sections ----------------------------------------------------------------- */
.section { padding: 104px 0; }
.section-alt {
  background: var(--bg-alt);
  border-block: 1px solid var(--line-soft);
}

.section-head { margin-bottom: 52px; }
.section-index {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin-bottom: 12px;
}
.section-title {
  font-size: clamp(1.875rem, 4.4vw, 2.625rem);
  letter-spacing: -0.03em;
}
.section-lede {
  margin-top: 18px;
  max-width: 52ch;
  color: var(--muted);
  font-size: 1.0625rem;
}

/* About -------------------------------------------------------------------- */
.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}

.prose p {
  color: var(--ink-soft);
  font-size: 1.0625rem;
  max-width: 62ch;
}
.prose p + p { margin-top: 20px; }
.prose strong { color: var(--ink); font-weight: 600; }

.fact-card {
  background: var(--bg-alt);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 28px 30px;
}
.fact + .fact {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.fact dt {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-light);
  margin-bottom: 5px;
}
.fact dd {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.45;
}

/* Experience --------------------------------------------------------------- */
.timeline {
  position: relative;
  padding-left: 34px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 12px;
  bottom: 12px;
  width: 1px;
  background: var(--line);
}

.timeline-item { position: relative; }
.timeline-item + .timeline-item { margin-top: 22px; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -34px;
  top: 30px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid var(--muted-light);
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}
.timeline-item:hover::before {
  border-color: var(--accent);
  background: var(--accent);
}

.role-card {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 28px 30px;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease),
    transform 0.25s var(--ease);
}
.role-card:hover {
  border-color: var(--line);
  box-shadow: 0 12px 32px rgba(21, 24, 29, 0.06);
  transform: translateY(-2px);
}

.role-period {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-light);
  margin-bottom: 10px;
}
.role-title {
  font-size: 1.1875rem;
  margin-bottom: 4px;
}
.role-org {
  color: var(--accent);
  font-size: 0.9375rem;
  font-weight: 500;
}

.role-points { margin-top: 18px; }
.role-points li {
  position: relative;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}
.role-points li + li { margin-top: 7px; }
.role-points li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 11px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted-light);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.tag {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: #fafbfc;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  line-height: 1.5;
}

/* Research ----------------------------------------------------------------- */
.section-dark {
  background:
    radial-gradient(90% 120% at 12% 0%, #1b3159 0%, transparent 58%),
    linear-gradient(160deg, var(--navy-deep) 0%, #101a2c 100%);
  color: #eef1f6;
  border: none;
}
.section-dark .section-title { color: #fff; }
.section-dark .section-index { color: var(--accent-light); }
.section-dark .eyebrow { color: rgba(238, 241, 246, 0.55); }

.research-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}

.research-topic {
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  color: #fff;
  margin-bottom: 18px;
}
.research-body {
  color: rgba(238, 241, 246, 0.74);
  font-size: 1.0625rem;
  max-width: 48ch;
}

.research-interests-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 18px;
}

.tag-list-dark { margin-top: 0; }
.tag-list-dark .tag {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(238, 241, 246, 0.9);
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.tag-list-dark .tag:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.3);
}

.publications { margin-top: 56px; }
.publication-list { display: grid; gap: 18px; }
.publication {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  padding: 24px 26px;
}
.publication-title { font-size: 1.0625rem; color: #fff; margin-bottom: 6px; }
.publication-meta,
.publication-authors {
  font-size: 0.875rem;
  color: rgba(238, 241, 246, 0.66);
}
.publication-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  font-size: 0.875rem;
}
.publication-links a { color: var(--accent-light); }
.publication-links a:hover { color: #fff; }

/* Education ---------------------------------------------------------------- */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}
.edu-card {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 30px;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease),
    transform 0.25s var(--ease);
}
.edu-card:hover {
  border-color: var(--line);
  box-shadow: 0 12px 32px rgba(21, 24, 29, 0.06);
  transform: translateY(-2px);
}
.edu-degree { font-size: 1.125rem; margin-bottom: 4px; }
.edu-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Skills ------------------------------------------------------------------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 48px 40px;
}
.skill-group-title {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.skill-group .tag-list { margin-top: 18px; }

.lang-list { margin-top: 10px; }
.lang-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px dashed var(--line);
}
.lang-row dt { font-weight: 600; font-size: 0.9375rem; }
.lang-row dd { color: var(--muted); font-size: 0.8125rem; }

/* Contact ------------------------------------------------------------------ */
.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}
.contact-name { font-size: 1.1875rem; margin-bottom: 22px; }

.contact-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 18px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.contact-row dt {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-light);
}
.contact-row dd {
  font-size: 0.9375rem;
  font-weight: 500;
  word-break: break-word;
}
.contact-row dd a { color: var(--ink); }
.contact-row dd a:hover { color: var(--accent); }

.contact-actions {
  display: grid;
  gap: 12px;
}

/* Footer ------------------------------------------------------------------- */
.site-footer {
  padding: 34px 0;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.footer-tagline,
.footer-copy {
  color: var(--muted-light);
  font-size: 0.8125rem;
}

/* Scroll reveal ------------------------------------------------------------ */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}
/* Fallback: if JS never runs, nothing stays hidden. */
.no-js .reveal,
html:not(.js) .reveal {
  opacity: 1;
  transform: none;
}

/* Responsive --------------------------------------------------------------- */
@media (max-width: 960px) {
  .about-layout,
  .research-layout,
  .contact-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
  }
  .skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 32px; }
}

@media (max-width: 820px) {
  .nav-desktop { display: none; }
  .nav-toggle { display: inline-flex; }
}

@media (max-width: 680px) {
  .shell { padding-inline: 20px; }
  .section { padding: 72px 0; }
  .hero-inner { padding-top: 64px; padding-bottom: 76px; }
  .section-head { margin-bottom: 38px; }

  .hero-actions { gap: 10px; }
  .hero-actions .btn,
  .contact-actions .btn { width: 100%; }
  .hero-actions { flex-direction: column; align-items: stretch; }

  .edu-grid,
  .skills-grid { grid-template-columns: minmax(0, 1fr); }

  .timeline { padding-left: 0; }
  .timeline::before { display: none; }
  .timeline-item::before { display: none; }

  .role-card,
  .edu-card,
  .fact-card { padding: 24px 22px; }

  .contact-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }

  .footer-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* Motion & print ----------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  .site-header,
  .mobile-menu,
  .skip-link,
  .hero-grid { display: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .section, .hero-inner { padding: 24px 0; }
  .section-dark {
    background: #fff !important;
    color: #15181d !important;
  }
  .section-dark .section-title,
  .section-dark .research-topic,
  .section-dark .research-interests-title { color: #15181d !important; }
  .section-dark .research-body { color: #3d444f !important; }
  .tag-list-dark .tag { border-color: #d8dbe1 !important; color: #3d444f !important; }
}
