/* === Google Fonts 已在 HTML 中引入 === */
/* Caveat (手写英文) · Ma Shan Zheng (中文行楷) · ZCOOL XiaoWei (中文艺术) */

/* === 全局 === */
:root {
  --bg: #000000;
  --bg2: #0a0a0a;
  --fg: #ffffff;
  --fg2: #d1d1d6;
  --fg3: #a1a1aa;

  --accent:   #ffffff;
  --red:      #ff453a;

  /* 实底卡片 + 清晰边框 */
  --card-bg:  rgba(18, 18, 20, 0.92);
  --card-border: rgba(255,255,255,0.12);

  /* 字体 */
  --font-hand:  'Caveat', cursive;
  --font-cn:    'Ma Shan Zheng', 'ZCOOL XiaoWei', cursive;
  --font-mono:  'Courier New', 'Source Code Pro', 'Consolas', monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-mono);
  background: transparent;
  color: var(--fg);
  line-height: 1.7;
  overflow-x: hidden;
}

a { text-decoration: none; transition: color 0.2s; }
a:hover { text-decoration: underline; }

/* ============================================================
   视频背景
   ============================================================ */
#bg-video {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: -2;
  filter: brightness(0.35);
}

/* 全页面暗色纱幕——保证任何位置文字都清晰 */
body::after {
  content: '';
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.55);
  z-index: -1;
  pointer-events: none;
}

/* ============================================================
   登录门 (全屏)
   ============================================================ */
#login-gate {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(16px) saturate(0.3);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.8s ease, transform 0.8s ease;
}
#login-gate.fade-out {
  opacity: 0; transform: scale(1.05);
  pointer-events: none;
}

.gate-inner {
  position: relative; z-index: 2;
  text-align: center;
  max-width: 500px; width: 100%;
  padding: 0 24px;
}

/* 名字——Apple 开机风格：纯白慢现 + 柔光 */
.gate-name {
  font-family: var(--font-hand);
  font-size: 5rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 0 80px rgba(255,255,255,0.3), 0 0 120px rgba(255,255,255,0.1);
  margin-bottom: 8px;
  letter-spacing: 2px;
  animation: apple-reveal 2.8s cubic-bezier(0.25, 0.1, 0.25, 1.0) forwards,
             apple-breath 6s 3s ease-in-out infinite;
}
@keyframes apple-reveal {
  0%   { opacity: 0; transform: scale(0.92); text-shadow: 0 0 0px rgba(255,255,255,0); }
  50%  { opacity: 0.6; transform: scale(1.0); text-shadow: 0 0 40px rgba(255,255,255,0.15); }
  100% { opacity: 1; transform: scale(1.0); text-shadow: 0 0 80px rgba(255,255,255,0.3), 0 0 120px rgba(255,255,255,0.1); }
}
@keyframes apple-breath {
  0%, 100% { text-shadow: 0 0 80px rgba(255,255,255,0.3), 0 0 120px rgba(255,255,255,0.1); }
  50% { text-shadow: 0 0 100px rgba(255,255,255,0.45), 0 0 160px rgba(255,255,255,0.18); }
}

/* 副标题 */
.gate-subtitle {
  font-family: var(--font-cn);
  font-size: 1.2rem;
  color: var(--fg3);
  margin-bottom: 48px;
  letter-spacing: 3px;
  animation: apple-fade-up 2.2s 0.5s cubic-bezier(0.25, 0.1, 0.25, 1.0) both;
}
@keyframes apple-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 登录表单延迟浮现 */
.gate-form-wrap {
  text-align: left;
  animation: apple-fade-up 2.2s 0.9s cubic-bezier(0.25, 0.1, 0.25, 1.0) both;
}

/* 底部提示最后浮现 */
.gate-hint {
  margin-top: 36px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #48484d;
  animation: apple-fade-up 2.2s 1.4s cubic-bezier(0.25, 0.1, 0.25, 1.0) both;
}

.gate-input-row {
  display: flex; align-items: center;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 10px 16px;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.gate-input-row:focus-within {
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.08);
}
.gate-prompt {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--fg2);
  white-space: nowrap;
  margin-right: 10px;
}
.gate-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  outline: none;
}
.gate-input-row input::placeholder {
  color: #555560;
}

.gate-btn {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.9rem; font-weight: 400;
  letter-spacing: 3px;
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.gate-btn:hover {
  background: rgba(255, 255, 255, 0.92);
  border-color: #ffffff;
  color: #000;
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.25);
}
.gate-btn.loading .gate-btn-text { display: none; }
.gate-btn.loading .gate-btn-load { display: inline; }
.gate-btn-load { display: none; }

.gate-error {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  margin-top: 12px;
  text-align: center;
  min-height: 20px;
}

.gate-hint::before {
  content: '';
  display: block; width: 40px; height: 1px;
  background: var(--border);
  margin: 0 auto 16px;
}

/* ============================================================
   主站点 (初始隐藏)
   ============================================================ */
#site-content {
  display: none;
  animation: site-reveal 0.7s ease;
}
#site-content.visible {
  display: block;
}
@keyframes site-reveal {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === 导航 === */
#navbar {
  position: fixed; top: 0; width: 100%; z-index: 100;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.nav-inner {
  max-width: 1000px; margin: 0 auto; padding: 0 24px;
  display: flex; justify-content: space-between; align-items: center;
  height: 56px;
}
.logo {
  font-family: var(--font-hand);
  font-size: 1.6rem; font-weight: 700;
  color: var(--fg);
}
.nav-links { list-style: none; display: flex; gap: 28px; }
.nav-links a {
  color: var(--fg3); font-size: 0.85rem;
  font-family: var(--font-mono);
  position: relative;
  letter-spacing: 1px;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: -4px; left: 0;
  width: 0; height: 1px; border-radius: 1px;
  background: rgba(255,255,255,0.4);
  transition: width 0.4s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}
.nav-links a:hover { color: #fff; text-decoration: none; }
.nav-links a:hover::after { width: 100%; }

.menu-toggle { display: none; background: none; border: none; color: var(--fg); font-size: 1.6rem; cursor: pointer; }

/* === Hero (登录后欢迎) === */
#home {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 80px 24px 40px;
  background: transparent;
}
.hero { text-align: center; max-width: 700px; }

.gate-welcome {
  font-family: var(--font-hand);
  font-size: 3.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: #ffffff;
  text-shadow: 0 0 60px rgba(255,255,255,0.2);
}
.gate-welcome span {
  font-family: var(--font-cn);
  color: #ffffff;
}

/* 旧 h1 glitch 保留给 blog 文章等使用 */
.hero h1.glitch {
  font-size: 4rem; color: var(--fg); margin-bottom: 16px;
  letter-spacing: 4px;
  font-family: var(--font-cn);
}
.glitch {
  position: relative;
  animation: glitch-skew 4s infinite linear alternate-reverse;
}
.glitch::before, .glitch::after {
  content: attr(data-text); position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; opacity: 0.4;
}
.glitch::before {
  color: rgba(255,255,255,0.3); z-index: -1;
  animation: glitch-anim 2s infinite linear alternate-reverse;
}
.glitch::after {
  color: rgba(255,255,255,0.15); z-index: -2;
  animation: glitch-anim 3s infinite linear alternate-reverse;
}
@keyframes glitch-anim {
  0%, 100% { transform: translate(0); }
  33% { transform: translate(-2px, 1px); }
  66% { transform: translate(2px, -1px); }
}
@keyframes glitch-skew {
  0%, 100% { transform: skew(0deg); }
  50% { transform: skew(0.3deg); }
}

.subtitle {
  font-family: var(--font-cn);
  font-size: 1.1rem; color: var(--fg3); margin-bottom: 8px;
  display: inline-block;
}
.subtitle::after {
  content: '';
  /* 去掉闪烁光标，Apple风格不搞这个 */
}
.tagline {
  font-family: var(--font-mono);
  color: var(--fg3); margin-bottom: 24px; font-size: 0.9rem;
}
.hero-badges { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.badge {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.18);
  padding: 6px 16px; border-radius: 20px; font-size: 0.82rem;
  font-family: var(--font-mono);
  color: var(--fg2);
  animation: badge-pulse 4s ease-in-out infinite;
}
.badge:nth-child(2) { animation-delay: 0.6s; }
.badge:nth-child(3) { animation-delay: 1.2s; }
.badge:nth-child(4) { animation-delay: 1.8s; }
@keyframes badge-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* === 通用 Section === */
section { padding: 80px 24px; }
.section-title {
  font-family: var(--font-cn);
  font-size: 2.2rem; margin-bottom: 48px;
  text-align: center;
  letter-spacing: 2px;
  color: #ffffff;
  font-weight: 400;
}
.section-title::before { content: "// "; color: var(--fg3); font-family: var(--font-mono); font-size: 1.1rem; }
.section-title::after  { content: ""; }

/* === About === */
.about-grid {
  max-width: 1000px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.about-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px; padding: 32px;
  transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
}
.about-card h3 {
  font-family: var(--font-cn);
  margin-bottom: 16px; font-size: 1.25rem;
  color: #ffffff; font-weight: 400;
  letter-spacing: 1px;
}
.about-card ul { list-style: none; }
.about-card li {
  padding: 6px 0; font-size: 0.95rem;
  color: var(--fg2); line-height: 1.6;
}
.about-card:hover {
  border-color: rgba(255,255,255,0.3);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  transform: translateY(-4px);
}

/* === Blog === */
.blog-grid {
  max-width: 1000px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}
.blog-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px; padding: 32px;
  transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
}
.blog-card:hover {
  border-color: rgba(255,255,255,0.3);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  transform: translateY(-4px);
}
.blog-card .date {
  font-size: 0.8rem; color: var(--fg3); margin-bottom: 10px;
  font-family: var(--font-mono);
}
.blog-card h3 {
  color: #ffffff;
  font-family: var(--font-cn);
  margin-bottom: 10px; font-size: 1.2rem;
  font-weight: 400;
  letter-spacing: 1px;
}
.blog-card p { font-size: 0.95rem; color: var(--fg2); line-height: 1.6; }

/* === Projects === */
.project-grid {
  max-width: 1000px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}
.project-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px; padding: 32px;
  transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
}
.project-card h3 {
  font-family: var(--font-cn);
  margin-bottom: 10px; font-size: 1.15rem;
  color: #ffffff; font-weight: 400;
  letter-spacing: 1px;
}
.project-card p { font-size: 0.95rem; color: var(--fg2); margin-bottom: 14px; line-height: 1.6; }
.project-card:hover {
  border-color: rgba(255,255,255,0.3);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  transform: translateY(-4px);
}
.tag {
  background: rgba(255,255,255,0.1);
  color: var(--fg2);
  padding: 3px 12px; border-radius: 6px;
  font-size: 0.75rem; font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

/* === Contact === */
.contact-content { text-align: center; }
.contact-content p { margin-bottom: 12px; font-size: 1.05rem; }
.contact-content a { color: var(--fg2); }
.contact-content a:hover { color: var(--fg); }

/* === Footer === */
footer {
  text-align: center; padding: 24px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(255,255,255,0.05);
  color: var(--fg3); font-size: 0.78rem;
}

/* ============================================================
   滚动揭示
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   成功登录提示
   ============================================================ */
.login-toast {
  position: fixed; top: 30px; left: 50%; transform: translateX(-50%);
  z-index: 10001;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: rgba(0,0,0,0.95);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--fg);
  padding: 12px 28px;
  border-radius: 10px;
  backdrop-filter: blur(20px);
  animation: toast-in 0.5s cubic-bezier(0.25,0.1,0.25,1), toast-out 0.4s ease 2s forwards;
}
@keyframes toast-in  { from { opacity: 0; transform: translateX(-50%) translateY(-20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(-50%) translateY(-20px); } }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 768px) {
  .gate-name { font-size: 3.5rem; }
  .gate-welcome { font-size: 2.2rem; }
  .nav-links { display: none; }
  .nav-links.open { display: flex; flex-direction: column; position: absolute; top: 56px; left: 0; right: 0; background: var(--bg2); padding: 16px 24px; border-bottom: 1px solid var(--border); }
  .menu-toggle { display: block; }
  section { padding: 60px 16px; }
  .section-title { font-size: 1.5rem; }
}

/* ============================================================
   Blog 文章页
   ============================================================ */
.blog-article h1 {
  font-family: var(--font-cn);
  color: var(--fg);
  font-weight: 400;
}
.blog-post { max-width: 760px; margin: 0 auto; }
.blog-post h2 {
  color: var(--fg); margin: 32px 0 16px;
  font-size: 1.3rem; font-family: var(--font-cn); font-weight: 400;
}
.blog-post h3 {
  color: var(--fg2); margin: 24px 0 12px;
  font-family: var(--font-cn); font-weight: 400;
}
.blog-post p { margin-bottom: 16px; color: var(--fg3); }
.blog-post pre {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); border-radius: 8px;
  padding: 18px; overflow-x: auto; font-size: 0.85rem; margin-bottom: 16px;
  color: var(--fg);
}
.blog-post code {
  background: rgba(255,255,255,0.08); padding: 2px 6px; border-radius: 4px; font-size: 0.88rem;
  color: var(--fg2);
}
.blog-post pre code { background: none; padding: 0; }
.blog-post ul, .blog-post ol { margin: 0 0 16px 24px; color: var(--fg3); }
.blog-post li { margin-bottom: 6px; }
.blog-post .back-link {
  display: inline-block; margin-top: 40px;
  color: var(--fg3); font-family: var(--font-mono);
}
