/* Shared public-page layout. Load after page styles so all pages use the same
   gutters, navigation breakpoint and readable type scale. */
:root {
  --page-width: 1440px;
  --page-gutter: clamp(16px, 3vw, 48px);
  --nav-height: 72px;
  --team-columns: 5;
  --gallery-columns: 3;
}
html { font-size: 16px; scroll-padding-top: calc(var(--nav-height) + 24px); }
body { padding-top: var(--nav-height); line-height: 1.7; }
.container, .detail-content, .research-detail-wrap, .news-list-container {
  width: 100%; max-width: var(--page-width); margin-inline: auto;
  padding-inline: var(--page-gutter);
}
.container .container { padding-inline: 0; }
section { padding-block: clamp(32px, 4vw, 64px); }
.section-title { font-size: clamp(1.4rem, 1rem + 1.4vw, 2.25rem); margin-bottom: 20px; }
.section-subtitle, .team-intro { font-size: 1rem; line-height: 1.85; }
.section-subtitle { max-width: 64rem; }
.projects-overview, .projects-outlook { font-size: 1rem; line-height: 1.85; padding: clamp(20px, 2.5vw, 32px); }
.detail-header h1, .news-list-header h1 { font-size: clamp(1.5rem, 1.1rem + 1vw, 2rem); }
.footer { padding-block: 40px 24px; }
.footer-content { gap: 24px; }
.footer-section p, .footer-section li, .footer-section a, .footer-bottom { font-size: .875rem; }

/* Navigation stays aligned with the page instead of spanning two containers. */
.navbar { height: var(--nav-height); min-height: var(--nav-height); padding: 0; }
.navbar .container { max-width: var(--page-width); min-height: var(--nav-height); padding-inline: var(--page-gutter); gap: 24px; }
.nav-logo { font-size: 1rem; max-width: none; }
.nav-menu { gap: clamp(12px, 1.5vw, 24px); flex-shrink: 0; }
.nav-link { font-size: .9375rem; }
.hamburger { border: 0; background: transparent; color: inherit; }
:where(a, button):focus-visible { outline: 3px solid var(--accent-gold); outline-offset: 3px; }

/* The hero is content-sized: no negative offsets or unbreakable title. */
.hero { height: auto; min-height: min(560px, 65svh); max-height: none; padding-block: clamp(40px, 6vw, 88px); }
.hero::before { background-position: center; }
.hero-content { grid-template-columns: minmax(0, 1fr); gap: 24px; }
.hero-copy { width: 100%; max-width: 850px; margin: 0; }
.hero-title { width: auto; max-width: 100%; white-space: normal; font-size: clamp(1.65rem, 1rem + 2vw, 2.8rem); line-height: 1.35; margin-bottom: 18px; text-wrap: balance; }
.hero-eyebrow { font-size: .8125rem; margin-bottom: 20px; }
.hero-subtitle { font-size: clamp(.875rem, .8rem + .3vw, 1.1rem); line-height: 1.6; margin-bottom: 18px; }
.hero-description { max-width: 44rem; font-size: 1rem; line-height: 1.85; margin-bottom: 24px; }
.hero-tags { flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.hero-tag { padding: 6px 12px; font-size: .8125rem; }
.hero-actions { flex-direction: row; flex-wrap: wrap; gap: 12px; }
.hero-primary-btn, .hero-secondary-btn { min-height: 44px; padding: 12px 22px; font-size: .9375rem; }

/* Research illustrations retain their aspect ratio and labels. */
.research-hl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(16px, 2vw, 28px); }
.research-hl-card { min-width: 0; gap: clamp(16px, 2vw, 28px); padding: clamp(20px, 2vw, 32px); }
.research-hl-icon { width: clamp(88px, 9vw, 132px); height: auto; aspect-ratio: 1; flex-shrink: 0; }
.research-hl-content { min-width: 0; }
.research-hl-title { font-size: clamp(1.125rem, 1rem + .4vw, 1.4rem); }
.research-hl-desc { font-size: .9375rem; }
.research-hl-tags .tag { font-size: .75rem; }
.research-nav-grid-wrap { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2vw, 28px); }
.research-nav-image { aspect-ratio: 16 / 10; background: #f4f7fb; }
.research-nav-image img, .canvas-image-item img { object-fit: contain; }
.research-nav-overlay { display: none; }
.research-nav-title { font-size: 1rem; line-height: 1.5; padding: 14px; }
.research-nav-section, .research-detail-section { padding-block: clamp(24px, 3.5vw, 56px); }
.research-block-content { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(24px, 3vw, 48px); }
.research-block-content.single-col { grid-template-columns: minmax(0, 1fr); }
.research-text, .research-banner-body { min-width: 0; }
.research-block-title { font-size: clamp(1.3rem, 1rem + .8vw, 1.75rem); }
.research-text p, .research-achievements li, .research-section-block .content-body { font-size: 1rem; line-height: 1.85; }
.research-banner { padding: clamp(24px, 3vw, 40px); }
.research-banner-body h1 { font-size: clamp(1.4rem, 1rem + 1vw, 2rem); }
.research-banner-desc, .research-detail-card-text { font-size: .9375rem; }
.research-section-block { padding: clamp(20px, 3vw, 40px); }
.research-detail-image { object-fit: contain; height: auto; max-height: none; }
.research-nav-btn { white-space: normal; }

/* Team pagination reads this same column count when the window changes. */
.team-grid, .team-cards-viewport { grid-template-columns: repeat(var(--team-columns), minmax(0, 1fr)); gap: clamp(12px, 1.5vw, 22px); }
.team-grid.has-team-pager { display: block; }
.team-category { padding: clamp(16px, 2vw, 28px); }
.team-category-header { gap: 16px; }
.team-category-title { font-size: 1.3rem; }
.team-category-eyebrow { font-size: .75rem; }
.team-category-brief { font-size: .875rem; }
.team-member-card, .team-member-info { min-width: 0; }
.team-member-photo { aspect-ratio: 4 / 5; }
.team-member-photo img { object-fit: cover; object-position: center top; }
.team-member-info { padding: 12px; }
.team-member-name { font-size: 1rem; white-space: normal; }
.team-member-name-row { flex-wrap: wrap; }
.team-member-position, .team-member-bio, .team-member-homepage a { font-size: .875rem; white-space: normal; }
.team-member-research .tag, .responsibility-badge { font-size: .75rem; }
.team-member-research { gap: 6px; }
.team-student-group-title { font-size: 1.1rem; }
.team-student-group-accent { font-size: .8125rem; }
.team-pager-btn, .pg-btn { min-width: 44px; min-height: 44px; }
.team-pager-info, .pg-total, .pg-jump { font-size: .875rem; }

/* Device names and descriptions must never be clipped by a fixed card height. */
.equip-card-top { display: grid; grid-template-columns: minmax(230px, 30%) minmax(0, 1fr); height: auto; }
.equip-card-img-wrap { width: 100%; height: auto; display: flex; flex-direction: column; }
.equip-card-img-wrap img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; background: #f3f6fa; }
.equip-card-img-placeholder { min-height: 160px; }
.equip-card-name-badge { position: static; padding: 14px 18px; font-size: 1rem; line-height: 1.6; background: var(--primary-color); }
.equip-card-info { min-width: 0; padding: clamp(18px, 2vw, 28px); }
.equip-card-info-label, .equip-card-bottom-label { font-size: .8125rem; }
.equip-card-specs, .equip-card-desc { font-size: 1rem; line-height: 1.85; overflow-wrap: anywhere; }
.equip-card-bottom, .equip-card:hover .equip-card-bottom { display: none; }
.equip-card.expanded .equip-card-bottom { display: block; }
.equip-card.expanded .equip-card-bottom-inner { padding: 20px; }
.equip-toggle { display: block; width: 100%; min-height: 44px; padding: 10px 20px; border: 0; border-top: 1px solid #e2e8f0; background: #f3f6fa; color: var(--primary-color); font: inherit; cursor: pointer; text-align: center; }
.gallery-grid { grid-template-columns: repeat(var(--gallery-columns), minmax(0, 1fr)); gap: 16px; }
.gallery-item { aspect-ratio: 4 / 3; }
.gallery-item img { object-fit: contain; background: #f3f6fa; }
.lab-pager-btn { min-height: 44px; font-size: .9375rem; }
.lab-detail-section h2 { font-size: clamp(1.25rem, 1rem + .8vw, 1.6rem); }

/* Article measure stays readable on wide monitors; tables scroll locally. */
.news-detail-container { width: 100%; max-width: 960px; padding-inline: var(--page-gutter); margin-block: 24px; }
.news-detail-title { font-size: clamp(1.4rem, 1rem + 1vw, 2rem); line-height: 1.55; overflow-wrap: anywhere; }
.news-detail-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; font-size: .875rem; }
.news-detail-meta span { margin: 0; }
.news-detail-content { font-size: 1rem; line-height: 1.9; overflow-wrap: anywhere; }
.news-detail-content img, .content-body img { max-width: 100%; height: auto; }
.news-list-body { min-width: 0; }
.news-list-body h3 { font-size: 1.0625rem; }
.news-list-body p { font-size: .9375rem; }
.news-list-body .date { font-size: .8125rem; }
.news-list-cover { width: clamp(140px, 20vw, 240px); height: auto; aspect-ratio: 16 / 10; }
.news-list-item { align-items: start; gap: 20px; }
.news-preview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.news-preview-title { font-size: 1.0625rem; }
.news-preview-date { font-size: .875rem; }
.content-body table, .news-detail-content table, .equip-card table, .modal-text table {
  display: block; max-width: 100%; overflow-x: auto;
}
.content-body pre, .news-detail-content pre { max-width: 100%; overflow-x: auto; }
.achievement-title, .project-card h4 { font-size: 1rem; }
.achievement-meta, .project-card .meta { font-size: .875rem; overflow-wrap: anywhere; }
.accordion-header { gap: 12px; }
.accordion-title { min-width: 0; }
.modal-info, .modal-text { min-width: 0; overflow-wrap: anywhere; }
.modal-info h3 { font-size: 1.25rem; }
.modal-text, .modal-position, .modal-email, .modal-paper-list li { font-size: 1rem; }

@media (max-width: 1200px) { :root { --team-columns: 4; } }
@media (max-width: 1100px) {
  :root { --nav-height: 64px; }
  .navbar .container { gap: 12px; position: static; }
  .nav-logo { flex: 1; max-width: calc(100% - 56px); font-size: .9375rem; }
  .nav-logo-text { white-space: normal; line-height: 1.45; overflow: visible; }
  .hamburger { display: flex; width: 44px; height: 44px; padding: 0; flex-shrink: 0; position: relative; border-radius: 6px; }
  .hamburger span { position: absolute; width: 22px; height: 2px; left: 11px; background: white; }
  .hamburger span:nth-child(1) { top: 15px; }
  .hamburger span:nth-child(2) { top: 21px; }
  .hamburger span:nth-child(3) { top: 27px; }
  .hamburger.active span:nth-child(1) { top: 21px; transform: rotate(45deg); }
  .hamburger.active span:nth-child(2) { opacity: 0; }
  .hamburger.active span:nth-child(3) { top: 21px; transform: rotate(-45deg); }
  .nav-menu { display: none !important; position: fixed; top: var(--nav-height); left: 0; right: 0; width: 100% !important; margin: 0 !important; padding: 8px var(--page-gutter) 16px; max-height: calc(100dvh - var(--nav-height)); overflow-y: auto; flex-direction: column; align-items: stretch; gap: 0; background: var(--primary-color); box-shadow: var(--shadow-lg); }
  .nav-menu.active { display: flex !important; }
  .nav-menu li { width: 100%; }
  .nav-link { width: 100%; min-height: 48px; justify-content: flex-start; text-align: left; padding: 12px; font-size: 1rem; border-bottom: 1px solid #ffffff20; }
  .dropdown-menu { position: static; display: none; opacity: 1; visibility: visible; transform: none; box-shadow: none; }
  .nav-dropdown.open .dropdown-menu { display: block; }
}
@media (max-width: 1000px) {
  :root { --gallery-columns: 2; }
  .research-hl-grid, .research-block-content { grid-template-columns: minmax(0, 1fr); }
  .news-preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  :root { --team-columns: 3; }
  .research-nav-grid-wrap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .research-banner-inner { gap: 20px; }
}
@media (max-width: 768px) {
  .hero { min-height: 0; padding-block: 40px; }
  .hero-content { padding-inline: var(--page-gutter); }
  .hero-actions { flex-direction: column; }
  .hero-primary-btn, .hero-secondary-btn { width: 100%; }
  .research-hl-card { flex-direction: row; align-items: flex-start; gap: 16px; }
  .research-hl-icon { width: 80px; border-radius: 16px; }
  .equip-card-top { grid-template-columns: minmax(0, 1fr); }
  .equip-card-img-wrap img { max-height: 320px; }
  .equip-card-name-badge { padding: 12px 18px; }
  .team-category-header { display: block; }
  .team-category-brief { margin-top: 10px; }
  .footer-content { grid-template-columns: minmax(0, 1fr); }
  .research-section-block h2 { font-size: 1.2rem; }
  .research-nav-bar { flex-direction: column; }
  .news-list-item { gap: 14px; padding: 16px 0; }
  .news-list-cover { width: 104px; aspect-ratio: 4 / 3; }
  .news-list-body h3 { font-size: 1rem; }
  .news-list-body p { font-size: .875rem; }
  .news-preview-grid { grid-template-columns: minmax(0, 1fr); }
  .achievement-actions { flex-wrap: wrap; }
  .achievement-action-btn { min-height: 40px; font-size: .8125rem; }
  .modal-container { max-height: 90dvh; }
  .modal-header, .modal-body { padding: 20px; }
}
@media (max-width: 600px) {
  :root { --team-columns: 2; --gallery-columns: 1; }
  .team-category, .team-student-group { padding: 16px 12px; }
  .team-grid, .team-cards-viewport { gap: 12px; }
  .team-member-info { padding: 10px; }
  .team-member-name { font-size: .9375rem; }
  .team-member-position { font-size: .8125rem; }
  .research-nav-title { font-size: .9375rem; padding: 12px 8px; min-height: 4.3em; display: grid; place-items: center; }
  .research-nav-grid-wrap { gap: 12px; }
  /* Absolute collage coordinates are useful on desktop, but unreadable on phones. */
  .canvas-image-container { display: grid; gap: 16px; aspect-ratio: auto; overflow: visible; border: 0; }
  .canvas-image-container .canvas-image-item { position: relative; left: auto !important; top: auto !important; width: 100% !important; height: auto !important; background: #f4f7fb; }
  .canvas-image-item img { width: 100%; height: auto; max-height: 440px; }
  .canvas-image-item .image-caption { position: static; background: #eef2f7; color: var(--text-dark); font-size: .875rem; padding: 10px; }
  .research-detail-wrap { padding-inline: var(--page-gutter); }
  .research-banner { padding: 24px 20px; }
  .research-banner-inner { align-items: flex-start; }
  .research-details-grid { grid-template-columns: minmax(0, 1fr); }
  .research-hl-card { flex-direction: column; }
  .research-hl-icon { width: 100%; height: 160px; aspect-ratio: auto; }
  .research-hl-icon img { width: 100%; height: 100%; object-fit: contain; }
  .research-hl-title { font-size: 1.2rem; }
}
@media (max-width: 360px) {
  .nav-logo { font-size: .875rem; }
  .team-category, .team-student-group { padding-inline: 10px; }
  .team-grid, .team-cards-viewport { gap: 8px; }
  .team-member-info { padding: 8px; }
  .news-list-item { flex-direction: column; }
  .news-list-cover { width: 100%; aspect-ratio: 16 / 9; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
/* On small viewports, keep text visible even before scroll animations trigger. */
@media (max-width: 768px) {
  [data-animate], .stagger-item { opacity: 1; transform: none; }
}
