/* ============================================
   Tokens
   ============================================ */
:root {
  --bg: #FFFFFF;
  --bg-alt: #F5F5F7;
  --text: #1D1D1F;
  --secondary: #6E6E73;
  --accent: #0071E3;
  --accent-rgb: 0, 113, 227;
  --accent-hover: #0077ED;
  --accent-deep: #0055B3;
  --divider: #D2D2D7;
  --link: #06C;
  --max-width: 980px;
  --nav-height: 48px;

  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;

  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-blur: saturate(180%) blur(30px);
  --glass-border: rgba(0, 0, 0, 0.08);

  --dropdown-bg: #FFFFFF;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-alt: #1D1D1F;
    --text: #F5F5F7;
    --secondary: #86868B;
    --accent: #2997FF;
    --accent-rgb: 41, 151, 255;
    --accent-hover: #47A9FF;
    --accent-deep: #6FBCFF;
    --divider: #424245;
    --link: #2997FF;

    --glass-bg: rgba(0, 0, 0, 0.72);
    --glass-border: rgba(255, 255, 255, 0.08);

    --dropdown-bg: #000000;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display",
               "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.47059;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

body.drawer-open {
  overflow: hidden;
  touch-action: none;
}

/* ============================================
   Nav Shell
   ============================================ */
.nav-shell {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
}

.global-nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 22px;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: relative;
  z-index: 2;
}

.global-nav .brand {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.global-nav .brand:hover { text-decoration: none; opacity: 0.7; }

.desktop-nav {
  display: flex;
  gap: 28px;
  align-items: center;
  margin-left: auto;
  margin-right: 8px;
}
.desktop-nav a {
  font-size: 12px;
  color: var(--text);
  opacity: 0.8;
  text-decoration: none;
  transition: opacity 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.desktop-nav a:hover { opacity: 1; text-decoration: none; }
.desktop-nav a.active { opacity: 1; font-weight: 500; }

.nav-burger {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: 44px;
  height: 30px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-burger::before {
  content: "";
  position: absolute;
  inset: -7px;
}
.nav-burger span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: opacity 0.2s;
}
.nav-burger:hover span { opacity: 0.6; }

/* ============================================
   Mega Dropdown — 纯色背景
   ============================================ */
.nav-dropdown {
  position: fixed;
  top: calc(var(--nav-height) - 1px);
  padding-top: 1px;
  left: 0;
  right: 0;

  background: var(--dropdown-bg);
  border-bottom: 1px solid var(--glass-border);

  overflow: hidden;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition:
    max-height 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
    opacity 0.3s cubic-bezier(0.25, 0.1, 0.25, 1),
    transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
  z-index: 3;
}

.nav-dropdown.is-open {
  max-height: 520px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-dropdown-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 44px 22px 52px;
}

.mega-eyebrow {
  font-size: 12px;
  color: var(--secondary);
  opacity: 0.8;
  margin-bottom: 14px;
  letter-spacing: 0;
}

.mega-heading {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 34px;
}

.mega-grid {
  display: grid;
  grid-template-columns: 1.3fr 2fr;
  gap: 60px;
}

.mega-big { display: flex; flex-direction: column; }

.mega-item {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  padding: 8px 0;
  transition: color 0.2s;
}
.mega-item:hover { color: var(--accent); text-decoration: none; }

.mega-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.mega-col-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--secondary);
  opacity: 0.85;
  margin-bottom: 14px;
}

.mega-col ul { list-style: none; padding: 0; margin: 0; }
.mega-col li { margin-bottom: 10px; }
.mega-col a {
  font-size: 12px;
  color: var(--text);
  text-decoration: none;
  opacity: 0.9;
  transition: opacity 0.2s, color 0.2s;
}
.mega-col a:hover { opacity: 1; color: var(--accent); text-decoration: none; }

.nav-backdrop {
  position: fixed;
  inset: 0;
  top: var(--nav-height);
  background: rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
  z-index: 1;
}
.nav-backdrop.is-open { opacity: 1; pointer-events: auto; }

/* ============================================
   移动端抽屉
   ============================================ */
.mobile-drawer {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: calc(var(--nav-height) + 8px);
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 200;
  max-width: 640px;
  margin: 0 auto;
  border-radius: 22px;
  overflow: hidden;
  background: var(--dropdown-bg);
  border: 1px solid var(--glass-border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition:
    opacity 0.3s cubic-bezier(0.25, 0.1, 0.25, 1),
    transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.mobile-drawer.is-open { opacity: 1; pointer-events: auto; transform: translateY(0); }

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 20px;
  border-bottom: 1px solid var(--divider);
}
.mobile-drawer-title { font-size: 14px; font-weight: 500; }
.mobile-drawer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
}
.mobile-drawer-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 20px 40px;
}

.drawer-big { display: flex; flex-direction: column; margin-bottom: 32px; }
.drawer-big a {
  display: block;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  padding: 10px 0;
  text-decoration: none;
}
.drawer-cols { display: flex; flex-direction: column; gap: 24px; }
.drawer-group-title { font-size: 12px; font-weight: 500; color: var(--secondary); margin-bottom: 10px; }
.drawer-group ul { list-style: none; padding: 0; margin: 0; }
.drawer-group li { margin-bottom: 8px; }
.drawer-group a { font-size: 14px; color: var(--text); opacity: 0.9; text-decoration: none; }
.drawer-group a:hover { opacity: 1; text-decoration: none; }

/* ============================================
   Hero
   ============================================ */
.hero { text-align: center; padding: 100px 22px 80px; background: var(--bg); }

.hero-inner { max-width: 640px; margin: 0 auto; }

.hero .eyebrow { font-size: 14px; font-weight: 500; color: var(--accent); margin-bottom: 12px; }

.hero h1 {
  font-size: 64px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 18px;
}

.hero .subhead {
  font-size: 28px;
  font-weight: 400;
  letter-spacing: 0.007em;
  color: var(--secondary);
  margin-bottom: 32px;
}

.hero .intro {
  font-size: 17px;
  color: var(--secondary);
  max-width: 560px;
  margin: 0 auto 12px;
}

.hero-links {
  margin-top: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.hero-links a { font-size: 17px; color: var(--accent); }

.hero-links a.btn-primary { color: #FFFFFF; }
.hero-links a.btn-primary:hover { color: #FFFFFF; }

/* ============================================
   Section
   ============================================ */
.section { padding: 80px 22px; border-top: 1px solid var(--divider); }
.section.alt { background: var(--bg-alt); }

.section-inner { max-width: var(--max-width); margin: 0 auto; }

.section-header { margin-bottom: 48px; }

.section-header .eyebrow {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 8px;
}

.section-header h2 {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
}

.section-header .subhead {
  font-size: 21px;
  font-weight: 400;
  color: var(--secondary);
  margin-top: 8px;
  letter-spacing: 0.011em;
}

/* ============================================
   Project Module
   ============================================ */
.project {
  padding: 40px 0;
  border-top: 1px solid var(--divider);
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 48px;
  transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.project:first-child { border-top: none; padding-top: 0; }

.project:hover { transform: translateY(-2px); }

.project-meta h3 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}

.project-meta .tagline {
  font-size: 17px;
  color: var(--secondary);
  font-style: italic;
}

.project-body p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 16px;
}

.project-body .spec {
  font-size: 13px;
  color: var(--secondary);
  margin-bottom: 8px;
}

.project-body .spec code {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 12px;
  background: var(--bg-alt);
  padding: 2px 7px;
  border-radius: 5px;
}

.project-body .stack {
  font-size: 13px;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  color: var(--secondary);
  margin-bottom: 20px;
  line-height: 1.8;
}

.project-body .links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.project-body .links a { font-size: 15px; }

/* ============================================
   Detail Page
   ============================================ */
.detail-hero { text-align: center; padding: 80px 22px 60px; }
.detail-hero .eyebrow {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 12px;
}
.detail-hero h1 {
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 16px;
}
.detail-hero .tagline {
  font-size: 21px;
  color: var(--secondary);
  font-style: italic;
  max-width: 600px;
  margin: 0 auto;
}

.detail-body {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 22px 80px;
}

.detail-body p {
  font-size: 17px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.detail-body h2 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 48px 0 16px;
}

.detail-body h3 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 32px 0 10px;
}

.detail-specs {
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
  padding: 24px 0;
  margin: 32px 0;
}
.detail-specs .row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
}
.detail-specs .row .label { color: var(--secondary); }
.detail-specs .row .value {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 13px;
}

/* ============================================
   Stack Grid
   ============================================ */
.stack-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.stack-grid span {
  font-size: 14px;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--divider);
  padding: 10px 18px;
  border-radius: 999px;
}

.section.alt .stack-grid span { background: var(--bg); }

.stack-group { margin-bottom: 32px; }
.stack-group:last-child { margin-bottom: 0; }
.stack-group-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 20px;
}

/* stack 区卡片之间的间距 */
#stack .glass-project + .glass-project {
  margin-top: 20px;
}

/* ============================================
   Back Link
   ============================================ */
.back-link {
  display: inline-block;
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 24px;
}

/* ============================================
   Buttons
   ============================================ */
.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 17px;
  font-weight: 400;
  padding: 12px 24px;
  border-radius: 980px;
  text-decoration: none;
  transition: background 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.btn-primary:hover {
  background: var(--accent-hover);
  text-decoration: none;
  color: #FFFFFF;
}

.btn-secondary {
  display: inline-block;
  font-size: 17px;
  color: var(--accent);
  padding: 12px 0;
}

.btn-secondary.btn-inline {
  padding: 8px 18px;
  font-size: 15px;
}

.download-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 32px 0;
}

.download-note { font-size: 13px; color: var(--secondary); }

/* ============================================
   About Preview
   ============================================ */
.about-preview p {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 20px;
}

/* ============================================
   Elsewhere
   ============================================ */
.elsewhere-links { display: flex; flex-direction: column; }

.elsewhere-links a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-top: 1px solid var(--divider);
  text-decoration: none;
  transition: opacity 0.2s;
}
.elsewhere-links a:hover { text-decoration: none; opacity: 0.7; }
.elsewhere-links a:first-child { border-top: none; }

.elsewhere-name { font-size: 17px; color: var(--text); font-weight: 500; }
.elsewhere-handle {
  font-size: 14px;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  color: var(--secondary);
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--divider);
  padding: 32px 22px;
  text-align: center;
}
.site-footer p {
  font-size: 12px;
  color: var(--secondary);
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ---------- Footer links（Liquid Glass + 语言）—— 非蓝色 ---------- */
.site-footer .footer-links {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 12px;
  color: var(--secondary);
}

.site-footer .glass-switch-footer,
.site-footer .lang-switch-footer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--secondary);
}

.site-footer .glass-switch-footer a,
.site-footer .lang-switch-footer a {
  font-size: 12px;
  color: var(--secondary) !important;
  opacity: 0.7;
  text-decoration: none;
  transition: opacity 0.2s;
}

.site-footer .glass-switch-footer a:hover,
.site-footer .lang-switch-footer a:hover {
  opacity: 1;
  text-decoration: underline;
  color: var(--secondary) !important;
}

.site-footer .lang-switch-footer a.active {
  opacity: 1;
  font-weight: 500;
  color: var(--text) !important;
}

.site-footer .lang-switch-footer .lang-label {
  color: var(--secondary);
  opacity: 0.7;
  margin-right: 2px;
}

.site-footer .lang-switch-footer .lang-sep {
  color: var(--divider);
  font-size: 12px;
}

/* ============================================
   Motion — Apple style
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.8s cubic-bezier(0.25, 0.1, 0.25, 1),
    transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.project.reveal:nth-child(2) { transition-delay: 0.08s; }
.project.reveal:nth-child(3) { transition-delay: 0.16s; }
.project.reveal:nth-child(4) { transition-delay: 0.24s; }

.hero h1,
.hero .eyebrow,
.hero .subhead,
.hero .intro {
  animation: heroFadeUp 1s cubic-bezier(0.25, 0.1, 0.25, 1) both;
}

.hero .eyebrow   { animation-delay: 0s; }
.hero h1         { animation-delay: 0.05s; }
.hero .subhead   { animation-delay: 0.12s; }
.hero .intro:nth-of-type(1) { animation-delay: 0.18s; }
.hero .intro:nth-of-type(2) { animation-delay: 0.24s; }
.hero-links      { animation: heroFadeUp 1s cubic-bezier(0.25, 0.1, 0.25, 1) 0.30s both; }

@keyframes heroFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .hero h1,
  .hero .eyebrow,
  .hero .subhead,
  .hero .intro,
  .hero-links {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .project:hover { transform: none; }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 734px) {
  .hero { padding: 64px 22px 48px; }
  .hero h1 { font-size: 40px; }
  .hero .subhead { font-size: 21px; }
  .section { padding: 56px 22px; }
  .section-header h2 { font-size: 32px; }
  .section-header .subhead { font-size: 17px; }
  .project {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 32px 0;
  }
  .project-meta h3 { font-size: 22px; }
  .detail-hero h1 { font-size: 36px; }
  .detail-hero .tagline { font-size: 17px; }

  .desktop-nav { display: none; }
  .nav-dropdown { display: none; }

  .nav-dropdown-inner { padding: 28px 22px 36px; }
  .mega-heading { font-size: 22px; margin-bottom: 24px; }
  .mega-grid { grid-template-columns: 1fr; gap: 32px; }
  .mega-item { font-size: 20px; }
  .mega-cols { grid-template-columns: 1fr; gap: 24px; }
}