/* =========================================================
   shiro 个人网站 · 全局样式
   支持深色/浅色主题切换、响应式布局
   ========================================================= */

:root {
  --bg: #f6f7fb;
  --bg-alt: #eef0f6;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --text: #141827;
  --text-muted: #5b6472;
  --border: #e4e7ee;
  --accent1: #6366f1;
  --accent2: #22d3ee;
  --grad: linear-gradient(120deg, #6366f1 0%, #8b5cf6 45%, #22d3ee 100%);
  --grad-soft: linear-gradient(120deg, rgba(99,102,241,.12), rgba(34,211,238,.12));
  --nav-bg: rgba(255, 255, 255, 0.78);
  --shadow: 0 12px 40px rgba(23, 28, 51, 0.08);
  --shadow-sm: 0 4px 14px rgba(23, 28, 51, 0.06);
}

[data-theme="dark"] {
  --bg: #0b0e15;
  --bg-alt: #0f131d;
  --surface: #141926;
  --surface-2: #1a2030;
  --text: #e7eaf1;
  --text-muted: #9aa4b5;
  --border: #232b3b;
  --nav-bg: rgba(11, 14, 21, 0.72);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.35);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB",
    "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- 通用 ---------- */
.gradient-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.section {
  padding: 84px 0;
}

.section-head {
  margin-bottom: 44px;
}

.section-eyebrow {
  display: inline-block;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent1);
  font-weight: 700;
  margin-bottom: 8px;
}

.section-title {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.25;
}

.section-desc {
  color: var(--text-muted);
  margin-top: 12px;
  max-width: 640px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.45);
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  border-color: var(--accent1);
  color: var(--accent1);
}

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.2s ease;
}

.site-header.scrolled {
  box-shadow: var(--shadow-sm);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand .dot {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-link.active {
  color: var(--text);
  background: var(--grad-soft);
  font-weight: 600;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--accent1);
  transform: rotate(12deg);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  cursor: pointer;
}

.nav-toggle span {
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 96px 0 72px;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -180px;
  right: -120px;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(99,102,241,.22), transparent 65%);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  bottom: -160px;
  left: -120px;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(34,211,238,.18), transparent 65%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 48px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--grad-soft);
  color: var(--accent1);
  margin-bottom: 22px;
}

.hero-badge .pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.hero h1 {
  font-size: clamp(38px, 7vw, 64px);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -1.5px;
  margin-bottom: 18px;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 480px;
  margin-bottom: 30px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-visual {
  display: grid;
  place-items: center;
}

.avatar-ring {
  position: relative;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: var(--grad);
  padding: 4px;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}

.avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 96px;
  font-weight: 800;
  color: var(--text);
}

.avatar-inner .gradient-text {
  font-size: clamp(72px, 12vw, 108px);
}

/* ---------- 关于 ---------- */
.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.info-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.info-card .ico {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--grad-soft);
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  color: var(--accent1);
}

.info-card .ico svg {
  width: 22px;
  height: 22px;
}

.info-card h3 {
  font-size: 17px;
  margin-bottom: 6px;
}

.info-card p {
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- 卡片网格（项目/博客） ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
  border-color: rgba(99, 102, 241, 0.4);
}

.card-media {
  height: 150px;
  background: var(--grad-soft);
  display: grid;
  place-items: center;
  font-size: 44px;
}

.card-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-tag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent1);
  text-transform: uppercase;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
}

.card-text {
  color: var(--text-muted);
  font-size: 14px;
  flex: 1;
}

.card-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.card-link:hover {
  text-decoration: underline;
}

/* ---------- 联系 ---------- */
.contact-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.contact-item:hover {
  border-color: var(--accent1);
  transform: translateX(4px);
}

.contact-item .ico {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--grad-soft);
  display: grid;
  place-items: center;
  color: var(--accent1);
  flex-shrink: 0;
}

.contact-item .ico svg {
  width: 20px;
  height: 20px;
}

.contact-item .label {
  font-size: 13px;
  color: var(--text-muted);
}

.contact-item .value {
  font-size: 15px;
  font-weight: 600;
  word-break: break-all;
}

.form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form label {
  font-size: 14px;
  font-weight: 600;
}

.form input,
.form textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.form input:focus,
.form textarea:focus {
  outline: none;
  border-color: var(--accent1);
}

.form textarea {
  min-height: 120px;
  resize: vertical;
}

.form-note {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 36px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.site-footer .brand {
  font-size: 18px;
  margin-bottom: 8px;
}

/* ---------- 404 ---------- */
.error-wrap {
  min-height: 70vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 60px 24px;
}

.error-code {
  font-size: clamp(80px, 20vw, 160px);
  font-weight: 800;
  line-height: 1;
  margin-bottom: 8px;
}

/* ---------- 滚动出现动画 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 32px;
  }
  .hero-subtitle,
  .hero-actions {
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
  }
  .about-grid,
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .contact-wrap {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .nav {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
  }
  .nav.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .nav-link {
    text-align: center;
  }
  .nav-toggle {
    display: flex;
  }
  .about-grid,
  .grid {
    grid-template-columns: 1fr;
  }
  .avatar-ring {
    width: 220px;
    height: 220px;
  }
  .section {
    padding: 60px 0;
  }
}
