/* Playlab — 手绘贴纸风个人站
 * 设计要点：厚墨线描边、硬阴影、轻微歪斜、不规则圆角、贴在点阵纸上的感觉。
 * 想换颜色改 :root 里的变量就行。 */

:root {
  --paper: #e8e4f3;
  --dot: #cbc5e3;
  --ink: #241f3d;
  --white: #fffcf4;
  --pink: #ff6b8b;
  --yellow: #ffd23f;
  --mint: #52d3a6;
  --blue: #5ba8ff;
  --orange: #ff9f45;

  /* 字体：只用系统自带字体，避免国内访问外部字体服务。
     想用自己的手写字体，见 README「换字体」。 */
  --font-display: "ZCOOL KuaiLe", "Yuanti SC", "YouYuan", "Hannotate SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;

  /* 不规则圆角，模拟手剪的边 */
  --r1: 22px 9px 26px 11px / 10px 24px 12px 28px;
  --r2: 10px 26px 12px 24px / 24px 10px 28px 12px;
  --r3: 28px 12px 20px 10px / 12px 22px 10px 26px;
  --r4: 12px 20px 10px 28px / 26px 12px 22px 10px;

  --line: 3px solid var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  --shadow-lift: 8px 8px 0 var(--ink);
}

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.8;
  color: var(--ink);
  background:
    radial-gradient(var(--dot) 1.3px, transparent 1.5px) 0 0 / 22px 22px,
    var(--paper);
  overflow-x: hidden;
}

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

a { color: inherit; }

:focus-visible {
  outline: 3px dashed var(--ink);
  outline-offset: 4px;
}

.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  background: var(--yellow); border: var(--line); border-radius: var(--r1);
  padding: 6px 14px; font-weight: 800; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- 页头 ---------- */

.site-header { padding: 20px 0 6px; }

.header-row {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 14px 24px;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.7rem; line-height: 1.1; font-weight: 900;
  text-decoration: none;
  background: var(--yellow);
  border: var(--line); border-radius: var(--r2);
  padding: 4px 16px 6px;
  box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-3deg);
  transition: transform 0.18s;
}
.brand:hover { transform: rotate(1deg) scale(1.04); }

.nav { display: flex; flex-wrap: wrap; gap: 10px; }

.nav a {
  font-weight: 800; font-size: 0.98rem; line-height: 1.2;
  text-decoration: none;
  background: var(--white);
  border: 2.5px solid var(--ink); border-radius: var(--r3);
  padding: 7px 15px;
  transition: transform 0.15s, background 0.15s;
}
.nav a:nth-child(odd) { transform: rotate(-1.5deg); }
.nav a:nth-child(even) { transform: rotate(1.2deg); border-radius: var(--r4); }
.nav a:hover { background: var(--yellow); transform: rotate(0) translateY(-2px); }
.nav a[aria-current="page"] {
  background: var(--pink);
  box-shadow: 3px 3px 0 var(--ink);
}

/* ---------- 首页 hero ---------- */

.hero { position: relative; padding: 44px 0 20px; }

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.8rem, 6.2vw, 4rem);
  line-height: 1.3;
}
.hero h1 span {
  display: inline-block;
  border: var(--line);
  padding: 0.04em 0.4em 0.1em;
  box-shadow: var(--shadow);
}
.hero h1 .l1 { background: var(--yellow); border-radius: var(--r1); transform: rotate(-2deg); }
.hero h1 .l2 { background: var(--white); border-radius: var(--r3); transform: rotate(1.2deg); margin: 16px 0 0 clamp(0px, 4vw, 48px); }

.hero-intro {
  margin: 30px 0 0; max-width: 32em;
  font-size: 1.12rem;
}

.doodle { position: absolute; pointer-events: none; }
.doodle svg { display: block; width: 100%; height: auto; }
.doodle-star { width: 76px; right: 6%; top: 24px; transform: rotate(14deg); }
.doodle-squig { width: 130px; right: 14%; bottom: 8px; transform: rotate(-6deg); }
.doodle-spark { width: 46px; right: 26%; top: 70px; transform: rotate(-10deg); }

/* ---------- 首页入口贴纸 ---------- */

.door-grid {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 28px 24px; margin: 44px 0 20px;
}

.door {
  --tilt: -1.5deg;
  position: relative;
  grid-column: span 2;
  display: flex; flex-direction: column; gap: 6px;
  padding: 24px 24px 20px;
  text-decoration: none;
  background: var(--bg, var(--white));
  border: var(--line); border-radius: var(--r1);
  box-shadow: var(--shadow);
  transform: rotate(var(--tilt));
  transition: transform 0.18s, box-shadow 0.18s;
}
.door::before { /* 胶带 */
  content: ""; position: absolute; top: -13px; left: 50%;
  width: 72px; height: 24px; margin-left: -36px;
  background: rgba(255, 252, 244, 0.7);
  border: 1.5px solid rgba(36, 31, 61, 0.28);
  transform: rotate(-4deg);
}
.door:hover, .door:focus-visible {
  transform: rotate(0) translate(-3px, -4px);
  box-shadow: var(--shadow-lift);
}
.door-icon { display: block; margin-bottom: 4px; }
.door h2 {
  margin: 0; font-family: var(--font-display); font-weight: 900;
  font-size: 1.8rem; line-height: 1.25;
}
.door p { margin: 0; }
.door .count {
  align-self: flex-start; margin-top: 12px;
  font-size: 0.86rem; font-weight: 800; line-height: 1.4;
  padding: 1px 12px;
  border: 2px solid var(--ink); border-radius: 99px;
  background: var(--white);
}
.door .count.is-zero { border-style: dashed; background: transparent; font-weight: 600; }

.door-writing { --bg: var(--pink); --tilt: -1.6deg; grid-column: span 3; border-radius: var(--r2); }
.door-works { --bg: var(--yellow); --tilt: 1.2deg; grid-column: span 3; border-radius: var(--r3); padding-block: 30px 26px; }
.door-tutorials { --bg: var(--mint); --tilt: 1deg; border-radius: var(--r4); }
.door-tools { --bg: var(--blue); --tilt: -1deg; }
.door-about { --bg: var(--orange); --tilt: 1.8deg; border-radius: var(--r2); }

/* ---------- 分区与标题 ---------- */

.block { margin: 52px 0; scroll-margin-top: 20px; }

.block > h2, .section-title {
  margin: 0 0 20px;
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(1.5rem, 3.4vw, 2rem); line-height: 1.3;
  text-decoration: underline wavy var(--pink) 3px;
  text-underline-offset: 9px;
  text-decoration-skip-ink: none;
}
.block > .lead { margin: -8px 0 22px; max-width: 36em; }

/* ---------- 内页头部 ---------- */

.page-head { padding: 40px 0 6px; }
.page-head h1 {
  display: inline-block; margin: 0;
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(1.9rem, 5vw, 3rem); line-height: 1.3;
  background: var(--yellow);
  border: var(--line); border-radius: var(--r1);
  padding: 0.04em 0.5em 0.1em;
  box-shadow: var(--shadow);
  transform: rotate(-1.6deg);
}
.page-head .lead { margin: 26px 0 0; max-width: 34em; font-size: 1.08rem; }

.page-head .head-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 0; padding: 0; list-style: none; }
.chips a {
  display: inline-block; text-decoration: none; font-weight: 800; font-size: 0.95rem;
  padding: 4px 14px; border: 2.5px solid var(--ink); border-radius: 99px;
  background: var(--white);
  transition: transform 0.15s, background 0.15s;
}
.chips li:nth-child(odd) a { transform: rotate(-1.5deg); }
.chips li:nth-child(even) a { transform: rotate(1.2deg); }
.chips a:hover { background: var(--mint); transform: rotate(0) translateY(-2px); }

/* ---------- 卡片 ---------- */

.card-list {
  display: grid; gap: 30px 26px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
}
.card-list.is-empty { display: block; }

.card {
  --tilt: -1deg;
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 22px 22px 20px;
  text-decoration: none;
  background: var(--white);
  border: var(--line); border-radius: var(--r1);
  box-shadow: var(--shadow);
  transform: rotate(var(--tilt));
  transition: transform 0.18s, box-shadow 0.18s;
}
.card:nth-child(3n + 2) { --tilt: 0.9deg; border-radius: var(--r2); }
.card:nth-child(3n) { --tilt: -0.4deg; border-radius: var(--r3); }
.card.is-link:hover, .card.is-link:focus-visible {
  transform: rotate(0) translate(-3px, -4px);
  box-shadow: var(--shadow-lift);
}
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.card-title { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: 1.5rem; line-height: 1.3; }
.card-meta { margin: 0; font-size: 0.88rem; opacity: 0.75; }
.card-text { margin: 0; }

.badge {
  font-size: 0.82rem; font-weight: 800; line-height: 1.4;
  padding: 0 10px; border: 2px solid var(--ink); border-radius: 99px;
  background: var(--white); transform: rotate(2deg);
}
.badge-dev { background: var(--orange); }
.badge-live { background: var(--mint); }
.badge-done { background: var(--blue); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; }
.tags li {
  font-size: 0.8rem; font-weight: 600; line-height: 1.5;
  padding: 0 9px; border: 1.5px solid var(--ink); border-radius: 6px 12px 7px 11px;
}

/* ---------- 空状态 ---------- */

.empty {
  max-width: 560px; margin: 8px 0;
  padding: 30px 26px 28px; text-align: center;
  border: 3px dashed var(--ink); border-radius: var(--r2);
  background: rgba(255, 252, 244, 0.55);
  transform: rotate(-0.6deg);
}
.empty-icon { display: block; margin-bottom: 6px; }
.empty-icon svg { transform: rotate(-5deg); }
.empty-title { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: 1.45rem; line-height: 1.4; }
.empty-text { margin: 4px 0 0; }

/* ---------- 按钮 ---------- */

.btn {
  display: inline-block; text-decoration: none; cursor: pointer;
  font: inherit; font-weight: 800; line-height: 1.3;
  padding: 10px 24px;
  color: var(--ink); background: var(--pink);
  border: var(--line); border-radius: var(--r3);
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.12s, box-shadow 0.12s;
}
a.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
a.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn[aria-disabled="true"] {
  cursor: not-allowed; color: #4d4766; background: #d9d5e6;
  border-style: dashed; box-shadow: none;
}

/* ---------- 正文块（关于、作品详情、文章） ---------- */

.note {
  max-width: 40em; padding: 24px 26px;
  background: var(--white);
  border: var(--line); border-radius: var(--r2);
  box-shadow: var(--shadow);
}
.note > :first-child { margin-top: 0; }
.note > :last-child { margin-bottom: 0; }

.play-box {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  max-width: 34em; padding: 26px;
  background: var(--yellow);
  border: var(--line); border-radius: var(--r1);
  box-shadow: var(--shadow); transform: rotate(-0.8deg);
}
.play-note { margin: 0; font-size: 0.95rem; }

.link-list { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 12px; }
.link-list a { font-weight: 800; }

.prose { max-width: 38em; }
.prose h2 { font-family: var(--font-display); font-size: 1.6rem; line-height: 1.4; margin: 2em 0 0.4em; }
.prose p { margin: 0 0 1.1em; }
.prose a { text-decoration-thickness: 2px; text-underline-offset: 3px; }
.prose img { border: var(--line); border-radius: var(--r2); box-shadow: var(--shadow); }
.prose blockquote { margin: 1.4em 0; padding: 4px 20px; border-left: 6px solid var(--pink); background: rgba(255, 252, 244, 0.6); }
.prose code { background: var(--white); border: 1.5px solid var(--ink); border-radius: 5px; padding: 0 5px; font-size: 0.92em; }
.prose pre { overflow-x: auto; padding: 16px; background: var(--ink); color: var(--white); border-radius: var(--r2); }
.prose pre code { background: none; border: 0; padding: 0; }

.back { display: inline-block; margin-top: 28px; font-weight: 800; }

.noscript { margin: 20px auto; padding: 12px 16px; border: 3px dashed var(--ink); border-radius: var(--r1); background: var(--white); }

/* ---------- 页脚 ---------- */

.site-footer {
  position: relative; margin-top: 90px; padding: 50px 0 36px;
  background: var(--ink); color: var(--white);
}
.site-footer::before { /* 撕边 */
  content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 14px;
  background: conic-gradient(from -45deg at bottom, transparent, var(--ink) 1deg 90deg, transparent 91deg) 50% / 28px 100%;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px 40px; align-items: start; }
.footer-brand { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: 1.7rem; line-height: 1.3; color: var(--yellow); }
.footer-tag { margin: 6px 0 0; max-width: 20em; font-size: 0.95rem; }
.footer-links { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, auto); justify-content: start; gap: 4px 28px; }
.footer-links a, .to-top, .footer-legal a { text-underline-offset: 4px; }
.footer-links a:hover, .to-top:hover, .footer-legal a:hover { color: var(--yellow); }
.footer-end { font-size: 0.9rem; }
.footer-legal { margin: 0 0 8px; }
.site-footer :focus-visible { outline-color: var(--yellow); }

/* ---------- 动效：只有首页载入时的一次「贴上去」 ---------- */

@media (prefers-reduced-motion: no-preference) {
  @keyframes slap {
    from { opacity: 0; transform: scale(0.6) rotate(calc(var(--tilt, 0deg) * 4 + 6deg)); }
  }
  .page-home .door { animation: slap 0.5s cubic-bezier(0.3, 1.5, 0.5, 1) backwards; }
  .page-home .door:nth-child(1) { animation-delay: 0.1s; }
  .page-home .door:nth-child(2) { animation-delay: 0.2s; }
  .page-home .door:nth-child(3) { animation-delay: 0.3s; }
  .page-home .door:nth-child(4) { animation-delay: 0.4s; }
  .page-home .door:nth-child(5) { animation-delay: 0.5s; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ---------- 小屏 ---------- */

@media (max-width: 820px) {
  .door-grid { grid-template-columns: repeat(2, 1fr); }
  .door, .door-writing, .door-works { grid-column: span 1; }
  .door-works { grid-column: span 2; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
  .doodle-spark, .doodle-squig { display: none; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .door-grid { grid-template-columns: 1fr; }
  .door, .door-works { grid-column: span 1; }
  .doodle-star { width: 52px; right: 2%; top: 8px; }
  .hero h1 .l2 { margin-left: 0; }
  .footer-grid { grid-template-columns: 1fr; }
  .nav a { padding: 6px 12px; }
}
