/* ============================================================
   千机创屿 — 性能与移动端增强
   此文件最后加载，用于覆盖页面内联样式。
   ============================================================ */

/* 图片解码前保留稳定的深色画布，避免白色闪烁。 */
img {
  background-color: var(--bg-secondary);
}

/* 首页先显示轻量海报；桌面视频准备好后再柔和切入。 */
.hero-poster,
.hero-poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-poster img {
  object-fit: cover;
  object-position: center top;
}

.hero-mv video {
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}

.hero-mv.video-ready video {
  opacity: 1;
}

/* 清晰的键盘焦点，也改善外接键盘与辅助设备体验。 */
:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--rose-gold-light);
  outline-offset: 3px;
}

@media (max-width: 768px) {
  html {
    scroll-padding-top: 76px;
  }

  body {
    font-size: 16px;
    line-height: 1.75;
    overflow-x: clip;
  }

  body.menu-open {
    overflow: hidden;
  }

  .container,
  .nav-inner {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }

  section {
    padding: 64px 0;
  }

  .section-header {
    margin-bottom: 42px;
  }

  .section-eyebrow {
    letter-spacing: 0.24em;
    gap: 10px;
  }

  .section-eyebrow::before {
    width: 24px;
  }

  .section-title {
    font-size: clamp(28px, 9vw, 36px);
    line-height: 1.3;
  }

  .section-desc {
    font-size: 15px;
    line-height: 1.8;
  }

  /* 导航：全高抽屉、44px 触控区、刘海屏安全边距。 */
  .navbar,
  .navbar.scrolled {
    padding: max(12px, env(safe-area-inset-top)) 0 12px;
  }

  .nav-inner {
    min-height: 48px;
  }

  .nav-logo {
    position: relative;
    z-index: 102;
    font-size: 19px;
  }

  .nav-logo span {
    display: none;
  }

  .nav-toggle {
    position: relative;
    z-index: 102;
    display: flex;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 10px;
  }

  .nav-toggle span {
    width: 24px;
    transform-origin: center;
  }

  .nav-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .nav-links {
    position: fixed;
    z-index: 101;
    inset: 0 0 0 auto;
    display: flex;
    width: min(86vw, 360px);
    height: 100vh;
    height: 100dvh;
    padding: calc(88px + env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) 24px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    overflow-y: auto;
    background: rgba(14, 12, 10, 0.97);
    backdrop-filter: blur(18px) saturate(130%);
    -webkit-backdrop-filter: blur(18px) saturate(130%);
    border-left: 1px solid var(--border-subtle);
    box-shadow: -24px 0 60px rgba(0, 0, 0, 0.4);
    visibility: hidden;
    opacity: 0;
    transform: translateX(100%);
    transition: transform 0.35s var(--ease-out), opacity 0.25s ease, visibility 0.35s;
  }

  .nav-links.mobile-open {
    position: fixed;
    inset: 0 0 0 auto;
    display: flex;
    padding: calc(88px + env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) 24px;
    visibility: visible;
    opacity: 1;
    transform: translateX(0);
  }

  .nav-links.mobile-open .nav-link,
  .nav-link {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 52px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border-hairline);
    font-size: 16px;
  }

  .nav-link::after {
    display: none;
  }

  .nav-cta {
    width: 100%;
    min-height: 48px;
    margin: 20px 0 0;
  }

  /* 通用页面首屏。 */
  .page-hero {
    min-height: 340px;
    padding: 132px 0 56px !important;
    display: flex;
    align-items: center;
  }

  .page-hero-title {
    font-size: clamp(34px, 10vw, 44px);
    line-height: 1.25;
  }

  .page-hero-desc {
    font-size: 15px;
    line-height: 1.75;
  }

  /* 首页首屏：手机只展示约 38KB 的响应式海报，不下载 8MB 视频。 */
  .hero {
    box-sizing: border-box;
    height: 100vh;
    height: 100svh;
    min-height: 620px;
    padding: 82px 0 34px;
  }

  .hero-mv video,
  .mv-player-bar,
  .scroll-hint {
    display: none;
  }

  .hero-glass {
    width: calc(100% - 32px);
    max-width: 520px;
    padding: 34px 20px;
    background: rgba(21, 18, 15, 0.72);
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
  }

  .hero-eyebrow {
    margin-bottom: 20px;
    font-size: 10px;
    letter-spacing: 0.28em;
  }

  .hero-title {
    margin-bottom: 18px;
    font-size: clamp(30px, 9vw, 38px);
  }

  .hero-desc {
    margin-bottom: 26px;
    font-size: 14px;
    line-height: 1.8;
  }

  .hero-actions,
  .featured-actions,
  .product-hero-actions {
    gap: 10px;
  }

  .hero-actions .btn,
  .featured-actions .btn,
  .product-hero-actions .btn,
  .demo-cta .btn,
  .cta-inner .btn {
    min-height: 46px;
  }

  .products .section-header-in-section {
    padding: 64px 20px 32px !important;
  }

  .product-item {
    padding: 32px 20px !important;
  }

  .showcase,
  .philosophy,
  .capabilities,
  .cta-section {
    padding: 64px 0 !important;
  }

  .showcase.reverse {
    padding-top: 24px !important;
    padding-bottom: 64px !important;
  }

  .showcase-inner {
    gap: 28px;
  }

  .philosophy-body {
    margin-top: 48px;
    gap: 26px;
  }

  .philosophy-quote {
    margin-bottom: 28px;
    font-size: clamp(23px, 7vw, 30px);
  }

  .cap-item {
    padding: 28px 24px;
  }

  /* 关于页。 */
  .mission,
  .team-section,
  .jobs-section {
    padding: 64px 0 !important;
  }

  .mission-inner {
    gap: 30px;
  }

  .quote-box {
    padding: 22px 20px;
  }

  .timeline {
    padding-left: 32px;
  }

  .timeline-item::before,
  .timeline-empty::before {
    left: -28px;
  }

  .team-placeholder {
    padding: 52px 22px;
  }

  .values-grid {
    gap: 26px;
  }

  .jobs-list {
    margin-top: 34px;
  }

  .job-card {
    padding: 24px 20px;
  }

  /* 作品列表。 */
  .featured-product {
    gap: 30px;
  }

  .featured-title {
    font-size: 34px;
  }

  .featured-actions {
    flex-wrap: wrap;
  }

  .more-products,
  .gallery,
  .in-dev-section {
    padding: 64px 0 !important;
  }

  .product-row {
    gap: 20px;
    padding: 30px 0;
  }

  .in-dev-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .in-dev-grid > div {
    padding: 24px 20px !important;
  }

  /* 作品详情。 */
  .product-hero {
    min-height: auto;
    padding: 124px 0 56px;
    align-items: start;
  }

  .product-hero-bg img {
    opacity: 0.34;
  }

  .product-hero-bg::after {
    background: linear-gradient(180deg, rgba(14, 12, 10, 0.62) 0%, rgba(14, 12, 10, 0.55) 48%, var(--bg-deep) 100%);
  }

  .product-hero-inner {
    gap: 30px;
  }

  .product-hero-title {
    font-size: clamp(46px, 15vw, 62px);
  }

  .product-hero-subtitle {
    margin-bottom: 22px;
    font-size: 16px;
    line-height: 1.7;
  }

  .product-hero-desc,
  .product-hero-tags {
    margin-bottom: 26px;
  }

  .hero-character {
    display: none;
  }

  .content-section {
    padding: 64px 0 !important;
  }

  .story-block {
    gap: 28px;
    margin-bottom: 72px;
  }

  .story-text h3 {
    font-size: 28px;
  }

  .char-grid,
  .systems-grid,
  .specs-grid,
  .screenshot-grid {
    grid-template-columns: 1fr;
  }

  .screenshot-grid {
    grid-auto-rows: auto;
  }

  .screenshot-grid .s-item {
    aspect-ratio: 4 / 3;
  }

  .system-item {
    padding: 28px 22px;
  }

  .specs-grid {
    gap: 20px;
    margin-top: 34px;
  }

  .specs-col {
    padding: 24px 20px;
  }

  .update-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .demo-cta {
    padding: 52px 20px;
  }

  .demo-cta h3 {
    font-size: 28px;
  }

  /* 联系、登录、隐私。 */
  .contact-wrap {
    gap: 40px;
  }

  .contact-form-card {
    padding: 30px 20px;
  }

  .contact-item-value {
    overflow-wrap: anywhere;
  }

  .social-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .form-input,
  .form-select,
  .form-textarea {
    min-height: 48px;
    font-size: 16px;
  }

  .form-submit-row {
    align-items: stretch;
  }

  .form-submit-row .btn {
    width: 100%;
    min-height: 48px;
  }

  .faq-section {
    margin-top: 64px;
  }

  .faq-item {
    padding: 22px 0;
  }

  .auth-page {
    min-height: 100vh;
    min-height: 100svh;
    padding: 80px max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .auth-card {
    padding: 34px 22px;
  }

  .auth-tab {
    min-width: 64px;
    min-height: 44px;
  }

  .auth-logo-sub {
    margin-bottom: 30px;
  }

  .back-link {
    top: max(16px, env(safe-area-inset-top));
    left: max(16px, env(safe-area-inset-left));
    min-height: 44px;
  }

  .toc {
    padding: 22px 18px;
    margin-bottom: 44px;
  }

  .privacy-section {
    margin-bottom: 38px;
  }

  .privacy-section h2 {
    align-items: flex-start;
    gap: 10px;
    font-size: 20px;
  }

  /* 页脚触控与信息密度。 */
  .footer {
    padding: 58px 0 max(28px, env(safe-area-inset-bottom));
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 30px;
    margin-bottom: 42px;
  }

  .footer-brand,
  .footer-grid > .footer-col:last-child {
    grid-column: 1 / -1;
  }

  .footer-col h4 {
    margin-bottom: 16px;
  }

  .footer-col ul {
    gap: 6px;
  }

  .footer-col a,
  .social-icon {
    min-height: 44px;
  }

  .social-icon {
    width: 44px;
    height: 44px;
  }

  .footer-bottom {
    align-items: flex-start;
    text-align: left;
  }

  .footer-bottom-links {
    flex-wrap: wrap;
    gap: 8px 24px;
  }

  .footer-bottom-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .hero-actions,
  .featured-actions,
  .product-hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn,
  .featured-actions .btn,
  .product-hero-actions .btn,
  .demo-cta .btn,
  .cta-inner .btn {
    width: 100%;
  }

  .feature-points {
    grid-template-columns: 1fr;
  }

  .spec-row {
    display: grid;
    gap: 4px;
  }

  .spec-key {
    width: auto;
  }

  .form-row {
    gap: 12px;
  }

  .oauth-row {
    gap: 12px;
  }
}

@media (max-width: 768px) and (max-height: 650px) {
  .hero {
    height: auto;
    min-height: 600px;
  }

  .hero-glass {
    padding-top: 26px;
    padding-bottom: 26px;
  }

  .hero-desc {
    margin-bottom: 20px;
  }
}

@media (hover: none) {
  .card:hover,
  .char-card:hover,
  .product-row:hover,
  .showcase-visual:hover img,
  .gallery-item:hover img,
  .story-image:hover img {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-mv video {
    display: none;
  }
}
