/* ============================================================
   全局变量 & 重置
   ============================================================ */
:root {
  --ink:      #f7f5f0;
  --ink-70:   rgba(247,245,240,.70);
  --ink-45:   rgba(247,245,240,.45);
  --ink-20:   rgba(247,245,240,.20);
  --serif:    "Noto Serif SC","Songti SC","STSong",serif;
  --sans:     -apple-system,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  --bg-dark:  #0b0d10;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg-dark);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(255,255,255,.22); }

/* ============================================================
   开场加载
   ============================================================ */
.preloader {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg-dark);
  display: flex; flex-direction: column;
  justify-content: center; align-items: center; gap: 30px;
  transition: opacity 1.1s ease, visibility 1.1s;
}

.preloader.hide { opacity: 0; visibility: hidden; }

.pre-name {
  font-family: var(--serif); font-weight: 200;
  font-size: clamp(42px, 7vw, 76px);
  letter-spacing: .4em; text-indent: .4em;
  opacity: 0;
  animation: preName 1.6s .2s cubic-bezier(.22,.61,.36,1) forwards;
}

@keyframes preName {
  from { opacity: 0; transform: translateY(22px); letter-spacing: .6em; }
  to   { opacity: 1; transform: translateY(0);    letter-spacing: .4em; }
}

.pre-line {
  width: 0; height: 1px;
  background: var(--ink-45);
  animation: preLine 2.2s .7s ease forwards;
}

@keyframes preLine { to { width: 130px; } }

.pre-tip {
  font-size: 11px; letter-spacing: .4em; text-indent: .4em;
  color: var(--ink-45); opacity: 0;
  animation: preName 1.4s 1.2s forwards;
}

/* ============================================================
   背景
   ============================================================ */
.bg-wrap {
  position: fixed; inset: -6%;
  will-change: transform;
}

.bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0;
  transition: opacity 2.8s ease;
  will-change: opacity, transform;
}

.bg.show {
  opacity: 1;
  animation: breath 36s ease-out forwards;
}

@keyframes breath {
  from { transform: scale(1.02); }
  to   { transform: scale(1.12); }
}

.mask {
  position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(80% 70% at 50% 45%, rgba(5,8,12,.35) 0%, rgba(5,8,12,.65) 100%),
    linear-gradient(180deg, rgba(5,8,12,.4) 0%, rgba(5,8,12,.15) 30%, rgba(5,8,12,.15) 62%, rgba(5,8,12,.5) 100%);
}

.grain {
  position: fixed; inset: -100%; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 9s steps(10) infinite;
}

@keyframes grain {
  0%, 100% { transform: translate(0,0); }
  10% { transform: translate(-5%,-8%); }
  30% { transform: translate(3%,-12%); }
  50% { transform: translate(-8%,4%); }
  70% { transform: translate(6%,8%); }
  90% { transform: translate(-3%,6%); }
}

/* ============================================================
   全屏转场动画
   ============================================================ */
.page-transition {
  position: fixed; inset: 0; z-index: 95;
  pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}

.pt-curtain {
  position: absolute; inset: 0;
  background: var(--bg-dark);
  transform: translateY(101%);
  transition: transform .65s cubic-bezier(.76,0,.24,1);
}

.page-transition.active { pointer-events: auto; }
.page-transition.active .pt-curtain { transform: translateY(0); }

.pt-label {
  position: relative; z-index: 2;
  font-family: var(--serif); font-weight: 200;
  font-size: clamp(28px, 5vw, 56px);
  letter-spacing: .35em; text-indent: .35em;
  opacity: 0; transform: translateY(12px);
  transition: opacity .4s ease .25s, transform .4s ease .25s;
}

.page-transition.active .pt-label {
  opacity: 1; transform: translateY(0);
}

.pt-sub {
  position: absolute; bottom: 18%; left: 50%;
  transform: translateX(-50%);
  font-size: 11px; letter-spacing: .5em; text-indent: .5em;
  color: var(--ink-45); opacity: 0;
  transition: opacity .4s ease .4s;
}

.page-transition.active .pt-sub { opacity: 1; }

/* ============================================================
   自定义光标
   ============================================================ */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0;
  pointer-events: none; z-index: 200; border-radius: 50%;
}

.cursor-dot { width: 6px; height: 6px; background: var(--ink); }

.cursor-ring {
  width: 34px; height: 34px;
  border: 1px solid var(--ink-45);
  transition: width .3s, height .3s, border-color .3s, background .3s;
}

.cursor-ring.hover {
  width: 58px; height: 58px;
  border-color: var(--ink);
  background: rgba(247,245,240,.08);
}

@media (hover:none), (pointer:coarse) {
  .cursor-dot, .cursor-ring { display: none; }
}

@media (hover:hover) and (pointer:fine) {
  body, a { cursor: none; }
}

/* ============================================================
   页面骨架
   ============================================================ */
.page {
  position: relative; z-index: 2;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  justify-content: space-between;
  padding: clamp(20px, 4vh, 44px) clamp(20px, 5vw, 64px);
}

header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; letter-spacing: .35em;
  text-transform: uppercase; color: var(--ink-70);
}

.logo { font-weight: 600; color: var(--ink); text-shadow: 0 1px 8px rgba(0,0,0,.5); }

.clock { font-variant-numeric: tabular-nums; text-shadow: 0 1px 8px rgba(0,0,0,.5); }

main {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
}

#mainInner {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  will-change: transform;
}

.greeting {
  font-size: 12px; letter-spacing: .5em; text-indent: .5em;
  text-transform: uppercase; color: var(--ink-70);
  margin-bottom: 24px;
  text-shadow: 0 1px 10px rgba(0,0,0,.5);
}

h1 {
  font-family: var(--serif); font-weight: 200; line-height: 1.15;
  font-size: clamp(46px, 8vw, 92px);
  letter-spacing: .16em; text-indent: .16em;
  text-shadow: 0 2px 20px rgba(0,0,0,.6), 0 0 60px rgba(0,0,0,.3);
}

.role {
  margin-top: 20px; font-size: 14px;
  letter-spacing: .32em; text-indent: .32em;
  color: var(--ink-70);
  text-shadow: 0 1px 10px rgba(0,0,0,.5);
}

.divider {
  width: 1px; height: 54px;
  margin: 36px auto 30px;
  background: linear-gradient(var(--ink-45), transparent);
}

.quote {
  min-height: 1.7em;
  font-family: var(--serif); font-weight: 400;
  font-size: 14px; letter-spacing: .14em;
  color: var(--ink-70);
  transition: opacity 1s ease;
  text-shadow: 0 1px 10px rgba(0,0,0,.5);
}

/* ============================================================
   导航
   ============================================================ */
nav {
  margin-top: 44px;
  display: flex; gap: clamp(16px, 4vw, 52px);
}

.link {
  position: relative;
  display: flex; flex-direction: column;
  align-items: center; gap: 9px;
  padding: 12px 12px 16px;
  text-decoration: none; color: var(--ink-70);
  transition: color .4s ease, transform .4s ease;
  text-shadow: 0 1px 8px rgba(0,0,0,.5);
}

.link .num {
  font-size: 10px; letter-spacing: .22em;
  color: var(--ink-45); transition: color .4s;
}

.link .zh {
  font-size: 16px; letter-spacing: .3em; text-indent: .3em;
  transition: letter-spacing .4s;
}

.link .en {
  font-size: 10px; letter-spacing: .3em; text-indent: .3em;
  text-transform: uppercase; color: var(--ink-45);
  transition: color .4s;
}

.link::after {
  content: "";
  position: absolute; left: 50%; bottom: 0;
  width: 0; height: 1px;
  background: var(--ink);
  transition: width .45s ease, left .45s ease;
}

.link:hover { color: var(--ink); transform: translateY(-5px); }
.link:hover .zh { letter-spacing: .42em; }
.link:hover .num, .link:hover .en { color: var(--ink-70); }
.link:hover::after { width: 100%; left: 0; }
.link:focus-visible { outline: 1px solid var(--ink-45); outline-offset: 4px; }

/* 移动端触摸反馈 */
@media (hover: none) {
  .link:active { opacity: .7; transform: scale(.96); }
}

/* ============================================================
   页脚
   ============================================================ */
footer {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; letter-spacing: .25em; color: var(--ink-45);
  text-shadow: 0 1px 8px rgba(0,0,0,.5);
}

/* ============================================================
   弹窗
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: opacity .4s ease, visibility .4s;
}

.modal-overlay.show { opacity: 1; visibility: visible; }

.modal {
  background: rgba(20,22,28,.92);
  border: 1px solid var(--ink-20);
  border-radius: 12px;
  padding: 40px 48px;
  text-align: center;
  max-width: 360px; width: 88vw;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(20px) scale(.96);
  transition: transform .4s cubic-bezier(.22,.61,.36,1);
}

.modal-overlay.show .modal {
  transform: translateY(0) scale(1);
}

.modal-title {
  font-family: var(--serif); font-weight: 200;
  font-size: 24px; letter-spacing: .3em; text-indent: .3em;
  margin-bottom: 24px;
}

.modal-content {
  font-size: 15px; letter-spacing: .12em;
  line-height: 2; color: var(--ink-70);
  word-break: break-all;
}

.modal-qrcode {
  width: 180px; height: 180px;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 12px;
}

.modal-text {
  font-size: 15px; letter-spacing: .12em;
  color: var(--ink-70);
}

.modal-hint {
  margin-top: 24px;
  font-size: 11px; letter-spacing: .3em; color: var(--ink-45);
}

/* ============================================================
   作品集弹窗
   ============================================================ */
.pf-overlay {
  position: fixed; inset: 0; z-index: 91;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: opacity .4s ease, visibility .4s;
}

.pf-overlay.show { opacity: 1; visibility: visible; }

.pf-panel {
  background: rgba(20,22,28,.92);
  border: 1px solid var(--ink-20);
  border-radius: 16px;
  padding: 48px 40px 36px;
  max-width: 680px; width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(20px) scale(.96);
  transition: transform .4s cubic-bezier(.22,.61,.36,1);
  /* 隐藏滚动条但保留滚动 */
  scrollbar-width: none; -ms-overflow-style: none;
}
.pf-panel::-webkit-scrollbar { display: none; }

.pf-overlay.show .pf-panel {
  transform: translateY(0) scale(1);
}

.pf-title {
  font-family: var(--serif); font-weight: 200;
  font-size: 24px; letter-spacing: .35em; text-indent: .35em;
  text-align: center;
  margin-bottom: 32px;
}

.pf-grid {
  display: flex; flex-direction: column; gap: 16px;
}

/* ---------- 作品卡片 ---------- */
.pf-card {
  display: flex; align-items: center; gap: 18px;
  padding: 20px 24px;
  background: rgba(247,245,240,.03);
  border: 1px solid var(--ink-20);
  border-radius: 12px;
  transition: background .35s ease, border-color .35s ease,
              transform .35s cubic-bezier(.22,.61,.36,1),
              box-shadow .35s ease;
}

.pf-card:hover {
  background: rgba(247,245,240,.06);
  border-color: var(--ink-45);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
}

.pf-card-icon {
  flex-shrink: 0;
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  background: rgba(247,245,240,.05);
  border: 1px solid var(--ink-20);
  border-radius: 10px;
}

.pf-card-info {
  flex: 1; min-width: 0;
}

.pf-card-name {
  font-size: 16px; font-weight: 600;
  letter-spacing: .18em; text-indent: .18em;
  margin-bottom: 5px;
  text-shadow: 0 1px 6px rgba(0,0,0,.4);
}

.pf-card-desc {
  font-size: 13px; letter-spacing: .06em;
  color: var(--ink-70); line-height: 1.6;
  margin-bottom: 8px;
}

.pf-card-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
}

.pf-card-tag {
  font-size: 10px; letter-spacing: .12em;
  padding: 3px 10px;
  background: rgba(247,245,240,.06);
  border: 1px solid var(--ink-20);
  border-radius: 100px;
  color: var(--ink-45);
}

.pf-card-links {
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 8px;
}

.pf-card-link {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  font-size: 11px; letter-spacing: .1em;
  color: var(--ink-70);
  background: rgba(247,245,240,.04);
  border: 1px solid var(--ink-20);
  border-radius: 100px;
  text-decoration: none;
  white-space: nowrap;
  transition: color .3s, border-color .3s, background .3s, transform .3s;
}

.pf-card-link:hover {
  color: var(--ink);
  border-color: var(--ink-45);
  background: rgba(247,245,240,.10);
  transform: translateY(-1px);
}

.pf-card-link:active { transform: scale(.96); }

.pf-card-link svg {
  width: 13px; height: 13px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.pf-hint {
  margin-top: 28px;
  text-align: center;
  font-size: 11px; letter-spacing: .3em; color: var(--ink-45);
}

/* 作品集入场动画 */
.pf-overlay.show .pf-card {
  animation: pfFadeUp .5s cubic-bezier(.22,.61,.36,1) forwards;
  opacity: 0;
}
.pf-overlay.show .pf-card:nth-child(1) { animation-delay: .06s; }
.pf-overlay.show .pf-card:nth-child(2) { animation-delay: .12s; }
.pf-overlay.show .pf-card:nth-child(3) { animation-delay: .18s; }
.pf-overlay.show .pf-card:nth-child(4) { animation-delay: .24s; }
.pf-overlay.show .pf-card:nth-child(5) { animation-delay: .30s; }
.pf-overlay.show .pf-card:nth-child(6) { animation-delay: .36s; }

@keyframes pfFadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 作品集响应式 ---------- */
@media (max-width: 480px) {
  .pf-panel { padding: 32px 20px 28px; }
  .pf-title { font-size: 20px; margin-bottom: 24px; }
  .pf-card {
    flex-wrap: wrap;
    padding: 16px 18px;
    gap: 12px;
  }
  .pf-card-icon { width: 42px; height: 42px; font-size: 22px; }
  .pf-card-name { font-size: 15px; }
  .pf-card-desc { font-size: 12px; }
  .pf-card-links {
    flex-direction: row;
    width: 100%;
    padding-top: 4px;
  }
  .pf-card-link { flex: 1; justify-content: center; padding: 7px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .pf-overlay.show .pf-card { animation: none; opacity: 1; }
}

/* ============================================================
   入场动画
   ============================================================ */
.fade { opacity: 0; }

.loaded .fade {
  animation: fadeUp 1.3s cubic-bezier(.22,.61,.36,1) forwards;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: translateY(0); }
}

.loaded .d1 { animation-delay: .1s; }
.loaded .d2 { animation-delay: .3s; }
.loaded .d3 { animation-delay: .5s; }
.loaded .d4 { animation-delay: .7s; }
.loaded .d5 { animation-delay: .9s; }
.loaded .d6 { animation-delay: 1.1s; }
.loaded .d7 { animation-delay: 1.3s; }

/* ============================================================
   响应式
   ============================================================ */

/* ---------- 手机：关闭纹理、收窄背景 ---------- */
@media (max-width: 768px) {
  .grain { display: none; }
  .bg-wrap { inset: 0; }
}

/* ---------- 手机竖屏 ---------- */
@media (max-width: 480px) {
  .page {
    padding: clamp(16px, 3vh, 32px) 20px;
    padding-left:  max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }

  header { font-size: 11px; letter-spacing: .25em; }

  h1 { font-size: clamp(36px, 12vw, 56px); }

  .greeting {
    font-size: 10px; letter-spacing: .3em; text-indent: .3em;
    margin-bottom: 18px;
  }

  .role {
    font-size: 12px; letter-spacing: .15em; text-indent: .15em;
    margin-top: 14px;
    word-break: keep-all;
  }

  .divider { height: 36px; margin: 24px auto 18px; }

  .quote {
    font-size: 13px; letter-spacing: .1em;
    padding: 0 8px;
  }

  nav {
    margin-top: 28px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px 0;
    max-width: 100%;
  }

  .link { padding: 10px 6px 14px; }
  .link .zh { font-size: 14px; letter-spacing: .2em; }
  .link .en { font-size: 9px; }

  footer {
    flex-direction: column; gap: 6px;
    text-align: center; font-size: 10px;
  }

  .modal { padding: 28px 24px; }
  .modal-title { font-size: 20px; margin-bottom: 18px; }
  .modal-qrcode { width: 150px; height: 150px; }
}

/* ---------- 小屏 / 折叠屏 ---------- */
@media (max-width: 360px) {
  h1 { font-size: clamp(30px, 11vw, 46px); }
  .greeting { font-size: 9px; }
  .role { font-size: 11px; }
  .quote { font-size: 12px; }
  .link .zh { font-size: 13px; }
}

/* ---------- 平板 / 中等屏幕 ---------- */
@media (min-width: 481px) and (max-width: 768px) {
  nav { gap: clamp(12px, 3vw, 32px); }
  h1 { font-size: clamp(42px, 7vw, 72px); }
}

/* ---------- 矮屏（横屏手机等） ---------- */
@media (max-height: 680px) {
  .greeting { margin-bottom: 12px; }
  .divider { height: 30px; margin: 18px auto 14px; }
  nav { margin-top: 20px; }
}

/* ---------- 极矮屏（允许滚动） ---------- */
@media (max-height: 620px) {
  body { overflow: auto; }
  .page { height: auto; min-height: 100dvh; }
}

/* ---------- 刘海屏 / 灵动岛底部安全区 ---------- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  footer {
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01s !important;
    transition-duration: .01s !important;
  }
}
