/* ==========================================================================
   styles.css — MAMHussien.github.io
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Custom Properties
   -------------------------------------------------------------------------- */
:root {
  /* UC Berkeley brand colors */
  --blue:         #002676;
  --gold:         #FDB515;   /* decorative only — fails WCAG AA on white */
  --gold-text:    #8a6000;   /* gold adjusted for AA contrast on white */
  --white:        #FFFFFF;
  --text:         #1a1a1a;
  --text-muted:   #555555;
  --border:       #dde0e6;
  --bg-soft:      #f6f7f9;

  /* Typography */
  --font-heading: 'Crimson Pro', Georgia, serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;

  /* Layout */
  --max-width:    920px;
  --gap:          4rem;
  --nav-h:        60px;
}

/* --------------------------------------------------------------------------
   2. Reset & Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}
a:hover { color: var(--gold-text); }

ul, ol { padding-left: 1.5rem; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

/* --------------------------------------------------------------------------
   3. Skip Link
   -------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: -4rem;
  left: 1rem;
  background: var(--blue);
  color: var(--white);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  text-decoration: none;
  border-radius: 0 0 4px 4px;
  z-index: 200;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; color: var(--white); }

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  flex: 1;
  padding-top: var(--nav-h);
}

section {
  padding: var(--gap) 0;
}

section + section {
  border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   5. Typography helpers
   -------------------------------------------------------------------------- */
.label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  display: block;
}

.page-title {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--blue);
  line-height: 1.2;
  margin-bottom: 1.5rem;
}

.section-heading {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--blue);
  line-height: 1.25;
  margin-bottom: 1.25rem;
}

/* --------------------------------------------------------------------------
   6. Navigation
   -------------------------------------------------------------------------- */
.site-nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 1rem;
}

.nav-logo {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--blue);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-logo:hover { color: var(--blue); text-decoration: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  margin: 0;
}

.nav-links a {
  display: block;
  padding: 0.35rem 0.6rem;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 4px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover { color: var(--blue); background: var(--bg-soft); }
.nav-links a.active {
  color: var(--blue);
  font-weight: 600;
  border-bottom: 2px solid var(--gold);
  border-radius: 0;
  padding-bottom: 0.2rem;
}

/* Hamburger button */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--blue);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* --------------------------------------------------------------------------
   7. Hero
   -------------------------------------------------------------------------- */
.hero {
  padding: 5rem 0 3.5rem;
}

.hero-name {
  font-family: var(--font-heading);
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  font-weight: 700;
  color: var(--blue);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

.hero-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
  letter-spacing: 0.01em;
}

.hero-tagline {
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.65;
  max-width: 680px;
  margin-bottom: 2.2rem;
}

.hero-quote {
  border-left: 3px solid var(--gold);
  padding: 0.4rem 0 0.4rem 1.2rem;
  margin-bottom: 2.5rem;
  max-width: 600px;
}
.hero-quote p {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.55;
}
.hero-quote cite {
  display: block;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.35rem;
  letter-spacing: 0.04em;
}

.hero-bio {
  max-width: 700px;
  font-size: 1rem;
  line-height: 1.75;
}

/* --------------------------------------------------------------------------
   8. News Cards
   -------------------------------------------------------------------------- */
.news-list { display: flex; flex-direction: column; }

.news-card {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 1rem 1.25rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.news-card:last-child { border-bottom: none; }
.news-card--no-img { grid-template-columns: 1fr; }

.news-thumb {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg-soft);
}

.news-date {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-text);
  margin-bottom: 0.3rem;
}

.news-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--blue);
  line-height: 1.3;
  margin-bottom: 0.35rem;
}
.news-title a { text-decoration: none; color: inherit; }
.news-title a:hover { text-decoration: underline; }

.news-summary {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.news-fallback { color: var(--text-muted); font-style: italic; }

.view-all {
  display: inline-block;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   9. Research Theme Cards
   -------------------------------------------------------------------------- */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

.theme-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.theme-card:hover {
  border-color: var(--blue);
  box-shadow: 0 2px 10px rgba(0,38,118,0.07);
  text-decoration: none;
  color: inherit;
}

.theme-num {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-text);
  margin-bottom: 0.5rem;
}

.theme-title {
  font-family: var(--font-heading);
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--blue);
  line-height: 1.3;
  margin-bottom: 0.7rem;
}

.theme-summary {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.theme-cta {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
}
.theme-card:hover .theme-cta { text-decoration: underline; }

/* --------------------------------------------------------------------------
   10. Publications
   -------------------------------------------------------------------------- */
.pub-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.pub-filter-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.filter-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.28rem 0.7rem;
  font-size: 0.82rem;
  font-family: var(--font-body);
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}
.filter-btn:hover,
.filter-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
}

.pub-year-group { margin-bottom: 2.5rem; }

.year-heading {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
}

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

.type-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-bottom: 0.4rem;
  background: var(--bg-soft);
  color: var(--text-muted);
}
.type-badge.journal    { background: #e6edf8; color: #1a437a; }
.type-badge.preprint   { background: #fef8e7; color: #7a5800; }
.type-badge.conference { background: #e8f5e9; color: #2e6b32; }

.pub-title {
  font-family: var(--font-heading);
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--blue);
  line-height: 1.35;
  margin-bottom: 0.2rem;
}

.pub-authors {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}
.pub-authors strong { color: var(--text); font-weight: 600; }

.pub-venue {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0.4rem;
}

.pub-links { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.pub-link {
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.18rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  transition: all 0.15s;
}
.pub-link:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
}

/* --------------------------------------------------------------------------
   11. Talks
   -------------------------------------------------------------------------- */
.talks-year-group { margin-bottom: 2.5rem; }

.talk-item {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 0 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.talk-item:last-child { border-bottom: none; }

.talk-type {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.2rem 0.45rem;
  border-radius: 3px;
  white-space: nowrap;
  margin-top: 0.2rem;
  display: inline-block;
}
.talk-type.invited     { background: #e6edf8; color: #1a437a; }
.talk-type.contributed { background: var(--bg-soft); color: var(--text-muted); }

.talk-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--blue);
  line-height: 1.35;
  margin-bottom: 0.2rem;
}

.talk-venue {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.talk-slides {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.3rem;
}

/* --------------------------------------------------------------------------
   12. CV & Resume
   -------------------------------------------------------------------------- */
.cv-section { margin-bottom: 3rem; }
.cv-section + .cv-section { border-top: 1px solid var(--border); padding-top: 3rem; }

.download-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  background: var(--bg-soft);
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-bottom: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-body);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-primary {
  background: var(--blue);
  color: var(--white);
  border: 1px solid transparent;
}
.btn-primary:hover { background: #003490; color: var(--white); text-decoration: none; }

.btn-outline {
  background: none;
  color: var(--blue);
  border: 1px solid var(--blue);
}
.btn-outline:hover { background: var(--blue); color: var(--white); text-decoration: none; }

.cv-coming-soon {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.skills-block { margin-bottom: 1.75rem; }

.skills-row {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
  line-height: 1.6;
}
.skills-row:last-child { border-bottom: none; }

.skills-cat {
  font-weight: 600;
  color: var(--text);
  margin-right: 0.4rem;
}

.project-list { margin-bottom: 1.75rem; }

.project-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.project-item:last-child { border-bottom: none; }

.project-name {
  font-weight: 600;
  color: var(--blue);
  font-size: 0.95rem;
  margin-right: 0.5rem;
}

.project-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.award-list { list-style: none; padding: 0; }

.award-item {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
  line-height: 1.55;
}
.award-item:last-child { border-bottom: none; }

.award-year {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.82rem;
  display: block;
  margin-bottom: 0.1rem;
}

/* --------------------------------------------------------------------------
   13. Timeline (Education / Positions)
   -------------------------------------------------------------------------- */
.timeline {
  position: relative;
  padding-left: 1.25rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding: 0 0 2rem 1.25rem;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -0.3rem;
  top: 0.45rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--white), 0 0 0 3px var(--gold);
}

.timeline-year {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.timeline-title {
  font-family: var(--font-heading);
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--blue);
  line-height: 1.3;
  margin-bottom: 0.15rem;
}

.timeline-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   14. About page
   -------------------------------------------------------------------------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 3rem;
  align-items: start;
}

.headshot-wrap img {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.headshot-placeholder {
  width: 100%;
  aspect-ratio: 3/4;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.prose p { margin-bottom: 1.2rem; }
.prose p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   15. Contact
   -------------------------------------------------------------------------- */
.contact-grid { display: grid; gap: 0.4rem; }

.contact-row { font-size: 0.95rem; line-height: 1.7; }

.contact-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: inline-block;
  min-width: 80px;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.social-link:hover {
  border-color: var(--blue);
  color: var(--blue);
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   16. Teaching
   -------------------------------------------------------------------------- */
.teaching-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.teaching-item:last-child { border-bottom: none; }

.teaching-period {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.teaching-role {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--blue);
  margin-bottom: 0.25rem;
}

.teaching-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   17. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--blue);
  color: rgba(255,255,255,0.82);
  padding: 2.5rem 0;
  margin-top: auto;
  font-size: 0.875rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: start;
}

.footer-name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 0.35rem;
}

.footer-aff {
  line-height: 1.65;
  color: rgba(255,255,255,0.72);
}
.footer-aff a { color: var(--gold); text-decoration: none; }
.footer-aff a:hover { text-decoration: underline; color: var(--gold); }

.footer-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: right;
}
.footer-nav a {
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.15s;
}
.footer-nav a:hover { color: var(--gold); text-decoration: none; }

.footer-copy {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.38);
  font-size: 0.76rem;
}

/* --------------------------------------------------------------------------
   18. Utilities
   -------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* --------------------------------------------------------------------------
   19. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 800px) {
  :root { --gap: 2.5rem; }

  .nav-toggle { display: flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.5rem 1.5rem 1rem;
    gap: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.07);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.6rem 0; font-size: 0.95rem; border-radius: 0; }
  .nav-links a.active {
    border-bottom: none;
    border-left: 2px solid var(--gold);
    padding-left: 0.75rem;
  }

  .about-grid { grid-template-columns: 1fr; }
  .headshot-placeholder, .headshot-wrap img { max-width: 160px; }

  .footer-grid { grid-template-columns: 1fr; }
  .footer-nav { text-align: left; flex-direction: row; flex-wrap: wrap; gap: 0.75rem; }

  .talk-item { grid-template-columns: 1fr; gap: 0.4rem; }
  .news-card { grid-template-columns: 1fr; }
  .news-thumb { display: none; }
  .theme-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .hero { padding: 2.5rem 0 2rem; }
  .download-bar { flex-direction: column; align-items: flex-start; }
}
