:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --text: #1c1c1a;
  --muted: #6b6b66;
  --line: #e4e4e0;
  --accent: #2f6f5f;
  --max: 42rem;
}

:root[data-theme="dark"] {
  --bg: #131315;
  --surface: #1a1a1d;
  --text: #ececea;
  --muted: #9a9a95;
  --line: #2c2c30;
  --accent: #7fc9b4;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131315;
    --surface: #1a1a1d;
    --text: #ececea;
    --muted: #9a9a95;
    --line: #2c2c30;
    --accent: #7fc9b4;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(3rem, 9vw, 6rem) 1.5rem 3rem;
}

/* Accessibility helpers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 1rem;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* Theme toggle */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--muted);
}

/* Hero */
.hero {
  margin-bottom: 3.5rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.hero__tagline {
  margin: 0.5rem 0 0;
  font-size: 1.05rem;
  color: var(--text);
}


/* Sections */
.section {
  margin-bottom: 3rem;
}

.section h2 {
  margin: 0 0 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.section p {
  margin: 0 0 0.85rem;
}

.section p:last-child {
  margin-bottom: 0;
}

/* Projects */
.projects {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1rem;
}

.project {
  position: relative;
  padding: 1.25rem;
  border: 1px solid transparent;
  border-radius: 0;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.project:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

:root[data-theme="dark"] .project:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .project:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  }
}

.project__name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.project__name a {
  color: var(--text);
  border-bottom: none;
}

.project__name a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.project__desc {
  margin: 0.2rem 0 0.3rem;
  color: var(--text);
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.project__tags {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  position: relative;
  z-index: 1;
  pointer-events: none;
}

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

a:hover {
  border-bottom-color: currentColor;
}

.links {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

/* Footer */
.footer {
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}

.footer p {
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
