
/* ===== Theme variables ===== */
:root {
  --bg: #f3f4f6;            /* page background */
  --card-bg: #ffffff;       /* card background */
  --card-bdr: #e5e7eb;      /* card border color */
  --text: #111827;          /* primary text */
  --muted: #6b7280;         /* muted text */
  --brand: #2563eb;         /* accent on hover */
  --brand-600: #1d4ed8;
  --radius-lg: 14px;
  --radius-md: 10px;
  --shadow: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 28px rgba(0,0,0,0.14);
  --ring: #c7d2fe;          /* subtle ring color */
}

/* ===== Base ===== */
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; transition: color .18s ease, text-decoration-color .18s ease; }
a:hover { color: var(--brand); text-decoration: underline; text-decoration-color: var(--brand); }

.container-xl { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.section { padding: 64px 0; }
.section + .section { padding-top: 0; }

/* ===== Top navigation ===== */
.topnav {
  position: sticky; top: 0; z-index: 50;
  background: #ffffffcc; backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid #e5e7eb;
}
.nav-inner { display: flex; gap: 18px; align-items: center; height: 56px; }
.nav-link { color: #374151; font-weight: 600; padding: 6px 10px; border-radius: 8px; }
.nav-link:hover, .nav-link.active { background: #eef2ff; color: #1d4ed8; }

/* ===== Section cards: ensure visible white "grid" look ===== */
.section-card {
  background: var(--card-bg);
  border: 1px solid var(--card-bdr);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* ===== Hero ===== */
.hero-card { padding: 28px; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr; /* text left, portrait right */
  gap: 24px; align-items: center;
}
.hero-text h1 {
  margin: 0 0 8px;
  font-weight: 500; /* softer */
  font-size: clamp(1.8rem, 1.2rem + 2.1vw, 2.4rem);
}
.hero-text .lead { color: var(--muted); margin-bottom: 14px; }

/* Icon-only buttons */
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; /* smaller icons */
  border-radius: 8px;
  border: 1px solid #d1d5db; background: #fff;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, color .18s ease;
}
.icon-btn:hover { transform: translateY(-1px); border-color: var(--brand); color: var(--brand); background: #f8fafc; }
.icon { width: 18px; height: 18px; display: block; } /* smaller icon glyph */

/* Circular portrait (right side, modest size) */
.hero-photo { display: grid; place-items: center; }
.hero-photo img {
  width: clamp(140px, 22vw, 190px);
  height: clamp(140px, 22vw, 190px);
  border-radius: 50%;
  object-fit: cover; display: block;
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 4px var(--ring), 0 8px 18px rgba(0,0,0,0.08);
  transition: transform .3s ease, box-shadow .3s ease, filter .3s ease;
}
.hero-photo img:hover { transform: translateY(-2px) scale(1.015); box-shadow: 0 0 0 4px var(--ring), 0 12px 26px rgba(0,0,0,0.12); filter: saturate(1.05); }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; line-height: 1; border-radius: var(--radius-md); padding: 10px 14px; font-weight: 600; }
.btn-primary { background: var(--brand); color: #fff; border: 1px solid var(--brand); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }

/* ===== Publications ===== */
.pubs { display: grid; gap: 16px; margin-top: 12px; color: var(--text); }
.pubs-year { margin: 22px 0 6px; font-size: 1.05rem; font-weight: 600; }
.pubs-group { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }

/* Make the publication line a flex row so actions stay inline */
.pubs-item {
  display: block; /* keep full width block */
  background: #fff; border: 1px solid var(--card-bdr); border-radius: 10px;
  padding: 12px 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* Keep all text the same color; only title changes on hover */
.pub-authors, .pub-venue, .pub-pages, .pub-title, .pub-sep { color: inherit; }
.pub-title { font-weight: 400; text-decoration: none; }
.pub-title:hover { color: var(--brand); text-decoration: underline; text-decoration-color: var(--brand); }

/* Ensure DOI badge sits on the same line as the text */
.pub-actions {
  display: inline; /* inline so it flows with the preceding text */
  margin-left: 8px;
  white-space: nowrap; /* prevent wrap to next line */
}
.pub-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 7px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid #dbeafe; background: #eef2ff; color: #1d4ed8;
  vertical-align: baseline; margin-left: 6px;
}
.pub-badge .icon { width: 14px; height: 14px; }

/* Remove any accidental underline/blue on your name in author list */
.me {
  background: transparent;
  color: inherit;
  text-decoration: none !important;
  border: 0;
}

/* ===== Apps: right-side thumbnail rows with fixed ratio ===== */

/* Two columns: text = 5/8, thumbnail = 3/8 */
.app-row {
  display: grid;
  grid-template-columns: 5fr 3fr;   /* 5/8 : 3/8 */
  gap: 16px;
  align-items: stretch;
}

/* Card container */
.sub-card {
  background: #fff;
  border: 1px solid var(--card-bdr);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  padding: 14px;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.sub-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.10);
  border-color: #d1d5db;
}

.app-col-text h3 { margin: 0 0 6px; font-size: 1.1rem; }
.app-col-text p  { margin: 0 0 10px; color: var(--muted); }

/* Clickable thumbnail with overlay */
.app-col-thumb { /* the 3/8 column */ }

.app-thumb-link {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;             /* consistent, responsive height */
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.app-thumb-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .30s ease, filter .30s ease;
}

/* Title overlay hidden by default */
.thumb-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: end start;            /* bottom-left */
  background: linear-gradient(to top, rgba(0,0,0,0.55), rgba(0,0,0,0.0) 60%);
  opacity: 0;
  transition: opacity .25s ease;
  padding: 10px;
}
.thumb-title {
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

/* Hover/focus: zoom + brighten + reveal title overlay */
.app-thumb-link:hover img,
.app-thumb-link:focus-visible img {
  transform: scale(1.03);
  filter: brightness(1.05) saturate(1.05);
}
.app-thumb-link:hover .thumb-overlay,
.app-thumb-link:focus-visible .thumb-overlay {
  opacity: 1;
}

/* Keyboard focus ring */
.app-thumb-link:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.8);   /* var(--brand) * 0.8 */
  outline-offset: 2px;
}

/* Mobile: stack vertically; thumbnail full width above/below text */
@media (max-width: 820px) {
  .app-row { grid-template-columns: 1fr; }
  .app-thumb-link { aspect-ratio: 16 / 9; } /* stays consistent */
}

/* ===== Loader overlay ===== */
#global-loading {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(255,255,255,0.65); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease;
}
.show-global-loader #global-loading { opacity: 1; visibility: visible; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid #e5e7eb; border-top-color: var(--brand); animation: spin 1s linear infinite; margin: 0 auto 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
#global-loading p { color: #374151; font-weight: 600; }

/* ===== Contact icons ===== */
.contact-icons { list-style: none; padding: 0; margin: 6px 0 0; display: flex; gap: 10px; align-items: center; }
.contact-icons a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid #d1d5db;
  background: #fff; transition: transform .18s ease, border-color .18s ease, color .18s ease, background .18s ease;
}
.contact-icons a:hover { transform: translateY(-1px); border-color: var(--brand); color: var(--brand); background: #f8fafc; }
.contact-icons .icon { width: 18px; height: 18px; }

/* ===== Responsive ===== */
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-photo img { width: clamp(130px, 34vw, 180px); height: clamp(130px, 34vw, 180px); }

  .app-row { grid-template-columns: 1fr; }
  .app-col-thumb img { width: 100%; height: 180px; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ===== Dark mode ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a; --card-bg: #0b1220; --card-bdr: #1f2937;
    --text: #e5e7eb; --muted: #9ca3af;
    --shadow: 0 2px 8px rgba(0,0,0,0.5);
    --shadow-lg: 0 14px 28px rgba(0,0,0,0.6);
    --ring: #334155;
  }
  .topnav { background: rgba(15,23,42,0.70); border-bottom-color: #1f2937; }
  .nav-link { color: #cbd5e1; }
  .nav-link:hover, .nav-link.active { background: rgba(37,99,235,0.15); color: #93c5fd; }

  /* Hover color in dark */
  a:hover { color: #93c5fd; text-decoration-color: #93c5fd; }

  .pub-badge { background: rgba(37,99,235,0.15); color: #93c5fd; border-color: rgba(37,99,235,0.35); }
}

/* Import handwritten font */
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@700&display=swap');

/

/* Intro text container: flex rows side-by-side + spacing below */

/* Container: Flex layout */
.intro-text {
  display: flex;
  justify-content: space-between; /* text left, quote right */
  align-items: center;            /* vertically center */
  gap: 40px;                      /* space between columns */
  margin: 40px auto;
  padding: 20px;
}

/* Left column: main text */
.intro-copy {
  flex: 1;                        /* take remaining space */
  text-align: justify;
  font-size: 1.05rem;
  color: #374151;
  line-height: 1.6;
}

.intro-copy p {
  margin-bottom: 16px;
}

.intro-copy strong {
  color: #007acc;
  font-weight: 600;
}

.intro-copy cursive {
  color: #007acc;
  font-style: italic;
}

/* Right column: handwritten quote */
.handwritten-quote {
  float: right;                 /* fixed width */
  display: inline;
  max-width: 280px;
  text-align: center;
  font-family: 'Caveat', cursive;
  font-size: clamp(1.4rem, 2.5vw, 2.2rem);
  font-style: italic;
  font-weight: 500;
  color: #000;
  line-height: 1.2;
  padding: 5px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Responsive: stack vertically */
@media (max-width: 820px) {
  .intro-text {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }
  .handwritten-quote {
    max-width: 100%;
    border-left: none;
    border-top: 4px solid #007acc;
  }
}
