/*
 * Author: Martin <lmccc.dev@gmail.com>
 * Co-Author: AI Assistant
 * Description: Official site shared styles — fonts, tokens, base, components, nav, hero, footer.
 *              官网共享样式——字体、token、基础、组件、导航、首屏、页脚。
 *              The first :root block keeps the 2.224 values that devlog and film mirror
 *              (web/devlog/tools/check_style_tokens.py); site-only variables use the --site- prefix.
 *              首个 :root 保留 2.224 的值，devlog 与影片页镜像这些值；站点独有变量以 --site- 开头。
 */

/* Space Grotesk (SIL OFL 1.1), Latin + Latin Ext. */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/assets/fonts/space-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/assets/fonts/space-grotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Noto Serif SC Bold subset (SIL OFL 1.1) built by web/sitekit/fonts.sh from headline glyphs only. */
@font-face {
  font-family: 'LMCC Serif';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/lmcc-serif-sc-bold.woff2') format('woff2');
}

:root {
  --bg: #05080F;
  --bg-2: #0A101E;
  --bg-3: #0D1526;
  --surface: rgba(255, 255, 255, .03);
  --surface-hover: rgba(255, 255, 255, .06);
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #E8EDF6;
  --text-2: #A7B3C9;
  --text-3: #8896AB;
  --accent: #7CD7F0;
  --accent-2: #9D8CFF;
  --star: #F0D9A0;
  --font-cn: 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-en: 'Space Grotesk', 'Noto Sans SC', 'PingFang SC', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Menlo', Consolas, monospace;
  --maxw: 1160px;
  --radius: 14px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --site-font-display: 'LMCC Serif', 'Noto Serif SC', 'Songti SC', serif;
  --site-fs-label: 13px;
  --site-fs-small: 14px;
  --site-fs-body: 16px;
  --site-fs-lead: 18px;
  --site-fs-h3: 22px;
  --site-fs-h2: clamp(30px, 3.8vw, 44px);
  --site-fs-h1: clamp(42px, 6.6vw, 76px);
  --site-lh-tight: 1.25;
  --site-lh-body: 1.75;
  --site-lh-loose: 1.95;
  --site-ls-label: .12em;
  --site-ls-display: 0;
  --site-space-section: 112px;
  --site-radius-sm: 4px;
  --site-veil: color-mix(in srgb, var(--bg) 86%, transparent);
}

html[lang="en"] {
  --site-ls-display: -.01em
}

/* ============ Base ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-cn);
  font-size: var(--site-fs-body);
  font-weight: 400;
  line-height: var(--site-lh-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

html[lang="en"] body {
  font-family: var(--font-en)
}

::selection {
  background: color-mix(in srgb, var(--star) 25%, transparent);
  color: var(--text)
}

a {
  color: inherit;
  text-decoration: none
}

img {
  max-width: 100%;
  display: block
}

:focus-visible {
  outline: 2px solid var(--star);
  outline-offset: 3px
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px
}

section {
  position: relative
}

.section-pad {
  padding: var(--site-space-section) 0
}

.band {
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line)
}

h1,
h2,
h3,
.display {
  font-family: var(--site-font-display);
  font-weight: 700;
  line-height: var(--site-lh-tight);
  letter-spacing: var(--site-ls-display);
}

h4 {
  font-size: var(--site-fs-body);
  font-weight: 700;
  line-height: 1.5
}

/* CJK: no single-character last lines; short captions split evenly. */
p {
  text-wrap: pretty
}

h1,
h2,
h3,
h4 {
  text-wrap: balance
}

/* ============ Components ============ */
.sec-head {
  max-width: 760px;
  margin-bottom: 56px
}

.sec-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  font-family: var(--font-mono);
  font-size: var(--site-fs-label);
  letter-spacing: var(--site-ls-label);
  color: var(--text-2);
}

.sec-kicker::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--star)
}

.sec-kicker .idx {
  color: var(--star)
}

.sec-title {
  font-size: var(--site-fs-h2)
}

.sec-title em,
.display em,
h1 .hl {
  font-style: normal;
  color: var(--star)
}

.sec-sub {
  margin-top: 18px;
  color: var(--text-2);
  font-size: var(--site-fs-lead)
}

.idx-mono {
  font-family: var(--font-mono);
  font-size: var(--site-fs-label);
  font-weight: 400;
  letter-spacing: var(--site-ls-label);
  color: var(--text-3);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 26px;
  border: 1px solid transparent;
  border-radius: var(--site-radius-sm);
  font-size: var(--site-fs-body);
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
}

.btn-primary {
  background: var(--star);
  color: var(--bg)
}

.btn-primary:hover {
  background: var(--text)
}

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--text)
}

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

.rule-item {
  border-top: 1px solid var(--line-strong);
  padding-top: 22px
}

.figure {
  border: 1px solid var(--line);
  border-radius: var(--site-radius-sm);
  background: var(--surface)
}

.chip {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: var(--site-radius-sm);
  font-size: var(--site-fs-small);
  color: var(--text-2);
}

/* Only hidden once site.js has run, so the diagrams stay readable without script. */
.js .reveal {
  opacity: 0;
  transition: opacity .5s var(--ease)
}

.js .reveal.in {
  opacity: 1
}

/* ============ Nav ============ */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background .3s, border-color .3s;
}

.nav.scrolled {
  background: var(--site-veil);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--line);
}

.nav-inner {
  max-width: var(--maxw);
  height: 72px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  line-height: 1;
  font-size: var(--site-fs-lead);
  font-weight: 700;
  letter-spacing: .04em;
}

.brand .dot-ai,
.cta-domain .dot-ai {
  color: var(--star);
  font-family: var(--font-en);
  line-height: 1
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 30px;
  font-size: var(--site-fs-small);
  color: var(--text-2)
}

.nav-links a {
  position: relative;
  padding: 6px 0;
  line-height: 1;
  text-decoration: none;
  transition: color .2s
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background: var(--star);
  transition: width .3s var(--ease);
}

.nav-links a:hover {
  color: var(--text)
}

.nav-links a:focus-visible {
  outline: none
}

.nav-links a:focus-visible::after {
  width: 100%
}

.lang-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--site-radius-sm);
  font-family: var(--font-en);
  font-size: var(--site-fs-label);
  font-weight: 500;
}

.lang-switch a {
  padding: 3px 12px;
  border-radius: 2px;
  color: var(--text-3);
  white-space: nowrap;
  transition: color .2s
}

.lang-switch a.active {
  background: color-mix(in srgb, var(--star) 18%, transparent);
  color: var(--star)
}

.lang-switch a:not(.active):hover {
  color: var(--text-2)
}

.nav-burger {
  display: none;
  place-items: center;
  width: 42px;
  height: 42px;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--site-radius-sm);
  cursor: pointer;
}

.nav-burger svg {
  width: 20px;
  height: 20px;
  stroke: var(--text)
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  z-index: 99;
  flex-direction: column;
  padding: 16px 28px 24px;
  background: color-mix(in srgb, var(--bg) 97%, transparent);
  border-bottom: 1px solid var(--line);
}

.mobile-menu.open {
  display: flex
}

.mobile-menu a {
  padding: 12px 4px;
  color: var(--text-2);
  border-bottom: 1px solid var(--line)
}

.mobile-menu a:last-of-type {
  border-bottom: none
}

.mobile-menu a:hover {
  color: var(--text)
}

.mobile-menu .lang-alt {
  color: var(--star)
}

/* ============ Hero ============ */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: url('/assets/hero-nebula.webp?v=vista2') center center / cover no-repeat
}

.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--bg) 94%, transparent) 0%, color-mix(in srgb, var(--bg) 72%, transparent) 42%, color-mix(in srgb, var(--bg) 28%, transparent) 100%),
    linear-gradient(180deg, transparent 50%, var(--bg) 97%);
}

.hero-credit {
  position: absolute;
  z-index: 2;
  right: 28px;
  bottom: 14px;
  left: 28px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--site-fs-label);
  line-height: 1.4;
  letter-spacing: .02em;
  color: var(--text-3);
  text-align: right;
  opacity: .4;
}

.hero-credit a {
  color: inherit
}

.hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 150px 28px 110px
}

.hero-copy {
  max-width: 620px
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: var(--site-fs-label);
  letter-spacing: var(--site-ls-label);
  text-transform: uppercase;
  color: var(--star);
}

.hero-eyebrow::before {
  content: "";
  width: 32px;
  height: 1px;
  background: var(--star)
}

.hero h1 {
  margin: 28px 0 24px;
  font-size: var(--site-fs-h1)
}

.hero-sub {
  font-size: var(--site-fs-lead);
  color: var(--text-2)
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 40px
}

.reticle {
  position: absolute;
  top: 50%;
  right: 28px;
  width: min(400px, 34vw);
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.reticle svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible
}

.reticle circle,
.reticle line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
  opacity: .5
}

.reticle .mark {
  fill: var(--star);
  stroke: none;
  opacity: 1
}

.reticle-label,
.reticle-telemetry {
  opacity: .55;
  white-space: nowrap;
  overflow: hidden
}

.reticle-label .reticle-geo {
  display: inline
}

.reticle-geo+.reticle-geo::before {
  content: " · "
}

.reticle-label.is-short .reticle-rest,
.reticle-telemetry.is-short .reticle-rest {
  display: none
}

.reticle-label.is-hidden,
.reticle-telemetry.is-hidden {
  display: none
}

.reticle-label {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: var(--site-fs-small);
  color: var(--text-3);
  text-align: center;
}

.reticle-label b {
  color: var(--text-2);
  font-weight: 500
}

/* ============ Footer ============ */
.footer {
  border-top: 1px solid var(--line);
  padding: 64px 0 40px
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px
}

.footer-brand .brand {
  margin-bottom: 16px
}

.footer-brand p {
  max-width: 320px;
  color: var(--text-2);
  font-size: var(--site-fs-small)
}

.footer h5 {
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: var(--site-fs-label);
  font-weight: 500;
  letter-spacing: var(--site-ls-label);
  text-transform: uppercase;
  color: var(--text-2);
}

.footer-col a {
  display: block;
  padding: 5px 0;
  color: var(--text-3);
  font-size: var(--site-fs-small);
  transition: color .2s
}

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

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: var(--site-fs-label);
  line-height: 2;
}

.footer-bottom .legal {
  text-align: right
}

.footer-bottom .legal b {
  color: var(--text-2);
  font-weight: 500
}

.footer-bottom .icp {
  display: inline-block;
  min-width: 11em;
  min-height: 1.5em;
  color: var(--text-3)
}

.footer-bottom .icp a {
  color: inherit
}

/* ============ Responsive (shared parts) ============ */
@media (max-width: 1120px) {
  .nav-links {
    gap: 22px
  }

  .reticle {
    width: 300px
  }

  .reticle-label {
    white-space: normal;
    overflow: visible
  }

  .reticle-label .reticle-geo {
    display: block
  }

  .reticle-geo+.reticle-geo::before {
    content: none
  }

  .hero-copy {
    max-width: 560px
  }
}

@media (max-width: 960px) {
  :root {
    --site-space-section: 88px
  }

  .nav-links {
    display: none
  }

  .nav-burger {
    display: grid
  }

  .hero {
    flex-direction: column;
    align-items: stretch
  }

  .reticle {
    position: static;
    width: auto;
    margin-top: 20px;
    transform: none
  }

  .reticle svg {
    width: 240px
  }

  .reticle-label,
  .reticle-telemetry {
    font-size: 11px;
    line-height: 1.35;
    text-align: left;
    white-space: nowrap;
    overflow: visible
  }

  .reticle-label .reticle-geo,
  .reticle-telemetry .reticle-rest {
    display: inline
  }

  .reticle-geo+.reticle-geo::before {
    content: " · "
  }

  .reticle-telemetry .reticle-sep {
    display: inline
  }

  /* UTC / GMST / HA is the desktop instrument line. On a phone it is a second row the coordinates do not need. */
  .reticle-telemetry {
    display: none
  }

  .hero-credit {
    position: static;
    margin: 8px 28px 12px;
    font-size: 11px;
    line-height: 1.35;
    text-align: left
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 36px
  }

  .footer-bottom {
    flex-direction: column
  }

  .footer-bottom .legal {
    text-align: left
  }
}

@media (max-width: 560px) {
  :root {
    --site-space-section: 72px
  }

  .container,
  .nav-inner,
  .hero-inner {
    padding-left: 20px;
    padding-right: 20px
  }

  .hero-inner {
    padding-top: 120px;
    padding-bottom: 12px
  }

  .btn {
    width: 100%
  }

  .reticle {
    position: static;
    width: auto;
    margin-top: 44px
  }

  .reticle svg {
    display: none
  }

  .reticle-label {
    margin-top: 0;
    text-align: left
  }

  .hero-credit {
    margin-left: 20px;
    margin-right: 20px
  }
}

/* Portrait: the nebula and the LMC line should not each take a screen of their own. */
@media (max-width: 560px) and (orientation: portrait) {
  .hero {
    min-height: 0
  }

  .hero-inner {
    padding-top: 92px;
    padding-bottom: 4px
  }

  .hero h1 {
    margin: 16px 0 12px
  }

  .hero-cta {
    margin-top: 20px
  }

  .btn {
    width: auto
  }

  html[lang="en"] .hero-cta,
  html[lang="en"] .cta-actions {
    flex-direction: column;
    align-items: stretch
  }

  html[lang="en"] .hero-cta .btn,
  html[lang="en"] .cta-actions .btn {
    width: 100%;
    text-align: center
  }

  .reticle {
    margin-top: 16px
  }
}

/* Landscape phones: keep the reticle on the right, on one line. site.js hides the tail if it still overflows. */
@media (orientation: landscape) and (max-height: 520px) {
  .hero {
    min-height: 100svh;
    flex-direction: row;
    align-items: center
  }

  .hero-inner {
    padding-top: 56px;
    padding-bottom: 28px;
    padding-right: min(250px, 42vw)
  }

  .hero-copy {
    max-width: none
  }

  .hero h1 {
    margin: 8px 0
  }

  .hero-sub {
    font-size: var(--site-fs-body)
  }

  .hero-cta {
    margin-top: 10px
  }

  .btn {
    width: auto
  }

  .reticle {
    position: absolute;
    top: 50%;
    right: 16px;
    width: min(220px, 38vw);
    margin: 0;
    transform: translateY(-50%)
  }

  .reticle svg {
    display: block;
    width: min(210px, 52vh);
    height: auto;
    margin: 0 auto
  }

  .reticle-telemetry {
    display: none
  }

  .reticle-label {
    margin-top: 6px;
    text-align: center;
    font-size: 11px;
    line-height: 1.35;
    white-space: normal;
    overflow: visible
  }

  .reticle-label .reticle-geo {
    display: block
  }

  .reticle-geo+.reticle-geo::before {
    content: none
  }

  .hero-credit {
    position: absolute;
    left: auto;
    right: 12px;
    bottom: 6px;
    width: min(42vw, 380px);
    margin: 0;
    font-size: 11px;
    line-height: 1.35;
    text-align: right
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important
  }

  .js .reveal {
    opacity: 1
  }
}
