/* style.css — simple responsive layout with CSS variables */

/* Variables */
:root {
  --bg: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --accent: #29AB87 ; /* #0b5fff , #29AB87, #2597e8 */
  --accent-2: #128a2c;
  --card: #f9fafa;
  --radius: 12px;
  --max-width: 1100px;
  --container-padding: 20px;
  --mono: "SFMono-Regular", Menlo, Monaco, "Roboto Mono", "Courier New",
    monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  --shadow: 0 6px 18px rgba(17, 24, 39, 0.06);
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  margin-top: -20px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  padding: var(--container-padding);
}

/* Header */
.site-header {
  border-bottom: 1px solid #e6e9ef;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0.95)
  );
  position: sticky;
  top: 0;
  z-index: 40;
  transition: padding 0.3s ease, background-color 0.3s ease;
  padding: 20px 0;
}
.site-header.shrunk {
  padding: 8px 0;
  background-color: rgba(255, 255, 255, 0.9); /* optional */
  backdrop-filter: blur(6px); /* optional glass effect */
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
}
.brand {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--text);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.brand.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Nav */
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 12px;
  align-items: center;
}
.site-nav a {
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
}
.site-nav a:hover,
.site-nav a:focus {
  color: var(--accent); /*  var(--text) */
  outline: none;
  background: rgba(11, 95, 255, 0.006);
}
.site-nav a.active {
  color: var(--accent);
  background: rgba(11, 95, 255, 0.006);
}

.nav-toggle {
  display: none;
  border: 0;
  background: transparent;
  font-size: 1.3rem;
}

/* Banner image */
.hero-banner {
  width: 100%;
  height: 260px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 1.5rem;
}

/* Profile image */
.profile-image {
  width: 160px;
  border-radius: 10%;
  float: right;
  margin: 0 0 1rem 1.5rem;
}

.email-link i {
  margin-right: 6px;
}


/* Hero */
.hero {
  padding: 36px 0;
  background: linear-gradient(180deg, rgba(11, 96, 255, 0), transparent 30%);
}
.hero-inner {
  padding: 0px 0;
  padding-left: 1em;
}
.hero h1 {
  margin: 0 0 10px;
  font-size: 2rem;
  font-weight: 700;
}
.lead {
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-ctas {
  margin-top: 18px;
  display: flex;
  gap: 10px;
}
.btn {
  background: var(--accent);
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
}
.btn.secondary {
  background: transparent;
  color: var(--accent);
  border: 2px solid rgba(11, 95, 255, 0.12);
}

.info-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.info-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.4;
}

.info-icon {
  font-size: 1.1rem;
  color: var(--accent, #555);
  margin-top: 2px;
}

.info-label {
  font-weight: 600;
  color: var(--text, #222);
  margin-right: 4px;
}

.info-link {
  color: var(--text, #222);
  text-decoration: none;
}

.info-link:hover {
  color: var(--accent, #0077cc);
}

.contact-card {
  background: var(--card);
  padding: 20px 24px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.contact-title {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.contact-left,
.contact-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.info-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.info-icon {
  font-size: 1.15rem;
  color: var(--accent);
  margin-top: 2px;
}

.info-label {
  font-weight: 600;
  color: var(--text);
  margin-right: 4px;
}

.info-link {
  color: var(--text);
  text-decoration: none;
}

.info-link:hover {
  color: var(--accent);
}


/* === RESEARCH CHAT PANEL — MATCHED TO SITE STYLE === */

#research-chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  height: 100vh;
  background: var(--bg);
  border-left: 1px solid #e6e9ef;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s ease;
  font-family: var(--sans);
  color: var(--text);
  z-index: 9999;
}

#research-chat-panel.open {
  transform: translateX(0);
}

/* Header */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--card);
  border-bottom: 1px solid #e6e9ef;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.chat-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

#close-chat {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.2s ease;
}
#close-chat:hover {
  color: rgba(255, 0, 0, 0.776); /* var(--text) */
}

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
}

.message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius);
  line-height: 1.5;
  font-size: 0.95rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* User bubble */
.message.user {
  background: rgba(41,171,135,0.15); /* accent tint */
  color: var(--text);
  align-self: flex-end;
  border: 1px solid rgba(41,171,135,0.25);
}

/* Bot bubble */
.message.bot {
  background: var(--card);
  border: 1px solid #e6e9ef;
  align-self: flex-start;
}

/* Input */
#chat-form {
  padding: 12px;
  border-top: 1px solid #e6e9ef;
  background: var(--bg);
}

#chat-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid #ccc;
  font-size: 0.95rem;
  font-family: var(--sans);
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

#chat-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(41,171,135,0.25);
  outline: none;
}

/* === OPEN CHAT BUTTON — MATCHED TO SITE BUTTONS === */
.open-chat-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: rgba(158, 161, 160, 0.654);;
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius);
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: var(--sans);
  box-shadow: var(--shadow);
  transition: background 0.2s ease, transform 0.2s ease;
}

.open-chat-btn:hover {
  background: var(--accent);
  transform: translateY(-2px);
}

.chat-iframe-wrapper {
  flex: 1;
  height: 100%;
  overflow: hidden;
}

/* === BACKDROP OVERLAY === */
#chat-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 9990;
}

#chat-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Snap-back animation */
.left-panel.snapping {
  transition: transform 0.25s ease;
}

/* Dragging removes animation */
.left-panel.dragging {
  transition: none !important;
}


#drag-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 100%;
  cursor: grab;
  z-index: 10000;
  background: transparent;
}


.grey-bold {
  color: #4b5563;      /* darker grey → more contrast */
  font-weight: 600;    /* guaranteed bold */
}

/* Cards and grid */

.grid {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: start; /* ← THIS makes each card have its own height */
}

/* Base card */
.card {
  background: var(--card);
  padding: 0;
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden; /* required for hover and blur effects */
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.05s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.05);
}

/* Top gradient + light tint overlay */


/* Darken background slightly on hover */
.card-bg:hover::before {
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0));
}

/* Glass panel for text */
.card-bg-content {
  position: relative;
  z-index: 1;
  backdrop-filter: blur(12px);
  background: rgb(255, 255, 255);
  padding: 18px 22px;
  border-radius: 14px;
  margin: 14px;
  transition: background 0.3s ease, backdrop-filter 0.3s ease;
}

/* Blur increases nicely on hover */
.card-bg:hover .card-bg-content {
  backdrop-filter: blur(15px);
  background: rgb(255, 255, 255);
}

/* Typography */
.card-bg-content h3,
.card-bg-content p {
  margin: 0 0 10px;
  line-height: 1.5;
}

.card-bg-content a {
  color: #000000;
  font-weight: 600;
  text-decoration: underline;
}

.card-bg-content a:hover {
  text-decoration: none;
}

.video-wrapper {
  position: relative;
  width: 100%;
  max-width: 400px; /* optional */
  margin: 10px auto; /* centers the whole block */
  padding-top: 56.25%; /* 16:9 ratio */
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.soma-video-wrapper {
  width: 100%;
  margin-top: 16px;
  border-radius: 12px;
  overflow: hidden;
  background: #000; /* fallback */
}

.soma-video {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover; /* keeps aspect ratio, crops if needed */
}

#somaVideo {
  opacity: 1;
  transition: opacity 0.6s ease;
}

.soma-video-carousel {
  position: relative;
  width: 100%;
  max-width: 700px; /* adjust to your layout */
  margin: 0 auto;
}

.soma-video-wrapper {
  position: relative;
}

.soma-video {
  width: 100%;
  border-radius: 8px;
}

/* ARROW BUTTONS */
.soma-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.35);
  border: none;
  color: white;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  font-size: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.soma-arrow:hover {
  background: rgba(0, 0, 0, 0.6);
  transform: translateY(-50%) scale(1.1);
}

.soma-arrow.left {
  left: 10px;
}

.soma-arrow.right {
  right: 10px;
}

/* Publications and lists */
/* Publication card with graphical abstract (two-column layout) */
.pub-card.with-ga {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 18px;
}

.pub-abstract {
  text-align: justify; /* main justification */
  text-justify: inter-word; /* better spacing */
  hyphens: auto; /* optional: improves justification for long words */
}

/* Left image wrapper */
/* Graphical Abstract wrapper (left thumbnail in publication card) */
.ga-wrapper-full {
  flex: 0 0 0 0px; /* fixed square block */
  height: 240px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden; /* ensures no overflow */
  border-radius: 12px;
  background: #f2f2f2;
  margin-right: 16px;
}

.ga-wrapper-full img {
  width: 100%;
  height: 100%;
  object-fit: fill; /* preserves aspect ratio, no cropping */
  border-radius: 12px;
  display: block;
}

.ga-wrapper {
  flex: 0 0 140px; /* fixed square block */
  height: 140px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden; /* ensures no overflow */
  border-radius: 12px;
  background: #f2f2f2;
  margin-right: 16px;
}

/* Image — scale to fit without distortion */
.ga-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: fill; /* preserves aspect ratio, no cropping */
  border-radius: 12px;
  display: block;
}

/* Home-latest version */
.pub-card.home-latest .ga-wrapper {
  width: 100%;
  height: auto;
  margin-top: 14px;
  margin-right: 0;
}

.pub-card.home-latest .ga-wrapper img {
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
  .ga-wrapper {
    max-width: 70%;
    height: auto;
    aspect-ratio: 1 / 1;
    margin-right: 0;
    margin-bottom: 12px;
  }
}

/* Text on the right */

.pub-text {
  flex: 1;
}

.pub-text p {
  margin-top: 4px; /* or more */
  display: block;
}

/* Responsive behavior: on small screens, stack image above text */

.ga-video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* crop, don’t stretch */
  border-radius: 12px;
  display: block;
}

.pub-section {
  margin-bottom: 60px;
}

.pub-section h2 {
  margin-bottom: 16px;
  font-size: 1.9rem;
  display: flex;
  align-items: center;
}

.pub-list {
  list-style: none;
  padding-left: 0;
  counter-reset: pubcounter;
}

.pub-list > li {
  margin-bottom: 24px;
}

/* Graphical abstract container */
.graphical-abstract {
  width: 100%;
  max-width: 700px;
  margin: 20px 0 40px;
  border-radius: 12px;
  overflow: hidden;
  background: #fafafa;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.graphical-abstract img {
  display: block;
  width: 100%;
  height: auto;
}

/* Publication cards */
/* Publication cards */
.pub-card {
  display: flex;
  gap: 16px;
  background: #ffffff;
  padding: 16px 20px;
  border-radius: 16px;
  margin-bottom: 18px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
  align-items: flex-start;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pub-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.pub-link {
  color: var(--text);
  text-decoration: none;
}

.pub-link:hover {
  color: var(--accent);
}

.progress-icon {
  font-size: 28px;
  color: #4caf50; /* default battery color (full / healthy) */
  flex: 0 0 auto;
  margin-top: 4px;
}

/* Optional: different colors depending on progress */
.pub-card.progress-1 .progress-icon {
  color: #e57373; /* red-ish */
}

.pub-card.progress-2 .progress-icon {
  color: #ffb74d; /* amber */
}

.pub-card.progress-3 .progress-icon {
  color: #4caf50; /* green */
}

/* Ensures content naturally aligns next to icon */
.pub-content {
  flex: 1;
}

/* Special layout only for the Home section latest article */
.pub-card.home-latest {
  flex-direction: column; /* stack text above GA */
  align-items: flex-start; /* keep left alignment */
}

/* Make the GA span below the text */
.pub-card.home-latest .ga-wrapper {
  width: 100%; /* full width (change if needed) */
  margin-top: 14px;
  margin-right: 0;
  height: auto; /* let image decide */
}

/* Prevent stretching */
.pub-card.home-latest .ga-wrapper img {
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
}

/* --- Button Styling --- */
.abstract-button {
  background-color: #f8f9fa; /* Light background */
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 8px 15px;
  cursor: pointer;
  font-size: 1em;
  font-weight: bold;
  display: inline-flex; /* Allows icon and text to align */
  align-items: center;
  margin: 10px 0;
}

.abstract-button:hover {
  background-color: #e2e6ea;
}

.finger-icon {
  font-size: 1.2em;
  margin-right: 8px;
  /* Optional: Small animation on hover */
  /* .abstract-button:hover .finger-icon { animation: point 0.3s ease-in-out infinite alternate; } */
}

/* --- Modal Styling --- */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 100; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0, 0, 0, 0.7); /* Black w/ opacity */
}

.modal-content {
  background-color: #fff;
  margin: 10% auto; /* 10% from the top and centered */
  padding: 20px;
  border: 1px solid #888;
  width: 80%; /* Could be adjusted */
  max-width: 600px;
  border-radius: 8px;
  position: relative;
}

.close-button {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close-button:hover,
.close-button:focus {
  color: #000;
  text-decoration: none;
}

.material-section {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px dashed #ccc;
}

.meta {
  font-weight: normal;
  font-size: 0.85rem;
  opacity: 0.7;
  margin-left: 4px;
}

/* Talks */
.talk-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.talk-card {
  background: var(--card);
  padding: 18px 20px;
  margin-bottom: 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.talk-title {
  margin: 0 0 4px;
  font-size: 1.1rem;
  font-weight: 700;
}

.talk-link {
  color: var(--text);
  text-decoration: none;
}

.talk-link:hover {
  color: var(--accent);
}

.talk-meta {
  margin-top: 2px;
  font-size: 0.9rem;
  color: var(--muted);
}

.talk-type {
  margin-top: 10px;
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
  opacity: 0.85;
}

/* Footer */
.site-footer {
  border-top: 1px solid #e6e9ef;
  margin-top: 48px;
  padding: 24px 0;
  background: transparent;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.muted {
  color: var(--muted);
}

.justified {
  text-align: justify;
  text-justify: inter-word; /* improves spacing */
}

/* Responsive */
/* ============================
   MEDIA QUERIES (merged + clean)
   ============================ */
/* ============================
   TABLET & SMALL DESKTOP (≤800px)
   ============================ */
@media (max-width: 800px) {
  /* NAVIGATION */
  .nav-toggle {
    display: block;
  }

  .site-nav {
    display: none;
    width: 100%;
  }
  .site-nav.open {
    display: block;
  }
  .site-nav ul {
    flex-direction: column;
    gap: 6px;
    padding: 10px 0;
  }

  .header-inner {
    align-items: center;
  }

  .hero h1 {
    font-size: 1.6rem;
  }
}

/* ============================
   MOBILE (≤600px)
   ============================ */
@media (max-width: 600px) {
  /* Main stacking */
  .pub-card.with-ga {
    display: flex;
    flex-direction: column; /* Stack all elements vertically */
    align-items: flex-start;
    text-align: left;
    gap: 10px;
  }

  /* Reorder elements */
  .pub-card.with-ga .pub-text {
    order: 1;
    width: 100%;
  }

  .pub-card.with-ga .abstract-button {
    order: 2;
  }

  .pub-card.with-ga .ga-wrapper {
    order: 3;
    width: 100%;
    max-width: 90%;
    margin-top: 10px;
    align-self: center;
  }

  /* --- AUTHORS + BUTTON on SAME LINE --- */

  .pub-card.with-ga .pub-text p {
    display: inline-block;
    margin-right: 8px;
  }

  .pub-card.with-ga .pub-text {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .pub-card.with-ga .pub-text-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 6px;
  }

  /* Button styling fix for mobile */
  .pub-card.with-ga .abstract-button {
    white-space: nowrap;
  }
}
