/* ═══════════════════════════════════════════
   云栖 Download Page — Stylesheet
   ═══════════════════════════════════════════ */

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

/* ─── TOKENS ─── */
:root {
  --ink: #0a0a0a;
  --ink-soft: #4a4a4a;
  --ink-muted: #8a8a8a;
  --surface: #f5f3ee;
  --surface-card: #ffffff;
  --surface-card-2: #fafaf8;
  --border: rgba(0,0,0,0.07);
  --border-strong: rgba(0,0,0,0.13);
  --accent: #c8501a;
  --accent-light: rgba(200,80,26,0.08);
  --accent-glow: rgba(200,80,26,0.15);
  --tag-bg: #eeebe5;
  --radius-lg: 24px;
  --radius-md: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.05);
  /* Shared easing — avoids repeating the cubic-bezier string */
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ─── BASE ─── */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Noto Sans SC', sans-serif;
  background: var(--surface);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh; /* iOS Safari: accounts for dynamic address-bar height */
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Dot grid — translateZ(0) promotes to its own GPU layer, preventing
   iOS Safari scroll jitter on fixed pseudo-elements. will-change is
   intentionally omitted: the element never animates. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(0,0,0,0.055) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
  transform: translateZ(0);
}

/* ─── NAV ─── */
/* Solid fallback for browsers that don't support backdrop-filter */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  height: 58px;
  background: rgba(245,243,238,0.97);
  border-bottom: 1px solid var(--border);
  transform: translateZ(0); /* GPU layer for smooth scroll */
}

/* Progressive enhancement: blur when the browser supports it */
@supports (backdrop-filter: blur(1px)) {
  nav {
    background: rgba(245,243,238,0.88);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
  }
}

.nav-logo {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-logo-dot {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}

.nav-links a {
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover {
  color: var(--ink);
  background: rgba(0,0,0,0.05);
}

.nav-links a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  color: var(--ink);
}

/* ─── HERO ─── */
.hero {
  position: relative;
  z-index: 1;
  padding: 120px 2.5rem 64px;
  max-width: 1120px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 32px;
  padding: 6px 14px 6px 6px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  box-shadow: var(--shadow-sm);
}

.hero-badge-dot {
  width: 20px; height: 20px;
  background: var(--accent-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-badge-dot::after {
  content: '';
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
}

.hero-title {
  font-size: clamp(36px, 8vw, 92px);
  font-weight: 300;
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: var(--ink);
  margin-bottom: 24px;
  word-break: keep-all;
}

.hero-title em {
  font-style: normal;
  color: var(--accent);
}

.hero-sub {
  font-size: clamp(14px, 2vw, 16px);
  color: var(--ink-soft);
  font-weight: 300;
  line-height: 1.75;
  max-width: 100%;
  margin-bottom: 56px;
  word-break: keep-all;
}

/* ─── SECTIONS ─── */
.download-section {
  position: relative;
  z-index: 1;
  padding: 0 2.5rem 80px;
  max-width: 1120px;
  margin: 0 auto;
}

.guide-section {
  position: relative;
  z-index: 1;
  padding: 0 2.5rem 100px;
  max-width: 1120px;
  margin: 0 auto;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.section-label {
  font-family: 'DM Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
}

.section-rule {
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

/* ─── NOSCRIPT BANNER ─── */
/* Default hidden; overridden to flex via <noscript><style> when JS is off */
.noscript-warn {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 18px 24px;
  background: #fff8f6;
  border: 1px solid rgba(200,80,26,0.25);
  border-radius: var(--radius-md);
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 24px;
}

.noscript-warn svg {
  width: 20px; height: 20px;
  stroke: currentColor; fill: none;
  stroke-width: 2; flex-shrink: 0;
}

/* ─── CARDS GRID ─── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ─── DOWNLOAD CARD ─── */
.dl-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s, transform 0.25s var(--ease-spring), box-shadow 0.25s;
  color: inherit;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  user-select: none;
  -webkit-touch-callout: none;
  /* No will-change here — browser promotes to compositing layer automatically
     when transform animation starts. Avoids wasteful pre-allocation of 3
     GPU layers for static cards. */
}

.dl-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.6) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

/* Keyboard focus indicator */
.dl-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Hover & featured hover: only on true pointer devices (not touchscreens) */
@media (hover: hover) and (pointer: fine) {
  .dl-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
  }

  .dl-card:hover::before { opacity: 1; }

  .dl-card:hover .card-dl-btn {
    opacity: 0.88;
    transform: translateX(2px);
  }

  /* Featured card hover — inside media query so it doesn't stick on touch */
  .dl-card.featured:hover {
    border-color: rgba(200,80,26,0.4);
    box-shadow: 0 12px 40px rgba(200,80,26,0.12), 0 2px 8px rgba(200,80,26,0.06);
  }
}

/* Touch: scale-down gives immediate tactile feedback */
.dl-card:active {
  transform: scale(0.985);
  box-shadow: var(--shadow-sm);
  transition-duration: 0.1s;
}

/* Featured variant */
.dl-card.featured {
  border-color: rgba(200,80,26,0.2);
  background: linear-gradient(145deg, #fff 0%, #fef9f6 60%, #fdf3ed 100%);
}

/* Recommended badge */
.card-badge {
  position: absolute;
  top: 18px; right: 18px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  background: var(--accent);
  color: white;
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 500;
}

/* Platform icon */
.card-icon-wrap {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}

.card-icon-wrap svg { width: 26px; height: 26px; }

.icon-android { background: linear-gradient(135deg, #e8f5e9, #c8e6c9); }
.icon-android svg { fill: #2e7d32; }
.icon-macos   { background: linear-gradient(135deg, #f5f5f5, #e0e0e0); }
.icon-macos svg { fill: #3a3a3a; }
.icon-windows { background: linear-gradient(135deg, #e3f2fd, #bbdefb); }
.icon-windows svg { fill: #0062ac; }

/* Card text */
.card-platform {
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 5px;
  letter-spacing: -0.01em;
}

.card-version {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--ink-muted);
  margin-bottom: 20px;
}

.card-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 28px;
}

.spec-tag {
  font-size: 11.5px;
  color: var(--ink-soft);
  background: var(--tag-bg);
  padding: 4px 10px;
  border-radius: 100px;
  font-family: 'DM Mono', monospace;
  border: 1px solid rgba(0,0,0,0.05);
}

/* Download button */
.card-dl-btn {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  font-weight: 500;
  min-height: 44px; /* WCAG 2.5.5 minimum touch target */
  padding: 0 20px;
  border-radius: 10px;
  transition: opacity 0.2s, transform 0.15s;
  width: fit-content;
  letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

.dl-card.featured .card-dl-btn { background: var(--accent); }

.card-dl-btn svg {
  width: 14px; height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.card-file-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 11.5px;
  color: var(--ink-muted);
  font-family: 'DM Mono', monospace;
}

.card-file-info::before {
  content: '';
  display: inline-block;
  width: 4px; height: 4px;
  background: currentColor;
  border-radius: 50%;
  opacity: 0.5;
  flex-shrink: 0;
}

/* ─── STEPS ─── */
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.step {
  padding: 30px 26px;
  border-right: 1px solid var(--border);
  transition: background 0.2s;
}

.step:last-child { border-right: none; }

@media (hover: hover) and (pointer: fine) {
  .step:hover { background: var(--surface-card-2); }
}

.step-num {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 16px;
  font-weight: 500;
}

.step-title {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.step-desc {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.65;
  font-weight: 300;
}

/* ─── GUIDE FOOTNOTE ─── */
.guide-footnote {
  margin-top: 20px;
  font-size: 13px;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.guide-footnote a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

.guide-footnote a:hover { opacity: 0.75; }

.guide-footnote a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── FOOTER ─── */
footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 28px 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  background: rgba(245,243,238,0.6);
}

.footer-logo {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 7px;
  letter-spacing: 0.03em;
}

.footer-logo-dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.footer-links {
  display: flex;
  gap: 0.25rem;
}

.footer-links a {
  font-size: 13px;
  color: var(--ink-muted);
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 7px;
  transition: color 0.2s, background 0.2s;
}

.footer-links a:hover {
  color: var(--ink);
  background: rgba(0,0,0,0.05);
}

.footer-links a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  color: var(--ink);
}

.footer-copy {
  font-size: 11.5px;
  color: var(--ink-muted);
  font-family: 'DM Mono', monospace;
}

/* ─── ANIMATIONS ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero-badge          { animation: fadeUp 0.55s var(--ease-spring) both 0.05s; }
.hero-title          { animation: fadeUp 0.55s var(--ease-spring) both 0.15s; }
.hero-sub            { animation: fadeUp 0.55s var(--ease-spring) both 0.25s; }
.dl-card:nth-child(1){ animation: fadeUp 0.55s var(--ease-spring) both 0.30s; }
.dl-card:nth-child(2){ animation: fadeUp 0.55s var(--ease-spring) both 0.40s; }
.dl-card:nth-child(3){ animation: fadeUp 0.55s var(--ease-spring) both 0.50s; }
.steps               { animation: fadeUp 0.55s var(--ease-spring) both 0.45s; }

/* ─── RESPONSIVE ─── */

/* Tablet ≤ 900px → 2-column cards */
@media (max-width: 900px) {
  .cards-grid { grid-template-columns: 1fr 1fr; }
  .dl-card:last-child { grid-column: 1 / -1; }
}

/* Mobile ≤ 640px */
@media (max-width: 640px) {
  nav { padding: 0 1rem; }
  .nav-links { display: none; }

  .hero { padding: 96px 1.25rem 48px; }
  .download-section,
  .guide-section { padding-left: 1.25rem; padding-right: 1.25rem; }

  .hero-sub { margin-bottom: 40px; }

  .cards-grid { grid-template-columns: 1fr; gap: 12px; }
  .dl-card:last-child { grid-column: auto; }
  .dl-card { padding: 22px; }
  .card-icon-wrap { margin-bottom: 16px; }
  .card-specs { margin-bottom: 20px; }
  .card-dl-btn { width: 100%; }

  .steps { grid-template-columns: 1fr 1fr; }
  .step { padding: 22px 18px; }
  .step:nth-child(2) { border-right: none; }
  .step:nth-child(1),
  .step:nth-child(2) { border-bottom: 1px solid var(--border); }
  .step:nth-child(3) { border-bottom: 1px solid var(--border); }

  footer {
    padding: 24px 1.25rem;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }
}

/* Small phones ≤ 400px */
@media (max-width: 400px) {
  .hero { padding-top: 84px; }
  .steps { grid-template-columns: 1fr; }
  .step { border-right: none !important; border-bottom: 1px solid var(--border); }
  .step:last-child { border-bottom: none; }
  .hero-badge { font-size: 10px; }
  .card-badge { font-size: 9px; padding: 2px 8px; }
}

/* Landscape phones — compress hero height */
@media (max-height: 500px) and (orientation: landscape) {
  .hero { padding-top: 76px; padding-bottom: 32px; }
  .hero-title { font-size: 36px; }
  .hero-sub { margin-bottom: 28px; }
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .hero-badge, .hero-title, .hero-sub,
  .dl-card, .steps {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .dl-card, .card-dl-btn {
    transition: none !important;
  }
}
