/* 鲸尾书斋：轻盈、可阅读的原创作品集界面 */
:root {
  --paper: #f4f8fc;
  --paper-2: #ffffff;
  --paper-3: #eaf1f9;
  --ink: #1b2d4b;
  --ink-2: #465b75;
  --ink-3: #62758c;
  --line: #d3e2ef;
  --line-soft: #e3edf6;
  --blue: #789fd0;
  --blue-2: #365f99;
  --blue-pale: #e6f0fb;
  --gold: #8b6b43;
  --gold-pale: #f6eadb;
  --r-m: 18px;
  --r-l: 26px;
  --shadow: 0 18px 48px -28px rgba(46, 85, 130, .35);
  --shadow-lg: 0 30px 65px -32px rgba(46, 85, 130, .4);
}
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body { background: var(--paper); }
body::before {
  background: radial-gradient(ellipse at 18% 0%, rgba(221, 236, 250, .8), transparent 48%), radial-gradient(ellipse at 86% 18%, rgba(232, 228, 250, .4), transparent 34%);
  opacity: .8;
}
.site-header { background: rgba(248, 251, 255, .9); border-bottom-color: rgba(211, 226, 239, .9); }
.brand-mark { background: #365f99; box-shadow: none; }
.brand-txt b { letter-spacing: .1em; }
.nav a[aria-current="page"] { color: var(--blue-2); }
.nav a::after { background: var(--blue); }
.nav-cta { border-color: var(--blue-2); color: var(--blue-2) !important; }
.nav-cta:hover { background: var(--blue-2); border-color: var(--blue-2); color: white !important; }
.drawer { background: #f6faff; overflow-y: auto; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.eyebrow { color: #527aa9; letter-spacing: .18em; }
.eyebrow::before { background: #91b4dc; }
.display, .h2, h1, h2, h3, h4 { letter-spacing: .01em; }
.page-head { padding-top: clamp(38px, 6vw, 76px); }
.section { scroll-margin-top: 88px; }
.section-head { gap: 24px; }
.pill { background: rgba(255, 255, 255, .88); }
.pill[aria-selected="true"], .pill.active { background: #365f99; border-color: #365f99; color: #fff; }
.btn { border-color: #365f99; background: #365f99; color: #fff; border-radius: 999px; }
.btn:hover { background: #294a79; border-color: #294a79; color: #fff; }
.btn.ghost { color: #365f99; background: #fff; border-color: #c9d9eb; }
.btn.ghost:hover { background: #eaf3fc; border-color: #8db0d6; color: #294a79; }
.btn:disabled { cursor: not-allowed; opacity: .58; }
.card, .skill, .tool, .panel, .demo-panel { background: rgba(255, 255, 255, .94); border-color: #dce9f4; box-shadow: var(--shadow); }
.card, .skill, .tool { transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease; }
.card:hover, .skill:hover, .tool:hover { border-color: #b4cce4; box-shadow: 0 20px 45px -30px rgba(45, 83, 132, .46); }
.site-footer { background: #eaf2fa; border-top-color: #d5e4f0; }

/* 首页：角色引导与清晰的作品入口。 */
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 500; padding: 12px 20px; border-radius: 12px; background: #365f99; color: #fff; }
.skip-link:focus { top: 12px; }
.hero { padding-top: clamp(36px, 6vw, 78px); }
.hero-head { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); align-items: center; gap: 20px 48px; }
.hero-head > div:first-child { min-width: 0; }
.hero-portrait { position: relative; grid-column: 2; grid-row: 1 / 3; display: grid; justify-items: center; align-content: center; min-height: 400px; padding: 22px 20px 48px; border: 1px solid #dbe9f6; border-radius: 48% 48% 24px 24px; background: linear-gradient(155deg, #e8f3ff, #f8f9ff); }
.hero-portrait img { position: relative; z-index: 1; width: min(76%, 300px); height: auto; object-fit: contain; transition: transform .35s ease; }
.hero-portrait:hover img { transform: translateY(-6px) rotate(1deg); }
.portrait-orbit { position: absolute; inset: 15% 10% 14%; border: 1px solid #b7d1e9; border-radius: 50%; transform: rotate(-20deg); }
.portrait-spark { position: absolute; right: 17%; top: 12%; color: #7297c1; font-size: 24px; }
.portrait-caption { position: absolute; left: 18px; bottom: 18px; right: 18px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px; border-radius: 99px; color: #365f85; font-size: 13px; background: #fff; }
.portrait-caption i { width: 6px; height: 6px; border-radius: 50%; background: #668bba; }
.room-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 24px; margin-top: clamp(40px, 6vw, 72px); scroll-margin-top: 100px; }
.room-heading > span { font-weight: 600; font-size: 17px; }
.room-heading p { color: var(--ink-3); font-size: 13px; margin: 0; }
.room-heading a { margin-left: auto; color: var(--blue-2); font-size: 13px; padding: 10px 0; }
.hero-head .display { font-family: var(--sans); font-weight: 700; font-size: clamp(37px, 4.7vw, 64px); line-height: 1.16; }
.hero-head .lead { max-width: 43em; margin-top: 18px; line-height: 1.9; }
.hero-room-intro { max-width: 48em; margin: 9px 0 0; color: var(--ink-3); font-size: 13px; line-height: 1.8; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.hero-actions .btn { min-height: 46px; }
.hero-meta { grid-column: 1; display: flex; gap: 14px; padding-bottom: 3px; }
.hero-meta div { min-width: 90px; padding: 12px 15px; background: rgba(255,255,255,.76); border: 1px solid #dceaf5; border-radius: 16px; text-align: left; }
.hero-meta b { color: #365f99; }
.hero-meta span { letter-spacing: .06em; }
.card .cap span { white-space: normal; overflow-wrap: anywhere; }
.prose { overflow-wrap: anywhere; }
.prose table { display: block; max-width: 100%; overflow-x: auto; }
.project-link, .text-link { display: inline-flex; align-items: center; min-height: 44px; }
.pill, .mode { min-height: 44px; }
.stage { margin-top: clamp(28px, 4vw, 48px); background: radial-gradient(ellipse at 25% 5%, #fff 0, rgba(255,255,255,0) 54%), linear-gradient(165deg, #e9f4ff 0%, #f6f9ff 55%, #edf1fc 100%); border-color: #d5e5f4; box-shadow: var(--shadow); }
.stage::before { background: linear-gradient(180deg, rgba(215, 232, 247, 0), rgba(209, 226, 242, .68)); border-top-color: rgba(167, 195, 221, .35); }
.stage-hint { color: #526b89; }

.featured-section, .about-section, .contact-section { border-top: 0; }
.featured-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
/* 5 个代表项目：最后一张占满整行收尾，避免 2+2+1 留下孤立卡片 */
@media (min-width: 561px) {
  .featured-card:nth-child(5) { grid-column: 1 / -1; min-height: auto; }
  .featured-card:nth-child(5) .project-desc { max-width: 52em; }
}
.featured-card { display: flex; flex-direction: column; min-width: 0; min-height: 270px; position: relative; padding: 24px; border: 1px solid #d9e8f4; border-radius: 22px; background: #fff; box-shadow: var(--shadow); overflow: hidden; transition: transform .22s ease, border-color .22s ease; }
.featured-card:hover { transform: translateY(-4px); border-color: #a4c6e5; }
.featured-card::after { content: ""; position: absolute; width: 112px; height: 112px; right: -34px; top: -38px; border-radius: 50%; border: 24px solid #f0f6fc; pointer-events: none; }
.project-number { color: #88a9cc; font-size: 12px; letter-spacing: .12em; }
.project-label { color: #557fae; font-size: 11px; letter-spacing: .12em; margin-top: 18px; }
.project-title { font-family: var(--sans); font-size: 20px; margin-top: 6px; overflow-wrap: anywhere; }
.project-desc { color: var(--ink-2); line-height: 1.8; font-size: 14px; margin: 12px 0 18px; flex: 1; }
.project-tags, .about-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.project-tags span, .about-tags span { padding: 4px 10px; font-size: 12px; color: #365f85; background: #edf5fb; border-radius: 999px; }
.project-details { margin-top: 14px; color: var(--ink-2); font-size: 13px; }
.project-details summary { width: fit-content; color: #365f99; cursor: pointer; font-weight: 600; }
.project-details p { line-height: 1.7; margin: 8px 0; }
.project-actions { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 18px; padding-top: 14px; border-top: 1px solid #edf2f7; }
.project-link, .text-link { color: #365f99; font-size: 13px; font-weight: 600; }
.project-link:hover, .text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.featured-empty { color: var(--ink-2); }
.featured-empty a { margin-left: 10px; }
.about-card, .contact-card { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(28px, 5vw, 72px); padding: clamp(26px, 5vw, 64px); border: 1px solid #d9e7f3; border-radius: 28px; background: #fff; box-shadow: var(--shadow); }
.about-copy p:not(.eyebrow) { max-width: 54em; color: var(--ink-2); line-height: 1.95; }
.about-tags { margin: 22px 0; }
.about-art { position: relative; min-height: 260px; display: grid; place-items: end center; border-radius: 22px; overflow: hidden; background: linear-gradient(145deg, #eff7ff, #f9f6ff); }
.about-art-ring { position: absolute; inset: 12% 18%; border: 1px solid #c7daef; border-radius: 50%; }
.about-art img { position: relative; max-height: 300px; width: auto; object-fit: contain; }
.contact-card { align-items: start; background: linear-gradient(130deg, #fff, #f2f7fd); }
.contact-card .lead { margin: 16px 0 22px; font-size: 15px; }
.contact-form { display: grid; gap: 9px; }
.contact-form label { color: var(--ink); font-weight: 600; font-size: 13px; }
.contact-form label span { color: #a44848; }
.contact-form label .optional { color: var(--ink-3); font-weight: 400; }
.contact-form textarea, .contact-form input { background: #fff; border-color: #cfdfed; font-size: 14px; }
.contact-form textarea { resize: vertical; min-height: 128px; }
.contact-form input { min-height: 44px; }
.contact-note { margin: 2px 0 6px; color: var(--ink-3); font-size: 12px; line-height: 1.7; }
.contact-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.contact-actions .btn { min-height: 44px; }
.contact-status { color: #365f85; font-size: 13px; }

.project-number { color: #557a9f; }
.pet-btn { width: 44px; height: 44px; }
.rbtn { min-width: 44px; min-height: 44px; }
.feedback-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 20px; border-top: 1px solid var(--line-soft); padding: 20px 0; }
.feedback-body { min-width: 0; overflow-wrap: anywhere; }
.feedback-body p { margin: 0 0 8px; }
.feedback-ops button { padding: 10px 16px; border-radius: 12px; min-height: 44px; border: 1px solid var(--line); color: var(--blue-2); background: #fff; font-size: 13px; }
.feedback-ops button:disabled { opacity: .55; cursor: wait; }
@media (max-width: 1100px) { .nav a { padding-inline: 9px; } .site-header .wrap { gap: 14px; } .hero-head { gap: 20px 30px; } }
@media (max-width: 900px) {
  .hero { padding-top: 36px; }
  .hero-head { grid-template-columns: minmax(0, 1fr) minmax(220px, .65fr); gap: 20px; }
  .hero-portrait { min-height: 310px; padding: 22px 14px 55px; }
  .hero-meta { margin-top: 4px; justify-content: flex-start; }
  .hero-meta div { min-width: 72px; padding: 10px; }
  .pet-btn { width: 44px; height: 44px; }
  .stage { background: linear-gradient(160deg, #eaf5ff, #f8faff); }
  .stage .item { background: rgba(255, 255, 255, .84); border-color: #dce9f4; }
  .featured-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about-card, .contact-card { grid-template-columns: 1fr; }
  .about-art { min-height: 220px; }
  .about-art img { max-height: 260px; }
}
@media (max-width: 560px) {
  .hero-head { grid-template-columns: minmax(0, 1fr); }
  .hero-portrait { grid-column: 1; grid-row: auto; min-height: 0; max-width: 320px; width: 100%; justify-self: center; padding-top: 18px; }
  .hero-portrait img { width: 65%; max-height: 240px; }
  .hero-meta { grid-row: 2; }
  .room-heading { gap: 8px; }
  .room-heading p { width: 100%; }
  .room-heading a { margin-left: 0; }
  .feedback-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .hero-head .display { font-size: clamp(34px, 9vw, 43px); }
  .hero-head .lead { font-size: 15px; }
  .hero-meta { gap: 8px; }
  .hero-meta div { min-width: 0; flex: 1; padding: 10px 11px; }
  .featured-grid { grid-template-columns: 1fr; gap: 12px; }
  .featured-card { min-height: 0; padding: 20px; }
  .about-card, .contact-card { padding: 24px; border-radius: 22px; gap: 28px; }
  .about-art { min-height: 180px; }
  .about-art img { max-height: 220px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .featured-card:hover, .hero-portrait:hover img { transform: none; } }

/* 页脚：实时累计访问量（数字为云端返回的真实值，非固定文案） */
.foot-views {
  display: inline-flex; align-items: center; gap: 7px;
  letter-spacing: .06em; white-space: nowrap;
}
.foot-views::before {
  content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%;
  background: var(--blue-2);
  box-shadow: 0 0 0 0 rgba(54, 95, 153, .42);
  animation: visit-pulse 3s cubic-bezier(.4, 0, .6, 1) infinite;
}
.foot-views b {
  font-weight: 600; font-size: 12px; line-height: 1; color: var(--blue-2);
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  letter-spacing: .03em;
}
.foot-views em { font-style: normal; }
@keyframes visit-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(54, 95, 153, .40); }
  70%  { box-shadow: 0 0 0 7px rgba(54, 95, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(54, 95, 153, 0); }
}
@media (prefers-reduced-motion: reduce) { .foot-views::before { animation: none; } }

/* 首页快捷入口：6 张卡排成 3 列两行，避免 5+1 的断行 */
#quickIndex { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 980px) { #quickIndex { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { #quickIndex { grid-template-columns: minmax(0, 1fr); } }

/* 页脚署名行：与版权行同层级，低音量、找得到 */
.foot-sign { display: inline-flex; align-items: center; gap: 7px; }
.foot-sign a {
  color: var(--ink-3); text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.foot-sign a:hover, .foot-sign a:focus-visible { color: var(--ink); border-bottom-color: var(--gold); }
.foot-sign i { font-style: normal; opacity: .55; }
@media (max-width: 620px) { .foot-sign { letter-spacing: .05em; } .foot-bottom { flex-direction: column; align-items: flex-start; gap: 9px; } }

/* 工具卡片上的「完整案例」入口 */
.tool .case {
  position: relative; z-index: 2; white-space: nowrap;
  font-size: 11.5px; letter-spacing: .04em; color: var(--gold);
  border-bottom: 1px solid #d8c4a0; padding-bottom: 1px;
  text-decoration: none; transition: .24s var(--ease);
}
.tool .case:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* 窄屏导航：登录入口让位，主题与菜单按钮靠右 */
@media (max-width: 720px) {
  .auth-btn { display: none; }
  .theme-btn { margin-left: auto; }
  .site-header .burger { margin-left: 6px; }
}

@media (max-width: 360px) {
  /* 极窄屏：主题切换可跟随系统，手动按钮让位给搜索与菜单。
     选择器带上 .site-header，否则被 dark.css 的 display:grid 覆盖 */
  .site-header .theme-btn { display: none; }
}

/* 灯箱信息栏：序号「3 / 18」整段不换行；窄屏直接收起，避免 meta 被挤成两行 */
.lb-idx { white-space: nowrap; }
@media (max-width: 480px) { .lb-idx { display: none; } }
