/* ============ 1. Reset & Variables ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --sf-purple: #B537F2;
  --sf-blue: #1E90FF;
  --sf-orange: #FF6B1A;
  --sf-bg-night: #0A0A1A;
  --sf-bg-deep: #12122A;
  --sf-mist: #F0F0F5;
  --sf-gray: #2A2A3A;
  --sf-pink: #FF3EB5;
  --sf-night: #7F8FA6;
  --sf-green: #39FF14;

  --font-sans: "Noto Sans SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --font-mono: "Roboto Mono", "Courier New", monospace;

  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.5rem;
  --fs-xl: 2rem;
  --fs-2xl: 2.75rem;
  --fs-3xl: 3.5rem;

  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;

  --container-max: 1440px;
  --container-narrow: 1080px;
  --header-h: 76px;

  --shadow-purple: 0 0 24px rgba(181, 55, 242, 0.35);
  --shadow-blue: 0 0 24px rgba(30, 144, 255, 0.3);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* ============ 2. Base Typography ============ */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.75;
  color: var(--sf-mist);
  background: var(--sf-bg-night);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--sf-mist);
}

h1 {
  font-size: var(--fs-3xl);
}

h2 {
  font-size: var(--fs-2xl);
}

h3 {
  font-size: var(--fs-xl);
}

h4 {
  font-size: var(--fs-lg);
}

p {
  margin-bottom: 0.75rem;
}

a {
  color: var(--sf-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--sf-purple);
}

ul,
ol {
  list-style-position: inside;
}

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

.mono-num {
  font-family: var(--font-mono);
  font-size: 0.875em;
  letter-spacing: 0.02em;
}

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

/* ============ 3. Layout & Containers ============ */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.section {
  padding: var(--space-xl) 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.section-index {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--sf-purple);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.section-title {
  font-size: var(--fs-2xl);
  font-weight: 700;
}

.section-desc {
  color: var(--sf-night);
  max-width: 720px;
  font-size: var(--fs-md);
}

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

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

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

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

/* ============ 4. Header ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 26, 0.95);
  border-bottom: 1px solid rgba(30, 144, 255, 0.2);
}

@supports (backdrop-filter: blur(8px)) {
  .site-header {
    background: rgba(10, 10, 26, 0.82);
    backdrop-filter: blur(16px);
  }
}

.site-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--sf-purple), var(--sf-blue) 40%, var(--sf-purple));
  z-index: 2;
}

.site-header::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--sf-blue), transparent);
  opacity: 0.4;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--sf-blue);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 8px 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  z-index: 200;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
  color: #fff;
}

.header-frame {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: var(--header-h);
  gap: var(--space-md);
  position: relative;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--sf-mist);
  text-decoration: none;
  flex-shrink: 0;
}

.header-brand:hover {
  color: var(--sf-mist);
}

.brand-badge {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--sf-purple), var(--sf-pink));
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 72% 100%, 0 100%);
  box-shadow: var(--shadow-purple);
}

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

.brand-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--sf-mist);
}

.brand-en {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: var(--sf-night);
  text-transform: uppercase;
}

.main-nav {
  margin-left: auto;
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 0.35rem;
}

.nav-item {
  list-style: none;
}

.nav-link {
  display: block;
  padding: 0.5rem 0.85rem;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--sf-mist);
  border-radius: 6px;
  position: relative;
  transition: color 0.2s ease, background 0.2s ease;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--sf-blue);
  background: rgba(30, 144, 255, 0.1);
}

.nav-link[aria-current="page"] {
  color: var(--sf-blue);
  background: rgba(30, 144, 255, 0.08);
}

.nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: 0.12rem;
  height: 2px;
  background: var(--sf-blue);
  border-radius: 2px;
}

.header-side {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-shrink: 0;
}

.version-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.7rem;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--sf-orange);
  border: 1px solid rgba(255, 107, 26, 0.4);
  border-radius: 3px;
  background: rgba(255, 107, 26, 0.08);
  white-space: nowrap;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 8px;
  background: transparent;
  border: 1px solid rgba(127, 143, 166, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.nav-toggle:hover {
  border-color: var(--sf-purple);
}

.toggle-line {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--sf-mist);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease, background 0.25s ease;
}

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

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

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

.header-progress {
  position: absolute;
  bottom: -2px;
  left: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--sf-purple), var(--sf-blue), var(--sf-orange));
  z-index: 10;
  transition: width 0.1s linear;
}

/* ============ 5. Mobile Navigation ============ */
@media (max-width: 960px) {
  .nav-toggle {
    display: flex;
  }

  .main-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    margin-left: 0;
    background: rgba(18, 18, 42, 0.99);
    border-bottom: 1px solid rgba(30, 144, 255, 0.3);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
  }

  .main-nav[data-open="true"] {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-list {
    flex-direction: column;
    padding: 0.75rem 1rem 1.25rem;
    gap: 0.25rem;
  }

  .nav-link {
    font-size: var(--fs-base);
    padding: 0.7rem 1rem;
    border-left: 3px solid transparent;
    border-radius: 0 6px 6px 0;
  }

  .nav-link:hover,
  .nav-link[aria-current="page"] {
    border-left-color: var(--sf-blue);
  }

  .nav-link[aria-current="page"]::after {
    left: 1rem;
    right: 1rem;
    bottom: 0.25rem;
  }
}

@media (max-width: 420px) {
  .brand-en {
    display: none;
  }

  .version-chip {
    display: none;
  }

  .header-frame {
    padding: 0 1rem;
    gap: 0.5rem;
  }
}

/* ============ 6. Footer ============ */
.site-footer {
  background: var(--sf-bg-deep);
  border-top: 1px solid rgba(30, 144, 255, 0.2);
  position: relative;
  padding-top: var(--space-xl);
}

.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 200px;
  height: 3px;
  background: linear-gradient(90deg, var(--sf-purple), transparent);
}

.footer-top {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem var(--space-lg);
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 0.8fr 1.1fr;
  gap: var(--space-lg);
}

.footer-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

.footer-logo {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--sf-purple), var(--sf-pink));
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 72% 100%, 0 100%);
  box-shadow: var(--shadow-purple);
  margin-bottom: 0.5rem;
}

.footer-slogan {
  font-size: var(--fs-sm);
  color: var(--sf-night);
  line-height: 1.7;
  max-width: 320px;
}

.footer-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sf-mist);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid rgba(181, 55, 242, 0.4);
  margin-bottom: 0.25rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.footer-links a {
  font-size: var(--fs-sm);
  color: var(--sf-night);
  text-decoration: none;
  transition: color 0.2s ease, padding-left 0.2s ease;
  display: inline-block;
}

.footer-links a:hover {
  color: var(--sf-blue);
  padding-left: 4px;
}

.footer-contact {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.footer-contact p {
  font-size: var(--fs-sm);
  color: var(--sf-night);
  margin-bottom: 0;
  word-break: break-all;
}

.footer-contact a {
  color: var(--sf-blue);
  transition: color 0.2s ease;
}

.footer-contact a:hover {
  color: var(--sf-purple);
}

.footer-bottom {
  border-top: 1px solid rgba(127, 143, 166, 0.15);
  background: rgba(0, 0, 0, 0.25);
}

.footer-bottom-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: var(--fs-xs);
  color: var(--sf-night);
  font-family: var(--font-mono);
}

/* ============ 7. Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--sf-purple);
  color: #fff;
  border-color: var(--sf-purple);
  box-shadow: 0 0 16px rgba(181, 55, 242, 0.25);
}

.btn-primary:hover {
  background: var(--sf-pink);
  border-color: var(--sf-pink);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(255, 62, 181, 0.35);
}

.btn-secondary {
  background: transparent;
  color: var(--sf-blue);
  border-color: var(--sf-blue);
}

.btn-secondary:hover {
  background: rgba(30, 144, 255, 0.12);
  color: var(--sf-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-blue);
}

/* ============ 8. Breadcrumb ============ */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 1rem 1.5rem 0;
  font-size: var(--fs-sm);
  color: var(--sf-night);
}

.breadcrumb a {
  color: var(--sf-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

.breadcrumb-sep {
  color: var(--sf-purple);
  font-family: var(--font-mono);
}

/* ============ 9. Cards & Panels ============ */
.card {
  background: var(--sf-bg-deep);
  border: 1px solid rgba(127, 143, 166, 0.15);
  border-radius: 12px;
  padding: var(--space-lg);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
  border-color: rgba(181, 55, 242, 0.4);
}

.panel-cut {
  background: linear-gradient(135deg, rgba(181, 55, 242, 0.14), rgba(30, 144, 255, 0.14));
  clip-path: polygon(0 0, calc(100% - 28px) 0, 100% 28px, 100% 100%, 28px 100%, 0 calc(100% - 28px));
  padding: var(--space-xl);
  border-radius: 4px;
}

/* ============ 10. Tags & Status ============ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 3px;
  border: 1px solid currentColor;
  background: transparent;
}

.tag-purple {
  color: var(--sf-purple);
}

.tag-blue {
  color: var(--sf-blue);
}

.tag-orange {
  color: var(--sf-orange);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sf-green);
  box-shadow: 0 0 8px var(--sf-green);
}

/* ============ 11. Figure Placeholders ============ */
.figure {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(30, 144, 255, 0.12), rgba(181, 55, 242, 0.12));
  aspect-ratio: 16 / 9;
}

.figure::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(127, 143, 166, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127, 143, 166, 0.1) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

.figure-wide {
  aspect-ratio: 21 / 9;
}

.figure-square {
  aspect-ratio: 1 / 1;
}

.figure-portrait {
  aspect-ratio: 3 / 4;
}

.figure > img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

/* ============ 12. Utilities ============ */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-sm {
  margin-top: var(--space-sm);
}

.mt-md {
  margin-top: var(--space-md);
}

.mt-lg {
  margin-top: var(--space-lg);
}

.mb-sm {
  margin-bottom: var(--space-sm);
}

.mb-md {
  margin-bottom: var(--space-md);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

/* ============ 13. Focus & Reduced Motion ============ */
:focus-visible {
  outline: 2px solid var(--sf-blue);
  outline-offset: 3px;
  border-radius: 2px;
}

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

  .header-progress {
    transition: none;
  }
}

/* ============ 14. Responsive Grid ============ */
@media (max-width: 960px) {
  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
  }
}

@media (max-width: 640px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .footer-top {
    grid-template-columns: 1fr;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .footer-bottom-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .section {
    padding: var(--space-lg) 0;
  }

  .section-head {
    gap: 0.5rem;
  }

  .section-title {
    font-size: var(--fs-xl);
  }

  .panel-cut {
    padding: var(--space-lg);
  }
}

@media (min-width: 641px) and (max-width: 960px) {
  .section-title {
    font-size: var(--fs-xl);
  }
}

/* ============ 15. Wide Screen Container ============ */
@media (min-width: 1600px) {
  .container,
  .header-frame,
  .footer-top,
  .footer-bottom-inner {
    padding-left: 3rem;
    padding-right: 3rem;
  }

  .breadcrumb {
    padding-left: 3rem;
    padding-right: 3rem;
  }
}
