/* === Base === */
:root {
  --bg: #0d1117;
  --bg-alt: #0a0c10;
  --card: #161b22;
  --border: #21262d;
  --border-hover: #30363d;
  --text: #c9d1d9;
  --text-secondary: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --success: #3fb950;
  --focus: #2f81f7;
  --radius: 10px;
  --max-width: 1100px;
}

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

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.95em;
}

/* === Focus === */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  padding: 8px 16px;
  background: var(--accent);
  color: #000;
  text-decoration: none;
  font-weight: 600;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* === Layout === */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

@media (max-width: 480px) {
  .container {
    padding: 0 18px;
  }
}

/* === Header === */
.site-header {
  border-bottom: 1px solid var(--border);
  background-color: rgba(13, 17, 23, 0.95);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: none;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo:hover {
  color: var(--accent);
}

.nav-list {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}

.nav-list a:hover {
  color: var(--text);
}

@media (max-width: 560px) {
  .header-inner {
    height: auto;
    flex-direction: column;
    padding-top: 14px;
    padding-bottom: 14px;
    gap: 10px;
  }

  .nav-list {
    gap: 18px;
  }
}

/* === Hero === */
.hero {
  position: relative;
  padding: 110px 0 120px;
  overflow: hidden;
}

.hero-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 70%);
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.hero-kicker {
  margin: 0 0 14px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: #f0f6fc;
}

.hero-tagline {
  margin: 0 0 22px;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  color: var(--text);
  font-weight: 500;
}

.hero-intro {
  max-width: 620px;
  margin: 0 0 32px;
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.75;
}

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

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background-color: var(--accent);
  color: #03060a;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  box-shadow: 0 4px 18px rgba(88, 166, 255, 0.18);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text);
  border-color: var(--border-hover);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 420px) {
  .btn {
    width: 100%;
  }
}

/* === Sections === */
.section {
  padding: 72px 0;
}

.section-alt {
  background-color: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section h2 {
  margin: 0 0 36px;
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 700;
  color: #f0f6fc;
  letter-spacing: -0.02em;
}

/* === About === */
.about-content {
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.about-content p {
  margin: 0;
  color: var(--text);
  font-size: 1.03rem;
}

/* === Skills === */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.skill-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: border-color 180ms ease, transform 180ms ease;
}

.skill-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
}

.skill-card h3 {
  margin: 0 0 18px;
  font-size: 1.05rem;
  color: var(--accent);
  font-weight: 700;
}

.skill-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skill-list li {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.55;
}

.skill-list .mono {
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 860px) {
  .skills-grid {
    grid-template-columns: 1fr;
  }
}

/* === Projects === */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.project-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  display: flex;
  flex-direction: column;
  transition: border-color 180ms ease, transform 180ms ease;
}

.project-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
}

.project-featured {
  grid-column: span 2;
  border-color: rgba(88, 166, 255, 0.35);
}

.project-featured:hover {
  border-color: rgba(88, 166, 255, 0.7);
}

.project-meta {
  margin-bottom: 12px;
}

.project-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #03060a;
  background-color: var(--accent);
}

.project-card h3 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  color: #f0f6fc;
  font-weight: 700;
}

.project-card p {
  margin: 0 0 20px;
  color: var(--text-secondary);
  font-size: 0.96rem;
  line-height: 1.6;
  flex-grow: 1;
}

.project-links {
  margin-top: auto;
}

.project-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.project-links a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.link-primary {
  color: var(--success) !important;
}

.link-primary:hover {
  color: #56d364 !important;
}

@media (max-width: 920px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .project-featured {
    grid-column: span 2;
  }
}

@media (max-width: 620px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .project-featured {
    grid-column: span 1;
  }
}

/* === Footer === */
.site-footer {
  border-top: 1px solid var(--border);
  background-color: var(--bg-alt);
  padding: 40px 0;
}

.footer-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-left p {
  margin: 0;
}

.footer-links {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer-separator {
  color: var(--text-secondary);
  user-select: none;
}

.footer-copy {
  margin-top: 8px !important;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.footer-home a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
}

.footer-home a:hover {
  color: var(--accent);
}

@media (max-width: 560px) {
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
