/* === FONT & BASE === */
:root {
  /* === SBAI Color Palette — teal + cyan + coral (light) === */
  --bg: #FFFFFF;          /* page background */
  --ink: #1A2327;         /* main text (cool near-black) */
  --muted: #5E6B73;       /* secondary text */
  --border: #DDE6E8;      /* borders / dividers (cool) */
  --accent-soft: #E3F6F8; /* light cyan tint — nav hover */
  --light: #FFFFFF;       /* cards / surfaces / sidebar */
  --primary-color: #0C6068;   /* deep teal — main point (readable on white) */
  --secondary-color: #0A5560; /* darker teal — subtitles / hover */

  --sidebar-w: 240px;
  --radius: 12px;
  /* Fluid: fill the viewport (minus sidebar + wrap padding) at every window size */
  --container: calc(100vw - var(--sidebar-w) - 64px);
  
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-soft: 0 1px 3px rgb(0 0 0 / 0.04), 0 12px 32px -12px rgb(0 0 0 / 0.10); /* airy card shadow */
}

* { box-sizing: border-box; }

html {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--ink);
  font-family: 'Pretendard', 'Inter', 'Noto Sans KR', ui-sans-serif, system-ui, -apple-system, sans-serif;
  scroll-behavior: smooth;
  font-size: 17px; /* slightly larger base text (all rem-based sizes scale) */
}

body {
  margin: 0;
  padding: 0 0 0 var(--sidebar-w);
  transition: padding-left 0.3s ease-in-out;
}

a { color: var(--primary-color); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--secondary-color); }

h1, h2, h3, h4, h5, h6 { margin: 0; padding: 0; }

hr { border: 0; border-top: 1px solid var(--border); margin: 3rem 0; }


/* === LAYOUT & COMPONENTS === */

/* Sidebar */
.sidebar {
  position: fixed; top: 0; left: 0; height: 100dvh; width: var(--sidebar-w);
  background: var(--light);
  border-right: 1px solid var(--border);
  padding: 24px 14px;
  overflow-y: auto;
  z-index: 1000;
  transition: transform 0.3s ease-in-out;
}
.brand { font-weight: 800; font-size: 24px; letter-spacing: .5px; margin: 0px 10px 24px; }
.nav .item {
  display: block;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin: 4px;
  color: #374151;  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease;
}
.nav .item:hover { background: var(--accent-soft); color: var(--primary-color); }.nav .item.active { background: var(--primary-color); color: white; }
details { margin: 4px; }
summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-weight: 600;
  color: #374151;  transition: background 0.2s ease;
}
summary::-webkit-details-marker { display: none; }
.nav summary:hover { background: var(--accent-soft); }
.nav summary.active { background: var(--accent-soft); font-weight: 700; }
.sub { padding-left: 14px; border-left: 2px solid var(--border); margin-left: 18px; margin-top: 8px; }
.sub .item { padding: 8px 10px; font-size: 15px; }


/* Top banner — light & airy (matches the Home hero mood); shown on non-Home tabs */
.banner {
  background: var(--light);
  border-bottom: 1px solid var(--border);
  padding: 24px 40px;
}

/* Main Content */
.wrap { padding: 32px; display: grid; justify-items: center; }
.tabcontent {
  display: none;
  animation: fadeIn 0.5s ease;
  width: 100%;
  max-width: var(--container);
  padding: 32px 0 56px;
}
.tabcontent.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }


/* Home immersive: at the top of Home, hide the sidebar and let the hero use the
   full viewport width. Scrolling down removes .home-top, so the sidebar slides in
   from the left (both transitions already defined above). Desktop only — mobile
   keeps its sticky menu bar. */
@media (min-width: 1025px) {
  body.home-top { padding-left: 0; }
  body.home-top .sidebar { transform: translateX(-100%); }
}


/* Hero scroll cue — a thin vertical "scan line" with a travelling read (sequencing motif) */
.scroll-scan {
  position: relative; width: 2px; height: 46px; overflow: hidden;
  background: linear-gradient(to bottom, var(--muted), transparent);
}
.scroll-scan::after {
  content: ""; position: absolute; left: 0; top: -45%;
  width: 2px; height: 45%; background: var(--primary-color);
  animation: scanDown 1.9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes scanDown { 0% { top: -45%; } 100% { top: 100%; } }
@media (prefers-reduced-motion: reduce) { .scroll-scan::after { animation: none; top: 0; } }

/* Our Focus feature cells — hover glow (own div so the cell's overflow-hidden reliably clips it) */
.feature-glow {
  position: absolute; inset: 0; opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
  background: linear-gradient(to top, var(--accent-soft), transparent);
}
.group\/feature:hover .feature-glow { opacity: 1; }
/* pillar hover pop — plain CSS (no Tailwind named-group; works on deploy regardless of the CDN) */
.group\/feature:hover .feature-icon  { color: var(--primary-color); }
.group\/feature:hover .feature-title { transform: translateX(0.5rem); }
.group\/feature:hover .feature-bar   { height: 2rem; background: #58D3DB; }
/* keep the title inside its cell at narrow widths: grid/flex items default to min-width:auto,
   which refuses to shrink below the longest word → the text (and hover slide) spill into the next cell.
   min-width:0 lets the cell shrink to its track; break-word wraps long titles instead of overflowing. */
.feature-title { overflow-wrap: anywhere; }   /* anywhere (not break-word) also shrinks intrinsic size → real wrap */

/* "What We Work On" intro paragraph width — plain CSS (same value as before) so it never depends on the CDN JIT */
.wwwo-lede { max-width: calc(40.91% + 43rem); }


/* PI Tab */
.pi-wrap { max-width: 1000px; }
.pi-hero { margin-top: 24px; }
.pi-photo { width: 100%; aspect-ratio: 3 / 4; height: auto; border-radius: var(--radius); object-fit: cover; box-shadow: var(--shadow-md); }
.pi-name-kr { margin-bottom: 4px; }
.pi-name-en { color: var(--muted); margin-bottom: 8px; }
.pi-title { color: var(--secondary-color); }.pi-contact a { color: var(--ink); }
.pi-divider { height: 1px; background: var(--border); margin: 24px 0; }
.pi-timeline { display: grid; grid-template-columns: max-content minmax(0, 28rem); justify-content: center; gap: 24px 32px; align-items: start; }
.pi-year { text-align: right; }
.pi-desc { line-height: 1.7; }
.pi-desc b { font-weight: 700; }

/* Professional Activities — reuses the Honors & Awards timeline grid; society names are bold group headers in the content column */
.pi-society-row { font-weight: 700; color: var(--ink); margin-top: 22px; }
.pi-society-row:first-child { margin-top: 0; }

/* Mobile: the year column (max-content) squeezes the description into one word per line — stack them */
@media (max-width: 640px) {
  .pi-timeline { grid-template-columns: 1fr; gap: 6px 0; }
  .pi-year { text-align: left; }
  .pi-timeline .pi-desc { margin-bottom: 14px; }
}

/* Lab Members Tab */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, 240px);
  justify-content: center;
  gap: 56px 40px;
}
.people-grid.placeholder .person-card {
    padding-top: 24px; /* Add some space to align better with cards that have photos */
}
.person-card { text-align: center; }
.person-card .photo, .person-card .photo-placeholder {
  display: block; margin: 0 auto;
  width: 100%; aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  background: var(--bg);
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.person-card:hover .photo { transform: scale(1.03); box-shadow: var(--shadow-md); }
.person-card .photo-placeholder {
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.person-card .name-kr { margin: 14px 0 4px; }
.person-card .name-en { color: var(--muted); }
.person-card .email { margin-top: 6px; word-break: break-all; }
.person-card .email a { color: var(--muted); }
.person-card .email a:hover { color: var(--primary-color); }

/* Alumni Tab */
.alumni-grid { display: grid; grid-template-columns: repeat(auto-fit, 250px); justify-content: center; gap: 24px 32px; }
.alumni-card { background: var(--light); border: 1px solid var(--border); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow-soft); transition: box-shadow 0.2s ease, transform 0.2s ease; }
.alumni-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.alumni-card .affil { color: var(--muted); margin-top: 4px; }

/* Publications Tab */

/* Entry card — replaces the ~200-char Tailwind string that was repeated on every entry */
.pub-entry {
  background: var(--light);
  padding: 1.5rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: 0 2px 20px -8px rgb(0 0 0 / 0.08);
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.pub-entry:hover {
  transform: translateY(-0.125rem);
  border-left-color: var(--secondary-color);
  box-shadow: 0 10px 30px -12px rgb(0 0 0 / 0.18);
}
/* First/corresponding-author papers: tinted + primary left bar (stays primary on hover) */
.pub-entry.is-highlight { background: color-mix(in srgb, var(--primary-color) 5%, transparent); border-left-color: var(--primary-color); }
.pub-entry.is-highlight:hover { border-left-color: var(--primary-color); }

/* Lab members' names, auto-emphasized in publication author lists (see LAB_AUTHORS in script.js) */
.lab-author { color: var(--primary-color); font-weight: 700; }

/* Publications year divider — left-aligned "year + rule" (modern, pairs with the card accent bars) */
.pub-year { color: var(--ink); font-weight: 800; font-size: 1.6rem; letter-spacing: -0.01em; }
.pub-year > span:first-child { display: none; }            /* hide the left line → year sits flush left */
.pub-year > span:last-child { background: var(--border); } /* right rule = subtle neutral line */

/* Footer */
footer {
  padding: 32px 40px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--bg);
  text-align: center;
}

/* === MOBILE & RESPONSIVE === */
.mobilebar { display: none; }

@media (max-width: 1024px) {
  :root { --sidebar-w: 0px; }
  body { padding-left: 0; }
  .wrap { padding: 24px; }
  .banner { padding: 14px 20px; }

  .sidebar { transform: translateX(-250px); box-shadow: var(--shadow-md); width: 250px; }
  .sidebar.open { transform: translateX(0); }

  #overlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4);
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
    z-index: 900;
  }
  #overlay.show { opacity: 1; pointer-events: auto; }
  
  .mobilebar {
    display: flex; align-items: center;
    gap: 12px;
    position: sticky; top: 0; z-index: 950;
    background: var(--light);
    color: var(--ink);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
  }
  .mobilebar button {
    background: transparent; border: 1px solid var(--border);
    color: var(--ink); padding: 8px 12px;
    border-radius: var(--radius);
  }
}