/* ============================================================
   Home page redesign — immersive, theme-aware (light / dark)
   Scoped under body.home so the rest of the site is untouched.
   ============================================================ */

body.home {
  /* Source Serif Pro for English, with CJK serif fallbacks for 张驰 */
  --serif: "Source Serif 4 Variable", "Source Serif Pro", "Source Serif 4",
    Georgia, Cambria, "Times New Roman",
    "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;

  --bg: #f6f8fc;
  --bg-elev: #ffffff;
  --text: #1b2230;
  --text-soft: #45506a;
  --text-muted: #8893a8;
  --border: #e6eaf2;
  --accent: #0085a1;
  --accent-2: #00b4d8;
  --accent-soft: rgba(0, 133, 161, 0.10);
  --shadow: 0 12px 34px rgba(22, 33, 64, 0.09);
  --shadow-soft: 0 4px 16px rgba(22, 33, 64, 0.06);

  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  transition: background 0.4s ease, color 0.4s ease;
}

/* element-level headings set their own font in hux-blog.css — override here */
body.home h1, body.home h2, body.home h3,
body.home h4, body.home h5, body.home h6,
body.home p, body.home li, body.home a,
body.home .pub-section__title strong,
body.home .timeline-date {
  font-family: var(--serif);
}

/* Fraunces reads a touch large; nudge body rhythm for elegance */
body.home .post-container p,
body.home .post-container li { letter-spacing: 0.003em; }

html[data-theme="dark"] body.home {
  --bg: #070b14;
  --bg-elev: #0f1626;
  --text: #e9eef7;
  --text-soft: #b8c4dc;
  --text-muted: #7f8ea8;
  --border: rgba(140, 165, 210, 0.14);
  --accent: #5aa0ff;
  --accent-2: #7fe0ff;
  --accent-soft: rgba(90, 160, 255, 0.14);
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 6px 22px rgba(0, 0, 0, 0.45);
}

body.home a { color: var(--accent); }
body.home a:hover, body.home a:focus { color: var(--accent-2); }

/* ---------------------------------------------------------------
   Theme toggle (sun / moon)
   --------------------------------------------------------------- */
.theme-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1200;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(12, 18, 33, 0.32);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.3s ease, background 0.25s ease, border-color 0.25s ease;
}
.theme-toggle:hover { transform: rotate(20deg) scale(1.06); border-color: rgba(255, 255, 255, 0.6); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
/* after scrolling past hero on light mode keep it legible */
html[data-theme="light"] .theme-toggle.is-scrolled,
body.home .theme-toggle.is-scrolled {
  background: var(--accent-soft);
  border-color: var(--border);
  color: var(--accent);
}
html[data-theme="dark"] .theme-toggle.is-scrolled {
  background: rgba(20, 30, 55, 0.7);
  border-color: var(--border);
  color: var(--accent-2);
}

/* ---------------------------------------------------------------
   Hero — cinematic cover (always dark/rich, both themes)
   --------------------------------------------------------------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  color: #eef4ff;
  isolation: isolate;
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(20, 40, 80, 0.55) 0%, rgba(6, 9, 18, 0) 60%),
    linear-gradient(160deg, #0a1f31 0%, #0c1830 45%, #0a1020 100%);
}
html[data-theme="dark"] .hero__bg {
  background:
    radial-gradient(ellipse at 50% 120%, rgba(20, 30, 60, 0.55) 0%, rgba(5, 7, 13, 0) 60%),
    linear-gradient(160deg, #060a14 0%, #070b16 50%, #05070d 100%);
}

/* drifting aurora blobs */
.hero__bg .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  will-change: transform;
}
.hero__bg .b1 {
  width: 46vw; height: 46vw; left: -8vw; top: -10vw;
  background: radial-gradient(circle, #0a85a1, transparent 65%);
  animation: drift1 22s ease-in-out infinite alternate;
}
.hero__bg .b2 {
  width: 40vw; height: 40vw; right: -6vw; top: 5vw;
  background: radial-gradient(circle, #3f6bd6, transparent 65%);
  animation: drift2 26s ease-in-out infinite alternate;
}
.hero__bg .b3 {
  width: 38vw; height: 38vw; left: 25vw; bottom: -14vw;
  background: radial-gradient(circle, #00b4d8, transparent 65%);
  animation: drift3 30s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(8vw, 6vw) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-7vw, 8vw) scale(1.1); } }
@keyframes drift3 { to { transform: translate(5vw, -8vw) scale(1.2); } }

/* faint perspective grid */
.hero__grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(160, 200, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(160, 200, 255, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 25%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 25%, transparent 75%);
}

.hero__inner {
  position: relative;
  padding: 120px 22px 90px;
  max-width: 820px;
  animation: heroRise 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes heroRise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }

.hero__avatar {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 6px rgba(90, 160, 255, 0.18), 0 14px 40px rgba(0, 0, 0, 0.5);
  margin-bottom: 26px;
  animation: avatarGlow 4.5s ease-in-out infinite;
}
@keyframes avatarGlow {
  0%, 100% { box-shadow: 0 0 0 6px rgba(90, 160, 255, 0.16), 0 14px 40px rgba(0, 0, 0, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(0, 180, 216, 0.22), 0 14px 46px rgba(0, 0, 0, 0.55); }
}

.hero__name {
  font-size: 58px;
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
  line-height: 1.05;
  background: linear-gradient(100deg, #ffffff 20%, #9fd0ff 60%, #7fe0ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero__name .hero__cn {
  -webkit-text-fill-color: rgba(255, 255, 255, 0.55);
  font-weight: 600;
  font-size: 0.62em;
  margin-left: 8px;
  letter-spacing: 0.04em;
}

.hero__role {
  font-size: 17px;
  color: #b9cbe8;
  margin: 0 0 18px;
  letter-spacing: 0.02em;
}
.hero__role strong { color: #eaf2ff; font-weight: 700; }

.hero__tag {
  font-size: 19px;
  color: #d6e2f5;
  margin: 0 auto 30px;
  min-height: 1.5em;
}
.hero__tag .rotator {
  color: #7fe0ff;
  font-weight: 700;
  border-bottom: 2px solid rgba(127, 224, 255, 0.4);
  transition: opacity 0.4s ease, transform 0.4s ease;
  display: inline-block;
}
.hero__tag .rotator.swap { opacity: 0; transform: translateY(6px); }

.hero__links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 12px;
}
.hero__links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #e7efff !important;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(150, 185, 255, 0.28);
  background: rgba(18, 28, 50, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.hero__links a:hover {
  transform: translateY(-2px);
  color: #fff !important;
  border-color: rgba(127, 224, 255, 0.65);
  background: rgba(28, 44, 78, 0.6);
}

.hero__scroll {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(220, 232, 247, 0.75) !important;
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.hero__scroll .chev {
  display: block;
  margin: 8px auto 0;
  width: 14px;
  height: 14px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  animation: bounce 1.8s ease-in-out infinite;
}
@keyframes bounce { 0%, 100% { transform: rotate(45deg) translate(0, 0); } 50% { transform: rotate(45deg) translate(4px, 4px); } }

/* ---------------------------------------------------------------
   Quote band (David Marr) — bridges hero and content
   --------------------------------------------------------------- */
.quote-band {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  padding: 54px 22px;
  text-align: center;
}
.quote-band blockquote {
  max-width: 820px;
  margin: 0 auto;
  border: 0;
  padding: 0;
  font-size: 20px;
  line-height: 1.7;
  font-style: italic;
  color: var(--text-soft);
}
.quote-band cite {
  display: block;
  margin-top: 18px;
  font-style: normal;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--accent);
}

/* ---------------------------------------------------------------
   Main content
   --------------------------------------------------------------- */
body.home .home-main { padding: 10px 0 30px; }

body.home .post-container { color: var(--text); }
body.home .post-container p { color: var(--text-soft); }
body.home .post-container a { color: var(--accent); }
body.home .post-container a:hover { color: var(--accent-2); }
body.home .post-container em { color: var(--text); font-style: italic; }
body.home .post-container ul li { color: var(--text-soft); }

/* hide the in-content Marr blockquote (moved to quote band) */
body.home .post-container > blockquote:first-child { display: none; }

/* section headings */
body.home .post-container h2 {
  font-size: 30px;
  font-weight: 800;
  margin: 70px 0 24px;
  padding-bottom: 12px;
  position: relative;
  color: var(--text);
}
body.home .post-container h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 56px;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* the contact line under About */
body.home .post-container h2#about-me + p,
body.home .post-container p:has(> a[href^="mailto"]) { line-height: 2; }

/* ---------------------------------------------------------------
   Publications — cards
   --------------------------------------------------------------- */
body.home .pub-section { margin-bottom: 14px; }
body.home .pub-section > summary { padding: 10px 0; }
body.home .pub-section__title strong { color: var(--text); font-size: 19px; }

body.home .pub-section > summary::after {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}
body.home .pub-section[open] > summary::after {
  color: #fff;
  background: var(--accent);
}

body.home .pub-img { overflow: visible; }
body.home .pub-img ul { margin: 0; padding: 0; }
body.home .pub-img hr { display: none; }

body.home .pub-img li {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
body.home .pub-img li:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}
body.home .pub-img img.thumbnail {
  float: none;
  flex: 0 0 150px;
  width: 150px;
  height: 150px;
  margin: 0;
  border-radius: 12px;
  object-fit: cover;
  background: var(--bg);
  border: 1px solid var(--border);
}
body.home .pub-img .title {
  font-weight: 700;
  font-size: 1.08em;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 4px;
}
body.home .pub-img .authors { color: var(--text-soft); font-size: 0.95em; }
body.home .pub-img .authors strong { color: var(--accent); }
body.home .pub-img .venue { color: var(--text-muted); font-weight: 700; font-size: 0.92em; }
body.home .pub-img .venue font[color="red"],
body.home .pub-img font[color="red"] { color: #e0533d !important; }
body.home .pub-img .resources { width: auto; margin-top: 6px; font-size: 0.92em; }
body.home .pub-img .resources a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
body.home .pub-img .resources a:hover { color: var(--accent-2); text-decoration: underline; }

@media only screen and (max-width: 600px) {
  body.home .pub-img li { flex-direction: column; align-items: center; text-align: center; }
  body.home .pub-img img.thumbnail { flex-basis: auto; }
}

/* ---------------------------------------------------------------
   Timeline — dark-aware overrides
   --------------------------------------------------------------- */
body.home .timeline::before {
  background: linear-gradient(to bottom, var(--accent) 0%, transparent 100%);
}
body.home .timeline-marker {
  background: var(--bg-elev);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
body.home .timeline-item.is-current .timeline-marker { background: var(--accent); }
body.home .timeline-content {
  background: var(--bg-elev);
  border-color: var(--border);
  box-shadow: var(--shadow-soft);
}
body.home .timeline-item:hover .timeline-content {
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
body.home .timeline-role { color: var(--text); }
body.home .timeline-org { color: var(--accent); }
body.home .timeline-place { color: var(--text-muted); }
body.home .timeline-date { color: var(--accent); background: var(--accent-soft); }
html[data-theme="dark"] body.home .timeline-logo {
  filter: brightness(0.95);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  padding: 4px;
}

/* ---------------------------------------------------------------
   Friends grid (footer area)
   --------------------------------------------------------------- */
.home-friends {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding: 54px 0 10px;
}
.home-friends h2 {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--text);
}
.home-friends .sub { color: var(--text-muted); margin: 0 0 24px; font-size: 14px; }
.home-friends .friend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.home-friends .friend-grid li { margin: 0; }
.home-friends .friend-grid a {
  display: block;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-soft) !important;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.home-friends .friend-grid a:hover {
  transform: translateY(-2px);
  color: var(--accent) !important;
  border-color: var(--accent);
}

/* ---------------------------------------------------------------
   Footer + nav theming on home
   --------------------------------------------------------------- */
body.home footer { color: var(--text-muted); }
body.home footer .copyright { color: var(--text-muted); }
body.home footer .copyright a { color: var(--accent); }

html[data-theme="dark"] body.home .navbar-custom.is-fixed {
  background-color: rgba(10, 16, 30, 0.92);
  border-bottom: 1px solid var(--border);
}
html[data-theme="dark"] body.home .navbar-custom.is-fixed .navbar-brand,
html[data-theme="dark"] body.home .navbar-custom.is-fixed .nav li a { color: var(--text); }
html[data-theme="dark"] body.home .navbar-custom.is-fixed .navbar-brand:hover,
html[data-theme="dark"] body.home .navbar-custom.is-fixed .nav li a:hover { color: var(--accent-2); }
html[data-theme="dark"] body.home .navbar-toggle .icon-bar { background-color: #fff; }
html[data-theme="dark"] body.home #huxblog_navbar .navbar-collapse { background: #0f1626; }

/* ---------------------------------------------------------------
   Scroll reveal
   --------------------------------------------------------------- */
body.home .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s ease; }
body.home .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  body.home .reveal { opacity: 1; transform: none; transition: none; }
  .hero__bg .blob, .hero__scroll .chev, .hero__avatar { animation: none; }
  .hero__inner { animation: none; }
}

/* ---------------------------------------------------------------
   Responsive hero
   --------------------------------------------------------------- */
@media only screen and (max-width: 768px) {
  .hero__name { font-size: 40px; }
  .hero__avatar { width: 108px; height: 108px; }
  .hero__tag { font-size: 17px; }
  body.home .post-container h2 { font-size: 25px; margin-top: 54px; }
  .quote-band blockquote { font-size: 17px; }
}
