/* ==========================================================================
   site.css — 单页站点结构：页头、主推应用、应用展示、联系方式、产品故事弹窗
   依赖 base.css
   ========================================================================== */

/* ---------- 页头 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: none;
}

.brand .logo {
  display: block;
  height: 28px;
  width: auto;
}

.brand .logo--inverse {
  display: none;
}

[data-theme="dark"] .brand .logo--light {
  display: none;
}

[data-theme="dark"] .brand .logo--inverse {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand .logo--light {
    display: none;
  }

  :root:not([data-theme="light"]) .brand .logo--inverse {
    display: block;
  }
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-inline-start: auto;
}

/* 语言切换：与主题按钮同高同风格，等宽字体显示语言代码 */
.lang-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.25rem;
  padding-inline: 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.lang-switch:hover {
  border-color: var(--text-faint);
  color: var(--text);
}

/* 中文标签用正文字体，等宽字体不适合汉字 */
.lang-switch:lang(zh) {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-soft);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.icon-btn:hover {
  border-color: var(--text-faint);
  color: var(--text);
}

.icon-btn svg {
  width: 1.05rem;
  height: 1.05rem;
}

.icon-btn .icon-moon {
  display: none;
}

[data-theme="dark"] .icon-btn .icon-sun {
  display: none;
}

[data-theme="dark"] .icon-btn .icon-moon {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .icon-sun {
    display: none;
  }
  :root:not([data-theme="light"]) .icon-btn .icon-moon {
    display: block;
  }
}

/* ---------- 通用区块 ---------- */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}

.section-head h2 {
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  letter-spacing: -0.03em;
}

.section-head .more {
  font-size: 0.9375rem;
  color: var(--text-soft);
}

.section-head .more:hover {
  color: var(--accent);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: var(--space-6);
}

/* ---------- 主推应用 ---------- */
.feature {
  position: relative;
  overflow: hidden;
  padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(3rem, 7vw, 5.5rem);
  border-bottom: 1px solid var(--line);
}

.feature-inner {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

.feature-copy h1 {
  margin-top: 0.9rem;
  font-size: clamp(2.5rem, 6vw, 4.4rem);
  letter-spacing: -0.04em;
  line-height: 1.02;
}

.feature-copy h1 em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--accent-quiet);
}

.feature-copy .lede {
  margin-top: clamp(1.1rem, 2.5vw, 1.6rem);
  max-width: 38ch;
}

.feature-note {
  margin-top: var(--space-4);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.feature-visual {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  background: var(--bg-sunken);
}

.feature-visual img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* ---------- 应用展示 ---------- */
.apps {
  padding-block: clamp(3.5rem, 8vw, 6rem);
}

.apps-intro {
  max-width: 42ch;
  margin-top: 0.75rem;
  color: var(--text-soft);
}

.app-list {
  display: flex;
  flex-direction: column;
  gap: clamp(2.5rem, 6vw, 5rem);
  margin-top: clamp(2.5rem, 5vw, 4rem);
}

.app-row {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  gap: clamp(1.75rem, 4.5vw, 4rem);
  align-items: center;
}

.app-row--flip .app-figure {
  order: 2;
}

.app-figure {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-sunken);
  box-shadow: var(--shadow);
}

.app-figure img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.app-row:hover .app-figure img {
  transform: scale(1.015);
}

.app-index {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.app-name {
  margin-top: 0.5rem;
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  letter-spacing: -0.028em;
}

.app-desc {
  margin-top: 0.7rem;
  font-size: 1rem;
  line-height: 1.72;
  color: var(--text-soft);
  max-width: 38ch;
}

.app-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1.05rem;
}

.story-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.35rem;
  padding-bottom: 2px;
  font-size: 0.9375rem;
  font-weight: 580;
  color: var(--accent);
  border-bottom: 1px solid color-mix(in oklab, var(--accent) 35%, transparent);
  transition: border-color var(--dur) var(--ease);
}

.story-link:hover {
  border-bottom-color: var(--accent);
}

.story-link svg {
  width: 1em;
  height: 1em;
  transition: transform var(--dur) var(--ease);
}

.story-link:hover svg {
  transform: translateX(3px);
}

/* ---------- 产品故事弹窗 ---------- */
.story {
  width: min(46rem, 100% - 2rem);
  max-height: min(86vh, 54rem);
  margin: auto; /* base.css 的 * { margin: 0 } 会覆盖 dialog 的默认居中 */
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.story::backdrop {
  background: rgba(10, 11, 12, 0.56);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.story[open] {
  display: flex;
  flex-direction: column;
  animation: story-in 0.32s var(--ease);
}

.story[open]::backdrop {
  animation: story-fade 0.28s var(--ease);
}

@keyframes story-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes story-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.story-head {
  position: relative;
  flex: none;
  padding: clamp(1.4rem, 4vw, 2.2rem) clamp(1.25rem, 4vw, 2.5rem) 1.1rem;
  border-bottom: 1px solid var(--line);
}

.story-head h2 {
  margin-top: 0.55rem;
  font-size: clamp(1.35rem, 3.2vw, 1.9rem);
  letter-spacing: -0.026em;
  padding-right: 2.5rem;
}

.story-meta {
  margin-top: 0.6rem;
  font-size: 0.8125rem;
  color: var(--text-faint);
}

.story-close {
  position: absolute;
  top: clamp(1rem, 3vw, 1.3rem);
  right: clamp(1rem, 3vw, 1.4rem);
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--text-soft);
  background: var(--bg-elev);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.story-close:hover {
  border-color: var(--text-faint);
  color: var(--text);
}

.story-close svg {
  width: 1rem;
  height: 1rem;
}

.story-body {
  overflow-y: auto;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  padding-top: clamp(1rem, 3vw, 1.5rem);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.story-body p {
  margin-top: 0.85rem;
  color: var(--text-soft);
  line-height: 1.78;
}

.story-lead {
  font-size: 1.0625rem;
  color: var(--text) !important;
}

.story-body h3 {
  margin-top: 1.85rem;
  font-size: 1.0625rem;
  letter-spacing: -0.012em;
}

.story-body blockquote {
  margin: 1.75rem 0 0;
  padding-left: 1.1rem;
  border-left: 2px solid var(--accent);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-style: italic;
  line-height: 1.6;
  color: var(--text);
}

html.is-story-open {
  overflow: hidden;
}

/* ---------- 联系方式 ---------- */
.contact {
  padding-block: clamp(3.5rem, 9vw, 7rem);
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
}

.contact-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
}

.contact-inner h2 {
  font-size: clamp(1.9rem, 4.6vw, 3.4rem);
  letter-spacing: -0.032em;
  max-width: 18ch;
}

.contact-inner h2 em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--accent-quiet);
}

.contact-side {
  max-width: 24rem;
}

.contact-side p {
  font-size: 0.9375rem;
  color: var(--text-soft);
  margin-bottom: var(--space-4);
}

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: var(--space-7) var(--space-6);
  background: var(--bg);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-6);
}

.footer-brand {
  max-width: 20rem;
}

.footer-brand .brand {
  display: inline-flex;
  margin-bottom: 0.65rem;
}

.footer-brand .brand .logo {
  height: 26px;
}

.footer-brand p {
  font-size: 0.875rem;
  color: var(--text-faint);
  line-height: 1.6;
}

.footer-cols {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(2rem, 5vw, 4rem);
}

.footer-col h4 {
  font-size: 0.75rem;
  font-weight: 620;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.7rem;
}

.footer-col a {
  display: block;
  font-size: 0.9375rem;
  color: var(--text-soft);
  padding-block: 0.18rem;
  transition: color var(--dur) var(--ease);
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-bottom {
  margin-top: var(--space-7);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: 0.8125rem;
  color: var(--text-faint);
}

/* ---------- 404 ---------- */
.error-page {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 60vh;
  padding-block: var(--space-9);
}

.error-page .code {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  color: var(--text-faint);
}

/* ---------- 滚动显现 ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

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

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .feature-inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .feature-copy {
    max-width: 36rem;
  }

  .feature-visual {
    order: -1;
  }

  .app-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }

  .app-row--flip .app-figure {
    order: 0;
  }
}

@media (max-width: 640px) {
  .header-inner {
    height: 58px;
    gap: 0.75rem;
  }

  .brand .logo {
    height: 24px;
  }

  .footer-inner {
    flex-direction: column;
  }

  .story {
    width: calc(100% - 1.5rem);
    max-height: 88vh;
  }
}
