/* ---------- Modern minimalist portfolio styles ---------- */
:root {
  --bg: #ffffff;
  --bg-soft: #fafaf9;
  --bg-soft-2: #f4f4f3;
  --border: #e7e6e3;
  --border-soft: #efefee;
  --text: #0a0a0a;
  --text-2: #595957;
  --text-3: #8b8b88;
  --accent: #0a0a0a;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 0 rgba(15, 15, 15, 0.04);
  --shadow-md: 0 6px 24px -10px rgba(15, 15, 15, 0.12);
  --max: 1180px;
  --gap: clamp(16px, 2.4vw, 28px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}
a:hover { border-color: currentColor; }

button { font: inherit; color: inherit; }

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 40px);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand:hover { border-color: transparent; }
.brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  background: var(--text);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}
.brand__name { font-size: 15px; }

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-2);
}
.nav a {
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
}
.nav a:hover { background: var(--bg-soft-2); color: var(--text); }
.nav__cta {
  background: var(--text);
  color: #fff !important;
  margin-left: 6px;
}
.nav__cta:hover { background: #222; }

/* ---------- Hero ---------- */
.hero {
  padding: clamp(64px, 12vw, 140px) 0 clamp(48px, 8vw, 96px);
  border-bottom: 1px solid var(--border-soft);
  background:
    radial-gradient(ellipse 60% 50% at 15% 20%, rgba(255, 196, 138, 0.32), transparent 60%),
    radial-gradient(ellipse 50% 50% at 85% 10%, rgba(155, 192, 255, 0.32), transparent 60%),
    radial-gradient(ellipse 70% 40% at 50% 100%, rgba(214, 178, 255, 0.28), transparent 60%),
    #ffffff;
}
.hero__eyebrow {
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.hero__title {
  margin: 0;
  font-size: clamp(40px, 7vw, 76px);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.hero__title-accent {
  color: var(--text-3);
  font-weight: 500;
}
.hero__lede {
  margin: 22px 0 0;
  max-width: 640px;
  font-size: clamp(15px, 1.4vw, 17px);
  color: var(--text-2);
  line-height: 1.65;
}
.hero__stats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: clamp(20px, 4vw, 56px);
  margin: clamp(36px, 5vw, 56px) 0 0;
  padding: 0;
}
.hero__stats li {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hero__stats b {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.hero__stats span {
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.04em;
}

/* Hero row: left text + right WeChat card */
.hero__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(32px, 5vw, 64px);
}
.hero__main { min-width: 0; }
.hero__wx {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  min-width: 0;
}
.wx-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px 16px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  width: 340px;
  max-width: 100%;
}
.wx-card__avatar {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f3f3f3;
}
.wx-card__qr {
  width: 124px;
  height: 124px;
  background: #fff;
  padding: 6px;
  border: 1px solid var(--border-soft);
}
.wx-card__body { min-width: 0; }
.wx-card__label {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-3);
  text-transform: uppercase;
}
.wx-card__name {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wx-card__hint {
  margin: 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}
@media (max-width: 720px) {
  .hero__row {
    grid-template-columns: 1fr;
  }
  .hero__wx { justify-content: flex-start; }
  .wx-card { max-width: 100%; }
}

/* ---------- Section heads ---------- */
.section-head { margin-bottom: 28px; }
.section-title {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 600;
  letter-spacing: -0.015em;
}
.section-sub {
  margin: 6px 0 0;
  color: var(--text-3);
  font-size: 14px;
}

/* ---------- Projects ---------- */
.projects { padding: clamp(56px, 9vw, 96px) 0; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 36px;
  padding: 6px;
  background: var(--bg-soft-2);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  width: max-content;
  max-width: 100%;
}
.filter {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.filter:hover { color: var(--text); }
.filter.is-active {
  background: var(--text);
  color: #fff;
}

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s ease, transform 0.25s ease, box-shadow 0.25s ease;
  will-change: transform;
  cursor: pointer;
}
.card:hover {
  border-color: #d6d4d0;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.card.is-hidden { display: none; }

.card__cta {
  margin-top: auto;
  padding-top: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s ease, gap 0.2s ease;
}
.card:hover .card__cta {
  color: var(--text);
  gap: 10px;
}
.card__cta .arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}
.card:hover .card__cta .arrow {
  transform: translateX(2px);
}

.card__icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  color: var(--text);
}
.card__icon svg { width: 20px; height: 20px; }

.card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-3);
}
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-2);
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
}
.version {
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  font-size: 11px;
}
.card__title {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.card__desc {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
}

.empty {
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
  padding: 40px 0;
}

/* ---------- About ---------- */
.about {
  border-top: 1px solid var(--border-soft);
  padding: clamp(56px, 9vw, 96px) 0;
  background:
    radial-gradient(ellipse 40% 50% at 90% 30%, rgba(255, 196, 138, 0.18), transparent 60%),
    radial-gradient(ellipse 40% 50% at 10% 70%, rgba(155, 192, 255, 0.20), transparent 60%),
    #ffffff;
}
.about__row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
}
.about__text {
  margin: 16px 0 0;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.75;
  max-width: 56ch;
}
.about__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--border);
}
.about__list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.about__list span { color: var(--text-3); }
.about__list b { font-weight: 500; }

/* ---------- Footer ---------- */
.footer {
  background: #0a0a0a;
  color: rgba(255, 255, 255, 0.62);
  padding: 36px 0 32px;
  font-size: 13px;
  margin-top: 32px;
}
.footer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.footer p { margin: 0; }
.footer p:first-child { color: rgba(255, 255, 255, 0.85); }
.footer__credit { letter-spacing: 0.04em; color: rgba(255, 255, 255, 0.38); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .topbar__row { height: 56px; }
  .nav { gap: 2px; font-size: 13px; }
  .nav a { padding: 6px 10px; }
  .nav__cta { margin-left: 4px; }
  .about__row { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* Subtle fade-in on cards when they enter the grid */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card { animation: cardIn 0.45s ease both; }

/* ---------- Modal (project detail) ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vw, 40px);
}
.modal.is-open { display: flex; }

.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: overlayIn 0.2s ease both;
}
@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal__dialog {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 32px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: dialogIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes dialogIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.modal__close:hover {
  background: var(--text);
  color: #fff;
  transform: rotate(90deg);
}
.modal__close svg { width: 16px; height: 16px; }

.modal__content {
  padding: clamp(24px, 4vw, 36px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.modal__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.modal__head .tag {
  height: 24px;
  font-size: 12px;
}
.modal__head .version {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.modal__title {
  margin: 0 0 6px;
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.modal__desc {
  margin: 0 0 18px;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.65;
}

.modal__long {
  margin: 0 0 22px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.75;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.modal__features {
  margin: 0 0 22px;
}
.modal__features h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}
.modal__features ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.modal__features li {
  position: relative;
  padding-left: 22px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.55;
}
.modal__features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
  background-image: linear-gradient(135deg, #2a2a2a 0%, #0a0a0a 100%);
}
.modal__features li::after {
  content: "";
  position: absolute;
  left: 3px;
  top: calc(0.55em + 3px);
  width: 6px;
  height: 3px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg);
}

.modal__meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 24px;
  padding: 14px;
  background: var(--bg-soft-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.modal__meta div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.modal__meta span {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.modal__meta b {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}

.modal__cta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--border-soft);
  padding-top: 20px;
}
.modal__cta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.modal__cta-hint {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

/* The most prominent element on the page: download button */
.btn--primary {
  flex: 1 1 auto;
  min-width: 200px;
  background: var(--text);
  color: #fff;
  font-size: 16px;
  padding: 16px 24px;
  box-shadow: 0 6px 20px -8px rgba(0, 0, 0, 0.5);
  position: relative;
}
.btn--primary::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: linear-gradient(135deg, #4a4a4a, #0a0a0a) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.btn--primary:hover {
  background: #1a1a1a;
  box-shadow: 0 10px 28px -8px rgba(0, 0, 0, 0.6);
}
.btn--primary:hover::after { opacity: 1; }

.btn--ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover {
  background: var(--bg-soft);
  border-color: #d6d4d0;
}

.btn--disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

@media (max-width: 520px) {
  .modal__meta { grid-template-columns: 1fr; gap: 8px; }
  .btn--primary { min-width: 0; width: 100%; }
  .modal__cta-row { flex-direction: column; }
  .modal__cta-row .btn { width: 100%; }
}

/* Lock body scroll when modal is open */
body.modal-open { overflow: hidden; }

/* ---------- Contact modal ---------- */
.contact-modal__dialog {
  max-width: 480px;
  width: calc(100% - 32px);
}
.contact-modal__content {
  padding: 36px 32px 32px;
}
.contact-modal__eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.contact-modal__title {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
.contact-modal__lede {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--text-3);
  line-height: 1.6;
}
.contact-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.contact-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
}
.contact-item__icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  color: var(--text);
}
.contact-item__icon svg { width: 20px; height: 20px; }
.contact-item__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.contact-item__label {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-3);
  text-transform: uppercase;
}
.contact-item__value {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  word-break: break-all;
}
.contact-item__value:hover { color: #000; text-decoration: underline; }
.contact-item__value--muted {
  font-weight: 400;
  color: var(--text-3);
  cursor: default;
}
.contact-item__value--muted:hover { text-decoration: none; }
.contact-item--qr { align-items: center; }
.contact-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
}
.contact-qr img {
  width: 200px;
  height: 200px;
  display: block;
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}
.contact-qr p {
  margin: 0;
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
}
@media (max-width: 520px) {
  .contact-modal__content { padding: 28px 20px 24px; }
  .contact-qr img { width: 180px; height: 180px; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 16px);
  background: rgba(20, 20, 20, 0.95);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.01em;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: min(90vw, 560px);
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.toast--show {
  opacity: 1;
  transform: translate(-50%, 0);
}
