/* ==========全局========== */
:root {
  /* 目前来看商品展示区默认文字是400 */
  --gray-100: #eeeeee;
	--gray-200: #b4b4b4;
	--gray-300: #7b7b7b;
	--gray-400: #6e6e6e;
	--gray-500: #606060;
	--gray-600: #484848;
	--gray-700: #3a3a3a;
	--gray-800: #313131;
	--gray-900: #2a2a2a;
	--gray-1000: #222222;
	--gray-1100: #191919;
	--gray-1200: #111111;
  --gray-1200-backdrop-bgc:rgba(17, 17, 17, .75);
  --black: #000000ff;

  --amber-50:  #fffbeb;
  --amber-100: #fef3c7;
  --amber-200: #fde68a;
  --amber-300: #fcd34d;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;
  --gold: #ffd60aff;

  /* 库存状态用 只在卡片那三个小圆点上出现 */
  --green-400: #4ade80;
  --red-400: #f87171;

  --amber-500-fill: rgba(245, 158, 11, 0.25);
  --amber-400-half: rgba(251, 191, 36, 0.5);

  /* ---语义色 上面的色阶只是原料 写规则时只用下面这些--- */
  /* 面 越靠前越亮 */
  --surface-page: var(--gray-1200);
  --surface-1: var(--gray-1100);
  --surface-2: var(--gray-1000);
  --surface-3: var(--gray-800);
  /* 线 */
  --border: var(--gray-800);
  /* 字 越重要越亮 */
  --text-primary: var(--gray-100);
  --text-body: var(--gray-200);
  --text-secondary: var(--gray-300);
  --text-label: var(--gray-400);
  /* 强调 */
  --accent: var(--amber-400);
  --accent-solid: var(--amber-600);

  /* 数字和代号专用 中文一律不给 等宽中文会又宽又散 */
  --font-mono: ui-monospace, monospace;

  /* 字号阶梯 只有这五档 不够用先想想是不是层级设计有问题 */
  --text-xs: 13px;
  --text-sm: 14px;
  --text-base: 15px;
  --text-md: 18px;
  --text-lg: 22px;
  --text-xl: 28px;


  --button-offset: 4px;
}

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

html {
  scroll-behavior: smooth;
  user-select: none;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: var(--surface-page);
  margin: 0;
}

p,dl,dd,h4 {
  margin: 0;
}


/* ==========着陆页========== */
.hero {
  height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 64px;
}

/* ---------星云--------- */
#galaxy {
  position: absolute;
  z-index: -1;
  top: 0;
  left: 0;
  /* 下缘渐隐 露出body底色 和商品区无缝衔接 */
  mask-image: linear-gradient(to bottom, black 90%, transparent 100%);
}

/* ---------logo--------- */
.logo {
  /* logo 要的是 Courier 那种老派打字机感 和面板里数字用的等宽不是一回事 */
  font-family: "Courier New", Courier, monospace;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-decoration: none;
}

.logo .logo-brand {
  letter-spacing: 3px;
  font-size: 72px;
  color: var(--accent);
  --lit: var(--gold);
}

.logo .logo-sub {
  letter-spacing: 6px;
  font-size: 36px;
  color: var(--text-body);
  --lit: var(--text-primary);
  text-align: center;
}

.logo .logo-sub::after {
  content: '';
  display: block;
  height: 1px;
  background-color: var(--accent);
}

/* logo动画 */
.logo > span > span {
  display: inline-block;
}

.logo:hover > span > span{
  animation-name: textReveal;
  animation-duration: 0.4s;
  animation-delay: calc(var(--i) * 30ms);
}

@keyframes textReveal {
  0% {}
  50% {
    color: var(--lit);
    transform: scale(1.1);
  }
  100% {}
}

/* ---------button--------- */
.hero .button {
  text-decoration: none;
  color: var(--text-body);
  font-family: var(--font-mono);
  letter-spacing: 6px;

  border: 2px solid var(--gray-400);

  box-shadow: var(--button-offset) var(--button-offset) 0 var(--accent);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease .1s, color .2s ease;
  overflow: hidden;
}

.hero .button:hover {
  color: var(--text-primary);

  .row {
    transform: translateY(100%);
  }
}

.hero .button:active {
  transform: translateY(var(--button-offset));

  border-color: var(--accent);
  box-shadow: 0 0 0 var(--accent);
}

.hero .button .row {
  position: relative;
  /* 左侧多3px补尾部6px的letter-spacing */
  padding: 10px 10px 10px 13px;
  transition: transform .5s ease;

  svg {
    position: absolute;
    bottom: 100%;
    width: 24px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
  }

  span {
    font-weight: 700;
    display: block;
  }
}


/* ==========商品展示========== */
.product-section {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* 内容仍然居中 但下方留出这么多 于是整体视觉上往上提 */
  padding-bottom: 10vh;

  color: var(--text-body);
}

/* 卡片、面板头部、其他船型列表 三处都用 字号各自定 这里只管颜色 */
.ship-name-cn {
  color: var(--text-primary);
}

.ship-name-en {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

/* ---------文字介绍区--------- */
.intro-section {
  text-align: center;
  margin-bottom: 56px;

  display: flex;
  flex-direction: column;
  gap: 20px;
}

.intro-brand {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 4px;
  color: var(--accent);
}

.intro-headline {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
}

.intro-hint {
  font-size: var(--text-xs);
  letter-spacing: 3px;
  color: var(--text-label);
  margin-top: 12px;
}

/* 正文和提示之间的分隔线 中间亮两头淡出 所以是渐变不是纯色 */
.intro-hint::before {
  content: '';
  display: block;
  width: 44px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber-400-half), transparent);
  margin: 0 auto 18px;
}

/* ---------卡片区--------- */
.ship-card-section {
  /* 两列等宽 内容长短不一时卡片也不会参差 */
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  justify-content: center;

  width: min(620px, 90vw);
  margin: 0 auto;
}

.ship-card {
  background-color: var(--surface-1);
  border: 1px solid var(--border);
  padding: 22px;
  min-height: 200px;
  cursor: pointer;

  /* 底部那行要贴着卡片下沿 不管上面的文字有几行 */
  display: flex;
  flex-direction: column;
  gap: 12px;

  transition: background-color .2s ease, border-color .2s ease, transform .2s ease;
}

.ship-card:hover {
  background-color: var(--surface-2);
  border-color: var(--gray-600);
  transform: translateY(-2px);
}

.ship-card-serial {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 2px;
  color: var(--text-label);
}

.ship-card-title {
  .ship-name-cn {
    font-size: var(--text-md);
    font-weight: 600;
  }
}

.ship-card-text {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.7;
}

/* auto 把剩下的空间全吃掉 于是这一行被顶到底 */
.ship-card-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);

  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-xs);
}

.stock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* 灯芯 明暗加辉光 */
.stock-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
  flex-shrink: 0;

  animation: breathe-core var(--breathe-speed) ease-in-out infinite;
}

/* 光晕 一圈描边向外扩散并淡出 和灯芯同周期 */
.stock-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid currentColor;

  animation: breathe-halo var(--breathe-speed) ease-in-out infinite;
}

/* 只动 opacity / box-shadow / transform 这三样不触发重排 */
@keyframes breathe-core {
  0%, 100% { opacity: .55; box-shadow: 0 0 3px currentColor; }
  50%      { opacity: 1;   box-shadow: 0 0 9px currentColor; }
}

@keyframes breathe-halo {
  0%        { transform: scale(1);   opacity: .5; }
  70%, 100% { transform: scale(2.8); opacity: 0; }
}

/* 颜色和呼吸快慢都挂在状态上 越"活"的状态呼吸越快 */
.stock.is-in-stock {
  color: var(--green-400);
  --breathe-speed: 3.4s;
}

.stock.is-producing {
  color: var(--amber-400);
  --breathe-speed: 1.9s;
}

/* 缺货是静止状态 不呼吸 光晕也一起去掉 */
.stock.is-out-of-stock {
  color: var(--red-400);

  .stock-dot {
    animation: none;
  }

  .stock-dot::after {
    display: none;
  }
}

/* 系统设了减少动效就全停 光晕留一圈静态的 */
@media (prefers-reduced-motion: reduce) {
  .stock-dot,
  .stock-dot::after {
    animation: none;
  }

  .stock-dot::after {
    opacity: .3;
  }
}

.ship-card-action {
  color: var(--text-secondary);
  display: inline-block;
  transition: color .2s ease, transform .2s ease;
}

/* 文字和箭头分开动 箭头往前 文字往后 拉开一点距离 */
.ship-card-arrow {
  display: inline-block;
  margin-left: 6px;
  transition: transform .2s ease;
}

.ship-card:hover .ship-card-action {
  color: var(--text-primary);
  transform: translateX(-3px);
}

.ship-card:hover .ship-card-arrow {
  transform: translateX(6px);
}


/* ==========面板========== */
dialog {
  border: none;
  padding: 0;
  background-color: transparent;
  color: inherit;
  user-select: none;
  outline: none;
}

dialog::backdrop {
  background-color: var(--gray-1200-backdrop-bgc);
  backdrop-filter: blur(4px);
}

.panel {
  background: linear-gradient(var(--surface-1), var(--surface-1)) padding-box, linear-gradient(to bottom, var(--gray-600), var(--gray-800)) border-box;
  width: min(770px, 90vw);
  padding: 26px;
  border-radius: 13px;
  border: 1px solid transparent;

  /* 面板内的默认字号 下面各处只在需要偏离时才写 */
  font-size: var(--text-base);

  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ---------头部 船名和价格--------- */
.panel-header {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.panel-identity .ship-name-cn {
  font-size: var(--text-lg);
}

.panel-price {
  text-align: end;
}

.price-label {
  font-size: var(--text-xs);
}

.price-value {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-xl);
}

/* ---------船型介绍--------- */
.panel-description {
  line-height: 1.7;
  min-height: calc(1.7em * 2);

  .hl {
    color: var(--accent);
    font-family: var(--font-mono);
  }
}

/* ---------规格条--------- */
.spec-list {
  display: flex;
  gap: 11px;

  dt {
    color: var(--text-label);
    font-size: var(--text-xs);
    transition: color .2s ease;
  }

  dd {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
  }
}

.spec-item {
  flex: 1;

  background-color: var(--surface-2);
  padding: 5px 13px;
  border-radius: 9px;
  transition: background-color .2s ease;
}

.spec-item:hover {
  background-color: var(--surface-3);

  dt {
    color: var(--text-body);
  }
}

/* ---------身体-------- */
.panel-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 6px;
}

/* 配置 性能 配件 其他船型 这四个分区标题 */
.panel-heading {
  color: var(--text-label);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 1px;
}

/* ---------配置 可选配件--------- */
.accessory-name {
  color: var(--text-label);
  font-size: var(--text-sm);
}

.accessory-select {
  display: grid;
  grid-template-columns: max-content 1fr;
  justify-content: center;
  align-items: center;
  align-content: flex-start;
  gap: 14px 11px;
}

.accessory-options {
  display: flex;
  border-radius: 9px;
  background-color: var(--surface-2);
  /* 滑块的定位祖先 */
  position: relative;
}

/* 滑块 一直存在 只换位置 所以能滑
   --count 和 --selected 由 JS 写在元素的 style 上 点击时只改后者 */
.accessory-options.has-slider::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(100% / var(--count));
  /* 位移的百分比是相对自身宽度 而自身宽度正好是一格 所以序号乘 100% */
  transform: translateX(calc(var(--selected) * 100%));

  background-color: var(--amber-500-fill);
  border: 1px solid var(--amber-500);
  /* 默认四角全直 只有贴着槽壁的那一侧才跟着槽圆 */
  border-radius: 0;

  transition: transform .25s ease, border-radius .25s ease;
}

.accessory-options.at-start::before {
  border-radius: 9px 0 0 9px;
}

.accessory-options.at-end::before {
  border-radius: 0 9px 9px 0;
}

.option {
  flex:1;
  text-align: center;
  padding: 5px 13px;
  font-size: var(--text-sm);
  transition: color .2s ease;
  /* 绝对定位的伪元素会画在普通内容之上 选项也定位一下才能压在滑块上面 */
  position: relative;
}

/* 只给多候选的组做 hover 而且只动文字
   选项一旦有底色 就会把滑块盖住 两者在抢同一块地方 */
.has-slider .option:hover {
  color: var(--text-primary);
}

/* 单候选点了也不会变 所以不给任何可交互的暗示 */
.option.one-option {
  cursor: default;
}

/* 底色交给滑块了 这里只管文字 */
.option.is-selected {
  color: var(--accent);
}

/* ---------性能 雷达图--------- */
.panel-chart {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  width: 330px;
  height: 330px;
}

/* 图里所有长度的单位都是 viewBox 用户单位 不是 px 图整体放大时会跟着放大 */

/* 网格和轴线退成中性细线 把橙色让给数据多边形 */
.chart-ring,
.chart-axis {
  fill: none;
  stroke: var(--gray-700);
  stroke-width: 1;
}

/* 同级平均 参照物 用虚线和中性色 不跟本配置抢 */
.chart-average {
  fill: none;
  stroke: var(--gray-500);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

/* 本配置 */
.chart-value {
  fill: var(--amber-500-fill);
  stroke: var(--amber-500);
  stroke-width: 1.5;
}

/* 轴名 */
.chart-label {
  font-size: 8px;
  fill: var(--text-body);
  text-anchor: middle;
  dominant-baseline: central;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-label);
}

/* 用 border 画线段 而不是打字打出来的短横 才能和图里的线一致 */
.legend-line {
  width: 18px;
  border-top: 2.5px solid var(--amber-500);
}

.legend-line.is-average {
  border-top: 1.5px dashed var(--gray-500);
}

.legend-name {
  margin-right: 8px;
}

/* 轴名下面那行数值 属于本配置 所以用强调色 */
.chart-number {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--accent);
  text-anchor: middle;
  dominant-baseline: central;
}

/* ---------配件一览--------- */
.accessory-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 3px;
}

.material {
  position: relative;
  width: 50px;
  height: 50px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);

  display: flex;
  justify-content: center;
  align-items: center;

  padding-bottom: 2px;
}

.material-qty {
  background-color: var(--black);
  font-family: var(--font-mono);
  padding: 0px 1px;
  /* 因父级覆盖了color，这里显式的写回 */
  color: var(--text-body);
  line-height: 1;
  font-size: var(--text-xs);

  position: absolute;
  bottom: 0%;
  right: 0%;
}

/* ---------其他船型--------- */
.other-ship {
  display: flex;
  justify-content: space-between;
  padding: 5px 13px;
  border-top: 1px solid var(--border);
  padding: 10px 0px;

  .ship-name-cn {
    font-size: var(--text-base);
    transition: transform .2s ease, color .3s ease;
  }

  .ship-name-cn:hover {
    transform: translateX(7px);
    color: var(--accent);
  }
}

.other-ship-spec {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}