/* ==========================================================================
   MLID Research Group — Modern Static Theme
   Light theme inspired by bioimaging RGB channels & logo colors
   ========================================================================== */

:root {
  --bg-body: #ffffff;
  --bg-surface: #f8fafc;
  --bg-surface-elevated: #ffffff;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #94a3b8;

  /* Logo-inspired bioimaging RGB channels */
  --brand-blue: #1d4ed8;
  --brand-blue-hover: #1e40af;
  --brand-blue-bg: #eff6ff;
  --brand-blue-border: #bfdbfe;

  --accent-red: #e11d48;
  --accent-red-bg: #fff1f2;
  --accent-red-border: #fecdd3;

  --accent-green: #059669;
  --accent-green-bg: #ecfdf5;
  --accent-green-border: #a7f3d0;

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

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);

  --container-max: 980px;
}

/* ── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-main);
  background-color: var(--bg-body);
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Canvas background for dynamic pixel matrix */
#pixel-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  opacity: 0.85;
}

/* ── Layout Shell ────────────────────────────────────────────────────────── */
.site-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* ── Header & Navigation ─────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  transition: box-shadow 0.2s ease;
}

.site-header.scrolled {
  box-shadow: var(--shadow-sm);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.85rem;
  padding-bottom: 0.65rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.25;
}

.brand-logo {
  height: 68px;
  max-height: 72px;
  width: auto;
  object-fit: contain;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  display: block;
  transition: transform 0.2s ease;
}

.brand-link:hover .brand-logo {
  transform: scale(1.02);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.brand-tagline {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Dedicated Navigation Row (One line down) */
.site-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding-top: 0.4rem;
  padding-bottom: 0.55rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.nav-link:hover {
  color: var(--brand-blue);
  background-color: var(--brand-blue-bg);
}

.nav-link.active {
  color: var(--brand-blue);
  background-color: var(--brand-blue-bg);
  font-weight: 600;
}

/* Mobile Nav Toggle Button */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-main);
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

.nav-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
}

/* ── Main Content Area ───────────────────────────────────────────────────── */
.main-content {
  flex: 1 0 auto;
  padding-top: 2rem;
  padding-bottom: 3.5rem;
}

.content-body {
  background-color: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2.5rem;
  box-shadow: var(--shadow-sm);
}

/* ── Typography & Markdown Elements ──────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 2.1rem;
  margin-top: 0;
  border-bottom: 2px solid var(--brand-blue-bg);
  padding-bottom: 0.5rem;
}

h2 {
  font-size: 1.6rem;
  position: relative;
  padding-bottom: 0.35rem;
}

h3 {
  font-size: 1.25rem;
}

p {
  margin-top: 0;
  margin-bottom: 1.25rem;
}

a {
  color: var(--brand-blue);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--brand-blue-hover);
  text-decoration-color: var(--brand-blue-hover);
}

hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, var(--border-subtle), var(--border-strong), var(--border-subtle));
  margin: 2.25rem 0;
}

ul, ol {
  padding-left: 1.5rem;
  margin-top: 0;
  margin-bottom: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  color: #0f172a;
}

pre {
  background-color: #0f172a;
  color: #f8fafc;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 1.5rem 0;
}

pre code {
  background-color: transparent;
  border: none;
  padding: 0;
  color: inherit;
}

blockquote {
  border-left: 4px solid var(--brand-blue);
  background-color: var(--brand-blue-bg);
  margin: 1.5rem 0;
  padding: 0.85rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
}

.content-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  display: block;
  margin: 1.5rem auto;
  box-shadow: var(--shadow-md);
}

/* Inline images & badges (e.g. Colab, shields.io badges) */
.content-body a img,
.content-body img[src*="badge"],
.content-body img[src*="shields.io"],
.content-body img.badge {
  display: inline-block !important;
  vertical-align: middle !important;
  margin: 0 !important;
  box-shadow: none !important;
  border-radius: 4px !important;
}

/* Resource buttons row for teaching & projects */
.resource-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  margin: 1rem 0 1.75rem;
}

.resource-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--brand-blue);
  background-color: var(--brand-blue-bg);
  border: 1px solid var(--brand-blue-border);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  line-height: 1.3;
  transition: all 0.15s ease;
}

.resource-btn:hover {
  background-color: var(--brand-blue);
  color: #ffffff;
  text-decoration: none;
}

.resource-colab-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.resource-colab-link img {
  height: 28px;
  width: auto;
  display: inline-block !important;
  vertical-align: middle !important;
  margin: 0 !important;
  box-shadow: none !important;
  border-radius: 4px !important;
}

.img-group-photo {
  max-width: 520px !important;
  width: 100%;
  height: auto;
}

.img-map {
  max-width: 250px !important;
  width: 100%;
  height: auto;
}

.img-landscape {
  max-width: 720px !important;
  width: 100%;
  height: auto;
}

/* ── Publication Items (Compact & Streamlined) ─────────────────────────── */
.pub-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 1rem 0 1.5rem;
}

.pub-item {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.pub-item:hover {
  background-color: #ffffff;
  border-color: var(--brand-blue-border);
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}

.pub-top {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pub-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  line-height: 1.25;
  flex-shrink: 0;
}

.pub-badge--preprint {
  color: var(--accent-red);
  background-color: var(--accent-red-bg);
  border: 1px solid var(--accent-red-border);
}

.pub-badge--paper {
  color: var(--accent-green);
  background-color: var(--accent-green-bg);
  border: 1px solid var(--accent-green-border);
}

.pub-title {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  line-height: 1.4;
}

.pub-title:hover {
  color: var(--brand-blue);
  text-decoration: underline;
}

.pub-arrow {
  color: var(--brand-blue);
  font-size: 0.85em;
  opacity: 0.7;
}

.pub-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.pub-authors {
  color: var(--text-muted);
}

.pub-venue {
  color: var(--text-light);
  font-style: italic;
}

.pub-year {
  color: var(--text-muted);
  font-weight: 500;
}

.pub-empty, .pub-error {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0.5rem 0;
}

/* ── Dataset Cards ───────────────────────────────────────────────────────── */
.dataset-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 1.5rem 0 2rem;
}

.dataset-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.dataset-card:hover {
  background-color: #ffffff;
  border-color: var(--brand-blue-border);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.dataset-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dataset-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.dataset-badge-rodare {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  line-height: 1.25;
  color: #1e40af;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
}

.dataset-version {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  line-height: 1.25;
  color: var(--text-muted);
  background-color: #f1f5f9;
  border: 1px solid var(--border-subtle);
}

.dataset-date {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-light);
}

.dataset-title {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  line-height: 1.45;
}

.dataset-title:hover {
  color: var(--brand-blue);
  text-decoration: underline;
}

.dataset-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Bluesky & Embeds Container ─────────────────────────────────────────── */
.embed-container {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin: 2rem 0;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  background-color: #ffffff;
  border-top: 1px solid var(--border-subtle);
  padding: 2.5rem 0;
  margin-top: auto;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.footer-link,
.footer-nav a {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.4;
  padding: 0.2rem 0;
  transition: color 0.15s ease;
}

.footer-link:hover,
.footer-nav a:hover {
  color: var(--brand-blue);
  text-decoration: underline;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-light);
  border-top: 1px solid var(--border-subtle);
  padding-top: 1rem;
}

/* ── Responsive Mobile Media Queries ─────────────────────────────────────── */
@media (max-width: 768px) {
  .header-top {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }

  .brand-logo {
    height: 52px;
  }

  .brand-title {
    font-size: 1.02rem;
  }

  .nav-toggle {
    display: block;
  }

  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding-top: 0.75rem;
    gap: 0.25rem;
    border-top: 1px solid var(--border-subtle);
    margin-top: 0.5rem;
  }

  .site-nav.open {
    display: flex;
  }

  .nav-link {
    padding: 0.65rem 0.85rem;
    font-size: 1rem;
  }

  .content-body {
    padding: 1.5rem 1.25rem;
    border-radius: var(--radius-md);
  }

  h1 {
    font-size: 1.7rem;
  }

  h2 {
    font-size: 1.35rem;
  }

  .footer-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-bottom {
    flex-direction: column;
  }
}

/* ── Accessibility & Reduced Motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  #pixel-canvas {
    display: none;
  }
}

