/* ============ RESET & TOKENS ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-deep: #0A1A2F;
  --color-warship: #0F2440;
  --color-steel: #1C3A5E;
  --color-orange: #FF6A00;
  --color-amber: #F5A623;
  --color-white: #FFFFFF;
  --color-moon: #F2F5F9;
  --color-mist: #7A9CC6;
  --color-cloud: #EAF0F7;
  --color-cyan: #00D5B0;
  --font-sans: 'HarmonyOS Sans SC', 'MiSans', 'PingFang SC', system-ui, sans-serif;
  --font-serif: 'Source Han Serif SC', 'Noto Serif CJK SC', 'Songti SC', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, 'Courier New', monospace;
  --container-max: 1280px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;
  --transition-fast: 200ms;
  --transition-base: 300ms;
  --header-z: 100;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-deep);
  color: var(--color-moon);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-white);
  margin-bottom: var(--space-3);
}

p {
  max-width: 65ch;
}

a {
  color: var(--color-mist);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-orange);
}

ul, ol {
  padding-left: 0;
  list-style: none;
}

img {
  display: block;
  width: 100%;
  height: auto;
}

/* ============ CONTAINERS & GRID ============ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.grid {
  display: grid;
  gap: var(--space-4);
}

.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 22px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--color-white);
  background-color: var(--color-steel);
  border: 1px solid var(--color-steel);
  border-radius: 0;
  cursor: pointer;
  text-align: center;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.btn:hover {
  background-color: var(--color-warship);
  border-color: var(--color-warship);
  color: var(--color-white);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background-color: var(--color-orange);
  border-color: var(--color-orange);
  color: var(--color-white);
}

.btn--primary:hover {
  background-color: #d95b00;
  border-color: #d95b00;
  color: var(--color-white);
}

.btn--outline {
  background: transparent;
  border-color: var(--color-steel);
  color: var(--color-mist);
}

.btn--outline:hover {
  border-color: var(--color-orange);
  color: var(--color-orange);
  background-color: rgba(255, 106, 0, 0.08);
}

/* ============ BREADCRUMB ============ */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-2);
  margin: 0;
  padding: var(--space-4) 0;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-mist);
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.breadcrumb li + li::before {
  content: '/';
  color: var(--color-steel);
  font-family: var(--font-mono);
}

.breadcrumb a {
  color: var(--color-mist);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--color-orange);
}

.breadcrumb [aria-current='page'] {
  color: var(--color-orange);
  font-weight: 600;
}

/* ============ IMAGE FRAMES ============ */
.img-frame {
  position: relative;
  display: block;
  overflow: hidden;
  background-color: var(--color-warship);
  background-image:
    linear-gradient(rgba(122, 156, 198, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 156, 198, 0.08) 1px, transparent 1px);
  background-size: 18px 18px;
  aspect-ratio: 16 / 9;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}

.img-frame::after {
  content: '';
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 24px;
  height: 24px;
  border-right: 1px solid var(--color-mist);
  border-bottom: 1px solid var(--color-mist);
  opacity: 0.5;
  pointer-events: none;
}

.img-frame > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.img-frame--wide { aspect-ratio: 21 / 9; }
.img-frame--square { aspect-ratio: 1 / 1; }
.img-frame--portrait { aspect-ratio: 3 / 4; }

/* ============ SECTION TITLE ============ */
.section-title {
  position: relative;
  font-size: clamp(22px, 3vw, 32px);
  color: var(--color-white);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4);
}

.section-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 48px;
  height: 4px;
  background: var(--color-orange);
}

.section-title__sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-mist);
  margin-bottom: var(--space-2);
}

/* ============ UTILITIES ============ */
.font-mono {
  font-family: var(--font-mono);
}

.text-muted {
  color: var(--color-mist);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ============ SIGNAL METER ============ */
.signal-meter {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  z-index: 200;
  background: linear-gradient(90deg, var(--color-orange), var(--color-amber));
  pointer-events: none;
  transition: width 100ms linear;
}

/* ============ SKIP LINK ============ */
.skip-link {
  position: fixed;
  top: -120px;
  left: 16px;
  z-index: 300;
  padding: 10px 20px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-white);
  background-color: var(--color-orange);
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 8px;
}

/* ============ HEADER ============ */
.site-header {
  position: relative;
  z-index: var(--header-z);
  background-color: var(--color-warship);
  background-image:
    linear-gradient(rgba(122, 156, 198, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 156, 198, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  border-bottom: 1px solid var(--color-steel);
}

.site-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-orange) 0%, var(--color-orange) 25%, var(--color-amber) 60%, transparent 100%);
  pointer-events: none;
}

.site-header::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 12px;
  width: 72px;
  height: 28px;
  border-right: 2px solid var(--color-steel);
  border-bottom: 2px solid var(--color-steel);
  pointer-events: none;
  opacity: 0.6;
}

.site-header__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) 0 var(--space-3);
}

.header-brand {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-3);
  padding-left: 14px;
}

.header-brand::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 4px;
  background: var(--color-orange);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%);
}

.header-brand__name {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 800;
  color: var(--color-white);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.header-brand__tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-amber);
  border: 1px solid rgba(245, 166, 35, 0.4);
  padding: 2px 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}

.header-top__tools {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.data-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-mist);
  white-space: nowrap;
}

.data-status__dot {
  width: 7px;
  height: 7px;
  background-color: var(--color-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0, 213, 176, 0.6);
  animation: status-pulse 2s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

/* ============ NAVIGATION ============ */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--color-steel);
  border-radius: 0;
  cursor: pointer;
}

.nav-toggle__bar {
  display: block;
  width: 20px;
  height: 2px;
  background-color: var(--color-white);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.nav-toggle[aria-expanded='true'] .nav-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded='true'] .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded='true'] .nav-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.site-nav {
  counter-reset: nav-counter;
  border-top: 1px solid rgba(28, 58, 94, 0.6);
}

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
}

.site-nav__item {
  counter-increment: nav-counter;
  margin-right: var(--space-5);
}

.site-nav__item:last-child {
  margin-right: 0;
}

.site-nav__link {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: var(--space-3) 0;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-moon);
  position: relative;
}

.site-nav__link::before {
  content: counter(nav-counter, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-mist);
  transform: translateY(-2px);
  transition: color var(--transition-fast);
}

.site-nav__link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 3px;
  background: var(--color-orange);
  transition: width var(--transition-base);
}

.site-nav__link:hover {
  color: var(--color-white);
}

.site-nav__link:hover::after,
.site-nav__link[aria-current='page']::after {
  width: 100%;
}

.site-nav__link:hover::before,
.site-nav__link[aria-current='page']::before {
  color: var(--color-orange);
}

.site-nav__link[aria-current='page'] {
  color: var(--color-white);
}

/* ============ HEADER SCALE ============ */
.header-scale {
  display: flex;
  align-items: flex-end;
  height: 14px;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-4);
  border-bottom: 1px solid rgba(28, 58, 94, 0.5);
}

.header-scale__tick {
  flex: 1;
  width: 1px;
  height: 4px;
  background-color: var(--color-steel);
}

.header-scale__tick:nth-child(even) { height: 8px; }
.header-scale__tick:nth-child(3n) { height: 10px; }
.header-scale__tick:nth-child(5n) { height: 14px; background-color: var(--color-mist); }

/* ============ FOOTER ============ */
.site-footer {
  position: relative;
  background-color: var(--color-deep);
  border-top: 3px solid var(--color-steel);
  margin-top: var(--space-7);
}

.site-footer::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 0;
  width: 140px;
  height: 3px;
  background: var(--color-orange);
}

.site-footer__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-7) var(--space-4) var(--space-5);
}

.footer-main {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--space-6);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid rgba(28, 58, 94, 0.6);
}

.footer-intro__brand {
  display: block;
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 800;
  color: var(--color-white);
  margin-bottom: var(--space-3);
  position: relative;
}

.footer-intro__brand::after {
  content: '维基彩站';
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--color-amber);
  letter-spacing: 0.1em;
  margin-top: 4px;
}

.footer-intro__brand:hover {
  color: var(--color-white);
}

.footer-intro__desc {
  font-size: 13px;
  line-height: 1.8;
  color: var(--color-mist);
  max-width: 48em;
}

.footer-nav__list {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 10px var(--space-5);
  padding: 0;
  margin: 0;
}

.footer-nav__link {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-mist);
  transition: color var(--transition-fast);
}

.footer-nav__link:hover {
  color: var(--color-orange);
}

.footer-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-6);
  padding: var(--space-4) 0;
  border-bottom: 1px solid rgba(28, 58, 94, 0.6);
}

.footer-contact__label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-amber);
}

.footer-contact__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  padding: 0;
  margin: 0;
}

.footer-contact__item {
  font-size: 13px;
  color: var(--color-mist);
}

.footer-contact__value {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-moon);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2) var(--space-3);
  padding-top: var(--space-4);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-mist);
}

.footer-bottom__icp {
  font-family: var(--font-mono);
}

.footer-bottom__sep {
  color: var(--color-steel);
}

.footer-bottom__link {
  color: var(--color-mist);
  transition: color var(--transition-fast);
}

.footer-bottom__link:hover {
  color: var(--color-orange);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 992px) {
  .header-brand__name {
    font-size: 18px;
  }

  .site-nav__item {
    margin-right: var(--space-3);
  }

  .footer-main {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }

  .grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .site-header__inner {
    padding: 0 var(--space-3);
  }

  .header-top {
    flex-wrap: wrap;
    gap: var(--space-3);
    padding: var(--space-3) 0;
  }

  .header-brand {
    gap: var(--space-2);
  }

  .header-brand__name {
    font-size: 17px;
  }

  .header-top__tools {
    gap: var(--space-2);
  }

  .data-status__text {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .site-nav {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    visibility: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, visibility 0s linear 0.4s;
  }

  .site-nav[data-open] {
    max-height: 480px;
    opacity: 1;
    visibility: visible;
    transition: max-height 0.4s ease, opacity 0.3s ease, visibility 0s;
  }

  .site-nav__list {
    flex-direction: column;
    gap: 0;
    padding-bottom: var(--space-3);
  }

  .site-nav__item {
    margin-right: 0;
  }

  .site-nav__link {
    display: flex;
    width: 100%;
    padding: var(--space-3) 0;
    border-bottom: 1px solid rgba(28, 58, 94, 0.4);
  }

  .header-scale {
    display: none;
  }

  .site-header::after {
    display: none;
  }

  .footer-main {
    padding-bottom: var(--space-4);
  }

  .footer-nav__list {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px var(--space-3);
  }

  .footer-contact {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .footer-bottom {
    gap: var(--space-2);
  }

  .grid--2,
  .grid--3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .header-brand__name {
    font-size: 15px;
  }

  .header-brand__tag {
    font-size: 10px;
  }

  .footer-nav__list {
    grid-template-columns: 1fr;
  }

  .footer-contact__list {
    flex-direction: column;
    gap: var(--space-2);
  }
}

/* ============ ACCESSIBILITY ============ */
:focus-visible {
  outline: 2px solid var(--color-orange);
  outline-offset: 3px;
}

@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;
  }

  .signal-meter {
    transition: none;
  }
}
