/**
 * 码上编程 — 统一主题样式
 *
 * 设计语言：暗底暖金 · 墨韵书阁风格
 * 字体：系统宋体（正文）+ Ma Shan Zheng（标题/品牌）
 * 配色：暗底 #0b0a09 + 金色 #c8a45c + 朱红 #c0504d
 */

/* ===== Google Fonts ===== */
/* 需要在 HTML 中引入：
   <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@300;400;600;700;900&family=Ma+Shan+Zheng&display=swap" rel="stylesheet">
*/

/* ===== CSS Variables ===== */
:root {
  --bg: #0b0a09;
  --bg-warm: #12110f;
  --surface: #1a1815;
  --surface-raised: #23201c;
  --accent: #c8a45c;
  --accent-dim: #a0833e;
  --accent-glow: #c8a45c33;
  --text-primary: #f0e8d8;
  --text-secondary: #b8a88c;
  --text-muted: #6b5f4f;
  --red-accent: #8b3a3a;
  --red-bright: #c0504d;
  --ink: #2a2520;
  --border: #2e2923;
  --serif: 'STSong', 'SimSun', 'Songti SC', serif;
  --display: 'Ma Shan Zheng', 'STKaiti', cursive;
}

/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* ===== Base ===== */
body {
  font-family: var(--serif);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.8;
  overflow-x: hidden;
}

/* Noise texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  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)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 9999;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent-dim); border-radius: 3px; }

/* ===== Navigation ===== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: 0 3rem;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(11,10,9,0.95) 0%, rgba(11,10,9,0.7) 70%, transparent 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.4s ease;
}

.nav.scrolled {
  background: rgba(11,10,9,0.97);
  box-shadow: 0 1px 0 var(--border);
}

.nav-brand {
  font-family: var(--display);
  font-size: 1.6rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-brand .seal {
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--red-bright);
  color: var(--red-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-family: var(--display);
  transform: rotate(-5deg);
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  align-items: center;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  transition: color 0.3s ease;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.nav-links a:hover { color: var(--text-primary); }
.nav-links a:hover::after { width: 100%; }

/* ===== Buttons ===== */
.btn-primary {
  display: inline-block;
  padding: 0.85rem 2.5rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s ease;
}

.btn-primary:hover::before { left: 100%; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px var(--accent-glow); }

.btn-ghost {
  display: inline-block;
  padding: 0.85rem 2rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-family: var(--serif);
  font-size: 0.95rem;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all 0.3s ease;
  text-decoration: none;
}

.btn-ghost:hover { border-color: var(--accent-dim); color: var(--text-primary); }

.btn-nav {
  padding: 0.45rem 1.4rem;
  background: transparent;
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  font-family: var(--serif);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.05em;
  text-decoration: none;
}

.btn-nav:hover { background: var(--accent); color: var(--bg); }

/* ===== Section ===== */
.section { padding: 6rem 4rem; }
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 3rem;
}

.section-title {
  font-family: var(--display);
  font-size: 2rem;
  color: var(--text-primary);
  position: relative;
  padding-left: 1.5rem;
}

.section-title::before {
  content: '';
  position: absolute;
  left: 0; top: 0.3rem; bottom: 0.3rem;
  width: 3px;
  background: var(--accent);
}

.section-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.section-more {
  color: var(--accent-dim);
  text-decoration: none;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 0.3s ease;
  letter-spacing: 0.05em;
}

.section-more:hover { color: var(--accent); }

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-3px);
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 0; height: 100%;
  background: linear-gradient(90deg, var(--accent-glow), transparent);
  transition: width 0.5s ease;
}

.card:hover::before { width: 100%; }

/* ===== Particles ===== */
.particles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.particle {
  position: absolute;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat 8s infinite ease-in-out;
}

.particle:nth-child(1) { width: 3px; height: 3px; top: 20%; left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { width: 2px; height: 2px; top: 40%; left: 80%; animation-delay: 1.5s; }
.particle:nth-child(3) { width: 4px; height: 4px; top: 60%; left: 30%; animation-delay: 3s; }
.particle:nth-child(4) { width: 2px; height: 2px; top: 35%; left: 60%; animation-delay: 4.5s; }
.particle:nth-child(5) { width: 3px; height: 3px; top: 75%; left: 70%; animation-delay: 6s; }
.particle:nth-child(6) { width: 2px; height: 2px; top: 15%; left: 45%; animation-delay: 2s; }

@keyframes particleFloat {
  0%, 100% { opacity: 0; transform: translateY(0) scale(0.5); }
  25% { opacity: 0.6; }
  50% { opacity: 0.3; transform: translateY(-60px) scale(1); }
  75% { opacity: 0.5; }
}

/* ===== Form Elements ===== */
.field { margin-bottom: 1.2rem; }

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  letter-spacing: 0.03em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-primary);
  font-family: var(--serif);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.3s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-muted);
}

/* ===== Alerts ===== */
.alert {
  padding: 0.8rem 1rem;
  margin-bottom: 1.2rem;
  font-size: 0.85rem;
  border-left: 3px solid;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.alert-error {
  background: rgba(139,58,58,0.1);
  border-color: var(--red-bright);
  color: #e8a8a8;
}

.alert-success {
  background: rgba(100,164,92,0.1);
  border-color: #6ba85c;
  color: #a8e8a8;
}

.alert-info {
  background: rgba(200,164,92,0.1);
  border-color: var(--accent);
  color: var(--text-secondary);
}

/* ===== Tags ===== */
.tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  font-size: 0.7rem;
  border: 1px solid var(--border);
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.tag.hot { border-color: var(--red-accent); color: var(--red-bright); }

/* ===== Divider ===== */
.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider span {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ===== Social Login Buttons ===== */
.social { display: flex; flex-direction: column; gap: 0.6rem; }

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.7rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-secondary);
  font-family: var(--serif);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.03em;
}

.social-btn:hover {
  border-color: var(--accent-dim);
  color: var(--text-primary);
}

/* ===== Footer ===== */
.footer {
  padding: 4rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-brand {
  font-family: var(--display);
  font-size: 1.8rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.footer-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.8;
  max-width: 320px;
}

.footer-col h4 {
  font-size: 0.85rem;
  color: var(--text-primary);
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
  font-weight: 600;
}

.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.6rem; }

.footer-col a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.3s ease;
}

.footer-col a:hover { color: var(--accent); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== Animations ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(25px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-6deg); }
  75% { transform: rotate(6deg); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
  .section { padding: 5rem 3rem; }
}

@media (max-width: 968px) {
  .nav { padding: 0 1.5rem; }
  .nav-links { display: none; }
  .section { padding: 4rem 1.5rem; }
  .footer-content { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .footer-content { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 0.5rem; text-align: center; }
}
