/* Reset / base */
:root{
  --bg: #ffffff;
  --black: #0b0b0b;
  --muted: #6b6b6b;
  --accent: #0ea5a4; /* teal accent */
  --gap: 28px;
  --max: 1200px;
  --radius: 8px;
  --card-bg: #fbfbfb;
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
}
*{box-sizing:border-box}
html,body{height:100%;margin:0;background:var(--bg);color:var(--black);-webkit-font-smoothing:antialiased}
.page{max-width:var(--max);margin:48px auto;padding:28px}
.site-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}
.brand{font-weight:800;letter-spacing:.01em;font-size:18px}
.nav-pill{display:flex;gap:14px;align-items:center}
.nav-pill a{display:inline-block;padding:8px 12px;border-radius:999px;background:#f6f8f8;text-decoration:none;color:var(--muted);font-weight:600;font-size:14px;box-shadow:0 6px 20px rgba(12,12,12,0.03)}
.nav-pill a[aria-current="page"]{color:var(--accent);font-weight:800}

/* layout */
.layout{display:grid;grid-template-columns:1fr 320px;gap:var(--gap);align-items:start}
.hero{padding-top:6px}
.hero h1{font-size:54px;line-height:1.02;margin:6px 0 14px;font-weight:800;letter-spacing:-0.02em}
.hero .strong{display:inline-block}
.lead{color:var(--muted);max-width:64ch;font-size:18px;margin:0 0 20px}
.actions{margin-top:12px;display:flex;gap:12px;align-items:center}
.btn-primary{display:inline-block;padding:10px 16px;border-radius:8px;border:2px solid var(--black);text-decoration:none;color:var(--black);font-weight:700}
.btn-ghost{display:inline-block;padding:10px 16px;border-radius:8px;background:transparent;color:var(--muted);text-decoration:none;border:1px solid transparent}

/* projects */
.meta{color:var(--muted);font-size:13px;margin-top:18px}
.featured{margin-top:24px;display:grid;gap:10px}
.project{display:flex;gap:12px;align-items:center;padding:12px 14px;background:var(--card-bg);text-decoration:none;color:var(--black);font-weight:700;border-left:4px solid transparent;border-radius:6px}
.project:hover{border-left-color:var(--accent);background:#f3f7f7}
.project .index{color:var(--muted);font-weight:800;margin-right:8px;width:36px;display:inline-block}

/* right column */
.side{border-left:1px solid #efefef;padding-left:28px}
.emblem{height:220px;display:flex;align-items:center;justify-content:center;opacity:.95}
.dots{width:220px;height:160px;position:relative}
.dots i{position:absolute;width:44px;height:36px;border-radius:8px;background:#f3f7f7;display:flex;align-items:center;justify-content:center;font-size:12px;color:var(--muted);font-weight:700}
.d1{left:6%;top:8%} .d2{left:28%;top:2%} .d3{left:60%;top:6%} .d4{left:78%;top:18%}
.d5{left:18%;top:52%} .d6{left:44%;top:44%} .d7{left:70%;top:62%} .d8{left:88%;top:54%}

/* card */
.card{display:flex;flex-direction:column;gap:12px}
.card-title{font-size:13px;color:var(--muted);font-weight:700}
.card-row{display:flex;flex-direction:column;gap:6px}
.card-row .label{color:var(--muted);font-size:13px;font-weight:700}
.card-row .value{font-weight:700}
.icons{display:flex;gap:8px;margin-top:6px}
.icon{width:36px;height:36px;border-radius:8px;background:#f6f8f8;color:var(--muted);display:inline-grid;place-items:center;text-decoration:none;font-weight:700}

/* contribution-like grid */
.contrib{margin-top:28px;border-top:1px solid #f0f0f0;padding-top:22px}
.months{display:flex;gap:8px;color:var(--muted);font-size:13px;margin-bottom:8px}
.grid{display:grid;grid-template-columns:repeat(12, 1fr);gap:6px}
.cell{height:12px;border-radius:3px;background:#f3f3f3}
.cell.level1{background:#d6f5ee}
.cell.level2{background:#8fe0d6}
.cell.level3{background:#37b8a9}

/* footer */
.site-footer{margin-top:40px;color:var(--muted);font-size:13px;text-align:center;padding-bottom:24px}

/* responsiveness */
@media (max-width:960px){
  .layout{grid-template-columns:1fr;gap:20px}
  .emblem{display:none}
  .hero h1{font-size:36px}
  .nav-pill{gap:8px}
}

/* 新增：爱心发射样式 */
.btn-wrap{position:relative;display:inline-block;outline:none}
.btn-wrap:focus{box-shadow:0 0 0 4px rgba(14,165,164,0.12);border-radius:10px}

/* 基础心形图片 */
.heart{
  position:absolute;
  left:50%;
  bottom:50%;
  width:32px;
  height:auto;
  transform:translate(-50%,0) scale(.8) rotate(0deg);
  opacity:0;
  pointer-events:none;
  filter:drop-shadow(0 8px 18px rgba(10,10,10,0.08));
  will-change:transform,opacity;
}

/* 各个心的偏移/缩放/延迟变量（像素单位用于 calc） */
.heart.h1{--tx:-46px; --ty:-140px; --s:1.05; --d:0ms}
.heart.h2{--tx:-12px; --ty:-160px; --s:0.82; --d:60ms}
.heart.h3{--tx:18px;  --ty:-150px; --s:1.18; --d:120ms}
.heart.h4{--tx:48px;  --ty:-130px; --s:0.92; --d:180ms}

/* hover 或 focus 时触发动画（同时支持键盘 focus） */
.btn-wrap:hover .heart,
.btn-wrap:focus-within .heart{
  animation:heart-fly 720ms cubic-bezier(.22,.9,.3,1) var(--d) both;
}

/* 如果需要允许重复触发（快速连续 hover），在 hover 结束后重置动画 */
.btn-wrap:not(:hover) .heart{ animation: none; }

/* 飞行关键帧：从按钮处放大出现、上升并渐隐 */
@keyframes heart-fly{
  0%{
    opacity:0;
    transform:translate(-50%,0) scale(0.25) rotate(-10deg);
  }
  15%{
    opacity:1;
    transform:translate(-50%,-6px) scale(calc(var(--s) * 0.9)) rotate(-6deg);
  }
  65%{
    opacity:1;
    transform:translate(calc(-50% + var(--tx)), calc(var(--ty))) scale(var(--s)) rotate(6deg);
  }
  100%{
    opacity:0;
    transform:translate(calc(-50% + var(--tx)), calc(calc(var(--ty) - 20px))) scale(calc(var(--s) * 0.95)) rotate(18deg);
  }
}

/* 小屏幕适配：缩小心形图 */
@media (max-width:480px){
  .heart{width:22px}
}

/* FEATURED 融球 & 趣味放大交互样式 */

/* 准备 featured 容器为相对定位并暴露 CSS 变量 --mx/--my */
#featured{
  position:relative;
  padding: 6px;
  --mx: 50%;
  --my: 50%;
  isolation:isolate;
}

/* 融球：使用伪元素在容器内绘制动态径向模糊光斑，随鼠标移动（产生“融球”/弥散效果）*/
#featured::before{
  content:"";
  position:absolute;
  left:0;top:0;right:0;bottom:0;
  pointer-events:none;
  z-index:1;
  background:
    radial-gradient(400px circle at var(--mx) var(--my),
                    rgba(14,165,164,0.14), transparent 32%),
    radial-gradient(300px circle at calc(var(--mx) + 10%) calc(var(--my) - 10%),
                    rgba(59,130,246,0.08), transparent 28%);
  filter: blur(14px) saturate(110%);
  mix-blend-mode: screen;
  transition: background 220ms linear;
}

/* featured 内项目样式调整，确保叠层与动画正常 */
#featured .project{
  position:relative;
  z-index:3;
  transition: transform .32s cubic-bezier(.2,.9,.3,1),
              box-shadow .32s cubic-bezier(.2,.9,.3,1),
              opacity .28s ease,
              filter .28s ease;
  transform-origin: center;
  display:block;
  border-radius:10px;
  padding:14px 16px;
  margin-bottom:10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(250,250,250,0.94));
  box-shadow: 0 6px 14px rgba(10,10,10,0.03);
  overflow:hidden;
}

/* active (hover/focus) 项：放大、浮起、轻微倾斜，营造趣味感 */
#featured .project.active{
  transform: translateY(-10px) scale(1.06) rotate(-1deg);
  box-shadow: 0 28px 60px rgba(10,10,10,0.12);
  z-index:6;
}

/* 非激活项在容器处于 dim 状态时变暗/收缩，突出 active 项 */
#featured.dim .project:not(.active){
  transform: translateY(0) scale(.98) rotate(0deg);
  opacity: .68;
  filter: grayscale(.03) blur(.0px);
  box-shadow: 0 4px 10px rgba(10,10,10,0.02);
}

/* 小的浮动装饰伪元素，模拟边缘融化（轻微移动） */
#featured .project::after{
  content: "";
  position: absolute;
  right: -12px;
  top: 10%;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(14,165,164,0.06), transparent 40%);
  transform: translateY(0) scale(.85);
  opacity:0;
  transition: transform .6s ease, opacity .36s ease;
  z-index:2;
}
#featured .project.active::after{
  opacity:1;
  transform: translateY(-8px) scale(1.06);
}

/* index number style stays visible but slightly animated */
#featured .index{
  display:inline-block;
  width:36px;
  color:var(--muted);
  font-weight:800;
  margin-right:10px;
  transition: transform .32s, color .32s;
}
#featured .project.active .index{ transform: translateY(-2px); color: var(--accent); }

/* 多米诺式逐字翻转：更丝滑的节奏与可重放控制 */
/* 只在父节点带 .play 时播放动画（便于 JS 重触发） */
.flip{display:block; perspective:1100px; -webkit-font-smoothing:antialiased}
.flip-line{display:inline-block}

/* 基础词样式（默认静态状态） */
.flip-word{
  display:inline-block;
  transform-origin: left bottom;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform, opacity;
  opacity: 0;
  /* 初始位置：轻微倾斜（像骨牌准备倒下） */
  transform: rotateX(82deg) translateY(8px) translateZ(0);
  margin-right: .36ch;
  transition: transform .24s cubic-bezier(.2,.9,.25,1), opacity .24s ease;
}

/* 播放时使用更短、平滑的时长与更紧的延迟，营造连锁多米诺感 */
.flip.play .flip-word{
  animation-name: domino-in;
  animation-duration: .48s;
  animation-timing-function: cubic-bezier(.22,.92,.28,1);
  animation-fill-mode: both;
  animation-delay: calc(var(--i,0) * 0.055s);
}

/* 关键帧：更丝滑的节奏，减少晃动并提高连续感 */
@keyframes domino-in{
  0%{
    opacity:0;
    transform: rotateX(82deg) translateY(10px) scale(.985);
  }
  40%{
    opacity:1;
    transform: rotateX(-8deg) translateY(-5px) scale(1.02);
  }
  72%{
    transform: rotateX(3deg) translateY(-1px) scale(1.01);
  }
  100%{
    opacity:1;
    transform: rotateX(0deg) translateY(0) scale(1);
  }
}

/* 微调：短词/标点间距 */
.flip-word[style*="--i:1"]{margin-right:.2ch}

/* hover/焦点下的次级交互：整段轻微上抬（更快） */
.flip:hover, .flip:focus{
  transform: translateY(-2px);
  transition: transform .18s ease;
}

/* 小屏幕及无悬停设备降级处理 */
@media (max-width:960px){
  .flip-word{animation-duration:.44s; animation-delay: calc(var(--i,0) * 0.045s)}
  .hero h1{font-size:36px}
  .flip:hover, .flip:focus{ transform:none }
}

/* 优先遵守减少动画偏好：直接显示文字 */
@media (prefers-reduced-motion: reduce){
  .flip-word{animation:none !important; transition:none !important; opacity:1; transform:none}
}