/* ==========================================================================
   AyuCheung — personal portfolio (shared styles)
   Editorial minimal, high-contrast. Tokens centralized below.
   ========================================================================== */

:root {
  /* palette — light（纯白底黑字；强调色取原站珊瑚红一族，正文对比 ≥4.5:1） */
  --paper: #FFFFFF;
  --surface: #FFFFFF;
  --ink: #000000;
  --muted: #55534D;
  --line: #E5E5E5;
  --accent: #3B82F6;
  --accent-ink: #2563EB;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --link: #9333EA;
  --link-soft: color-mix(in srgb, var(--link) 12%, transparent);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 32%, transparent);

  /* type */
  --font-display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", "Hiragino Sans GB", "Helvetica Neue", sans-serif;

  /* scale — 统一小比例：正文 1rem / 标题 1.125rem / 大标题 1.25rem */
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1rem;      /* 正文 */
  --text-xl: 1.125rem;  /* 标题 */

  /* spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 16px;
  --sp-4: 24px;
  --sp-5: 32px;
  --sp-6: 48px;
  --sp-7: 64px;
  --sp-8: 96px;

  /* motion */
  --dur: 220ms;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* geometry */
  --radius: 10px;
  --container: 70%;
  --gutter: 24px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 50;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 0 0 var(--radius) var(--radius);
  text-decoration: none;
  transition: top var(--dur) var(--ease);
}

.skip-link:focus { top: 0; }

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- header（悬浮白色磨砂药丸） ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 16px 0; /* 顶部留白，药丸悬浮于页面之上 */
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: 56px;
  padding-inline: 20px;
  border-radius: 999px; /* 药丸 */
  background: rgba(255, 255, 255, 0.7); /* 白色磨砂 */
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.125rem;
  letter-spacing: 0.04em;
}

.brand img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

/* ---------- 桌面导航（菜单名，内联） ---------- */
.site-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  text-decoration: none;
  color: var(--muted);
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  border-radius: 999px;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

@media (hover: hover) {
  .site-nav a:hover { color: var(--link); background: var(--link-soft); }
}

.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

/* ---------- 汉堡按钮（纯图标，仅移动端显示） ---------- */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

.menu-toggle .menu-bar {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 1px;
  background: var(--ink);
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}

.menu-toggle[aria-expanded="true"] .menu-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-bar:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .menu-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 右侧抽屉菜单 ---------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur) var(--ease), visibility var(--dur) var(--ease);
}
.drawer-backdrop.is-open { opacity: 1; visibility: visible; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: min(320px, 84vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.1);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform var(--dur) var(--ease), visibility var(--dur) var(--ease);
}
.drawer.is-open { transform: translateX(0); visibility: visible; }

.drawer-nav { padding: var(--sp-6) var(--sp-4); }
.drawer-nav a {
  display: block;
  padding: var(--sp-3);
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.25rem;
  border-radius: var(--radius);
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
@media (hover: hover) {
  .drawer-nav a:hover { background: var(--link-soft); color: var(--link); }
}
.drawer-nav a[aria-current="page"] { color: var(--accent); }

body.drawer-open { overflow: hidden; }

/* PC 无右侧栏：抽屉与遮罩仅在移动端生效 */
@media (min-width: 769px) {
  .drawer, .drawer-backdrop { display: none; }
}

/* ---------- 返回顶部（常驻，页面滑动显示） ---------- */
.back-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--dur) var(--ease), visibility var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.back-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.back-top svg { width: 32px; height: 32px; }
@media (hover: hover) {
  .back-top:hover { background: rgba(255, 255, 255, 0.92); color: var(--accent); }
}

/* ---------- sections ---------- */
.section { padding-block: var(--sp-7); }
.section + .section { border-top: 1px solid var(--line); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.section-head-main { min-width: 0; }

.section-head.center {
  justify-content: center;
  text-align: center;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.01em;
}

.section-sub {
  margin: var(--sp-2) 0 0;
  color: var(--muted);
  font-size: var(--text-md);
  max-width: 34em;
}

/* ---------- work cards ---------- */
.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-5) var(--sp-4);
}

.work-card {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  border-radius: var(--radius);
  transition: transform var(--dur) var(--ease);
}

.work-card .media {
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  aspect-ratio: 3 / 4; /* 所有封面统一 3:4 竖版，横图（如 TCL）object-fit 裁切 */
}

.work-card .media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 420ms var(--ease);
}

@media (hover: hover) {
  .work-card:hover { transform: translateY(-2px); }
  .work-card:hover .media img { transform: scale(1.02); }
}

.work-card .work-title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  margin: var(--sp-3) 0 var(--sp-1);
  transition: color var(--dur) var(--ease);
}

@media (hover: hover) {
  .work-card:hover .work-title { color: var(--link); }
}

.work-card .tag {
  display: inline-block;
  color: var(--muted);
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
}

/* ---------- buttons / links ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 12px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: background-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

@media (hover: hover) {
  .btn:hover { background: var(--accent-ink); }
}

.btn:active { transform: translateY(1px); }

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

@media (hover: hover) {
  .btn.ghost:hover { background: transparent; color: var(--link); border-color: var(--link); }
}

/* ---------- FAQ accordion (home) ---------- */
.faq-list {
  display: grid;
  gap: var(--sp-3);
}

.faq-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.5;
  list-style: none;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: "+";
  flex-shrink: 0;
  font-size: 1.375rem;
  font-weight: 400;
  line-height: 1;
  color: var(--muted);
  transition: transform var(--dur) var(--ease), color var(--dur) var(--ease);
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
  color: var(--accent);
}

@media (hover: hover) {
  .faq-item summary:hover::after { color: var(--accent); }
}

.faq-body {
  padding: 0 var(--sp-4) var(--sp-4);
  border-top: 1px solid var(--line);
}

.faq-body p { margin: var(--sp-3) 0 0; color: var(--muted); }

/* ---------- about page article ---------- */
.article {
  max-width: 46em;
  margin-inline: auto;
  padding-block: var(--sp-7);
}

.article .page-title {
  font-family: var(--font-display);
  font-size: 1.25rem; /* 大标题 */
  font-weight: 600;
  margin: 0 0 var(--sp-1);
}

.article .page-sub {
  color: var(--muted);
  margin: 0 0 var(--sp-6);
}

.article h2 {
  font-family: var(--font-display);
  font-size: 1.125rem; /* 标题 */
  font-weight: 600;
  margin: var(--sp-6) 0 var(--sp-3);
  line-height: 1.4;
}

.article p {
  margin: 0 0 var(--sp-4);
  color: var(--ink);
}

.article p.lead {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  line-height: 1.7;
}

.article .cta { margin-top: var(--sp-6); }

/* ---------- footer（AbinCMS 同款） ---------- */
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  justify-content: center;
  margin-top: 1.2rem;
}
.footer-links a {
  color: #777;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.3s ease;
}
.footer-links a:hover { color: #111; }

/* 页脚联系方式行 */
.footer-contact {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
}
.footer-contact .icon-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.footer-contact .icon-link {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  cursor: pointer;
  color: #000;
  text-decoration: none;
}
.footer-contact button.icon-link {
  padding: 0;
  border: 0;
  font: inherit;
  line-height: 1;
}
.footer-contact .icon-link:hover {
  background-color: #000;
  color: #fff;
  transform: translateY(-3px);
}
.footer-contact .icon-link:focus-visible {
  outline: 2px solid #000;
  outline-offset: 2px;
}
.footer-contact .icon-link i {
  font-size: 1.2rem;
  color: inherit;
}
.footer-contact .icon-link .icon-svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}
.footer-contact .icon-wrapper:hover .icon-link i { color: #fff; }
.footer-contact .icon-text {
  font-size: 0.85rem;
  color: #666;
}

.footer {
  text-align: center;
  padding: 2rem;
  margin-top: auto;
}
.copyright {
  margin-bottom: 0.5rem;
  color: #333;
  font-weight: 400;
}
.copyright-notice {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.3rem;
  line-height: 1.3;
}
.beian {
  margin-top: 0.5rem;
}
.beian a {
  color: #aaaaaa;
  text-decoration: none;
  transition: color 0.3s ease;
  font-size: 0.85rem;
}
.beian a:hover {
  color: #888888;
  text-decoration: underline;
}

/* ---------- work detail page ---------- */
.detail { padding: var(--sp-6) 0; }
.detail .container { max-width: 860px; }
.detail-head { margin-bottom: var(--sp-5); text-align: center; }
.detail-head h1 {
  font-family: var(--font-display);
  font-size: 1.25rem; /* 大标题 */
  line-height: 1.3;
  margin: 0 0 var(--sp-3);
}
.detail-head .tag { color: var(--accent); }

.detail-cover { margin: 0 0 var(--sp-5); }
.detail-cover img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.detail-body { display: grid; gap: var(--sp-4); }
.detail-body p { margin: 0; }
.detail-body img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.detail-body h2 {
  font-family: var(--font-display);
  font-size: 1.125rem; /* 标题 */
  line-height: 1.4;
  margin: var(--sp-4) 0 0;
}
.detail-body blockquote {
  margin: 0;
  padding-left: var(--sp-4);
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.detail-body pre {
  overflow-x: auto;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.detail-body code { font-size: 0.9em; }
.detail-body ul, .detail-body ol { margin: 0; padding-left: 1.25em; }

.detail-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
}

/* ---------- reveal on scroll（无 JS 时默认可见；仅 html.js 下才先隐藏再入场） ---------- */
.reveal { transition: opacity 520ms var(--ease), transform 520ms var(--ease); }
html.js .reveal:not(.is-in) { opacity: 0; transform: translateY(14px); }

.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- homepage: image hero / values / banner ---------- */
.hero-img {
  min-height: 110vh;
  margin-top: -88px; /* 拉到页面顶部，banner 铺满顶端（抵消 header 高度 16+56+16） */
  display: flex;
  align-items: center; /* banner 文案垂直居中 */
  background-size: cover;
  background-position: top center; /* 图片顶对齐页面顶部、水平居中 */
  position: relative;
  color: #fff;
  padding-bottom: calc(var(--sp-7) + clamp(28px, 5vw, 60px));
}
.hero-img::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.12) 55%, rgba(0, 0, 0, 0.25));
}
.hero-img .container { position: relative; z-index: 1; width: 100%; }
.hero-img-title {
  font-family: var(--font-display);
  font-size: 1rem; /* banner 文本 16px */
  line-height: 1.8; /* 行高 1.8 倍 */
  margin: 0 0 var(--sp-3);
  letter-spacing: 0.01em;
  text-align: left;
}
.hero-img-sub { font-size: 1rem; line-height: 1.8; opacity: 0.92; margin: 0; text-align: left; }

.value-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}
.value-item {
  padding: var(--sp-5) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.value-item h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  margin: 0 0 var(--sp-3);
}
.value-item p { margin: 0; color: var(--muted); }
.value-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: var(--sp-4);
}
.value-icon svg { width: 22px; height: 22px; }

.banner {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  background-attachment: fixed; /* 视差：背景固定，内容滚动 */
  position: relative;
  color: #fff;
  padding: var(--sp-7) 0;
}
.banner::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }
.banner .container { position: relative; z-index: 1; width: 100%; }
.banner-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  line-height: 1.6;
  text-align: center;
  margin: 0;
}
.banner-title span { display: block; }

/* 作品列表页 banner：矮版（50vh），并拉满顶部抵消悬浮头部高度 */
.banner-short {
  min-height: 50vh;
  margin-top: -88px; /* 与首页 hero-img 一致：拉满顶部，抵消 header 高度 16+56+16 */
}

/* ---------- responsive ---------- */
@media (max-width: 768px) {
  :root { --gutter: 20px; }
  .banner { background-attachment: scroll; } /* 移动端固定背景易出 bug，改随页滚动 */
  .site-nav { display: none; }
  .menu-toggle { display: inline-flex; }
  main .container, .article { max-width: 100%; padding-inline: 5%; } /* 页面内容手机端统一 90% 宽（左右各 5%）；PC 端 70% 不变 */
  .value-grid { grid-template-columns: 1fr; gap: var(--sp-4); }
  .work-grid { grid-template-columns: 1fr; }
  .section-head { flex-wrap: wrap; }
  .footer-contact .icon-link { width: 45px; height: 45px; }
}

@media (max-width: 375px) {
  .detail-nav { flex-direction: column; align-items: stretch; }
  .detail-nav a { justify-content: center; }
}
