/*
 * 布局：两种版式（≤768 紧凑 / ≥1024 展开），容器封顶居中，七档零溢出。
 */

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

html {
  margin: 0;
  padding: 0;
  max-width: 100%;
  scroll-behavior: smooth;
}

html,
body {
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  max-width: 100%;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  background: var(--color-page-bg);
  color: var(--color-text-primary);
}

img,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-link);
}

a:focus-visible,
button:focus-visible,
.nav-toggle:focus-visible,
.prefs__link:focus-visible,
.cta:focus-visible {
  outline: 3px solid var(--color-brand-orange);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
}

.skip-link:focus {
  left: var(--page-pad-inline);
  z-index: 100;
  background: var(--color-surface);
  color: var(--color-text-primary);
  padding: 0.5rem 0.75rem;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--page-pad-inline);
  min-width: 0;
}

/* —— Header —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-tab-bg);
  border-bottom: 1px solid var(--color-divider);
  min-height: var(--header-h-compact);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h-compact);
  min-width: 0;
}

/*
 * 品牌区方案：同一行等重视觉对齐。
 * 理由：中文名「星哒」与英文名「Flystar」同为正式品牌名，不应做成附属小字；
 * 单行可在 320–1280 保持不换行、与图标垂直居中，比上下堆叠更稳。
 * 数值（紧凑 ≤1023）：图标 36×36 · 间距 10px · 英文/中文均 18px/700/lh22 ·
 *   英文字距 -0.01em · 中文字距 0.08em · 名间 8px
 * 数值（展开 ≥1024）：图标 40×40 · 间距 12px · 字号 20px / lh 24（其余同上）
 */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--color-nav-fg);
  min-width: 0;
  flex-shrink: 0;
}

.brand__mark {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: block;
}

.brand__text {
  display: inline-flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  line-height: 22px;
  white-space: nowrap;
}

.brand__name {
  font-size: 18px;
  font-weight: 700;
  line-height: 22px;
  letter-spacing: -0.01em;
  color: var(--color-brand-fg);
}

.brand__name-zh {
  font-size: 18px;
  font-weight: 700;
  line-height: 22px;
  letter-spacing: 0.08em;
  color: var(--color-brand-fg);
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--color-brand-blue-deep);
  cursor: pointer;
  padding: 0;
}

.nav-toggle__bars {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 -7px 0 currentColor, 0 7px 0 currentColor;
}

.nav {
  display: none;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.5rem 0;
  color: var(--color-nav-fg);
  text-decoration: none;
  font-weight: 600;
}

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

.site-header.is-open .nav {
  display: flex;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: var(--color-tab-bg);
  border-bottom: 1px solid var(--color-divider);
  padding: 0.5rem var(--page-pad-inline) 1rem;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 1;
  min-width: 0;
}

.prefs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.15rem 0.25rem;
  align-items: center;
  min-width: 0;
}

.prefs__label {
  color: var(--color-text-tertiary);
  font-size: 0.75rem;
}

.prefs__link {
  color: var(--color-link);
  text-decoration: none;
  min-height: 44px;
  min-width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.prefs__link.is-active {
  color: var(--color-accent);
  font-weight: 700;
}

.prefs__link:hover {
  color: var(--color-accent-hover);
}

.site-main {
  min-width: 0;
}

.site-footer {
  background: var(--color-tab-bg);
  border-top: 1px solid var(--color-divider);
  padding: 2rem 0 2.5rem;
  color: var(--color-text-secondary);
  margin-top: var(--section-gap);
}

.slogan {
  color: var(--color-text-primary);
  margin: 0 0 1rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
}

.footer-nav a {
  color: var(--color-link);
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

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

.footer-lang {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.75rem 0 0;
}

.copyright {
  margin: 1rem 0 0;
  font-size: 0.875rem;
  color: var(--color-text-tertiary);
}

.site-link {
  color: var(--color-link);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.site-link:hover {
  color: var(--color-accent-hover);
}

/* 展开档 ≥1024 */
@media (min-width: 1024px) {
  .site-header,
  .site-header__inner {
    min-height: var(--header-h-expand);
  }

  .nav-toggle {
    display: none;
  }

  .site-header__inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.5rem;
  }

  .nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem 1.5rem;
    position: static;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .site-header.is-open .nav {
    position: static;
    padding: 0;
    border: 0;
  }

  .nav a {
    padding: 0;
    min-height: 44px;
  }

  .brand {
    gap: 12px;
  }

  .brand__mark {
    width: 40px;
    height: 40px;
  }

  .brand__text {
    line-height: 24px;
  }

  .brand__name,
  .brand__name-zh {
    font-size: 20px;
    line-height: 24px;
  }
}

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

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