/* === 墨迹 Blog — Shared Styles === */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Noto+Serif+SC:wght@400;600;700;900&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  --radius: 16px;
  --serif: 'Playfair Display', 'Noto Serif SC', serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

/* Dark (default) */
:root,
[data-theme="dark"] {
  --bg: #0c0c0e;
  --bg-card: #141416;
  --bg-elevated: #1a1a1e;
  --text: #e8e6e3;
  --text-dim: #8a8a8a;
  --text-muted: #555;
  --accent: #c9a96e;
  --accent-dim: #c9a96e22;
  --accent-glow: #c9a96e44;
  --border: #222228;
  --border-light: #2a2a30;
  --code-bg: #111114;
  --grain-opacity: 0.03;
  --header-bg: rgba(12,12,14,0.8);
  --shadow-accent: rgba(201,169,110,0.25);
}

/* Light */
[data-theme="light"] {
  --bg: #f5f3ef;
  --bg-card: #ffffff;
  --bg-elevated: #ece9e3;
  --text: #1a1a1e;
  --text-dim: #5a5a5a;
  --text-muted: #999;
  --accent: #9a7b3c;
  --accent-dim: #9a7b3c18;
  --accent-glow: #9a7b3c18;
  --border: #e2dfd9;
  --border-light: #d4d0c8;
  --code-bg: #eae7e1;
  --grain-opacity: 0.015;
  --header-bg: rgba(245,243,239,0.85);
  --shadow-accent: rgba(154,123,60,0.2);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Grain overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  opacity: var(--grain-opacity);
  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");
  pointer-events: none;
  z-index: 9999;
}

/* Cursor glow */
.glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 0;
  opacity: 0;
  transition: opacity 0.4s;
}
body:hover .glow { opacity: 1; }

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.05em;
}
.logo span { opacity: 0.5; }
.nav { display: flex; gap: 2rem; align-items: center; }
.nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.3s;
  position: relative;
}
.nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s;
}
.nav a:hover { color: var(--text); }
.nav a:hover::after { width: 100%; }
.nav a.active { color: var(--accent); }
.nav a.active::after { width: 100%; }

/* Auth shared */
.auth-wrapper {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem;
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.5s ease-out both;
}
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent 80%);
}
.auth-logo {
  text-align: center;
  margin-bottom: 2.5rem;
}
.auth-logo .logo-mark {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.auth-logo .logo-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}
.auth-tab {
  flex: 1;
  padding: 0.75rem 0;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.3s, border-color 0.3s;
  background: none;
  border-top: none; border-left: none; border-right: none;
  font-family: var(--sans);
  text-decoration: none;
  display: block;
}
.auth-tab:hover { color: var(--text-dim); }
.auth-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Form */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  letter-spacing: 0.03em;
}
.form-input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  font-size: 0.82rem;
}
.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dim);
  cursor: pointer;
}
.form-check input[type="checkbox"] {
  appearance: none;
  width: 16px; height: 16px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  background: var(--bg-elevated);
  cursor: pointer;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}
.form-check input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.form-check input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--bg);
  font-weight: 700;
}
.form-link {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s;
}
.form-link:hover { opacity: 0.8; }

.btn-primary {
  width: 100%;
  padding: 0.85rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.3s;
  letter-spacing: 0.02em;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--shadow-accent);
}
.btn-primary:active { transform: translateY(0); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.auth-divider::before,
.auth-divider::after {
  content: ''; flex: 1; height: 1px;
  background: var(--border);
}
.btn-social {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  font-family: var(--sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: border-color 0.3s, background 0.2s;
  margin-bottom: 0.75rem;
}
.btn-social:hover {
  border-color: var(--border-light);
  background: var(--bg-card);
}
.btn-social svg { width: 18px; height: 18px; }

.auth-footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.auth-footer a {
  color: var(--accent);
  text-decoration: none;
}
.auth-footer a:hover { text-decoration: underline; }

.password-strength {
  display: flex;
  gap: 4px;
  margin-top: 0.5rem;
}
.strength-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s;
}
.strength-bar.weak { background: #e74c3c; }
.strength-bar.medium { background: #f39c12; }
.strength-bar.strong { background: #27ae60; }

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  transition: border-color 0.3s, color 0.3s, transform 0.3s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(20deg);
}

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeUp 0.6s ease-out both; }

/* Footer */
.footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.footer a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}
.footer a:hover { color: var(--accent); }

@media (max-width: 600px) {
  .header-inner { padding: 0.75rem 1rem; }
  .logo { font-size: 1.3rem; }
  .nav { gap: 1rem; }
  .nav a { font-size: 0.78rem; }
  .auth-card { padding: 2rem 1.5rem; }
  .form-row { flex-direction: column; gap: 0; }
  .footer { flex-direction: column; gap: 0.75rem; text-align: center; padding: 2rem 1.5rem; }
  .glow { display: none; }
}
@media (max-width: 400px) {
  .auth-card { padding: 1.75rem 1.25rem; border-radius: 12px; }
  .auth-logo .logo-mark { font-size: 1.6rem; }
  .form-input { font-size: 16px; padding: 0.7rem 0.9rem; }
  .btn-primary { font-size: 16px; }
  .auth-wrapper { padding: 1rem; }
}
