/* 工程助手官网样式。
 *
 * 配色沿用 App 的 AppPalette（lib/theme/app_theme.dart）：
 * 深色是默认，[data-theme="light"] 换成浅色那一套。
 * 只用纯 CSS，不引任何外部字体 / 框架，断网也能正常显示。
 */

:root {
  color-scheme: dark;

  --bg: #0a0e14;
  --surface: #121821;
  --surface-high: #1a2230;
  --surface-higher: #222c3c;
  --outline: #2e3a4c;
  --text: #e9f0fa;
  --text-dim: #93a4bb;

  --primary: #4f9cff;
  --on-primary: #04101f;
  --secondary: #22d3ee;
  --tertiary: #34d399;
  --violet: #c084fc;
  --orange: #ff7a59;
  --warning: #fbbf24;

  --a0: var(--primary);
  --a1: var(--tertiary);
  --a2: var(--violet);
  --a3: var(--orange);
  --a4: var(--warning);
  --a5: var(--secondary);

  --glow-1: rgba(79, 156, 255, 0.16);
  --glow-2: rgba(34, 211, 238, 0.1);
  --header-bg: rgba(10, 14, 20, 0.78);
  --shadow: 0 26px 60px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.35);

  --radius: 18px;
  --radius-sm: 12px;
  --maxw: 1240px;
}

[data-theme='light'] {
  color-scheme: light;

  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-high: #edf1f7;
  --surface-higher: #e2e8f1;
  --outline: #d2dae5;
  --text: #101b2d;
  --text-dim: #5a6b83;

  --primary: #1f6feb;
  --on-primary: #ffffff;
  --secondary: #0e7490;
  --tertiary: #0f9d74;
  --violet: #7c3aed;
  --orange: #dc6320;
  --warning: #b45309;

  --glow-1: rgba(31, 111, 235, 0.12);
  --glow-2: rgba(14, 116, 144, 0.08);
  --header-bg: rgba(244, 246, 250, 0.82);
  --shadow: 0 26px 60px rgba(16, 27, 45, 0.14);
  --shadow-soft: 0 12px 30px rgba(16, 27, 45, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC',
    'Noto Sans TC', 'PingFang SC', 'Microsoft YaHei', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 560px at 8% -8%, var(--glow-1), transparent 62%),
    radial-gradient(760px 520px at 96% 2%, var(--glow-2), transparent 60%);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

img {
  max-width: 100%;
  height: auto;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  z-index: 100;
}

.skip-link:focus {
  left: 16px;
}

/* ---------------------------------------------------------------- 顶栏 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--outline);
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--outline);
  object-fit: cover;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-text strong {
  font-size: 15px;
  font-weight: 650;
}

.brand-text small {
  color: var(--text-dim);
  font-size: 11.5px;
}

.nav-links {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav-links a {
  color: var(--text-dim);
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 999px;
  transition: color 0.18s, background 0.18s;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--surface-high);
  text-decoration: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-switch {
  display: flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--outline);
  border-radius: 999px;
  background: var(--surface-high);
}

.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.18s, background 0.18s;
}

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

.lang-switch button[aria-pressed='true'] {
  background: var(--primary);
  color: var(--on-primary);
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--outline);
  border-radius: 999px;
  background: var(--surface-high);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}

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

.gh-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--outline);
  background: var(--surface-high);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.18s;
}

.gh-link:hover {
  border-color: var(--primary);
  text-decoration: none;
}

/* ---------------------------------------------------------------- 布局 */

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 76px 0;
  scroll-margin-top: 72px;
}

#features,
#tools,
#screens,
#platforms {
  scroll-margin-top: 76px;
}

.section-head {
  max-width: 720px;
  margin-bottom: 34px;
}

.section-head h2 {
  font-size: clamp(24px, 2.6vw, 32px);
}

.section-head p {
  margin-top: 12px;
  color: var(--text-dim);
  font-size: 15.5px;
}

.section-note {
  display: inline-block;
  margin-top: 14px !important;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--outline);
  background: var(--surface-high);
  color: var(--text-dim);
  font-size: 12.5px !important;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------- Hero */

.hero {
  display: grid;
  grid-template-columns: 1.04fr 0.96fr;
  gap: 56px;
  align-items: center;
  padding: 76px 0 84px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 18px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--outline);
  background: var(--surface-high);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(32px, 4.6vw, 50px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero .lead {
  margin-top: 20px;
  color: var(--text-dim);
  font-size: 16.5px;
  max-width: 34em;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 650;
  border: 1px solid transparent;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--shadow-soft);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--outline);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--primary);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}

.chips li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-high);
  border: 1px solid var(--outline);
  color: var(--text-dim);
  font-size: 12.5px;
}

.chips li::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

.chips li:nth-child(2)::before {
  background: var(--tertiary);
}

.chips li:nth-child(3)::before {
  background: var(--violet);
}

.chips li:nth-child(4)::before {
  background: var(--orange);
}

.hero-shot {
  margin: 0;
  justify-self: center;
  width: min(352px, 100%);
}

/* 手机外壳：截图是 390×844 的 App 竖屏，套一圈圆角边框就像真机 */
.phone {
  position: relative;
  display: block;
  padding: 7px;
  border-radius: 30px;
  border: 1px solid var(--outline);
  background: linear-gradient(
    155deg,
    color-mix(in srgb, var(--outline) 70%, var(--surface-high)),
    var(--surface-high)
  );
  box-shadow: var(--shadow);
  cursor: zoom-in;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.phone:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--primary) 45%, var(--outline));
  box-shadow: var(--shadow-soft);
}

.phone img {
  display: block;
  width: 100%;
  aspect-ratio: 390 / 844;
  object-fit: cover;
  object-position: top center;
  border-radius: 23px;
  background: var(--surface);
}

.hero-shot .phone:hover {
  transform: none;
}

.hero-shot .phone {
  cursor: default;
}

/* 截图 + 底部导航热点的定位容器（绝对定位相对这张图，别相对手机边框） */
.hero-shot .screen {
  position: relative;
  display: block;
}

.hero-shot .screen > a {
  display: block;
  cursor: zoom-in;
}

.hero-shot .screen img {
  border-radius: 23px;
}

/* 导航热点：透明按钮覆盖在截图底部三个 tab 上，点一下换一张截图。
   导航栏占截图底部 62 / 844，三个 tab 等宽。 */
.hotspots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hotspot {
  position: absolute;
  top: 92.65%;
  height: 7.35%;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  /* 外层 .hotspots 是 pointer-events: none，按钮自己收回来才点得到 */
  pointer-events: auto;
  transition: background 0.18s, box-shadow 0.18s;
}

.hotspot:nth-child(1) {
  left: 0;
  width: 33.33%;
}

.hotspot:nth-child(2) {
  left: 33.33%;
  width: 33.34%;
}

.hotspot:nth-child(3) {
  left: 66.67%;
  width: 33.33%;
}

.hotspot[aria-pressed='true'] {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.hero-shot .phone .hotspot:hover,
.hero-shot .phone .hotspot:focus-visible {
  background: color-mix(in srgb, var(--primary) 24%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 62%, transparent);
}

.hotspot:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.hero-hint {
  margin: 8px 0 0;
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
}

.hero-shot figcaption,
.page-shot figcaption {
  margin-top: 12px;
  color: var(--text-dim);
  font-size: 12.5px;
  text-align: center;
}

/* ---------------------------------------------------------------- 功能卡片 */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(272px, 1fr));
  gap: 18px;
}

.feature,
.platform {
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--outline);
  background: var(--surface);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.feature:hover,
.platform:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--primary) 45%, var(--outline));
  box-shadow: var(--shadow-soft);
}

.glyph {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  color: var(--tile, var(--primary));
  background: color-mix(in srgb, var(--tile, var(--primary)) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--tile, var(--primary)) 32%, transparent);
}

[data-accent='0'] {
  --tile: var(--a0);
}
[data-accent='1'] {
  --tile: var(--a1);
}
[data-accent='2'] {
  --tile: var(--a2);
}
[data-accent='3'] {
  --tile: var(--a3);
}
[data-accent='4'] {
  --tile: var(--a4);
}
[data-accent='5'] {
  --tile: var(--a5);
}

.feature h3,
.platform h3 {
  margin-top: 16px;
  font-size: 16.5px;
  font-weight: 650;
}

.feature p,
.platform p {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 14px;
}

/* ---------------------------------------------------------------- 工具 */

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 32px 22px;
}

.tool {
  display: flex;
  flex-direction: column;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}

.tool:hover {
  text-decoration: none;
}

.tool .phone {
  border-radius: 24px;
  padding: 5px;
}

.tool .phone img {
  border-radius: 19px;
}

/* 手机左上角的小圆标，沿用 App 的工具图标 */
.tool .phone .badge {
  position: absolute;
  top: 16px;
  left: -9px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--tile, var(--primary)) 38%, var(--outline));
  background: color-mix(in srgb, var(--tile, var(--primary)) 18%, var(--surface-high));
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
}

.tool-name {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: center;
}

.tool-name strong {
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.35;
}

.tool-name span {
  color: var(--text-dim);
  font-size: 11.5px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------------------------------------------------------------- 页面截图 */

.screens-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 32px;
  max-width: 920px;
  margin: 0 auto;
}

.page-shot {
  margin: 0;
  max-width: 260px;
  justify-self: center;
  width: 100%;
}

.page-shot figcaption {
  margin-top: 14px;
}

/* ---------------------------------------------------------------- 页脚 */

.footer {
  margin-top: 24px;
  border-top: 1px solid var(--outline);
  background: var(--surface);
}

.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 24px 36px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 28px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-brand img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--outline);
  object-fit: cover;
}

.footer-brand span {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.footer-brand strong {
  font-size: 13.5px;
}

.footer-brand small,
.footer-meta,
.footer-note {
  color: var(--text-dim);
  font-size: 12.5px;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.footer-note {
  flex-basis: 100%;
}

/* ---------------------------------------------------------------- 大图浮层 */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 32px 24px;
  background: rgba(4, 8, 14, 0.82);
  backdrop-filter: blur(6px);
}

.lightbox[hidden] {
  display: none;
}

.lightbox figure {
  margin: 0;
  max-width: min(1200px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lightbox img {
  max-height: calc(100vh - 120px);
  width: auto;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--outline);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.lightbox figcaption {
  color: #cbd5e1;
  font-size: 13px;
  text-align: center;
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--outline);
  background: var(--surface);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 1000px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 56px 0 64px;
  }

  .nav-links {
    display: none;
  }

  .brand {
    margin-right: auto;
  }
}

@media (max-width: 640px) {
  main {
    padding: 0 18px;
  }

  .topbar-inner {
    padding: 10px 18px;
    gap: 12px;
  }

  .brand-text small,
  .gh-link span {
    display: none;
  }

  .gh-link {
    display: none;
  }

  .section {
    padding: 56px 0;
  }

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

  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 24px 14px;
  }

  .screens-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
  }

  .hero-shot {
    width: min(268px, 100%);
  }

  .chips li {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
  }
}
