/* ===================================
   DR. MAHFOUD AMARA — ACADEMIC SITE
   Qatar University Color Palette:
   Deep Maroon: #6D1D2A / #4A0E18
   Gold:        #C9A84C / #E8D5A0
   Warm Ivory:  #F7F4EF
   Slate Text:  #2C3E50
   =================================== */

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

:root {
  --maroon:      #6D1D2A;
  --maroon-dark: #4A0E18;
  --maroon-mid:  #8B2535;
  --gold:        #C9A84C;
  --gold-light:  #E8D5A0;
  --ivory:       #F7F4EF;
  --ivory-dark:  #EDE8E0;
  --text:        #2C3E50;
  --text-muted:  #6B7280;
  --white:       #FFFFFF;
  --border:      rgba(201,168,76,0.25);
  --shadow:      rgba(74,14,24,0.12);

  --ff-display: 'Cormorant Garamond', Georgia, serif;
  --ff-body:    'DM Sans', system-ui, sans-serif;

  --max-w: 1160px;
  --radius: 6px;
}

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--ff-body);
  color: var(--text);
  background: var(--ivory);
  line-height: 1.75;
  font-weight: 300;
}

a { color: inherit; text-decoration: none; }

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

/* ---- Utility ---- */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.center-link { text-align: center; margin-top: 40px; }

/* ---- Navigation ---- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(247,244,239,0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.3s;
}
.nav.scrolled { box-shadow: 0 2px 20px var(--shadow); }

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: 1.3em;
  color: var(--maroon);
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 4px;
}
.nav-links a {
  font-size: 0.82em;
  font-weight: 400;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: color 0.2s, background 0.2s;
}
.nav-links a:hover,
.nav-links a.active { color: var(--maroon); background: rgba(109,29,42,0.07); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  width: 24px; height: 2px;
  background: var(--maroon);
  display: block;
  transition: transform 0.3s;
}

/* ---- Hero ---- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 64px;
  overflow: hidden;
}

.hero-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--maroon-dark) 0%, var(--maroon) 40%, #9B2D3E 100%);
}
.hero-bg::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-stripe {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold));
}

.hero-content {
  position: relative; z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 80px 24px;
  display: flex;
  align-items: center;
  gap: 60px;
}

.hero-photo-wrap {
  flex-shrink: 0;
  width: 200px; height: 200px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--gold);
  box-shadow: 0 0 0 8px rgba(201,168,76,0.2);
}
.hero-photo { width: 100%; height: 100%; object-fit: cover; }
.hero-photo-fallback {
  width: 100%; height: 100%;
  background: var(--maroon-mid);
  display: none;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-display);
  font-size: 3em;
  color: var(--gold-light);
  font-weight: 600;
}

.hero-label {
  font-size: 0.8em;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-bottom: 12px;
  opacity: 0.85;
}
.hero-name {
  font-family: var(--ff-display);
  font-size: clamp(2.4em, 5vw, 4em);
  font-weight: 700;
  color: var(--white);
  line-height: 1.1;
  margin-bottom: 8px;
}
.hero-title {
  font-family: var(--ff-display);
  font-size: 1.35em;
  font-weight: 400;
  font-style: italic;
  color: var(--gold-light);
  margin-bottom: 4px;
}
.hero-subtitle {
  font-size: 0.9em;
  color: rgba(255,255,255,0.6);
  margin-bottom: 20px;
}
.hero-ids {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.hero-ids span {
  font-size: 0.75em;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.5px;
  font-family: monospace;
}
.hero-links { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 4px;
  font-size: 0.85em;
  font-weight: 500;
  letter-spacing: 0.5px;
  background: var(--gold);
  color: var(--maroon-dark);
  transition: background 0.2s, transform 0.2s;
}
.hero-btn:hover { background: var(--gold-light); transform: translateY(-1px); }
.hero-btn-outline {
  background: transparent;
  border: 1px solid rgba(201,168,76,0.5);
  color: var(--gold-light);
}
.hero-btn-outline:hover { background: rgba(201,168,76,0.15); }

/* ---- Sections ---- */
.section { padding: 80px 0; }
.section:nth-child(even) { background: var(--white); }

.section-title {
  font-family: var(--ff-display);
  font-size: clamp(1.8em, 3vw, 2.5em);
  color: var(--maroon);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--gold-light);
}
.section-intro {
  max-width: 700px;
  color: var(--text-muted);
  margin-bottom: 40px;
  font-size: 1.05em;
}

/* About two-col */
.two-col {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 60px;
  align-items: start;
}

.about-text p { margin-bottom: 16px; max-width: 65ch; }

.sub-title {
  font-family: var(--ff-display);
  font-size: 1.3em;
  color: var(--maroon);
  margin: 32px 0 16px;
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  background: rgba(109,29,42,0.07);
  color: var(--maroon);
  border: 1px solid rgba(109,29,42,0.15);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.82em;
  font-weight: 400;
  transition: background 0.2s;
}
.tag:hover { background: rgba(109,29,42,0.13); }

/* Sidebar cards */
.sidebar-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  transition: box-shadow 0.3s;
}
.sidebar-card:hover { box-shadow: 0 4px 20px var(--shadow); }
.sidebar-card h3 {
  font-family: var(--ff-display);
  color: var(--maroon);
  font-size: 1.15em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gold-light);
}

.book-list, .profile-links { list-style: none; }
.book-list li, .profile-links li { margin-bottom: 10px; font-size: 0.88em; }
.book-list a, .profile-links a {
  color: var(--maroon);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.book-list a:hover, .profile-links a:hover { border-color: var(--gold); }

.arabic-text {
  font-size: 0.9em;
  line-height: 1.9;
  direction: rtl;
  text-align: right;
  color: var(--text-muted);
}

/* Featured cards */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 24px;
}
.featured-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}
.featured-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px var(--shadow); }
.featured-card-inner { padding: 28px; background: var(--white); height: 100%; display: flex; flex-direction: column; }
.featured-label {
  font-size: 0.72em;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
  font-weight: 500;
}
.featured-card h3 {
  font-family: var(--ff-display);
  color: var(--maroon);
  font-size: 1.25em;
  margin-bottom: 12px;
  line-height: 1.3;
}
.featured-card p {
  color: var(--text-muted);
  font-size: 0.88em;
  flex: 1;
}
.card-link {
  display: inline-block;
  margin-top: 16px;
  font-size: 0.82em;
  font-weight: 500;
  color: var(--maroon);
  letter-spacing: 0.3px;
}

/* Stats strip */
.stats-strip {
  background: var(--maroon-dark);
  padding: 56px 0;
  border-top: 3px solid var(--gold);
  border-bottom: 3px solid var(--gold);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
  text-align: center;
}
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-num {
  font-family: var(--ff-display);
  font-size: 3em;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.stat-label {
  font-size: 0.8em;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Activity list */
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--ivory-dark);
}
.activity-year {
  flex-shrink: 0;
  width: 48px;
  font-family: var(--ff-display);
  font-size: 1em;
  font-weight: 600;
  color: var(--gold);
  padding-top: 2px;
}
.activity-body { font-size: 0.93em; }
.activity-body strong { color: var(--maroon); font-weight: 500; }
.activity-body em { color: var(--text-muted); }

/* ---- Buttons ---- */
.btn-primary {
  display: inline-block;
  padding: 12px 32px;
  background: var(--maroon);
  color: var(--white);
  border-radius: 4px;
  font-size: 0.88em;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: background 0.2s, transform 0.2s;
}
.btn-primary:hover { background: var(--maroon-dark); transform: translateY(-1px); }

.btn-outline {
  display: inline-block;
  padding: 10px 28px;
  border: 1.5px solid var(--maroon);
  color: var(--maroon);
  border-radius: 4px;
  font-size: 0.88em;
  font-weight: 500;
  transition: background 0.2s;
}
.btn-outline:hover { background: var(--maroon); color: var(--white); }

/* ---- Book Covers Gallery ---- */
.book-covers-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}
.book-cover-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  group: true;
  transition: transform 0.3s;
}
.book-cover-item:hover { transform: translateY(-4px); }
.book-cover-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(74,14,24,0.18);
  transition: box-shadow 0.3s;
  border: 1px solid var(--border);
}
.book-cover-item:hover img {
  box-shadow: 0 8px 32px rgba(74,14,24,0.28);
}
.book-cover-label {
  display: block;
  margin-top: 10px;
  font-size: 0.78em;
  font-weight: 500;
  color: var(--maroon);
  line-height: 1.3;
}
.book-cover-year {
  display: block;
  font-size: 0.72em;
  color: var(--text-muted);
  margin-top: 3px;
}
.book-cover-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, var(--maroon), var(--maroon-mid));
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(74,14,24,0.18);
}
.book-cover-placeholder span {
  color: var(--gold-light);
  font-family: var(--ff-display);
  font-size: 0.88em;
  line-height: 1.4;
}
@media (max-width: 900px) {
  .book-covers-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .book-covers-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Publications page ---- */
.pub-section { margin-bottom: 52px; }
.pub-section h2 {
  font-family: var(--ff-display);
  color: var(--maroon);
  font-size: 1.7em;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--gold-light);
  margin-bottom: 24px;
}
.pub-section h3 {
  font-family: var(--ff-display);
  color: var(--maroon);
  font-size: 1.2em;
  margin: 28px 0 14px;
}

.pub-list { list-style: none; }
.pub-list li {
  padding: 14px 0 14px 20px;
  border-bottom: 1px solid var(--ivory-dark);
  font-size: 0.91em;
  line-height: 1.65;
  position: relative;
}
.pub-list li::before {
  content: '';
  position: absolute;
  left: 0; top: 22px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
}
.pub-list li a {
  color: var(--maroon);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.pub-list li a:hover { border-color: var(--gold); }
.pub-year {
  display: inline-block;
  background: rgba(201,168,76,0.15);
  color: var(--maroon);
  font-size: 0.78em;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 3px;
  margin-right: 8px;
  font-family: monospace;
}

/* ---- Page hero (inner pages) ---- */
.page-hero {
  background: linear-gradient(135deg, var(--maroon-dark), var(--maroon));
  padding: 100px 24px 56px;
  border-bottom: 4px solid var(--gold);
}
.page-hero h1 {
  font-family: var(--ff-display);
  font-size: clamp(2em, 4vw, 3.2em);
  color: var(--white);
  max-width: var(--max-w);
  margin: 0 auto;
}
.page-hero p {
  max-width: var(--max-w);
  margin: 12px auto 0;
  color: rgba(255,255,255,0.65);
  font-size: 1em;
}

/* ---- Conferences ---- */
.conf-item {
  padding: 20px 0 20px 24px;
  border-bottom: 1px solid var(--ivory-dark);
  position: relative;
}
.conf-item::before {
  content: '';
  position: absolute; left: 0; top: 28px;
  width: 8px; height: 2px;
  background: var(--gold);
}
.conf-year {
  font-size: 0.78em;
  color: var(--gold);
  font-weight: 500;
  font-family: monospace;
  margin-bottom: 4px;
}
.conf-title { font-size: 0.92em; }
.conf-venue { font-size: 0.82em; color: var(--text-muted); margin-top: 3px; }

/* ---- Research projects ---- */
.research-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 20px;
  transition: box-shadow 0.3s;
}
.research-card:hover { box-shadow: 0 4px 20px var(--shadow); }
.research-card h3 { font-family: var(--ff-display); color: var(--maroon); font-size: 1.1em; margin-bottom: 8px; }
.research-card .meta { font-size: 0.82em; color: var(--gold); margin-bottom: 8px; font-weight: 500; }
.research-card p { font-size: 0.88em; color: var(--text-muted); }

/* ---- Media entries ---- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.media-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow 0.3s, transform 0.2s;
}
.media-card:hover { box-shadow: 0 6px 24px var(--shadow); transform: translateY(-2px); }
.media-card .lang-badge {
  display: inline-block;
  font-size: 0.7em;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
  margin-bottom: 10px;
  font-weight: 500;
}
.lang-en { background: rgba(109,29,42,0.1); color: var(--maroon); }
.lang-fr { background: rgba(0,85,164,0.1); color: #0055A4; }
.lang-ar { background: rgba(0,100,0,0.1); color: #006400; }
.media-card h4 { font-family: var(--ff-display); color: var(--maroon); font-size: 1em; margin-bottom: 6px; }
.media-card .media-outlet { font-size: 0.8em; color: var(--text-muted); }
.media-card a.read-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.8em;
  color: var(--maroon);
  border-bottom: 1px solid var(--gold-light);
  transition: border-color 0.2s;
}
.media-card a.read-link:hover { border-color: var(--gold); }

/* ---- Footer ---- */
.site-footer {
  background: var(--maroon-dark);
  color: rgba(255,255,255,0.65);
  padding: 48px 0 0;
  border-top: 3px solid var(--gold);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  flex-wrap: wrap;
  padding-bottom: 40px;
}
.footer-name {
  font-family: var(--ff-display);
  font-size: 1.3em;
  color: var(--white);
  margin-bottom: 4px;
}
.footer-role, .footer-inst { font-size: 0.85em; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.footer-nav a {
  font-size: 0.85em;
  color: rgba(255,255,255,0.55);
  transition: color 0.2s;
}
.footer-nav a:hover { color: var(--gold-light); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 14px 24px;
  text-align: center;
  font-size: 0.78em;
  color: rgba(255,255,255,0.35);
}

/* ---- Back to top ---- */
.back-to-top {
  position: fixed; bottom: 24px; right: 24px;
  width: 44px; height: 44px;
  background: var(--maroon);
  color: var(--gold-light);
  border: none; border-radius: 50%;
  font-size: 1.1em;
  cursor: pointer;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s, background 0.2s;
  z-index: 50;
  box-shadow: 0 2px 12px var(--shadow);
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover { background: var(--maroon-dark); }

/* ---- Animations ---- */
.fade-in { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.fade-in.visible { opacity: 1; transform: translateY(0); }
.fade-in-delay { transition-delay: 0.15s; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .featured-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: repeat(3,1fr); }
}

@media (max-width: 768px) {
  .nav-links { 
    display: none; flex-direction: column; 
    position: absolute; top: 64px; left: 0; right: 0;
    background: var(--ivory);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    gap: 4px;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: flex; }

  .hero-content { flex-direction: column; text-align: center; gap: 32px; padding: 60px 24px; }
  .hero-photo-wrap { width: 150px; height: 150px; }
  .hero-ids { justify-content: center; }
  .hero-links { justify-content: center; }
  .featured-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 500px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-num { font-size: 2.2em; }
}

@media print {
  .nav, .back-to-top, .site-footer { display: none; }
  body { font-size: 11pt; }
  .section { padding: 20px 0; }
}
