/* Project page styles */

/* --------------------------------------------
   Reset & Base
   -------------------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family:
    "Plus Jakarta Sans",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  color: var(--text-primary);
  background: var(--bg-white);
  line-height: 1.6;
  overflow-x: hidden;
}

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

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

/* --------------------------------------------
   Navigation
   -------------------------------------------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.5);
  transition: all 0.3s ease;
}

.nav--scrolled {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 20px rgba(0, 0, 0, 0.05);
}

.nav__container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav__logo {
  display: flex;
  align-items: center;
}

.nav__logo-img {
  height: 60px;
  width: auto;
}

.nav__toggle { display: none; }

.nav__links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav__link {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav__link:hover {
  color: var(--primary);
}

/* --------------------------------------------
   Project Hero
   -------------------------------------------- */
.project-hero {
  padding: 10rem 2rem 4rem;
  background: var(--bg-light);
}

.project-hero__container {
  max-width: 800px;
  margin: 0 auto;
}

.project-hero__back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 2rem;
  transition: color 0.2s ease;
}

.project-hero__back:hover {
  color: var(--primary);
}

.project-hero__back svg {
  width: 18px;
  height: 18px;
}

.project-hero__tag {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  background: rgba(14, 165, 233, 0.1);
  color: var(--primary);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.project-hero__title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.project-hero__author {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.project-hero__author strong {
  color: var(--text-primary);
}

/* --------------------------------------------
   Project Content
   -------------------------------------------- */
.project-content {
  padding: 4rem 2rem 6rem;
}

.project-content__container {
  max-width: 800px;
  margin: 0 auto;
}

.project-content__image {
  margin-bottom: 3rem;
  border-radius: 20px;
  overflow: hidden;
}

.project-content__image img {
  width: 100%;
  height: auto;
  display: block;
}

.project-content__image-placeholder {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: rgba(255, 255, 255, 0.3);
}

.project-content__image-placeholder svg {
  width: 60px;
  height: 60px;
}

/* --------------------------------------------
   Project Sections
   -------------------------------------------- */
.project-section {
  margin-bottom: 3rem;
}

.project-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.project-section p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 1rem;
}

.project-section ul {
  list-style: none;
  padding: 0;
}

.project-section li {
  position: relative;
  padding-left: 1.5rem;
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 0.75rem;
}

.project-section li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75rem;
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
}

.project-section li strong {
  color: var(--text-primary);
}

/* --------------------------------------------
   Project Gallery
   -------------------------------------------- */
.project-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.project-gallery__item {
  border-radius: 16px;
  overflow: hidden;
}

.project-gallery__item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.project-gallery__item .project-content__image-placeholder {
  height: 200px;
}

/* --------------------------------------------
   Project Video
   -------------------------------------------- */
.project-video {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-dark);
}

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

/* --------------------------------------------
   Project Publications
   -------------------------------------------- */
.project-publications {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project-publication {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: all 0.3s ease;
}

.project-publication:hover {
  border-color: rgba(14, 165, 233, 0.3);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
}

.project-publication__icon {
  width: 48px;
  height: 48px;
  background: var(--bg-white);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.project-publication__icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--primary);
}

.project-publication__content {
  flex: 1;
}

.project-publication__content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.project-publication__content p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}

.project-publication__arrow {
  width: 20px;
  height: 20px;
  stroke: var(--text-muted);
  flex-shrink: 0;
  transition: stroke 0.2s ease;
}

.project-publication:hover .project-publication__arrow {
  stroke: var(--primary);
}

/* --------------------------------------------
   Footer
   -------------------------------------------- */
.footer {
  background: var(--bg-dark);
  color: rgba(255, 255, 255, 0.7);
  padding: 3rem 2rem;
}

.footer__content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer__logo {
  display: flex;
  align-items: center;
}

.footer__logo .lab-name {
  text-align: left;
}

.footer__logo-img {
  height: 60px;
  width: auto;
  filter: brightness(0) invert(1);
}

.footer__links {
  display: flex;
  gap: 2rem;
}

.footer__link {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.footer__link:hover {
  color: #ffffff;
}

.footer__copy {
  width: 100%;
  text-align: center;
  padding-top: 2rem;
  margin-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
}

/* --------------------------------------------
   Animations
   -------------------------------------------- */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------
   Responsive
   -------------------------------------------- */
@media (max-width: 768px) {
  .nav {
    padding: 1rem;
  }

  .nav__container { gap: 0.5rem; flex-wrap: wrap; }
  .nav--enhanced .nav__container { flex-wrap: nowrap; }

  .nav__logo { min-width: 0; }
  .nav__logo-img { height: 42px; }
  /* Match the desktop optical offset to each logo's displayed height. */
  .nav__logo .lab-name { font-size: 0.75rem; transform: translateY(5.6px); }
  .footer__logo .lab-name { transform: translateY(8px); }

  .nav__links {
    width: 100%;
    gap: 0.5rem;
    justify-content: space-between;
  }

  .nav--enhanced .nav__toggle {
    display: flex;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    cursor: pointer;
  }

  .nav__toggle span { width: 20px; height: 2px; background: #1e293b; }
  .nav__toggle:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
  .nav--enhanced .nav__links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    padding: 0.5rem 1rem 1rem;
    background: #fff;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  }
  .nav--enhanced .nav__links.is-open { display: flex; flex-direction: column; gap: 0; }
  .nav__link { display: block; padding: 0.75rem 0; }


  .project-hero {
    padding: 8rem 1.5rem 3rem;
  }

  .project-content {
    padding: 3rem 1.5rem 4rem;
  }

  .project-content__image-placeholder {
    height: 250px;
  }

  .project-publication {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .project-publication__arrow {
    display: none;
  }

  .footer__content {
    flex-direction: column;
    text-align: center;
  }

  .footer__links {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* Shared MIS Lab identity */
.nav__logo, .footer__logo {
  gap: 0.5rem;
  font-weight: 700;
}
.lab-name {
  max-width: 190px;
  font-size: 0.9rem;
  line-height: 1.3;
  transform: translateY(8px);
}
.project-hero {
  background: linear-gradient(135deg, #0f172a 0%, #12304a 65%, #0f172a 100%);
  color: var(--text-white);
}
.project-hero__back, .project-hero__author {
  color: rgba(255, 255, 255, 0.78);
}
.project-hero__back:hover { color: var(--primary-light); }
.project-hero__author strong { color: var(--text-white); }
.project-hero__title { color: var(--text-white); }
.project-section h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.02em;
}
.author-card { background: var(--bg-light); }
.footer__logo { color: var(--text-white); text-align: left; }
.footer__logo-img { filter: none; }
@media (max-width: 768px) {
  .footer__logo { text-align: left; }
}

/* Reading layout */
.project-content__container { max-width: 900px; }
.project-hero__container { max-width: 900px; }
.project-hero__title { max-width: 22ch; }
.project-content__image {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}
.article-nav {
  padding: 1.25rem 1.5rem;
  margin: 0 0 4rem;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.article-nav__label {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.article-nav__links { display: flex; flex-wrap: wrap; gap: 0.6rem 1.5rem; }
.article-nav__links a { color: var(--primary-dark); font-size: 0.9rem; font-weight: 600; }
.article-nav__links a:hover { text-decoration: underline; }
.project-section { margin-bottom: 4rem; scroll-margin-top: 7rem; }
.project-section p, .project-section li { max-width: 72ch; }
.project-section h2 { margin-bottom: 1rem; }
.project-gallery { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
.gallery-diagram { min-width: 0; }
a:focus-visible { outline: 3px solid var(--primary); outline-offset: 4px; }
@media (max-width: 600px) {
  .project-content { padding-inline: 1.25rem; }
  .project-hero { padding-inline: 1.25rem; }
  .article-nav { margin-bottom: 3rem; padding: 1rem; }
  .project-section { margin-bottom: 3rem; }
  .gallery-diagram { padding: 0.75rem; }
  .author-card { min-width: 0; }
  .author-card__email { overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fade-in { opacity: 1; transform: none; transition: none; }
}

.project-authors {
        display: flex;
        flex-wrap: wrap;
        gap: 1rem;
        margin-top: 1.5rem;
      }
      .author-card {
        display: flex;
        align-items: center;
        gap: 1rem;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color, #e2e8f0);
        border-radius: var(--radius-lg);
        padding: 1.25rem 1.5rem;
        flex: 1 1 260px;
      }
      .author-card__avatar {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: var(--primary);
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
        font-weight: 700;
        font-size: 1.1rem;
        flex-shrink: 0;
      }
      .author-card__name {
        font-weight: 600;
        color: var(--text-primary);
        margin: 0 0 0.35rem;
        font-size: 1rem;
      }
      .author-card__email {
        color: var(--primary);
        font-size: 0.875rem;
        text-decoration: none;
      }
      .author-card__email:hover {
        text-decoration: underline;
      }

      /* Gallery override: diagrams need full height and no cropping */
      .gallery-diagram {
        grid-column: 1 / -1;
        border-radius: 16px;
        overflow: hidden;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        padding: 1.5rem;
      }
      .gallery-diagram img {
        width: 100%;
        height: auto;
        display: block;
      }
      .gallery-diagram figcaption {
        font-size: 0.85rem;
        color: #64748b;
        text-align: center;
        margin-top: 0.75rem;
      }

      /* Tool card */
      .tool-card {
        display: flex;
        gap: 1.5rem;
        align-items: flex-start;
        padding: 1.5rem;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 16px;
        margin-top: 1rem;
        text-decoration: none;
        color: inherit;
        transition:
          border-color 0.2s,
          box-shadow 0.2s;
      }
      .tool-card:hover {
        border-color: rgba(14, 165, 233, 0.4);
        box-shadow: 0 4px 20px rgba(14, 165, 233, 0.08);
      }
      .tool-card__preview {
        flex-shrink: 0;
        width: 160px;
        height: 100px;
        border-radius: 10px;
        overflow: hidden;
        border: 1px solid #e2e8f0;
        background: #1e293b;
      }
      .tool-card__preview img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
      }
      .tool-card__preview-placeholder {
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
      }
      .tool-card__preview-placeholder svg {
        width: 32px;
        height: 32px;
        stroke: rgba(56, 189, 248, 0.6);
      }
      .tool-card__body {
        flex: 1;
        min-width: 0;
      }
      .tool-card__name {
        font-size: 1.05rem;
        font-weight: 600;
        color: var(--text-primary, #1e293b);
        margin: 0 0 0.4rem;
      }
      .tool-card__desc {
        font-size: 0.95rem;
        color: var(--text-secondary, #64748b);
        line-height: 1.6;
        margin: 0 0 0.75rem;
      }
      .tool-card__link {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        font-size: 0.9rem;
        font-weight: 600;
        color: #0ea5e9;
      }
      .tool-card__link svg {
        width: 14px;
        height: 14px;
        stroke: currentColor;
      }
      @media (max-width: 600px) {
        .tool-card {
          flex-direction: column;
        }
        .tool-card__preview {
          width: 100%;
          height: 140px;
        }
      }
@media (max-width: 600px) {
  .gallery-diagram { padding: 0.75rem; }
  .author-card { min-width: 0; }
  .author-card__email { overflow-wrap: anywhere; }
}
/* Markdown project content shares the same typography as project sections. */
.project-prose > h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); margin: 4rem 0 1rem; scroll-margin-top: 7rem; }
.project-prose > h2:first-child { margin-top: 0; }
.project-prose > p, .project-prose > ul { color: var(--text-secondary); font-size: 1.05rem; line-height: 1.8; max-width: 72ch; margin-bottom: 1rem; }
.project-prose > ul { padding-left: 1.5rem; }
.project-prose > ul li { margin-bottom: 0.75rem; }
.project-prose > ul li::marker { color: var(--primary); }
.project-prose > ul strong { color: var(--text-primary); }
.project-prose > .project-section { margin-top: 4rem; }
.project-prose > .project-tool { margin-bottom: 4rem; }

.project-figure { margin-top: 1.5rem; margin-bottom: 1.5rem; }

@media (max-width: 768px) {
  .project-section, .project-prose > h2 { scroll-margin-top: 10rem; }
}

/* University and lab identity */
.footer__logo {
  background: transparent;
  color: var(--text-white);
  padding: 0.75rem 1rem;
  gap: 0.75rem;
}
.footer__logo-img {
  height: auto;
  width: 160px;
  max-width: 55vw;
  filter: none;
}
.footer__lab-name {
  font-size: 1.1rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Responsive header and footer identity */
.nav__logo {
  flex: 0 1 auto;
  min-width: 0;
  gap: 0.65rem;
}
.nav__logo-img {
  display: block;
  flex: none;
  height: 52px;
  width: auto;
}
.nav__logo .lab-name {
  max-width: 175px;
  font-size: 0.85rem;
  line-height: 1.25;
  transform: translateY(7px);
}
.footer__logo {
  padding: 0;
  gap: 0.85rem;
}
.footer__logo-img {
  display: block;
  width: 190px;
  max-width: 55vw;
}
.footer__lab-name {
  font-size: 1.1rem;
  line-height: 1.2;
}
@media (max-width: 768px) {
  .nav__logo { gap: 0.45rem; }
  .nav__logo-img { height: 38px; }
  .nav__logo .lab-name {
    max-width: 135px;
    font-size: 0.7rem;
    line-height: 1.2;
    transform: translateY(5px);
  }
  .footer { padding: 2.5rem 1.25rem; }
  .footer__logo { gap: 0.65rem; }
  .footer__logo-img { width: 160px; }
  .footer__lab-name { font-size: 1rem; }
  .footer__links { gap: 0.75rem 1.5rem; }
}
