/* ========================================================================
   PCellAI — Design System & Styles
   Architecture: variables → base → layout → components → pages
   ======================================================================== */

/* ── Variables: Dark (default) ── */
:root,
[data-theme="dark"] {
  --font-display: "Space Grotesk", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --maxw: 1240px;
  --gut: clamp(20px, 5vw, 64px);
  --nav-h: 72px;

  --bg: #08080d;
  --bg-2: #0f0f17;
  --surface: rgba(255, 255, 255, 0.025);
  --surface-hi: rgba(255, 255, 255, 0.045);
  --border: rgba(255, 255, 255, 0.08);
  --border-hi: rgba(255, 255, 255, 0.16);
  --text: #ecedf2;
  --text-2: #9a9aae;
  --text-3: #56566a;
  --accent: #00e6ff;
  --accent-2: #a855f7;
  --accent-3: #3b82f6;
  --grad: linear-gradient(110deg, #00e6ff 0%, #a855f7 55%, #3b82f6 100%);
  --glow: 0 0 40px rgba(0, 230, 255, 0.18);
  --grid-line: rgba(255, 255, 255, 0.025);
  --noise-op: 0.035;
}

/* ── Variables: Light ── */
[data-theme="light"] {
  --bg: #f6f4ee;
  --bg-2: #efece4;
  --surface: rgba(0, 0, 0, 0.018);
  --surface-hi: rgba(0, 0, 0, 0.04);
  --border: rgba(0, 0, 0, 0.1);
  --border-hi: rgba(0, 0, 0, 0.2);
  --text: #1a1a22;
  --text-2: #5a5a68;
  --text-3: #9a9aa6;
  --accent: #0a7d8c;
  --accent-2: #7c3aed;
  --accent-3: #2563eb;
  --grad: linear-gradient(110deg, #0a7d8c 0%, #7c3aed 55%, #2563eb 100%);
  --glow: 0 0 32px rgba(10, 125, 140, 0.12);
  --grid-line: rgba(0, 0, 0, 0.025);
  --noise-op: 0.04;
}

/* ── Base ── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
  font-feature-settings: "ss01", "cv11";
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* ── Atmosphere ── */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 80%);
}

.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--noise-op);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Layout ── */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gut);
  position: relative;
  z-index: 1;
}

.section {
  padding: clamp(90px, 14vh, 180px) 0;
  position: relative;
}

/* ── Navigation ── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--border);
  transition: background 0.4s, border-color 0.4s;
}

.nav-inner {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gut);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: var(--glow);
}

.brand-logo {
  height: 28px;
  width: auto;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* 新版导航：图标img + HTML渐变文字（无字体加载依赖问题） */
.brand-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: inline-block;
}
.brand-word {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.12em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  /* Firefox 兼容：当 background-clip:text 不生效时，保留可见色兜底 */
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  font-size: 14px;
  color: var(--text-2);
  padding: 8px 14px;
  border-radius: 999px;
  transition: color 0.2s, background 0.2s;
  text-decoration: none;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: var(--surface);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: all 0.25s;
  font-size: 14px;
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-hi);
  background: var(--surface);
}

/* ── Typography ── */
.display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.96;
}

.mono {
  font-family: var(--font-mono);
}

.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.kicker::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--accent);
}

.gradient-text {
  background: var(--grad);
  -webkit-background-clip: text;
     -moz-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
          color: transparent;
}

.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-block;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: var(--glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 50px rgba(0, 230, 255, 0.3);
}

.btn-ghost {
  border: 1px solid var(--border-hi);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--surface);
  border-color: var(--accent);
}

/* ── Cards ── */
.card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 18px;
  padding: 32px;
  transition: border-color 0.3s, background 0.3s, transform 0.3s;
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-hi);
  background: var(--surface-hi);
  transform: translateY(-3px);
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.card:hover::after {
  opacity: 0.5;
}

/* ── Hero Section ── */
.hero {
  padding-top: calc(var(--nav-h) + clamp(60px, 10vh, 120px));
  padding-bottom: clamp(80px, 12vh, 160px);
  position: relative;
}

.hero-title {
  font-size: clamp(48px, 8vw, 96px);
  margin-top: 24px;
}

.hero-title span {
  display: block;
}

.hero-desc {
  margin-top: 28px;
  color: var(--text-2);
  font-size: 17px;
  max-width: 640px;
  line-height: 1.75;
}

.hero-desc--second {
  margin-top: 14px;
}

.hero-actions {
  margin-top: 40px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* ── About Section ── */
.about-content {
  max-width: 680px;
}

.about-content .display {
  font-size: clamp(36px, 5vw, 64px);
  margin-top: 20px;
}

.about-text {
  margin-top: 20px;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1.8;
}

.about-text + .about-text {
  margin-top: 16px;
}

/* ── Culture Values ── */
.values-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 56px;
}

.value-card {
  text-align: center;
  padding: 40px 24px;
}

.value-icon {
  font-size: 32px;
  margin-bottom: 16px;
}

.value-label {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.value-desc {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Products Section ── */
.products-header {
  margin-bottom: 56px;
  max-width: 720px;
}

.products-header .display {
  font-size: clamp(36px, 5vw, 64px);
  margin-top: 20px;
}

.products-subtitle {
  margin-top: 16px;
  color: var(--text-2);
  font-size: 17px;
}

.products-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-3);
  letter-spacing: 0.04em;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

/* ── Product Card ── */
.product-card-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-top: 16px;
}

.product-card-desc {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.7;
  margin-top: 12px;
}

.product-card-footer {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.coming-soon {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.06em;
}

/* ── Product Detail ── */
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 40px;
  text-decoration: none;
  transition: color 0.2s;
}

.detail-back:hover {
  color: var(--text);
}

.detail-name {
  font-size: clamp(36px, 5vw, 64px);
  margin-top: 16px;
}

.detail-desc {
  color: var(--text-2);
  font-size: 17px;
  line-height: 1.8;
  margin-top: 24px;
  max-width: 640px;
}

.detail-footer {
  margin-top: 40px;
}

/* ── Feedback Form ── */
.feedback-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 64px;
  align-items: start;
}

.feedback-info .display {
  font-size: clamp(36px, 5vw, 64px);
  margin-top: 20px;
}

.feedback-subtitle {
  color: var(--text-2);
  font-size: 16px;
  margin-top: 16px;
  line-height: 1.7;
}

.feedback-note {
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.6;
}

.form-group {
  margin-top: 24px;
}

.form-textarea {
  width: 100%;
  min-height: 140px;
  padding: 16px;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  resize: vertical;
  transition: border-color 0.2s, background 0.2s;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-hi);
}

.form-textarea::placeholder {
  color: var(--text-3);
}

.form-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.char-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
}

.char-count.warn {
  color: #ef4444;
}

.form-message {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  display: none;
}

.form-message.success {
  display: block;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22c55e;
}

.form-message.error {
  display: block;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.btn-submit {
  margin-top: 20px;
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Products Sub-nav Tabs ── */
.products-tabs {
  position: sticky;
  top: var(--nav-h);
  z-index: 99;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  transition: background 0.4s, border-color 0.4s;
}

.products-tabs .wrap {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.products-tab {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--text-3);
  padding: 6px 16px;
  border-radius: 999px;
  transition: all 0.2s;
  white-space: nowrap;
  text-decoration: none;
}

.products-tab:hover {
  color: var(--text);
  background: var(--surface);
}

.products-tab.active {
  color: var(--text);
  background: var(--surface-hi);
  border: 1px solid var(--border-hi);
}

/* ── View All Link ── */
.view-all {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  margin-top: 32px;
  transition: opacity 0.2s;
  text-decoration: none;
}

.view-all:hover {
  opacity: 0.8;
}

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 48px 0;
  color: var(--text-3);
  font-size: 13px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Page Header (for products/feedback pages) ── */
.page-top {
  padding-top: calc(var(--nav-h) + 60px);
}

/* ── Animations ── */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.rise {
  animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-link:not(.always) {
    display: none;
  }

  .section {
    padding: 80px 0;
  }

  .values-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .feedback-layout {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .products-grid {
    grid-template-columns: 1fr;
  }
}
