/* ============================================================
   YangZa — 个人主页
   纯 HTML/CSS + 少量 JS，无框架、无外部请求。
   颜色全部走自定义属性，改主题只动变量。
   ============================================================ */

/* ---------- 主题 ---------- */
:root {
  color-scheme: dark;

  --bg: #08090c;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-h: rgba(255, 255, 255, 0.065);
  --border: rgba(255, 255, 255, 0.085);
  --border-h: rgba(255, 255, 255, 0.17);

  --text: #eef1f7;
  --text-2: #99a2b5;
  --text-3: #6a7284;

  --accent: #6f8bff;
  --brand-grad: linear-gradient(140deg, #6f8bff, #b06bff);
  --hero-grad: linear-gradient(178deg, #ffffff 12%, #a8b4ff 96%);

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-h: 0 22px 44px -26px rgba(0, 0, 0, 0.95);

  --shell: 1180px;
  --r-card: 18px;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-h: #ffffff;
  --border: rgba(14, 19, 34, 0.09);
  --border-h: rgba(14, 19, 34, 0.2);

  --text: #0c1120;
  --text-2: #535c72;
  --text-3: #848ca0;

  --hero-grad: linear-gradient(178deg, #0a0f1f 8%, #3b46a8 100%);
  --shadow: 0 1px 2px rgba(14, 19, 34, 0.06), 0 10px 24px -16px rgba(14, 19, 34, 0.18);
  --shadow-h: 0 24px 48px -28px rgba(14, 19, 34, 0.35);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

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

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

svg { display: block; }

.sprite { display: none; }

.shell {
  width: min(var(--shell), 100% - 48px);
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: 50%;
  top: 10px;
  translate: -50% -200%;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  z-index: 100;
  transition: translate 0.22s var(--ease);
}
.skip:focus-visible { translate: -50% 0; }

:where(a, button):focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 85%, #fff);
  outline-offset: 3px;
  border-radius: 8px;
}

::selection {
  background: color-mix(in srgb, var(--accent) 42%, transparent);
}

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text) 20%, transparent);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}

/* ---------- 背景 ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.aurora span {
  position: absolute;
  width: 52vw;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.42;
}

.aurora__a { top: -20vw; left: -6vw; background: radial-gradient(circle, #3b5bff 0%, transparent 66%); animation: drift-a 28s ease-in-out infinite; }
.aurora__b { top: -24vw; right: -8vw; background: radial-gradient(circle, #8b3bff 0%, transparent 66%); animation: drift-b 34s ease-in-out infinite; }
.aurora__c { top: 38vh; left: 46vw; background: radial-gradient(circle, #ff3d81 0%, transparent 66%); opacity: 0.24; animation: drift-c 40s ease-in-out infinite; }

:root[data-theme="light"] .aurora span { opacity: 0.2; }
:root[data-theme="light"] .aurora__c { opacity: 0.14; }

.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 140px 140px;
}
:root[data-theme="light"] .grain { opacity: 0.045; mix-blend-mode: multiply; }

@keyframes drift-a { 50% { transform: translate3d(6vw, 5vw, 0) scale(1.1); } }
@keyframes drift-b { 50% { transform: translate3d(-5vw, 7vw, 0) scale(1.06); } }
@keyframes drift-c { 50% { transform: translate3d(-8vw, -6vw, 0) scale(0.92); } }

/* ---------- 顶栏 ---------- */
.head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .head { background: var(--bg); }
}

.head__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 10px;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  background: var(--brand-grad);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: 0 6px 16px -8px color-mix(in srgb, #6f8bff 80%, transparent);
}

.brand__name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-2);
}
.brand__dot { color: var(--accent); }
.brand:hover .brand__name { color: var(--text); }

.head__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.head__divider {
  width: 1px;
  height: 18px;
  margin: 0 6px;
  background: var(--border);
}

.icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--text-3);
  transition: color 0.18s var(--ease), background-color 0.18s var(--ease);
}
.icon svg { width: 17px; height: 17px; }
.icon:hover {
  color: var(--text);
  background: var(--surface-h);
}

.icon--btn {
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
}
.icon__sun { display: none; }
.icon__moon { display: block; }
:root[data-theme="light"] .icon__sun { display: block; }
:root[data-theme="light"] .icon__moon { display: none; }

/* ---------- Hero ---------- */
.hero { padding: clamp(56px, 9vw, 104px) 0 clamp(40px, 6vw, 68px); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
  animation: rise 0.6s var(--ease) backwards;
}

.pulse {
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5);
  animation: pulse 2.6s ease-out infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.hero__title {
  /* 渐变文字只铺在盒子内，g 的下勾会掉到 line-height 0.95 的盒子外面变透明。
     用上下 padding 把背景撑到字形范围，再用等量负 margin 把布局位置拉回来。 */
  padding: 0.06em 0 0.26em;
  margin: calc(18px - 0.06em) 0 -0.26em;
  font-size: clamp(52px, 10vw, 104px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.95;
  background: var(--hero-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  width: fit-content;
  animation: rise 0.7s var(--ease) 0.06s backwards;
}

.hero__lede {
  margin-top: 20px;
  max-width: 34ch;
  font-size: clamp(16px, 2vw, 19px);
  color: var(--text-2);
  animation: rise 0.7s var(--ease) 0.12s backwards;
}

.hero__quote {
  margin-top: clamp(28px, 4vw, 44px);
  padding-left: 16px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  max-width: 40ch;
  font-family: ui-serif, Georgia, "Times New Roman", "Songti SC", serif;
  font-style: italic;
  font-size: clamp(14.5px, 1.6vw, 17px);
  line-height: 1.65;
  color: var(--text-3);
  animation: rise 0.7s var(--ease) 0.18s backwards;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
}

/* ---------- 分区标题 ---------- */
.services { padding-bottom: clamp(48px, 7vw, 84px); scroll-margin-top: 84px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section-head h2 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}

.section-head__meta {
  font-size: 12px;
  color: var(--text-3);
}

/* ---------- 卡片网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 13px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 176px;
  padding: 17px;
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  isolation: isolate;
  animation: rise 0.55s var(--ease) backwards;
  animation-delay: calc(var(--i, 0) * 45ms + 0.15s);
  transition: transform 0.24s var(--ease), border-color 0.24s var(--ease),
    background-color 0.24s var(--ease), box-shadow 0.3s var(--ease);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  background: radial-gradient(
    240px circle at var(--mx, 50%) var(--my, 0%),
    color-mix(in srgb, var(--accent) 20%, transparent),
    transparent 62%
  );
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}

.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--surface-h);
  box-shadow: var(--shadow-h);
}
.card:hover::before { opacity: 1; }

.card__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: color-mix(in srgb, var(--accent) 40%, var(--text));
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  transition: transform 0.24s var(--ease), background-color 0.24s var(--ease);
}
.card__icon svg { width: 19px; height: 19px; }
.card:hover .card__icon {
  transform: scale(1.06);
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.card__title {
  margin-top: 14px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.card__desc {
  margin-top: 5px;
  flex: 1;
  font-size: 12.6px;
  line-height: 1.55;
  color: var(--text-2);
}

.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
}

.card__host {
  font-size: 10.8px;
  letter-spacing: 0.01em;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__arrow {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  color: var(--text-3);
  opacity: 0.5;
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease),
    color 0.24s var(--ease);
}
.card:hover .card__arrow {
  opacity: 1;
  color: var(--accent);
  transform: translate(2px, -2px);
}

.card:nth-child(1) { --i: 0; }
.card:nth-child(2) { --i: 1; }
.card:nth-child(3) { --i: 2; }
.card:nth-child(4) { --i: 3; }
.card:nth-child(5) { --i: 4; }
.card:nth-child(6) { --i: 5; }
.card:nth-child(7) { --i: 6; }
.card:nth-child(8) { --i: 7; }
.card:nth-child(9) { --i: 8; }
.card:nth-child(10) { --i: 9; }

/* ---------- 结尾 ---------- */
.next { padding-bottom: clamp(56px, 8vw, 92px); }

.next__inner {
  position: relative;
  padding: clamp(28px, 5vw, 56px);
  border-radius: 24px;
  border: 1px solid var(--border);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 58%),
    var(--surface);
  overflow: hidden;
}

.next__inner::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -110px;
  width: 280px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, #b06bff 30%, transparent), transparent 68%);
  filter: blur(20px);
  pointer-events: none;
}

.next h2 {
  font-size: clamp(22px, 3.4vw, 32px);
  font-weight: 650;
  letter-spacing: -0.02em;
}

.next p {
  margin-top: 10px;
  max-width: 48ch;
  font-size: 14px;
  color: var(--text-2);
}

/* ---------- 页脚 ---------- */
.foot {
  border-top: 1px solid var(--border);
}

.foot__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 22px 0 40px;
  font-size: 12px;
  color: var(--text-3);
}

.foot__links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.foot__links a {
  color: var(--text-3);
  transition: color 0.18s var(--ease);
}
.foot__links a:hover { color: var(--text); }

/* ---------- 响应式 ---------- */

/* 平板：4 列 → 3 列 */
@media (max-width: 1000px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* 手机与小平板 */
@media (max-width: 720px) {
  .shell { width: calc(100% - 32px); }
  .head__inner { height: 56px; }
  .head__actions { gap: 2px; }
  .icon { width: 38px; height: 38px; }
  .icon svg { width: 18px; height: 18px; }
  .section-head__meta { display: none; }

  .hero { padding: 44px 0 36px; }
  .hero__title { letter-spacing: -0.04em; }
  .hero__lede { font-size: 16px; }
  .hero__quote { margin-top: 26px; padding-left: 13px; font-size: 14.5px; }

  .card { min-height: 0; padding: 14px; }
  .card__desc { font-size: 12.8px; }
  .card__host { min-width: 0; font-size: 11px; }

  /* 大面积模糊光斑在手机上吃 GPU，收一收 */
  .aurora span { filter: blur(64px); opacity: 0.3; }
  .aurora__c { display: none; }
  .grain { opacity: 0.028; }

  .next__inner { padding: 26px 22px; border-radius: 20px; }
  .foot__inner { padding: 20px 0 calc(28px + env(safe-area-inset-bottom)); }
}

/* 窄屏：卡片改为「图标 + 标题一行，说明在下」，比竖排更紧凑 */
@media (max-width: 560px) {
  .card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 12px;
    row-gap: 9px;
    padding: 14px;
  }
  .card__icon { grid-column: 1; grid-row: 1; }
  .card__title { grid-column: 2; grid-row: 1; margin-top: 0; font-size: 14.5px; }
  .card__desc { grid-column: 1 / -1; grid-row: 2; margin-top: 0; }
  .card__foot { grid-column: 1 / -1; grid-row: 3; margin-top: 2px; padding-top: 10px; }

  .grid { gap: 10px; }
  .next h2 { font-size: 21px; }
}

/* 小屏手机 */
@media (max-width: 400px) {
  .brand__name { display: none; }
  .head__divider { display: none; }
  .hero__title { font-size: 46px; }
  .card { padding: 13px; }
  .card__desc { font-size: 12.4px; }
}

/* ---------- 减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .aurora span { animation: none !important; }
}
