/* ==========================================================
   Zhang Hui · AI Coding Portfolio
   明亮卡片网格（Bento）+ 柚子配色
   ========================================================== */
:root {
  color-scheme: light;
  --bg: #F4F3EE;
  --card: #FFFFFF;
  --ink: #141414;
  --ink-2: #3A3A36;
  --muted: #76766F;
  --line: rgba(20, 20, 20, .08);
  --dark: #151515;
  /* 柚子：果皮 / 白瓤 / 果肉 */
  --peel: #D7F05A;
  --pith: #FFF7E2;
  --pulp: #FF8A6B;
  --blush: #FFE4D9;
  --accent: var(--peel);
  --accent-ink: #141414;

  --radius: 28px;
  --radius-sm: 18px;
  --gap: 14px;
  --pad: clamp(20px, 2.4vw, 32px);
  --maxw: 1320px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 1px 2px rgba(20,20,20,.04), 0 8px 24px -12px rgba(20,20,20,.12);
  --shadow-hover: 0 1px 2px rgba(20,20,20,.05), 0 24px 48px -20px rgba(20,20,20,.25);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, video, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -.03em; line-height: 1.1; font-weight: 700; }
p { margin: 0; }
button { font: inherit; color: inherit; }
::selection { background: var(--peel); color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 8px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 999px; }

main, .footer { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(16px, 2.4vw, 28px); }

/* ---------- 导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: var(--maxw); margin: 0 auto; padding: 14px clamp(16px, 2.4vw, 28px);
}
.nav::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  mask: linear-gradient(#000 70%, transparent);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; font-size: 17px; }
.brand-mark { transition: transform .8s var(--ease); }
.brand:hover .brand-mark { transform: rotate(120deg); }
.nav-links { display: flex; align-items: center; gap: 4px; font-size: 14px; }
.nav-links a { padding: 8px 14px; border-radius: 999px; transition: background .2s; }
.nav-links a:hover { background: var(--card); }
.status-pill {
  display: inline-flex; align-items: center; gap: 8px; margin-left: 6px;
  padding: 7px 14px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow);
  font-size: 13px; color: var(--ink-2); white-space: nowrap;
}
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: #3BC46B; box-shadow: 0 0 0 0 rgba(59,196,107,.6); animation: pulse 2.2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(59,196,107,0); } 100% { box-shadow: 0 0 0 0 rgba(59,196,107,0); } }

/* ---------- 通用 ---------- */
.bento { display: grid; gap: var(--gap); }
.tile {
  position: relative; overflow: hidden;
  background: var(--card); border-radius: var(--radius); padding: var(--pad);
  box-shadow: var(--shadow);
}
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.eyebrow.light { color: rgba(255,255,255,.55); }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 22px; border-radius: 999px; font-size: 15px; font-weight: 600;
  transition: transform .25s var(--ease), box-shadow .25s, background .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { box-shadow: 0 10px 24px -10px rgba(0,0,0,.5); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { box-shadow: 0 10px 24px -12px var(--accent); }
.btn-ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12.5px; line-height: 1.5; background: var(--bg); color: var(--ink-2); }
.chip-accent { background: var(--accent); color: var(--accent-ink); }

.spin { animation: spin 80s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 入场动画（仅在 JS 可用时启用） */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: var(--d, 0s); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- 首页 Hero ---------- */
.hero { grid-template-columns: repeat(4, 1fr); margin-top: 8px; }
.tile-intro { grid-column: span 2; grid-row: span 2; display: flex; flex-direction: column; gap: 22px; padding: clamp(28px, 3.6vw, 52px); min-height: 460px; }
.hero-title { font-size: clamp(38px, 4.6vw, 68px); text-wrap: balance; letter-spacing: -.045em; line-height: 1.02; margin-top: auto; }
.hero-intro { max-width: 34em; color: var(--ink-2); font-size: clamp(15px, 1.2vw, 17px); }
.tile-intro .btn { align-self: flex-start; }

.tile-count { background: var(--peel); display: flex; flex-direction: column; justify-content: space-between; min-height: 222px; }
.big-num { font-size: clamp(88px, 9vw, 136px); font-weight: 800; letter-spacing: -.06em; line-height: .85; font-variant-numeric: tabular-nums; }
.tile-count p { font-weight: 600; line-height: 1.35; }

.tile-pomelo { background: var(--blush); display: grid; place-items: center; padding: 0; min-height: 222px; }
.tile-pomelo:hover .hero-pomelo { animation-duration: 6s; }
.hero-pomelo { width: 62%; height: auto; max-width: 200px; margin-top: -14px; filter: drop-shadow(0 18px 24px rgba(255,120,90,.25)); }
.tile-pomelo-label { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; font-family: var(--mono); font-size: 12px; color: #B4553C; }

.tile-tools { background: var(--dark); color: #fff; display: flex; flex-direction: column; gap: 14px; min-height: 222px; }
.tool-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tool-list li { padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.08); font-size: 14px; }
.tool-list li:first-child { background: var(--peel); color: var(--ink); }
.tile-note { margin-top: auto; font-size: 13px; color: rgba(255,255,255,.5); }

.tile-latest { display: flex; flex-direction: column; gap: 6px; min-height: 222px; transition: transform .35s var(--ease), box-shadow .35s; }
.tile-latest strong { margin-top: auto; font-size: clamp(22px, 2vw, 30px); letter-spacing: -.03em; line-height: 1.15; }
.tile-latest span { color: var(--muted); font-size: 14px; }
.tile-latest:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }

/* ---------- 作品列表 ---------- */
.works { margin-top: clamp(64px, 9vw, 120px); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.section-title { font-size: clamp(36px, 4.4vw, 60px); letter-spacing: -.045em; }
.section-title sup { font-family: var(--mono); font-size: 14px; font-weight: 500; color: var(--muted); vertical-align: top; position: relative; top: .4em; margin-left: 4px; letter-spacing: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter { border: 0; cursor: pointer; padding: 8px 16px; border-radius: 999px; background: var(--card); font-size: 14px; box-shadow: var(--shadow); transition: background .2s, color .2s; }
.filter:hover { background: var(--pith); }
.filter.active { background: var(--ink); color: #fff; }

.work-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-flow: dense; gap: var(--gap); }
.work-card {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--card); border-radius: var(--radius); padding: 10px;
  box-shadow: var(--shadow); transition: transform .45s var(--ease), box-shadow .45s var(--ease), opacity .3s;
}
.work-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); }
.work-card.featured { grid-column: span 2; grid-row: span 2; }
.work-card.is-hidden { display: none; }
.work-cover { position: relative; overflow: hidden; border-radius: var(--radius-sm); aspect-ratio: 16 / 10; background: var(--accent); isolation: isolate; }
.featured .work-cover { flex: 1; aspect-ratio: auto; min-height: 280px; }
.cover-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.work-card:hover .cover-media, .work-card:hover .cover-gen-pomelo { transform: scale(1.05); }
.work-arrow {
  position: absolute; top: 12px; right: 12px; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; background: var(--card); color: var(--ink); font-size: 18px;
  opacity: 0; transform: scale(.6) rotate(-45deg); transition: all .4s var(--ease); z-index: 2;
}
.work-card:hover .work-arrow { opacity: 1; transform: none; }
.work-meta { padding: 14px 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.work-head { display: flex; align-items: baseline; gap: 10px; }
.work-head h3 { font-size: 21px; letter-spacing: -.025em; flex: 1; }
.featured .work-head h3 { font-size: clamp(24px, 2.4vw, 32px); }
.work-index, .work-year { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.work-meta > p { color: var(--ink-2); font-size: 14.5px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 自动生成的封面 */
.cover-gen {
  position: absolute; inset: 0; overflow: hidden;
  background: var(--accent); color: var(--accent-ink);
  --peel: color-mix(in srgb, var(--accent-ink) 14%, transparent);
  --pith: var(--accent);
  --pulp: color-mix(in srgb, var(--accent-ink) 10%, transparent);
}
.p-cover .cover-gen { position: relative; aspect-ratio: 16 / 8; }
.cover-gen-mark { position: absolute; left: 7%; top: 12%; font-size: clamp(44px, 6vw, 72px); line-height: 1; }
.cover-gen.big .cover-gen-mark { font-size: clamp(64px, 10vw, 140px); }
.cover-gen-title { position: absolute; left: 7%; bottom: 10%; right: 40%; font-weight: 800; letter-spacing: -.04em; line-height: 1; font-size: clamp(26px, 3vw, 40px); }
.cover-gen.big .cover-gen-title { font-size: clamp(40px, 6.5vw, 96px); }
.cover-gen-pomelo { position: absolute; right: -14%; bottom: -30%; width: 62%; height: auto; transition: transform .8s var(--ease); }

.empty { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; padding: 72px 24px; border-radius: var(--radius); background: var(--card); color: var(--muted); }

/* ---------- 详情页 ---------- */
.back { display: inline-flex; margin: 6px 0 14px; padding: 8px 16px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-size: 14px; transition: transform .25s var(--ease); }
.back:hover { transform: translateX(-3px); }
.p-hero { grid-template-columns: 2fr 1fr; }
.p-title-tile { display: flex; flex-direction: column; gap: 18px; padding: clamp(28px, 3.6vw, 52px); }
.p-title { display: flex; align-items: center; gap: .25em; flex-wrap: wrap; font-size: clamp(42px, 6.4vw, 92px); letter-spacing: -.05em; line-height: 1; margin-top: 18px; }
.p-logo { width: .9em; height: .9em; border-radius: .2em; object-fit: cover; }
.p-emoji { font-size: .85em; }
.p-tagline { font-size: clamp(18px, 1.7vw, 23px); font-weight: 500; letter-spacing: -.01em; color: var(--ink-2); max-width: 30em; }
.p-summary { color: var(--muted); max-width: 40em; }
.p-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.p-meta { margin: 0; display: flex; flex-direction: column; gap: 0; }
.meta-row { display: grid; gap: 6px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.meta-row:first-child { padding-top: 0; }
.meta-row:last-child { border-bottom: 0; padding-bottom: 0; }
.meta-row dt { font-family: var(--mono); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.meta-row dd { margin: 0; font-weight: 500; }

.p-cover { margin-top: var(--gap); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--accent); }
.p-cover > .cover-media { position: static; width: 100%; height: auto; max-height: 82vh; object-fit: cover; }

.metrics { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-top: var(--gap); }
.metric { display: flex; flex-direction: column; gap: 8px; }
.metric strong { font-size: clamp(40px, 4.4vw, 64px); letter-spacing: -.05em; line-height: 1; }
.metric span { color: var(--muted); font-size: 14px; }
.metric:first-child { background: var(--accent); color: var(--accent-ink); }
.metric:first-child span { color: inherit; opacity: .7; }

.block { margin-top: clamp(56px, 7vw, 96px); }
.block-title { font-size: clamp(28px, 3vw, 40px); letter-spacing: -.04em; margin-bottom: 18px; }
.highlights { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.highlight { display: flex; flex-direction: column; gap: 10px; min-height: 200px; }
.highlight h3 { font-size: 21px; margin-top: auto; }
.highlight p { color: var(--ink-2); font-size: 15px; }
.hl-icon { font-size: 30px; line-height: 1; }
.hl-num { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.highlight-accent { background: var(--accent); color: var(--accent-ink); }
.highlight-accent p, .highlight-accent .hl-num { color: inherit; opacity: .78; }

.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); align-items: start; }
.shot { margin: 0; background: var(--card); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); }
.shot.wide { grid-column: 1 / -1; }
.shot img, .shot video { width: 100%; border-radius: var(--radius-sm); background: var(--bg); }
.shot img { cursor: zoom-in; }
.shot figcaption { padding: 12px 8px 4px; font-size: 14px; color: var(--muted); }

.story {
  display: grid; grid-template-columns: minmax(180px, 1fr) 3fr; gap: clamp(20px, 4vw, 64px);
  margin-top: var(--gap); padding: clamp(28px, 4vw, 56px); background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
}
.block + .story, .highlights + .story { margin-top: clamp(56px, 7vw, 96px); }
.story-title { font-size: clamp(24px, 2.4vw, 32px); letter-spacing: -.035em; align-self: start; position: sticky; top: 92px; }
.story-title::before { content: ""; display: block; width: 28px; height: 6px; border-radius: 3px; background: var(--accent); margin-bottom: 14px; }

.prose { max-width: 70ch; font-size: 16.5px; line-height: 1.85; color: var(--ink-2); }
.prose > * + * { margin-top: 1em; }
.prose h2, .prose h3, .prose h4 { color: var(--ink); margin-top: 1.8em; letter-spacing: -.02em; line-height: 1.3; }
.prose h2 { font-size: 24px; } .prose h3 { font-size: 20px; } .prose h4 { font-size: 17px; }
.prose a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 3px; }
.prose strong { color: var(--ink); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .35em; }
.prose li::marker { color: var(--muted); }
.prose blockquote { margin-left: 0; padding: 14px 20px; border-radius: 14px; background: var(--pith); color: var(--ink); border-left: 4px solid var(--accent); }
.prose code { font-family: var(--mono); font-size: .88em; padding: .15em .45em; border-radius: 6px; background: var(--bg); color: var(--ink); }
.prose pre { padding: 18px 20px; border-radius: 16px; background: var(--dark); color: #EDEDE8; overflow-x: auto; font-size: 14px; line-height: 1.65; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.prose th { color: var(--ink); font-weight: 600; }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 2em 0; }
.md-figure { margin: 1.6em 0; }
.md-figure img { border-radius: var(--radius-sm); box-shadow: var(--shadow); cursor: zoom-in; }
.md-figure figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); text-align: center; }

.next-card {
  position: relative; display: flex; flex-direction: column; gap: 10px; overflow: hidden;
  margin-top: clamp(56px, 7vw, 96px); padding: clamp(32px, 5vw, 64px);
  background: var(--accent); color: var(--accent-ink); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .45s var(--ease);
}
.next-card .eyebrow { color: inherit; opacity: .65; }
.next-card strong { font-size: clamp(40px, 7vw, 104px); letter-spacing: -.055em; line-height: 1; }
.next-tagline { opacity: .75; max-width: 36em; }
.next-arrow { position: absolute; right: clamp(24px, 4vw, 56px); top: 50%; font-size: clamp(40px, 6vw, 88px); transform: translateY(-50%); transition: transform .45s var(--ease); }
.next-card:hover { transform: translateY(-4px); }
.next-card:hover .next-arrow { transform: translate(12px, -50%); }

/* 灯箱 */
.lightbox { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 4vmin; background: rgba(20,20,20,.88); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); cursor: zoom-out; animation: fade .25s ease; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 92vh; border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.lightbox-close { position: absolute; top: 18px; right: 18px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #fff; font-size: 24px; cursor: pointer; }
@keyframes fade { from { opacity: 0; } }

/* ---------- 页脚 ---------- */
.footer { margin-top: clamp(80px, 10vw, 140px); padding-bottom: 20px; }
.footer-card { background: var(--dark); color: #fff; border-radius: var(--radius); padding: clamp(32px, 5vw, 64px); display: flex; flex-direction: column; gap: 28px; overflow: hidden; }
.footer-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.footer-title { font-size: clamp(44px, 7vw, 104px); letter-spacing: -.055em; line-height: .98; margin-top: 14px; }
.footer-title em { font-style: normal; color: var(--peel); }
.footer-pomelo { flex: none; width: clamp(80px, 11vw, 132px); height: auto; }
.footer-intro { max-width: 40em; color: rgba(255,255,255,.65); }
.contacts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.contacts a, .contacts span { display: inline-block; padding: 9px 16px; border-radius: 999px; background: rgba(255,255,255,.08); font-size: 14px; transition: background .2s, color .2s; }
.contacts a:hover { background: var(--peel); color: var(--ink); }
.footer-bottom { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.1); font-family: var(--mono); font-size: 12px; color: rgba(255,255,255,.45); }

.notfound { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; }
.notfound h1 { font-size: 96px; letter-spacing: -.06em; }
.notfound p { color: var(--muted); margin-bottom: 8px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .hero { grid-template-columns: repeat(2, 1fr); }
  .tile-intro { min-height: 400px; }
  .work-grid { grid-template-columns: repeat(2, 1fr); }
  .work-card.featured { grid-row: span 1; }
  .featured .work-cover { flex: none; aspect-ratio: 16 / 8; min-height: 0; }
  .p-hero { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  :root { --radius: 22px; --radius-sm: 14px; --gap: 10px; }
  .nav-links a { display: none; }
  .status-pill { margin-left: 0; }
  .tile-intro { min-height: 0; padding-top: 48px; }
  .tile-count, .tile-pomelo, .tile-tools, .tile-latest { min-height: 180px; }
  .big-num { font-size: 80px; }
  .work-grid { grid-template-columns: 1fr; }
  .work-card.featured { grid-column: auto; }
  .featured .work-cover { aspect-ratio: 16 / 10; }
  .gallery { grid-template-columns: 1fr; }
  .story { grid-template-columns: 1fr; gap: 16px; }
  .story-title { position: static; }
  .p-cover .cover-gen { aspect-ratio: 4 / 3; }
  .footer-top { flex-direction: column-reverse; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
