:root {
  --hhx-primary: #0a5fd4;
  --hhx-primary-dark: #0847a8;
  --hhx-primary-light: #e8f0fd;
  --hhx-accent: #00c8a0;
  --hhx-text: #1a1a2e;
  --hhx-muted: #667085;
  --hhx-border: #e5eaf1;
  --hhx-surface: #ffffff;
  --hhx-shadow: 0 10px 30px rgba(10, 95, 212, 0.12);
}

body.hhx-site-shell {
  --primary: var(--hhx-primary);
  --primary-dark: var(--hhx-primary-dark);
  --primary-light: var(--hhx-primary-light);
  --accent: var(--hhx-accent);
  color: var(--hhx-text);
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.hhx-site-shell *,
body.hhx-site-shell *::before,
body.hhx-site-shell *::after {
  box-sizing: border-box;
}

.hhx-global-header,
.hhx-global-header * {
  box-sizing: border-box;
}

.hhx-global-header {
  position: sticky;
  top: 0;
  z-index: 2147483000;
  width: 100%;
  height: 68px;
  color: var(--hhx-text);
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(10, 95, 212, 0.09);
  box-shadow: 0 2px 14px rgba(23, 43, 77, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.hhx-global-header.is-scrolled {
  box-shadow: var(--hhx-shadow);
}

.hhx-global-inner {
  width: min(1200px, calc(100% - 32px));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.hhx-global-brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--hhx-primary);
  text-decoration: none;
  white-space: nowrap;
}

.hhx-global-brand img {
  display: block;
  width: auto;
  height: 38px;
  object-fit: contain;
}

.hhx-global-brand-copy {
  padding-left: 12px;
  border-left: 1px solid var(--hhx-border);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.hhx-global-links {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hhx-global-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 6px;
  color: #344054;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease;
}

.hhx-global-links a:hover,
.hhx-global-links a:focus-visible {
  color: var(--hhx-primary);
  background: rgba(10, 95, 212, 0.055);
}

.hhx-global-links a[aria-current="page"] {
  color: var(--hhx-primary);
  background: transparent;
  font-weight: 650;
  box-shadow: none;
}

.hhx-global-links a[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: 50%;
  bottom: 2px;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--hhx-primary), var(--hhx-accent));
  transform: translateX(50%);
}

.hhx-global-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 9px;
  border: 1px solid var(--hhx-border);
  border-radius: 10px;
  color: var(--hhx-primary);
  background: var(--hhx-surface);
  cursor: pointer;
  flex: 0 0 44px;
  touch-action: manipulation;
}

.hhx-global-toggle span {
  display: block;
  height: 2px;
  margin: 4px 0;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.hhx-global-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hhx-global-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hhx-global-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

body.hhx-site-shell button,
body.hhx-site-shell a,
body.hhx-site-shell input,
body.hhx-site-shell select,
body.hhx-site-shell textarea {
  font-family: inherit;
}

body.hhx-site-shell :focus-visible {
  outline: 3px solid rgba(10, 95, 212, 0.24);
  outline-offset: 2px;
}

/* The professional-query charts contain fixed-size canvases. Keep their grid
   items shrinkable on narrow screens so the page never drifts horizontally. */
body.hhx-site-shell .charts-grid > .chart-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

body.hhx-site-shell .chart-card canvas {
  max-width: 100%;
}

@media (max-width: 1120px) {
  .hhx-global-brand-copy { display: none; }
  .hhx-global-links a { padding-inline: 8px; font-size: 13px; }
}

@media (max-width: 900px) {
  .hhx-global-header { height: 62px; }
  .hhx-global-inner {
    width: 100%;
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
  }
  .hhx-global-brand img { height: 34px; }
  .hhx-global-toggle { display: block; margin-left: auto; order: 1; }
  /* Remove the absolute menu's nav wrapper from the flex row. Otherwise it
     becomes a third empty item and leaves the toggle in the middle. */
  .hhx-global-inner > nav {
    position: absolute;
    inset: 0;
    pointer-events: none;
  }
  .hhx-global-links {
    position: absolute;
    top: calc(100% + 8px);
    right: max(12px, env(safe-area-inset-right, 0px));
    left: max(12px, env(safe-area-inset-left, 0px));
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--hhx-border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 50px rgba(23, 43, 77, 0.18);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    max-height: calc(var(--hhx-visual-height, 100vh) - 86px - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .hhx-global-links.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .hhx-global-links a {
    justify-content: flex-start;
    width: 100%;
    min-height: 44px;
    font-size: 14px;
    touch-action: manipulation;
  }
  .hhx-global-links a[aria-current="page"]::after {
    left: 10px;
    right: auto;
    transform: none;
  }
}

@media (max-width: 420px) {
  .hhx-global-links { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .hhx-global-header *, .hhx-global-header *::before, .hhx-global-header *::after { transition: none !important; }
}


/* Public frontend: compact mobile reading, scoped by the shell's route marker. */
@media(max-width:768px){
 body[data-hhx-public-page] .hero,body[data-hhx-public-page] #hero{min-height:0!important;padding-top:28px!important;padding-bottom:28px!important}
 body[data-hhx-public-page] .hero h1,body[data-hhx-public-page] #hero h1{font-size:30px!important;line-height:1.4!important;letter-spacing:0!important}
 body[data-hhx-public-page] .hero-lead{font-size:16px!important;line-height:1.8!important}
 body[data-hhx-public-page] .hero-grid,body[data-hhx-public-page] .hero-grid-draft,body[data-hhx-public-page] .hero-inner{min-height:0!important;gap:20px!important}
 body[data-hhx-public-page] .section{padding-top:32px!important;padding-bottom:32px!important}
 body[data-hhx-public-page] a.action,body[data-hhx-public-page] .hero-action,body[data-hhx-public-page] .hero-actions a{min-height:44px;display:inline-flex;align-items:center}
 body[data-hhx-public-page="home"] .hero-visual,
 body[data-hhx-public-page="home"] #schools,
 body[data-hhx-public-page="research"] .hero-data,
 body[data-hhx-public-page="research"] .hero-tags,
 body[data-hhx-public-page="research"] .convert-strip,
 body[data-hhx-public-page="team"] .research-scene,
 body[data-hhx-public-page="enroll"] .scene,
 body[data-hhx-public-page="major"] .stats-section,
 body[data-hhx-public-page="exam"] .hero-panel,
 body[data-hhx-public-page="exam"] #features,
 body[data-hhx-public-page="exam"] #system{display:none!important}
 body[data-hhx-public-page="home"] .skill-scene *,
 body[data-hhx-public-page="team"] .research-scene *,
 body[data-hhx-public-page="enroll"] .scene *{animation:none!important;transition:none!important}
 body[data-hhx-public-page="research"] .hero-inner,
 body[data-hhx-public-page="team"] .hero-inner{display:block!important}
 body[data-hhx-public-page="industry"] .report-card{padding:18px!important}
 body[data-hhx-public-page="industry"] .report-list{gap:16px!important}
 body[data-hhx-public-page="major"] .search-section{padding-block:24px!important}
 body[data-hhx-public-page="exam"] .theory-section img{max-height:240px;object-fit:contain}
}
@media(max-width:768px){
 body[data-hhx-public-page="team"] .teachers-grid{grid-template-columns:1fr!important;gap:12px!important}
 body[data-hhx-public-page="team"] .teacher-card{display:grid!important;grid-template-columns:88px minmax(0,1fr);min-height:132px;align-items:start}
 body[data-hhx-public-page="team"] .card-photo{height:112px!important;min-height:0!important;aspect-ratio:auto!important}
 body[data-hhx-public-page="team"] .card-photo img{height:112px!important;object-fit:cover}
 body[data-hhx-public-page="team"] .card-body{padding:12px!important}
 body[data-hhx-public-page="team"] .card-name{font-size:18px!important}
 body[data-hhx-public-page="team"] .card-highlights,body[data-hhx-public-page="team"] .card-education{display:none!important}
 body[data-hhx-public-page="team"] .card-tags{margin-top:8px!important}
 body[data-hhx-public-page="team"] .card-tag{font-size:12px!important}
 body[data-hhx-public-page="research"] .theme-card{padding:18px!important;min-height:0!important}
 body[data-hhx-public-page="research"] .theme-top{display:none!important}
 body[data-hhx-public-page="research"] .topic-chips span:nth-child(n+4){display:none!important}
 body[data-hhx-public-page="exam"] .project-cover{display:none!important}
 body[data-hhx-public-page="exam"] .project-card{min-height:0!important}
 body[data-hhx-public-page="exam"] .project-body{padding:16px!important}
 body[data-hhx-public-page="exam"] .projects-grid{grid-template-columns:1fr!important;gap:12px!important}
}
.hhx-mobile-class-pager{display:none}
@media(max-width:768px){
 .class-grid>.hhx-mobile-page-hidden{display:none!important}
 .hhx-mobile-class-pager:not([hidden]){display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:16px 0}
 .hhx-mobile-class-pager button,.hhx-mobile-class-pager select{min-height:44px;border:1px solid #dce5f0;background:#fff;border-radius:8px;padding:8px 12px;color:#174a8b;font:inherit}
 .hhx-mobile-class-pager span{flex-basis:100%;font-size:14px}
 .hhx-mobile-class-pager button:disabled{opacity:.45}
}
@media(max-width:768px){
 body[data-hhx-public-page] .fade-up{opacity:1!important;transform:none!important;transition:none!important}
}
