/* ========== 01. Variables & Reset ========== */
:root {
  --bg-deep: #0B1B2B;
  --bg-navy: #1A2B4C;
  --bg-panel: #162030;
  --bg-dark: #0D1117;
  --accent-purple: #8A2BE2;
  --accent-green: #00FF87;
  --text-main: #E6E6E6;
  --text-sub: #9AA7B0;
  --border: #2A3A4A;
  --warn: #FFD54F;
  --font-head: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-body: 'Inter', 'Helvetica Neue', 'PingFang SC', sans-serif;
  --nav-width: 280px;
  --content-max: 1200px;
  --header-height: 64px;
  --radius: 8px;
  --transition: 0.3s ease;
  --z-header: 260;
  --z-mask: 250;
  --z-drawer: 300;
  --z-progress: 999;
  --z-skip: 1000;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-main);
  background: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(138, 43, 226, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(138, 43, 226, 0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
  z-index: 0;
}

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

ul, ol {
  list-style: none;
}

a {
  color: var(--accent-green);
  text-decoration: none;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

a:hover {
  color: var(--text-main);
}

button {
  font: inherit;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent-green);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: rgba(138, 43, 226, 0.55);
  color: #fff;
}

/* ========== 02. Layout & Main ========== */
.main-content {
  margin-left: var(--nav-width);
  min-height: 65vh;
  position: relative;
  z-index: 1;
}

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

.grid {
  display: grid;
  gap: 28px;
}

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

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

/* ========== 03. Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.22s ease;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-purple);
  color: #fff;
  border-color: var(--accent-purple);
}

.btn-primary:hover {
  background: #9d3bef;
  border-color: #9d3bef;
  color: #fff;
  box-shadow: 0 0 22px rgba(138, 43, 226, 0.45);
}

.btn-outline {
  background: transparent;
  color: var(--accent-green);
  border-color: var(--accent-green);
}

.btn-outline:hover {
  background: rgba(0, 255, 135, 0.08);
  color: var(--accent-green);
  box-shadow: 0 0 16px rgba(0, 255, 135, 0.25);
}

/* ========== 04. Skip Link & Scroll Progress ========== */
.skip-link {
  position: fixed;
  top: -120px;
  left: 20px;
  z-index: var(--z-skip);
  background: var(--accent-green);
  color: var(--bg-deep);
  font-weight: 800;
  font-size: 0.9rem;
  font-family: var(--font-body);
  padding: 12px 20px;
  border-radius: 0 0 10px 10px;
  transition: top 0.25s ease;
  box-shadow: 0 4px 20px rgba(0, 255, 135, 0.35);
}

.skip-link:focus {
  top: 0;
  color: var(--bg-deep);
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: transparent;
  z-index: var(--z-progress);
  pointer-events: none;
  box-shadow: 0 0 12px rgba(0, 255, 135, 0.3);
}

/* ========== 05. Header & Navigation ========== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--nav-width);
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 24px 28px;
  z-index: var(--z-header);
  overflow-y: auto;
  overflow-x: hidden;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text-main);
  text-decoration: none;
}

.brand:hover {
  color: var(--text-main);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 6px;
  background: linear-gradient(135deg, var(--accent-purple) 0%, #4a1a8a 100%);
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 0.95rem;
  color: #fff;
  border-radius: 10px 2px 10px 2px;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 82% 100%, 0 100%);
  letter-spacing: 0.04em;
}

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

.brand-name {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.22rem;
  letter-spacing: 0.02em;
  color: var(--text-main);
  white-space: nowrap;
}

.brand-sub {
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  color: var(--accent-green);
  margin-top: 4px;
  text-transform: uppercase;
}

.nav-toggle {
  display: none;
}

.site-nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-sub);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  border-left: 1px solid var(--border);
  border-radius: 0 8px 8px 0;
  text-decoration: none;
  transition: all 0.2s ease;
}

.nav-item a::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  background: var(--border);
  border-radius: 50%;
  transition: all 0.22s ease;
}

.nav-item a:hover {
  color: var(--text-main);
  background: rgba(138, 43, 226, 0.08);
  border-left-color: var(--accent-purple);
}

.nav-item a:hover::before {
  background: var(--accent-purple);
  box-shadow: 0 0 10px rgba(138, 43, 226, 0.6);
}

.nav-item a[aria-current="page"] {
  color: #fff;
  background: linear-gradient(90deg, rgba(138, 43, 226, 0.22) 0%, transparent 100%);
  border-left-color: var(--accent-green);
}

.nav-item a[aria-current="page"]::before {
  background: var(--accent-green);
  box-shadow: 0 0 14px rgba(0, 255, 135, 0.7);
}

.nav-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.nav-meta-line {
  height: 1px;
  background: linear-gradient(90deg, var(--accent-purple), transparent);
}

.nav-meta-text {
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  color: var(--text-sub);
  text-transform: uppercase;
  font-family: var(--font-body);
}

.nav-meta-code {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--accent-green);
  opacity: 0.75;
  font-family: var(--font-body);
}

.nav-cta {
  margin-top: 24px;
  width: 100%;
  text-align: center;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
}

.nav-mask {
  display: none;
}

/* ========== 06. Footer ========== */
.site-footer {
  position: relative;
  z-index: 1;
  margin-left: var(--nav-width);
  background: var(--bg-dark);
  border-top: 1px solid var(--border);
  padding: 68px 56px 28px;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-purple) 0%, var(--accent-green) 60%, transparent 100%);
  opacity: 0.85;
}

.site-footer::after {
  content: '';
  position: absolute;
  right: -60px;
  bottom: -80px;
  width: 320px;
  height: 320px;
  border: 1px solid rgba(138, 43, 226, 0.14);
  border-radius: 28px;
  background: rgba(138, 43, 226, 0.035);
  transform: rotate(45deg);
  pointer-events: none;
}

.footer-inner {
  position: relative;
  z-index: 1;
  max-width: var(--content-max);
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 56px;
}

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

.footer-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  height: 50px;
  padding: 0 8px;
  background: linear-gradient(135deg, var(--accent-purple) 0%, #4a1a8a 100%);
  color: #fff;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1rem;
  border-radius: 10px 2px 10px 2px;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 82% 100%, 0 100%);
  margin-bottom: 18px;
}

.footer-company {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.35rem;
  color: var(--text-main);
  margin-bottom: 8px;
  letter-spacing: 0.03em;
}

.footer-brief {
  color: var(--text-sub);
  font-size: 0.93rem;
  line-height: 1.8;
  max-width: 300px;
}

.footer-col {
  display: flex;
  flex-direction: column;
}

.footer-heading {
  position: relative;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.1em;
  color: var(--text-main);
  margin-bottom: 20px;
  padding-bottom: 10px;
}

.footer-heading::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 28px;
  height: 2px;
  background: var(--accent-green);
}

.footer-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
  color: var(--text-sub);
  font-size: 0.9rem;
}

.footer-list li {
  line-height: 1.7;
  word-break: break-word;
}

.footer-list a {
  color: var(--text-sub);
  text-decoration: none;
  transition: all 0.18s ease;
}

.footer-list a:hover {
  color: var(--accent-green);
  padding-left: 4px;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 20px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-sub);
  font-size: 0.8rem;
}

.footer-bottom p {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-copy {
  letter-spacing: 0.04em;
}

.footer-icp {
  letter-spacing: 0.1em;
}

.footer-meta {
  flex-wrap: wrap;
}

.footer-meta span + span::before {
  content: '/';
  margin-right: 8px;
  color: var(--border);
}

/* ========== 07. Common Components ========== */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-sub);
  padding: 14px 0 8px;
}

.breadcrumb-separator {
  color: var(--border);
}

.breadcrumb-current {
  color: var(--text-main);
  font-weight: 600;
}

.breadcrumb a {
  color: var(--text-sub);
}

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

.section-index {
  display: block;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: clamp(3.5rem, 8vw, 6rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: rgba(138, 43, 226, 0.2);
  -webkit-text-stroke: 1px rgba(138, 43, 226, 0.6);
  user-select: none;
}

.vertical-note {
  writing-mode: vertical-rl;
  font-family: var(--font-head);
  font-size: 0.75rem;
  letter-spacing: 0.42em;
  color: var(--text-sub);
  text-transform: uppercase;
  line-height: 1.7;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: var(--accent-green);
  text-transform: uppercase;
  font-family: var(--font-body);
}

.eyebrow::before {
  content: '';
  width: 26px;
  height: 2px;
  background: var(--accent-purple);
  flex-shrink: 0;
}

.divider {
  height: 1px;
  border: none;
  background: linear-gradient(90deg, var(--border), transparent);
}

.media {
  position: relative;
  overflow: hidden;
  background: var(--bg-panel);
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

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

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

.media-wide {
  aspect-ratio: 16 / 7;
}

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

.media-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-sub);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  background:
    linear-gradient(rgba(138, 43, 226, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(138, 43, 226, 0.08) 1px, transparent 1px),
    var(--bg-panel);
  background-size: 28px 28px;
  text-transform: uppercase;
}

/* ========== 08. Reveal & Motion ========== */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.js [data-reveal].is-revealed {
  opacity: 1;
  transform: translateY(0);
}

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

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

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

/* ========== 09. Responsive ========== */
@media (max-width: 1024px) {
  :root {
    --nav-width: 0px;
  }

  .main-content,
  .site-footer {
    margin-left: 0;
  }

  .site-header {
    position: sticky;
    top: 0;
    width: 100%;
    height: var(--header-height);
    bottom: auto;
    flex-direction: row;
    align-items: center;
    padding: 0 20px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    background: rgba(11, 27, 43, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: visible;
  }

  .header-top {
    width: 100%;
    padding-bottom: 0;
    border-bottom: none;
    margin-bottom: 0;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(138, 43, 226, 0.18);
    border: 1px solid var(--accent-purple);
    border-radius: 6px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .nav-toggle:hover {
    background: rgba(138, 43, 226, 0.35);
    box-shadow: 0 0 14px rgba(138, 43, 226, 0.3);
  }

  .nav-toggle-line {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.22s ease, opacity 0.22s ease;
  }

  .nav-toggle-icon {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
  }

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

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

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

  .site-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(360px, 88vw);
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    padding: 52px 28px 32px;
    transform: translateX(105%);
    transition: transform 0.36s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: var(--z-drawer);
    overflow-y: auto;
    box-shadow: -18px 0 40px rgba(0, 0, 0, 0.35);
  }

  .site-nav[data-open] {
    transform: translateX(0);
  }

  .nav-list {
    margin-top: 0;
  }

  .nav-mask {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(3, 8, 15, 0.65);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: var(--z-mask);
  }

  .site-nav[data-open] + .nav-mask {
    opacity: 1;
    visibility: visible;
  }

  .container {
    padding: 0 28px;
  }

  .site-footer {
    padding: 52px 28px 24px;
  }

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

  .footer-bottom {
    margin-top: 40px;
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 20px;
  }

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

  .site-header {
    padding: 0 14px;
  }

  .brand-name {
    font-size: 1.05rem;
  }

  .brand-sub {
    font-size: 0.62rem;
    letter-spacing: 0.22em;
  }

  .brand-mark {
    min-width: 38px;
    height: 38px;
    font-size: 0.82rem;
  }

  .nav-toggle-label {
    display: none;
  }

  .nav-toggle {
    padding: 8px;
  }

  .site-footer {
    padding: 44px 20px 20px;
  }

  .footer-grid {
    gap: 32px;
  }

  .footer-bottom {
    font-size: 0.76rem;
  }
}
