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

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  scrollbar-gutter: stable;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

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

ul, ol {
  list-style: none;
}

a {
  color: var(--color-teal);
  text-decoration: none;
  transition: color 0.25s ease;
}

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

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

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

/* ===== CSS Variables ===== */
:root {
  --color-primary: #0A1E3C;
  --color-primary-rgb: 10, 30, 60;
  --color-accent: #FF6B35;
  --color-accent-rgb: 255, 107, 53;
  --color-teal: #00C2A8;
  --color-teal-rgb: 0, 194, 168;
  --color-deep: #0B3B42;
  --color-deep-rgb: 11, 59, 66;
  --color-light: #E8ECF1;
  --color-white: #FFFFFF;
  --color-text: #FFFFFF;
  --color-text-secondary: #B0B8C4;
  --color-text-light: #1A2B3C;

  --font-heading: "Montserrat", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-number: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;

  --container-width: 1200px;
  --radius: 10px;
  --cut-angle: 12px;
  --header-height: 72px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ===== Base Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text);
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.8rem, 3vw, 2.75rem);
  letter-spacing: -0.01em;
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.75rem);
}

h4 {
  font-size: 1.125rem;
}

p {
  color: var(--color-text-secondary);
}

section-light h1,
section-light h2,
section-light h3,
section-light h4,
section-light h5,
section-light h6,
.section-light h1,
.section-light h2,
.section-light h3,
.section-light h4,
.section-light h5,
.section-light h6 {
  color: var(--color-text-light);
}

.section-light p {
  color: #405060;
}

::selection {
  background: var(--color-accent);
  color: #fff;
}

/* ===== Container & Layout Helpers ===== */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.section {
  padding: clamp(60px, 8vw, 120px) 0;
}

.section-light {
  background: var(--color-light);
  color: var(--color-text-light);
}

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

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

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

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

.card {
  background: var(--color-deep);
  border-radius: var(--radius);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 6px;
  transition: background 0.25s ease, color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  cursor: pointer;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

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

.btn-primary:hover {
  background: #ff8558;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--color-white);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.btn-ghost:hover {
  border-color: var(--color-teal);
  color: var(--color-teal);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 8px 18px;
  font-size: 0.85rem;
}

.section-light .btn-ghost {
  color: var(--color-text-light);
  border-color: rgba(26, 43, 60, 0.3);
}

.section-light .btn-ghost:hover {
  border-color: var(--color-teal);
  color: var(--color-teal);
}

/* ===== Section Head ===== */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 48px;
}

.section-index {
  font-family: var(--font-number);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  transition: color 0.35s ease;
}

.section-index::before {
  content: "\25C6";
  font-size: 0.55rem;
  color: var(--color-accent);
  line-height: 1;
}

.section-title {
  font-size: clamp(1.8rem, 3.5vw, 3rem);
}

.section-desc {
  max-width: 440px;
  font-size: 0.95rem;
  color: var(--color-text-secondary);
}

.section-light .section-index {
  color: #6b7b8f;
}

.section-light .section-index::before {
  color: var(--color-accent);
}

.section-light .section-desc {
  color: #405060;
}

/* ===== Page Head ===== */
.page-head {
  padding: clamp(100px, 14vh, 160px) 0 clamp(32px, 5vw, 64px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: clamp(48px, 8vw, 80px);
}

.page-title {
  font-size: clamp(2.2rem, 4vw, 3.5rem);
  letter-spacing: -0.02em;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}

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

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

.breadcrumb-sep {
  color: rgba(255, 255, 255, 0.25);
  font-family: var(--font-number);
}

.section-light .breadcrumb,
.section-light .breadcrumb a {
  color: #6b7b8f;
}

.section-light .breadcrumb-sep {
  color: rgba(26, 43, 60, 0.25);
}

/* ===== Image Frames ===== */
.img-frame {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--color-deep);
  aspect-ratio: 16 / 9;
}

.img-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 12px,
    rgba(255, 255, 255, 0.025) 12px,
    rgba(255, 255, 255, 0.025) 13px
  );
  pointer-events: none;
}

.img-frame::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.img-frame.is-wide {
  aspect-ratio: 21 / 9;
}

.img-frame.is-square {
  aspect-ratio: 1 / 1;
}

.img-frame.is-portrait {
  aspect-ratio: 3 / 4;
}

/* ===== Bento Grid ===== */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

.bento-card {
  position: relative;
  grid-column: span 4;
  background: var(--color-deep);
  border-radius: var(--radius);
  padding: 28px;
  min-height: 200px;
  overflow: hidden;
  clip-path: polygon(
    0 var(--cut-angle),
    var(--cut-angle) 0,
    100% 0,
    100% calc(100% - var(--cut-angle)),
    calc(100% - var(--cut-angle)) 100%,
    0 100%
  );
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.bento-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.bento-card.is-featured {
  grid-column: span 8;
  background: linear-gradient(135deg, var(--color-deep) 0%, var(--color-primary) 100%);
}

.bento-card.is-accent {
  background: var(--color-accent);
  color: #fff;
}

.bento-card.is-teal {
  background: var(--color-teal);
  color: var(--color-text-light);
}

/* ===== Tags & Legend ===== */
.tag {
  display: inline-block;
  padding: 4px 12px;
  font-family: var(--font-number);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  border-radius: 100px;
  background: rgba(0, 194, 168, 0.1);
  color: var(--color-teal);
  border: 1px solid rgba(0, 194, 168, 0.25);
}

.tag--orange {
  background: rgba(255, 107, 53, 0.1);
  color: var(--color-accent);
  border-color: rgba(255, 107, 53, 0.25);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
  flex-shrink: 0;
}

.legend-dot.is-teal {
  background: var(--color-teal);
}

.legend-dot.is-orange {
  background: var(--color-accent);
}

/* ===== Cut Panel ===== */
.cut-panel {
  position: relative;
  clip-path: polygon(
    0 var(--cut-angle),
    var(--cut-angle) 0,
    100% 0,
    100% calc(100% - var(--cut-angle)),
    calc(100% - var(--cut-angle)) 100%,
    0 100%
  );
}

/* ===== Skip Link ===== */
.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 2000;
  padding: 10px 20px;
  background: var(--color-accent);
  color: #fff;
  border-radius: 0 0 8px 8px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  transition: top 0.25s ease;
}

.skip-link:focus-visible {
  top: 0;
}

/* ===== Top Progress ===== */
.top-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--color-accent) 0%, var(--color-teal) 70%, var(--color-teal) 100%);
  z-index: 1500;
  pointer-events: none;
  border-radius: 0 3px 3px 0;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(10, 30, 60, 0.55);
  border-bottom: 1px solid transparent;
  transition: background 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.site-header.is-scrolled {
  background: rgba(10, 30, 60, 0.94);
  border-bottom-color: rgba(255, 255, 255, 0.07);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.28);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--header-height);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-white);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

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

.brand-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--color-accent);
  color: #fff;
  font-family: var(--font-number);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  clip-path: polygon(
    0 0,
    100% 0,
    100% calc(100% - 8px),
    calc(100% - 8px) 100%,
    0 100%
  );
}

.brand-mark::after {
  content: "";
  position: absolute;
  top: 0;
  right: 10px;
  width: 1px;
  height: 100%;
  background: rgba(255, 255, 255, 0.35);
  transform: rotate(18deg);
  transform-origin: center;
}

.brand-name {
  white-space: nowrap;
}

/* ===== Navigation ===== */
.site-nav {
  display: block;
}

.nav-list {
  counter-reset: navindex;
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  border-radius: 4px;
  transition: color 0.25s ease;
}

.nav-link::before {
  counter-increment: navindex;
  content: "0" counter(navindex);
  font-family: var(--font-number);
  font-size: 0.62rem;
  color: var(--color-teal);
  line-height: 1;
  transition: color 0.25s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 2px;
  height: 2px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.nav-link:hover {
  color: var(--color-white);
}

.nav-link:hover::after,
.nav-link[aria-current="page"]::after {
  transform: scaleX(1);
}

.nav-link[aria-current="page"] {
  color: var(--color-white);
}

.nav-link[aria-current="page"]::before {
  color: var(--color-accent);
}

/* Header coord */
.header-coord {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 100px;
  font-family: var(--font-number);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.coord-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-teal);
  flex-shrink: 0;
  animation: coord-pulse 2.4s ease-in-out infinite;
}

@keyframes coord-pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(0, 194, 168, 0.4);
  }
  50% {
    opacity: 0.65;
    box-shadow: 0 0 0 5px rgba(0, 194, 168, 0);
  }
}

/* ===== Nav Toggle (mobile) ===== */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background 0.25s ease;
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav-toggle-line {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-white);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.is-active .nav-toggle-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-active .nav-toggle-line:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-active .nav-toggle-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===== Footer ===== */
.site-footer {
  position: relative;
  background: var(--color-deep);
  color: var(--color-text);
  overflow: hidden;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-accent) 0%, var(--color-teal) 45%, transparent 85%);
  z-index: 1;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 48px;
  padding-top: 72px;
  padding-bottom: 56px;
}

.footer-brand .brand {
  margin-bottom: 18px;
}

.footer-trust {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  line-height: 1.8;
  max-width: 300px;
}

.footer-heading {
  font-family: var(--font-number);
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-teal);
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 194, 168, 0.15);
}

.footer-contact-list li,
.footer-list li {
  padding: 6px 0;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.footer-list a {
  color: var(--color-text-secondary);
  transition: color 0.2s ease;
}

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

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.12);
  padding: 20px 0;
}

.footer-bottom-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-bottom p {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
}

.footer-icp {
  font-family: var(--font-number);
  letter-spacing: 0.04em;
}

/* ===== Scroll Spy ===== */
[data-spy] {
  scroll-margin-top: calc(var(--header-height) + 24px);
}

[data-spy].is-in-view .section-index {
  color: var(--color-accent);
}

/* ===== Responsive ===== */
@media (max-width: 1023px) {
  .header-coord {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-deep);
    padding: 8px 24px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.32);
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.28s ease, transform 0.28s ease, visibility 0s linear 0.28s;
  }

  .site-nav[data-open] {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.28s ease, transform 0.28s ease;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .nav-link {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 15px 8px;
    font-size: 1.05rem;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .nav-link::after {
    display: none;
  }

  .nav-link[aria-current="page"] {
    color: var(--color-accent);
  }

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

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 899px) {
  .bento-card {
    grid-column: span 6;
  }

  .bento-card.is-featured {
    grid-column: span 12;
  }

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

@media (max-width: 599px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

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

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .section-desc {
    max-width: 100%;
  }

  .bento-card {
    grid-column: span 12;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-top: 48px;
    padding-bottom: 40px;
  }

  .footer-bottom-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-inner {
    gap: 12px;
  }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }

  .coord-dot {
    animation: none;
  }

  .site-nav {
    transition: none;
  }
}

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

[data-spy] {
  scroll-margin-top: calc(var(--header-height) + 24px);
}

:target {
  scroll-margin-top: calc(var(--header-height) + 24px);
}

[id] {
  scroll-margin-top: calc(var(--header-height) + 24px);
}

::selection {
  background: var(--color-accent);
  color: #fff;
}

img {
  height: auto;
}

@media (prefers-reduced-motion: no-preference) {
  .bento-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
  }
}
