/* =====================================================================
   ccfriend website — dark + gradient glow
   ===================================================================== */

:root {
  --bg: #0a0b14;
  --bg-elev: #0f1120;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f4fa;
  --text-dim: #b6b8cc;
  --text-mute: #7c7f99;
  --violet: #7c3aed;
  --violet-2: #a78bfa;
  --cyan: #06b6d4;
  --cyan-2: #67e8f9;
  --rose: #f472b6;
  --amber: #fbbf24;
  --green: #34d399;
  --brand-red: #cc5b4f;

  --font-sans: "Inter", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --container: 1200px;
  --shadow-glow: 0 30px 80px -20px rgba(124, 58, 237, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* CJK gets slightly different font stack via :lang */
html[lang="zh"] body {
  font-family: "Noto Sans SC", "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.18s ease;
}
a:hover {
  color: var(--violet-2);
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.1em 0.4em;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: #d4d2ff;
}

/* =====================================================================
   Background effects
   ===================================================================== */

.bg-fx {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 70%);
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.55;
  will-change: transform;
}
.bg-orb--violet {
  width: 600px;
  height: 600px;
  top: -200px;
  left: -100px;
  background: radial-gradient(circle, #7c3aed 0%, transparent 70%);
  animation: floatA 22s ease-in-out infinite;
}
.bg-orb--cyan {
  width: 500px;
  height: 500px;
  top: 200px;
  right: -150px;
  background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
  animation: floatB 28s ease-in-out infinite;
}
.bg-orb--rose {
  width: 400px;
  height: 400px;
  bottom: -100px;
  left: 30%;
  background: radial-gradient(circle, #f472b6 0%, transparent 70%);
  opacity: 0.3;
  animation: floatA 32s ease-in-out infinite reverse;
}

.bg-noise {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes floatA {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(60px, 40px); }
}
@keyframes floatB {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-50px, 60px); }
}

/* =====================================================================
   Nav
   ===================================================================== */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 16px 32px;
  max-width: var(--container);
  margin: 0 auto;
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  background: rgba(10, 11, 20, 0.6);
  border-bottom: 1px solid var(--border);
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.nav__brand-icon {
  filter: drop-shadow(0 0 12px rgba(204, 91, 79, 0.5));
}

.nav__links {
  display: flex;
  gap: 28px;
  margin-left: auto;
  font-size: 14px;
  color: var(--text-dim);
}
.nav__links a {
  position: relative;
}
.nav__links a:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.22s ease;
}
.nav__links a:hover::after {
  transform: scaleX(1);
}

.nav__tools {
  display: flex;
  gap: 12px;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.lang-toggle:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}
.lang-toggle__sep {
  opacity: 0.4;
}
.lang-toggle [data-lang-label].is-active {
  color: var(--text);
  font-weight: 700;
}

@media (max-width: 720px) {
  .nav { padding: 12px 18px; gap: 16px; }
  .nav__links { display: none; }
}

/* =====================================================================
   Layout
   ===================================================================== */

main {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 32px;
}

section {
  padding: 96px 0;
}

@media (max-width: 720px) {
  main { padding: 0 18px; }
  section { padding: 64px 0; }
}

/* =====================================================================
   Buttons
   ===================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  box-shadow: 0 8px 24px -8px rgba(124, 58, 237, 0.7);
}
.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px -8px rgba(124, 58, 237, 0.9);
  color: #fff;
}

.btn--ghost {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-strong);
  backdrop-filter: blur(8px);
}
.btn--ghost:hover {
  background: var(--surface-2);
  border-color: var(--violet-2);
  color: var(--text);
}

/* =====================================================================
   Hero
   ===================================================================== */

.hero {
  padding: 64px 0 80px;
}
.hero__inner {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  align-items: center;
  gap: 48px;
}
@media (max-width: 880px) {
  .hero__inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--violet-2);
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 999px;
  margin-bottom: 24px;
}
.hero__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--violet-2);
  box-shadow: 0 0 10px var(--violet-2);
  animation: pulseDot 2s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero__title {
  font-size: clamp(36px, 5.5vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 800;
  margin: 0 0 24px;
}
html[lang="zh"] .hero__title {
  letter-spacing: -0.01em;
  line-height: 1.18;
}

.grad-text {
  background: linear-gradient(135deg, #a78bfa 0%, #67e8f9 50%, #f472b6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__sub {
  font-size: 18px;
  line-height: 1.65;
  color: var(--text-dim);
  margin: 0 0 32px;
  max-width: 560px;
}
@media (max-width: 880px) {
  .hero__sub { margin-left: auto; margin-right: auto; }
}

.hero__cta {
  display: flex;
  gap: 14px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}
@media (max-width: 880px) {
  .hero__cta { justify-content: center; }
}

.hero__bullets {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  color: var(--text-dim);
}
.hero__bullets li {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero__bullets svg {
  flex-shrink: 0;
  color: var(--green);
}
@media (max-width: 880px) {
  .hero__bullets li { justify-content: center; }
}

/* Hero visual — animated logo on glow ring */
.hero__visual {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 360px;
}
.logo-stage {
  position: relative;
  width: 320px;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-stage__logo {
  width: 240px;
  height: 240px;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 40px rgba(204, 91, 79, 0.6))
    drop-shadow(0 0 80px rgba(124, 58, 237, 0.35));
  animation: floatLogo 6s ease-in-out infinite;
}
@keyframes floatLogo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.logo-stage__ring,
.logo-stage__ring--2 {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(124, 58, 237, 0.35);
  inset: 0;
  animation: ringPulse 4s ease-in-out infinite;
}
.logo-stage__ring--2 {
  inset: -40px;
  border-color: rgba(6, 182, 212, 0.25);
  animation-delay: 2s;
}
@keyframes ringPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.1; transform: scale(1.08); }
}

/* =====================================================================
   Showcase
   ===================================================================== */

.showcase {
  padding-top: 24px;
}
.showcase__frame {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 8px;
  background: linear-gradient(135deg,
    rgba(124, 58, 237, 0.4),
    rgba(6, 182, 212, 0.3),
    rgba(244, 114, 182, 0.3));
  box-shadow: var(--shadow-glow);
  isolation: isolate;
}
.showcase__frame::before {
  content: "";
  position: absolute;
  inset: -80px -40px;
  z-index: -1;
  background: radial-gradient(ellipse at center,
    rgba(124, 58, 237, 0.25) 0%,
    transparent 60%);
  filter: blur(40px);
  pointer-events: none;
}
.showcase__svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  background: var(--bg);
}
.showcase__caption {
  text-align: center;
  font-size: 13px;
  color: var(--text-mute);
  margin-top: 18px;
}

/* =====================================================================
   Section headers
   ===================================================================== */

.section-head {
  text-align: center;
  margin: 0 auto 56px;
  max-width: 720px;
}
.section-head__title {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 800;
  margin: 0 0 16px;
}
.section-head__sub {
  font-size: 17px;
  color: var(--text-dim);
  margin: 0;
}
.section-head__sub a {
  color: var(--violet-2);
  border-bottom: 1px dashed var(--violet);
}

/* =====================================================================
   Features grid
   ===================================================================== */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 980px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .feature-grid { grid-template-columns: 1fr; }
}

.feature {
  position: relative;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  transition: all 0.25s ease;
  overflow: hidden;
}
.feature::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.18),
    transparent);
}
.feature:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.feature__icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  margin-bottom: 16px;
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(124, 58, 237, 0.3);
  color: var(--violet-2);
}
.feature__icon svg {
  width: 22px;
  height: 22px;
}
.feature__icon--cyan {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.3);
  color: var(--cyan-2);
}
.feature__icon--rose {
  background: rgba(244, 114, 182, 0.12);
  border-color: rgba(244, 114, 182, 0.3);
  color: var(--rose);
}
.feature__icon--amber {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.3);
  color: var(--amber);
}
.feature__icon--green {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.3);
  color: var(--green);
}

.feature h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.feature p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-mute);
  margin: 0;
}

/* =====================================================================
   Stats
   ===================================================================== */

.stats {
  padding: 48px 0;
}
.stats__row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 36px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
}
@media (max-width: 720px) {
  .stats__row { grid-template-columns: repeat(2, 1fr); padding: 24px 16px; }
}

.stats__item {
  text-align: center;
}
.stats__num {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--violet-2), var(--cyan-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
  margin-bottom: 6px;
}
.stats__label {
  font-size: 12px;
  color: var(--text-mute);
  letter-spacing: 0.02em;
}

/* =====================================================================
   Download
   ===================================================================== */

.download-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}
@media (max-width: 880px) {
  .download-grid { grid-template-columns: 1fr; }
}

.dl-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  transition: all 0.25s ease;
  text-decoration: none;
  color: var(--text);
}
.dl-card:hover {
  background: var(--surface-2);
  border-color: var(--violet-2);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px -16px rgba(124, 58, 237, 0.6);
  color: var(--text);
}

.dl-card__icon {
  width: 36px;
  height: 36px;
  color: var(--text);
  margin-bottom: 18px;
}
.dl-card__os {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.dl-card__hint {
  font-size: 13px;
  color: var(--text-mute);
  margin-bottom: 18px;
}
.dl-card__cta {
  margin-top: auto;
  font-size: 14px;
  font-weight: 600;
  color: var(--violet-2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.2s ease;
}
.dl-card:hover .dl-card__cta {
  gap: 8px;
}

.download__note {
  text-align: center;
  font-size: 13px;
  color: var(--text-mute);
  margin: 0;
}
.download__note a {
  color: var(--violet-2);
}

/* =====================================================================
   Install (CLI section)
   ===================================================================== */

.install__inner {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 48px;
  align-items: center;
}
@media (max-width: 880px) {
  .install__inner { grid-template-columns: 1fr; }
}

.install__title {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 800;
  margin: 16px 0;
}
.install__sub {
  font-size: 16px;
  color: var(--text-dim);
  line-height: 1.65;
  margin: 0 0 24px;
}

/* Terminal block */
.shell {
  position: relative;
  background: linear-gradient(180deg, #11131e 0%, #0a0b14 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(124, 58, 237, 0.1);
}
.shell__head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-mute);
}
.shell__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.shell__title {
  margin-left: 8px;
  font-family: var(--font-mono);
}
.shell__body {
  margin: 0;
  padding: 20px 22px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  color: #d4d6e9;
  overflow-x: auto;
  white-space: pre;
}
.shell__body code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.t-mut { color: var(--violet-2); }
.t-cmd { color: #fff; font-weight: 600; }
.t-dim { color: var(--text-mute); }
.t-ok { color: var(--green); }
.t-link { color: var(--cyan-2); text-decoration: underline; text-decoration-style: dotted; }

.shell__copy {
  position: absolute;
  top: 12px;
  right: 16px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.shell__copy:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--violet-2);
}
.shell__copy.is-copied {
  color: var(--green);
  border-color: var(--green);
}

/* =====================================================================
   Footer
   ===================================================================== */

.footer {
  margin-top: 48px;
  padding: 40px 0 56px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  text-align: center;
}
.footer__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
}
.footer__tag {
  color: var(--text-mute);
  font-weight: 400;
  font-size: 14px;
}
.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  font-size: 14px;
  color: var(--text-dim);
}
.footer__meta {
  display: flex;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-mute);
}

/* =====================================================================
   Lang-specific hidden text (set by JS)
   ===================================================================== */

[data-i18n] {
  /* default visible; JS swaps innerHTML */
}

/* Reduce motion respect */
@media (prefers-reduced-motion: reduce) {
  /* user prefers reduced motion — but per project guidance, app-level */
  /* sites don't honour OS pref. This is the marketing site, where it's */
  /* appropriate to honour it. */
  .bg-orb, .logo-stage__logo, .logo-stage__ring,
  .hero__dot { animation: none; }
  * { transition-duration: 0.001ms !important; scroll-behavior: auto; }
}
