/*
 *  Site styles: layout, sticky sidebar, typography
 *    Used by index.html. Design tokens live in :root below.
 */

:root{
  --primary:#2d5f89; --primary-dark:#1a3d5c; --primary-light:#eaf1f8;
  --osu:#D73F09;
  --text:#1c2331; --text-sec:#4a5568; --text-muted:#8896a7;
  --border:#dde4ed; --bg-light:#f5f8fb;
  --nav-h:54px;
  --font:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
}
*{box-sizing:border-box}
body{margin:0;font-family:var(--font);font-size:15px;line-height:1.6;color:var(--text);background:#fff;
     padding-top:var(--nav-h)}
a{color:var(--primary);text-decoration:none}
a:hover{color:var(--primary-dark);text-decoration:underline}

/* Navigation: fixed top bar */
.nav{position:fixed;top:0;left:0;right:0;height:var(--nav-h);background:#fff;z-index:50;
     border-bottom:1px solid var(--border);display:flex;align-items:center}
.nav .wrap{position:relative}
.nav .wrap{max-width:1120px;margin:0 auto;padding:0 1.5rem;width:100%;display:flex;align-items:center;gap:1.5rem}
.nav .brand{font-weight:700;font-size:1.22rem;color:var(--text);margin-right:auto}
.nav-menu{display:flex;align-items:center;gap:1.5rem}
.nav-toggle{display:none;flex-direction:column;justify-content:center;gap:4px;
            width:34px;height:34px;padding:0;border:none;background:none;cursor:pointer}
.nav-toggle span{display:block;height:2px;width:20px;margin:0 auto;border-radius:2px;
                 background:var(--text-sec);transition:transform .2s, opacity .2s}
.nav-toggle.open span:nth-child(1){transform:translateY(6px) rotate(45deg)}
.nav-toggle.open span:nth-child(2){opacity:0}
.nav-toggle.open span:nth-child(3){transform:translateY(-6px) rotate(-45deg)}
.nav a.item{font-size:1rem;font-weight:500;color:var(--text-sec);font-variant:small-caps}
.nav a.item:hover,.nav a.item.on{color:var(--primary);text-decoration:none}
.nav a.item.on{font-weight:700}

.wrap{max-width:1120px;margin:0 auto;padding:0 1.5rem}

/* Layout: sticky sidebar + main column */
.layout{display:grid;grid-template-columns:245px 1fr;gap:2.75rem;padding:2rem 0 4rem}

/* Sidebar: sticks, scrolls internally when it overflows */
.side{
  position:sticky;
  top:calc(var(--nav-h) + 1.25rem);
  max-height:calc(100vh - var(--nav-h) - 2.5rem);
  overflow-y:auto;
  padding-right:.85rem;
  font-size:.89rem;line-height:1.6;
  scrollbar-width:thin;scrollbar-color:var(--border) transparent;
}
.side::-webkit-scrollbar{width:6px}
.side::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}
.side::-webkit-scrollbar-thumb:hover{background:var(--text-muted)}
.side::-webkit-scrollbar-track{background:transparent}

.photo{width:170px;height:170px;border-radius:50%;overflow:hidden;margin:0 0 1rem;
       background:#e8eef5 url('../resources/shhong_profile.png') center/cover no-repeat;transition:.25s}
.photo:hover{background-image:url('../resources/shhong_profile_cloaked.png')}

.affil{font-size:.89rem;line-height:1.55;margin:0 0 1rem}
.affil b{display:block;font-size:.99rem;color:var(--text)}
.aff-item{display:block}
.affil .narrow{display:none}
.ct-item{display:block}
.ct-line + .ct-line{display:block}

.shead{font-variant:small-caps;font-weight:700;font-size:.97rem;color:var(--primary-dark);
       margin:1.35rem 0 .3rem;padding-bottom:.2rem;border-bottom:1px solid var(--border)}
.side p{margin:.35rem 0 .5rem}
.icons{display:flex;align-items:center;gap:.75rem;margin:.7rem 0 0;font-size:1.3rem}
.icons a{color:var(--text-sec)} .icons a:hover{color:var(--primary)}
.icons img{width:54px;vertical-align:middle}
.side .co{color:var(--text-muted);font-size:.80rem}
.side .sub{font-weight:600;color:var(--text-sec);font-size:.80rem;font-variant:small-caps}
.press-d{font-weight:600;color:var(--text-sec);font-size:.84rem}
.tt{width:100%;border-collapse:collapse}
.tt td{padding:.16rem 0;vertical-align:top;font-size:.87rem}
.tt td.lvl{width:58px;color:var(--text-muted)}

/* Main column */
.hiring{background:#fdf1ec;border-left:3px solid var(--osu);padding:.7rem .9rem;
        border-radius:0 5px 5px 0;font-size:.88rem;margin:1.1rem 0 1.4rem}
.hiring b{color:var(--osu)}
.sec{font-variant:small-caps;font-weight:700;font-size:1.24rem;color:var(--primary-dark);
     margin:2rem 0 .6rem;padding-bottom:.3rem;border-bottom:2px solid var(--primary-dark)}
.nrow{display:grid;grid-template-columns:124px 1fr;gap:.8rem;padding:.34rem 0;font-size:.89rem;
      border-bottom:1px solid #f0f4f8}
.ndate{color:var(--text-muted);font-size:.82rem;text-align:right;padding-top:.12rem}
.more{display:inline-block;margin-top:.8rem;font-size:.86rem}

.spub{padding:.55rem 0 .7rem;border-bottom:1px solid #f0f4f8;font-size:.89rem;line-height:1.5}
.spub:last-of-type{border-bottom:none}
.spub .t{font-weight:700;color:var(--text)}
.spub .a{font-style:italic;color:var(--text-sec);font-size:.86rem}
.spub .v{font-size:.86rem}
.spub .l{font-size:.82rem;margin-top:.1rem}
.award{color:var(--osu);font-weight:700}


/*
 *  Button for scroll-ups
 */
#topBtn {
  display: none;
  position: fixed;
  z-index: 99;
  font-size: 32px;
  border: none;
  outline: none;
  cursor: pointer;
  border-radius: 4px;
  /* colors */
  color: #333333;
  background-color: rgba(255, 255, 255, .84);
  /* position */
  bottom: 20px;
  right: 20px;
  /* paddings */
  padding: 2px 14px;
}

#topBtn:hover {
  background-color: rgba(242, 242, 242, .84);
}

/*
 *  Footer
 */
.footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0 2rem;
  text-align: center;
}

.footer .text-muted {
  color: var(--text-muted);
  font-size: .85rem;
}

/*
 *  Sub-sections and tags (papers / students / services / application)
 */
.ssec {
  font-weight: 700;
  font-size: .98rem;
  color: var(--text);
  margin: 1.3rem 0 .35rem;
}

.pubyear {
  font-variant: small-caps;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary-dark);
  margin: 1.5rem 0 .4rem;
  padding-bottom: .2rem;
  border-bottom: 1px solid var(--border);
}

.tag {
  display: inline-block;
  font-size: .68rem;
  font-weight: 600;
  line-height: 1.5;
  padding: 0 .4rem;
  border-radius: 3px;
  vertical-align: 1px;
  white-space: nowrap;
}

.tag-success { color: #1c6b4a; background: #dcf1e6; }
.tag-primary { color: #1a3d5c; background: #dfeaf5; }
.tag-info    { color: #175c6b; background: #d9eef2; }
.tag-danger  { color: #8a2d13; background: #fbe3dc; }

.legend {
  margin: 0 0 .4rem;
}

.legend .tag {
  margin-right: .35rem;
}

main p {
  margin: .35rem 0 .8rem;
}

/*
 *  Publications: list + sticky year rail on the right
 */
.pubs-layout {
  display: grid;
  grid-template-columns: 1fr 76px;
  gap: 0 1.5rem;
  align-items: start;
}

.pubs-main { min-width: 0; }

.pubs-side {
  position: sticky;
  top: calc(var(--nav-h) + 1.25rem);
  align-self: start;
  max-height: calc(100vh - var(--nav-h) - 2.5rem);
  overflow-y: auto;
  scrollbar-width: none;
}

.pubs-side::-webkit-scrollbar { display: none; }

.year-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--border);
}

.year-nav li { margin: 0; }

.year-nav-link {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: .28rem 0 .28rem .7rem;
  line-height: 1.4;
  cursor: pointer;
  transition: color .15s;
}

.year-nav-link:hover,
.year-nav-link.active { color: var(--primary); text-decoration: none; }

.lablink {
  display: inline-block;
  margin-top: .3rem;
  font-weight: 600;
  color: var(--text-sec);
}


/*
 *  Responsive: single column, collapsed nav
 *    Keep this block LAST — these rules override the base rules above.
 */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 1.5rem; }
  .side   { position: static; max-height: none; overflow: visible; padding-right: 0; }

  /* long lists live on their own pages — drop them on phones */
  .side-people,
  .side-extra { display: none; }

  /* photo on top, then name and contact stacked, each full width */
  .side-top { display: block; }

  .side-top .photo {
    width: 80%;
    max-width: 360px;
    height: auto;
    aspect-ratio: 1 / 1;
    margin: 0 auto 1.1rem;
  }

  .side-profile,
  .side-contact { width: 100%; }

  /* name, affiliation and contact all centred under the photo */
  .side-top { text-align: center; }

  .side-top .affil     { margin: 0 0 .4rem; }
  .side-top .affil b   { font-size: 1.35rem; margin-bottom: .15rem; }
  .side-contact .shead { margin-top: .9rem; }

  /* affiliation runs as one wrapping line, with short labels */
  .aff-item { display: inline; }
  .affil .wide   { display: none; }
  .affil .narrow { display: inline; }

  .lablink { display: block; margin-top: .3rem; }

  /* contact collapses to: Office ... | Office Hours ... */
  .ct-item { display: inline; }
  .ct-line { display: inline; }

  /* street and city drop off — the building link still maps it */
  .ct-line + .ct-line { display: none; }

  /* social icons: centred, tight spacing */
  .icons {
    width: auto;
    margin: .9rem auto 0;
    justify-content: center;
    gap: 1.5rem;
    font-size: 2rem;
  }

  .aff-item + .aff-item::before,
  .ct-item + .ct-item::before {
    content: "|";
    margin: 0 .45rem;
    color: var(--text-muted);
  }

  .nrow  { grid-template-columns: 1fr; gap: 0; }
  .ndate { text-align: left; }

  /* the year rail needs a viewport to stick to — no room on phones */
  .pubs-layout { grid-template-columns: 1fr; }
  .pubs-side   { display: none; }

  /* top bar collapses to the name + a hamburger */
  .nav-toggle { display: flex; }

  .nav-menu {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: .35rem 0 .6rem;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 6px 16px rgba(28, 35, 49, .08);
  }

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

  .nav-menu a.item {
    padding: .6rem 1.5rem;
    font-size: 1.05rem;
  }

  .nav-menu a.item:hover { background: var(--bg-light); }
}
