/* =========================================================================
   Junjie Jiang — personal site
   Warm minimal academic homepage. Inspired by the Luka homepage template
   (github.com/wzsyyh/luka-homepage-template): two-column profile + content,
   warm clay palette, light/dark theme. Adapted for Jekyll/Markdown content.
   ========================================================================= */

:root {
  --bg:        #faf9f7;
  --surface:   #ffffff;
  --text:      #3d3929;
  --accent:    #c2714f;
  --accent-ink:#a85b3b;
  --secondary: #8c8577;
  --border:    rgba(194, 113, 79, .2);
  --border-soft: rgba(194, 113, 79, .12);
  --shadow:    rgba(61, 57, 41, .12);
  --social-bg: #ffffff;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Ubuntu Mono", "SFMono-Regular", ui-monospace, monospace;

  --maxw: 1600px;
  --side: 360px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1917; --surface: #22211e; --text: #d1cec7;
    --accent: #e28a67; --accent-ink: #e9a184; --secondary: #9b9488;
    --border: rgba(226,138,103,.2); --border-soft: rgba(226,138,103,.12);
    --shadow: rgba(0,0,0,.35); --social-bg: #22211e;
  }
}
[data-theme="dark"] {
  --bg: #1a1917; --surface: #22211e; --text: #d1cec7;
  --accent: #e28a67; --accent-ink: #e9a184; --secondary: #9b9488;
  --border: rgba(226,138,103,.2); --border-soft: rgba(226,138,103,.12);
  --shadow: rgba(0,0,0,.35); --social-bg: #22211e;
}

* , *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}
a { color: var(--accent); text-decoration: none; }
a:hover { filter: brightness(1.12); }
img { max-width: 100%; display: block; }
::selection { background: var(--accent); color: #fff; }

/* ------------------------------------------------------------- top nav */
.top-nav {
  position: fixed; inset: 0 0 auto 0; height: 60px; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
}
.nav-container {
  width: 100%; max-width: var(--maxw); padding: 0 40px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-left a { color: var(--text); font-size: 18px; font-weight: 600; }
.nav-mid { display: flex; gap: 26px; }
.nav-mid a {
  position: relative; color: var(--secondary); font-size: 14px; font-weight: 500;
  padding-bottom: 3px; transition: color .2s;
}
.nav-mid a::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .25s ease;
}
.nav-mid a:hover { color: var(--accent); filter: none; }
.nav-mid a:hover::after { transform: scaleX(1); }
.nav-right { display: flex; gap: 6px; }
.theme-toggle {
  border: none; background: transparent; color: var(--text);
  width: 40px; height: 40px; border-radius: 999px; cursor: pointer;
  font-size: 17px; display: inline-flex; align-items: center; justify-content: center;
  transition: background-color .2s, color .2s;
}
.theme-toggle:hover { background: var(--border); color: var(--accent); }

/* ------------------------------------------------------------- layout */
.wrapper {
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: flex-start; min-height: 100vh;
}

/* ----------------------------------------------------------- sidebar */
.sidebar {
  width: var(--side); flex-shrink: 0;
  position: fixed; top: 60px; left: calc(50% - (var(--maxw) / 2));
  height: calc(100vh - 60px); overflow-y: auto;
  display: flex; flex-direction: column; align-items: center;
  padding-top: 64px; text-align: center;
}
.profile-card { width: 100%; padding: 0 20px; }
.avatar {
  width: 200px; height: 200px; margin: 0 auto 26px;
  border-radius: 50%; object-fit: cover;
  box-shadow: 0 6px 24px var(--shadow);
  background: var(--surface);
}
.site-name { margin: 0 0 6px; font-size: 27px; line-height: 1.2; color: var(--text); font-weight: 700; }
.site-role { margin: 0 0 14px; font-size: 14px; color: var(--secondary); }
.site-role a { color: var(--accent); }
.site-email {
  margin: 0 0 22px; font-family: var(--mono); font-size: 13px;
  color: var(--secondary); word-break: break-all;
}
.social-icons { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.social-icons a {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--social-bg); color: var(--secondary);
  box-shadow: 0 2px 8px var(--shadow);
  font-size: 17px;
  transition: transform .2s, background-color .2s, color .2s;
}
.social-icons a:hover { background: var(--accent); color: #fff; transform: translateY(-2px); filter: none; }

.visitor-map { margin: 0 auto 18px; width: 100%; max-width: 320px; }
.visitor-map img, .visitor-map canvas { width: 100% !important; height: auto !important; border-radius: 12px; }
/* hide the page-view / visitor counter text, keep the map */
.mapmyvisitors-visitors,
.mapmyvisitors-date,
.mapmyvisitors-bottom-text { display: none !important; }
.last-update {
  margin: 16px 0 0; font-family: var(--mono);
  font-size: 16px; letter-spacing: .02em; color: var(--secondary);
}

/* ----------------------------------------------------------- content */
.content {
  flex: 1; min-width: 0;
  margin-left: var(--side);
  padding: 116px 24px 64px 60px;
}
.page__content { max-width: 1200px; }

/* section titles (markdown h1) */
.page__content > h1 {
  display: inline-block;
  margin: 46px 0 18px;
  padding-bottom: 9px;
  border-bottom: 2px solid var(--accent);
  color: var(--accent);
  font-size: 20px; font-weight: 600; letter-spacing: .01em;
}
.page__content > h1:first-of-type { margin-top: 4px; }
.page__content h2 { font-size: 18px; font-weight: 600; margin: 30px 0 12px; color: var(--text); }

.page__content p { margin: 0 0 14px; color: var(--text); }
.page__content strong { color: var(--text); font-weight: 600; }

/* About interest tags */
.page__content > ul {
  list-style: none; padding: 0; margin: 16px 0 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.page__content > ul > li {
  font-size: 13px; padding: 5px 12px;
  border: 1px solid var(--border); border-radius: 999px;
  color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 7%, transparent);
}

/* date-led lists: News / Honors / Education / Experience */
.page__content > ul:has(> li > em:first-child) { display: block; }
.page__content > ul > li:has(> em:first-child) {
  display: grid; grid-template-columns: 160px 1fr; gap: 2px 20px;
  padding: 11px 0; margin: 0;
  border: 0; border-bottom: 1px solid var(--border-soft); border-radius: 0;
  background: none; color: var(--text); font-size: 16px; align-items: baseline;
}
.page__content > ul > li > em:first-child {
  font-family: var(--mono); font-style: normal; font-size: 15px;
  color: var(--accent); font-weight: 700;
}

/* ----------------------------------------------------- publications */
.paper-box {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 30px;
  align-items: start;
  padding: 26px 0;
  border-bottom: 1px solid var(--border-soft);
}
.paper-box-image .badge {
  display: inline-block; margin-bottom: 10px;
  font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: .02em;
  color: var(--accent); border: 1px solid var(--accent);
  border-radius: 5px; padding: 3px 9px;
}
.paper-box-image img {
  width: 100%; border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 26px var(--shadow);
  transition: transform .35s ease, box-shadow .35s ease;
}
.paper-box:hover .paper-box-image img { transform: translateY(-3px); box-shadow: 0 14px 34px var(--shadow); }

.paper-box-text > p:first-of-type {        /* title */
  font-size: 19px; font-weight: 600; line-height: 1.4; color: var(--text); margin-bottom: 6px;
}
.paper-box-text > p:first-of-type a { color: var(--text); border-bottom: 1px solid transparent; transition: border-color .2s, color .2s; }
.paper-box-text > p:first-of-type a:hover { color: var(--accent); border-color: var(--accent); filter: none; }
.paper-box-text > p:nth-of-type(2) { font-size: 15.5px; color: var(--secondary); margin-bottom: 12px; }   /* authors */
.paper-box-text > p:nth-of-type(2) strong { color: var(--accent); font-weight: 700; }
.paper-box-text ul { margin: 0 0 12px; padding: 0; list-style: none; }
.paper-box-text ul li { position: relative; padding-left: 19px; font-size: 15.5px; color: var(--text); margin-bottom: 5px; }
.paper-box-text ul li::before { content: "›"; position: absolute; left: 2px; color: var(--accent); font-weight: 700; }
.paper-box-text > p:last-child { font-family: var(--mono); font-size: 13.5px; color: var(--secondary); margin: 0; }

/* ----------------------------------------------------------- patents */
.patent-list { list-style: none; counter-reset: pat; padding: 0; margin: 18px 0 0; }
.patent-list li {
  counter-increment: pat; position: relative;
  margin-bottom: 12px; padding: 12px 0 12px 16px;
  border-left: 3px solid var(--accent);
  font-size: 14px; line-height: 1.55; color: var(--text);
}
.patent-list strong { color: var(--accent); font-weight: 600; }
.patent-list a { color: var(--accent); font-weight: 500; }

/* ----------------------------------------------------------- project */
.project-box {
  display: grid;
  grid-template-columns: 540px 1fr;
  gap: 30px;
  align-items: start;
  padding: 26px 0;
  border-bottom: 1px solid var(--border-soft);
}
.project-box-image {
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: var(--surface); box-shadow: 0 8px 26px var(--shadow);
  transition: transform .35s ease, box-shadow .35s ease;
}
.project-box:hover .project-box-image { transform: translateY(-3px); box-shadow: 0 14px 34px var(--shadow); }
.project-box-image img,
.project-box-image video { width: 100%; height: auto; display: block; }
.project-box-text > p { font-size: 15.5px; color: var(--text); }
.project-box-text > p:first-child { font-size: 19px; font-weight: 600; color: var(--text); margin-bottom: 9px; }
.project-box-text p:last-child a {
  display: inline-block; margin-top: 4px;
  font-family: var(--mono); font-size: 13px; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 6px; padding: 4px 12px;
  transition: background-color .2s, color .2s;
}
.project-box-text p:last-child a:hover { background: var(--accent); color: #fff; filter: none; }

/* ----------------------------------------------------------- footer */
.site-footer {
  width: 100%; flex-basis: 100%;
  padding: 30px 24px 40px calc(var(--side) + 60px);
  text-align: center;
}
.site-footer p {
  margin: 0; padding-top: 20px;
  border-top: 1px solid var(--border-soft);
  color: var(--secondary); font-size: 13px;
}
.site-footer a { color: var(--secondary); }
.site-footer a:hover { color: var(--accent); }

/* ----------------------------------------------------------- reveal */
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.is-in { opacity: 1; transform: none; transition: opacity .5s ease, transform .5s ease; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1 !important; transform: none !important; } }

/* --------------------------------------------------------- responsive */
@media (max-width: 920px) {
  .nav-mid { display: none; }
}
@media (max-width: 1080px) {
  .nav-container { padding: 0 20px; }
  .wrapper { flex-direction: column; padding: 0 20px; }
  .sidebar { position: static; left: auto; width: 100%; height: auto; padding-top: 84px; overflow: visible; }
  .content { margin-left: 0; padding: 28px 0 48px; }
  .page__content { max-width: 100%; }
  .site-footer { padding: 30px 0; }
  .site-footer p { padding-top: 0; border-top: none; }
}
@media (max-width: 640px) {
  .avatar { width: 150px; height: 150px; }
  .site-name { font-size: 23px; }
  .paper-box, .project-box { grid-template-columns: 1fr; gap: 14px; }
  .paper-box-image { max-width: 360px; }
  .page__content > ul > li:has(> em:first-child) { grid-template-columns: 1fr; gap: 1px; }
}
