:root {
  --bg: #f6f8f2;
  --panel: #ffffff;
  --ink: #151915;
  --muted: #60685f;
  --line: #d9dfd5;
  --teal: #009b8e;
  --coral: #e84f6a;
  --amber: #d49a00;
  --leaf: #2f7d48;
  --shadow: 0 24px 80px rgba(21, 25, 21, 0.12);
  --radius: 8px;
  --header-height: 76px;
}

body[data-theme="dark"] {
  --bg: #10140f;
  --panel: #181d17;
  --ink: #f2f5ef;
  --muted: #aeb9ad;
  --line: #30382f;
  --teal: #21d4c4;
  --coral: #ff6a82;
  --amber: #ffd15c;
  --leaf: #7bd98f;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(90deg, rgba(0, 155, 142, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(232, 79, 106, 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: 42px 42px;
  color: var(--ink);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.7;
  letter-spacing: 0;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--teal), var(--amber), var(--coral));
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  padding: 0 6vw;
  background: rgba(246, 248, 242, 0.84);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(18px);
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

body[data-theme="dark"] .site-header {
  background: rgba(16, 20, 15, 0.84);
}

.site-header[data-elevated="true"] {
  border-color: var(--line);
  box-shadow: 0 10px 28px rgba(21, 25, 21, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  font-weight: 800;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #ffffff;
  background: var(--ink);
  border-radius: var(--radius);
  font-size: 0.82rem;
}

body[data-theme="dark"] .brand-mark {
  color: #10140f;
  background: var(--amber);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  background: color-mix(in srgb, var(--panel) 74%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.94rem;
  transition: color 180ms ease, background 180ms ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--ink);
  background: color-mix(in srgb, var(--teal) 14%, transparent);
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(21, 25, 21, 0.08);
  transition: transform 180ms ease, border-color 180ms ease;
}

.theme-toggle:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.section-band {
  padding: 96px 6vw;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.86fr);
  gap: 56px;
  align-items: center;
  min-height: calc(100vh - var(--header-height));
  padding-top: 72px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 24px;
  font-size: 5rem;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 2.65rem;
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  font-size: 1.28rem;
  line-height: 1.35;
  letter-spacing: 0;
}

.hero-lead {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.12rem;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 128px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 800;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 42px rgba(21, 25, 21, 0.14);
}

.button.primary {
  color: #ffffff;
  background: var(--ink);
  border-color: var(--ink);
}

body[data-theme="dark"] .button.primary {
  color: #10140f;
  background: var(--amber);
  border-color: var(--amber);
}

.button.secondary {
  color: var(--ink);
  background: var(--panel);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 620px;
  margin: 0;
}

.hero-stats div {
  min-height: 110px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 52px rgba(21, 25, 21, 0.08);
}

.hero-stats dt {
  color: var(--ink);
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1.1;
}

.hero-stats dd {
  margin: 8px 0 0;
  color: var(--muted);
}

.hero-visual {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--teal) 12%, transparent), transparent 42%),
    linear-gradient(315deg, color-mix(in srgb, var(--coral) 12%, transparent), transparent 46%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

#heroCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.visual-core {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 190px;
  height: 190px;
  color: var(--ink);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  border: 1px solid var(--line);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 22px 70px rgba(21, 25, 21, 0.12);
}

.visual-core span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.visual-core strong {
  font-size: 2.1rem;
  line-height: 1;
}

.visual-label {
  position: absolute;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  color: var(--ink);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 800;
  box-shadow: 0 14px 38px rgba(21, 25, 21, 0.1);
}

.label-top {
  top: 34px;
  left: 50%;
  transform: translateX(-50%);
}

.label-right {
  top: 47%;
  right: 26px;
}

.label-bottom {
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
}

.label-left {
  top: 47%;
  left: 26px;
}

.section-heading {
  max-width: 980px;
  margin: 0 auto 32px;
}

.about-layout,
.skills-layout,
.contact-layout {
  display: grid;
  grid-template-columns: 0.88fr 1.12fr;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
}

.about-intro,
.skill-detail,
.contact-layout {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 60px rgba(21, 25, 21, 0.08);
}

.about-intro {
  padding: 30px;
}

.about-intro p,
.contact-layout p,
.project-card p,
.skill-detail p,
.principle p {
  color: var(--muted);
}

.principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.principle {
  min-height: 230px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.principle:hover {
  border-color: var(--teal);
  box-shadow: 0 20px 48px rgba(21, 25, 21, 0.1);
  transform: translateY(-4px);
}

.principle-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 32px;
  margin-bottom: 28px;
  color: #ffffff;
  background: var(--teal);
  border-radius: 6px;
  font-weight: 900;
}

.principle:nth-child(2) .principle-index {
  background: var(--coral);
}

.principle:nth-child(3) .principle-index {
  color: var(--ink);
  background: var(--amber);
}

.skill-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 1180px;
  margin: 0 auto 18px;
}

.filter-button {
  min-width: 86px;
  min-height: 40px;
  padding: 0 14px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 800;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.filter-button:hover,
.filter-button.active {
  color: var(--ink);
  background: color-mix(in srgb, var(--amber) 24%, var(--panel));
  border-color: var(--amber);
  transform: translateY(-2px);
}

.skills-layout {
  align-items: start;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.skill-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  min-height: 112px;
  padding: 20px;
  text-align: left;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.skill-card:hover,
.skill-card.active {
  border-color: var(--teal);
  box-shadow: 0 20px 48px rgba(21, 25, 21, 0.1);
  transform: translateY(-3px);
}

.skill-card.is-hidden {
  display: none;
}

.skill-card span {
  font-size: 1.2rem;
  font-weight: 900;
}

.skill-card small {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.skill-detail {
  position: sticky;
  top: 96px;
  min-height: 296px;
  padding: 30px;
}

.meter {
  width: 100%;
  height: 12px;
  margin: 28px 0 12px;
  overflow: hidden;
  background: color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 999px;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--leaf), var(--amber));
  border-radius: inherit;
  transition: width 420ms ease;
}

#skillPercent {
  font-size: 1.35rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
}

.project-card {
  min-height: 430px;
  padding: 30px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 60px rgba(21, 25, 21, 0.08);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.project-card:hover {
  border-color: var(--coral);
  box-shadow: var(--shadow);
  transform: translateY(-5px);
}

.project-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
}

.project-type {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.project-number {
  color: var(--line);
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 24px 0;
  list-style: none;
}

.project-tags li {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  color: var(--ink);
  background: color-mix(in srgb, var(--teal) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--teal) 28%, var(--line));
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 800;
}

.project-toggle {
  min-width: 108px;
  min-height: 40px;
  padding: 0 14px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 800;
  transition: background 180ms ease, border-color 180ms ease;
}

.project-toggle:hover {
  background: color-mix(in srgb, var(--coral) 12%, transparent);
  border-color: var(--coral);
}

.project-details {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 220ms ease, opacity 220ms ease, margin 220ms ease;
}

.project-details p {
  min-height: 0;
  overflow: hidden;
  margin-bottom: 0;
}

.project-card.open .project-details {
  grid-template-rows: 1fr;
  margin-top: 18px;
  opacity: 1;
}

.contact-layout {
  align-items: center;
  grid-template-columns: 1fr auto;
  padding: 34px;
}

.contact-actions {
  display: grid;
  gap: 12px;
  min-width: 280px;
}

.email-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
  color: var(--ink);
  background: color-mix(in srgb, var(--amber) 18%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--amber) 46%, var(--line));
  border-radius: var(--radius);
  font-weight: 900;
  word-break: break-all;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 6vw;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  min-width: 124px;
  min-height: 42px;
  padding: 9px 16px;
  color: #ffffff;
  background: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 520ms ease, transform 520ms ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--amber) 78%, white);
  outline-offset: 3px;
}

@media (max-width: 1060px) {
  .hero,
  .about-layout,
  .skills-layout,
  .contact-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-visual {
    min-height: 480px;
  }

  .skill-detail {
    position: static;
  }

  .contact-actions {
    min-width: 0;
  }
}

@media (max-width: 820px) {
  .site-header {
    align-items: flex-start;
    min-height: auto;
    padding: 14px 18px;
  }

  .brand span:last-child {
    display: none;
  }

  .nav-links {
    order: 3;
    flex: 1 0 100%;
    justify-content: space-between;
    margin-top: 12px;
    overflow-x: auto;
  }

  .nav-links a {
    flex: 0 0 auto;
    padding: 0 10px;
    font-size: 0.88rem;
  }

  .section-band {
    padding: 72px 18px;
  }

  h1 {
    font-size: 3.55rem;
  }

  h2 {
    font-size: 2.1rem;
  }

  .hero-stats,
  .principles,
  .project-grid,
  .skill-grid {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    min-height: 420px;
  }

  .visual-label {
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.82rem;
  }

  .visual-core {
    width: 154px;
    height: 154px;
  }

  .visual-core strong {
    font-size: 1.55rem;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .hero-actions {
    display: grid;
  }

  .button {
    width: 100%;
  }

  .hero-stats div,
  .about-intro,
  .principle,
  .skill-detail,
  .project-card,
  .contact-layout {
    padding: 22px;
  }

  h1 {
    font-size: 3rem;
  }

  .hero-visual {
    min-height: 360px;
  }

  .label-left,
  .label-right {
    top: auto;
    bottom: 92px;
  }

  .label-left {
    left: 16px;
  }

  .label-right {
    right: 16px;
  }

  .label-top {
    top: 18px;
  }

  .label-bottom {
    bottom: 18px;
  }
}

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

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