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

/* ========== VARIABLES ========== */
:root {
  --bg-main: #14181f;
  --bg-panel: #1e2a24;
  --bg-deep: #0b0e11;
  --line-dark: #3a2b22;
  --text-light: #f2efe6;
  --text-muted: #9a958e;
  --accent-moss: #6a8e7f;
  --accent-terra: #c56b4a;
  --accent-lime: #b7e14a;
  --accent-yellow: #ffd83d;

  --font-display: "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;

  --container: 1200px;
  --radius: 4px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);

  --z-skip: 9999;
  --z-progress: 1001;
  --z-header: 1000;
  --z-float: 900;
}

/* ========== BASE ========== */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-light);
  background-color: var(--bg-main);
  background-image:
    linear-gradient(rgba(58, 43, 34, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(58, 43, 34, 0.22) 1px, transparent 1px);
  background-size: 44px 44px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--accent-moss);
  text-decoration: none;
  transition: color 200ms var(--ease), border-color 200ms var(--ease), background 200ms var(--ease);
}

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

ul,
ol {
  list-style: none;
}

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

::selection {
  background: var(--accent-lime);
  color: var(--bg-main);
}

:focus-visible {
  outline: 2px solid var(--accent-lime);
  outline-offset: 2px;
}

#main-content {
  min-height: 60vh;
}

/* ========== UTILITIES ========== */
.container {
  width: min(100% - 48px, var(--container));
  margin-inline: auto;
}

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

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

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 20px;
  border: 1px solid var(--accent-moss);
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent-moss);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: background 200ms var(--ease), color 200ms var(--ease), border-color 200ms var(--ease);
}

.btn:hover {
  background: var(--accent-moss);
  color: var(--bg-main);
}

.btn-primary {
  border-color: var(--accent-lime);
  background: var(--accent-lime);
  color: var(--bg-main);
}

.btn-primary:hover {
  background: var(--accent-yellow);
  border-color: var(--accent-yellow);
  color: var(--bg-main);
}

/* ========== SKIP LINK ========== */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: var(--z-skip);
  padding: 8px 20px;
  background: var(--accent-lime);
  color: var(--bg-main);
  font-weight: 700;
  font-size: 14px;
  border-radius: 0 0 4px 4px;
  transition: top 200ms var(--ease);
}

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

/* ========== SCROLL PROGRESS ========== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--accent-lime);
  z-index: var(--z-progress);
  pointer-events: none;
}

/* ========== LIVE DOT ========== */
.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-lime);
  margin-right: 6px;
  vertical-align: middle;
  animation: live-pulse 2s ease-in-out infinite;
}

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

/* ========== HEADER ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: rgba(20, 24, 31, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-dark);
}

.header-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 24px;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--line-dark);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.topbar-live {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.header-main {
  max-width: var(--container);
  margin-inline: auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ========== BRAND ========== */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--text-light);
}

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

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 34px;
  background: var(--accent-lime);
  color: var(--bg-main);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  clip-path: polygon(18% 0, 100% 0, 82% 100%, 0 100%);
  transition: background 200ms var(--ease);
}

.brand:hover .brand-mark {
  background: var(--accent-yellow);
}

.brand-text {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.03em;
  color: var(--text-light);
  transition: color 200ms var(--ease);
}

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

/* ========== NAV ========== */
.site-nav {
  margin-inline: auto;
}

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

.nav-item {
  position: relative;
}

.nav-link {
  display: block;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius);
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: color 200ms var(--ease), background 200ms var(--ease);
}

.nav-link:hover {
  color: var(--text-light);
  background: rgba(106, 142, 127, 0.12);
}

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

.nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2px;
  background: var(--accent-lime);
  border-radius: 2px 2px 0 0;
}

/* ========== HEADER ACTIONS ========== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: color 200ms var(--ease), border-color 200ms var(--ease);
}

.btn-search:hover {
  color: var(--accent-lime);
  border-color: var(--accent-lime);
}

.header-version {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.btn-return {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1px solid var(--accent-yellow);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-yellow);
  letter-spacing: 0.05em;
  transition: background 200ms var(--ease), color 200ms var(--ease), border-color 200ms var(--ease);
}

.btn-return:hover {
  background: var(--accent-yellow);
  border-color: var(--accent-yellow);
  color: var(--bg-main);
}

/* ========== NAV TOGGLE ========== */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  padding: 8px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: transparent;
}

.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-light);
  border-radius: 2px;
  transition: transform 250ms var(--ease), opacity 200ms var(--ease), background 200ms var(--ease);
}

.nav-toggle:hover .nav-toggle-bar {
  background: var(--accent-lime);
}

.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);
}

/* ========== FOOTER ========== */
.site-footer {
  margin-top: 80px;
  background: var(--bg-panel);
  border-top: 1px solid var(--line-dark);
}

.footer-accent {
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--accent-lime) 0%,
    var(--accent-lime) 20%,
    var(--accent-yellow) 20%,
    var(--accent-yellow) 35%,
    var(--accent-terra) 35%,
    var(--accent-terra) 50%,
    var(--accent-moss) 50%,
    var(--accent-moss) 100%
  );
}

.footer-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 48px 0 24px;
  border-bottom: 1px solid var(--line-dark);
}

.footer-brand-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
  color: var(--text-light);
  letter-spacing: 0.05em;
}

.footer-slogan {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--accent-lime);
  letter-spacing: 0.18em;
  margin-top: 6px;
}

.footer-live {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-links {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1.5fr;
  gap: 40px;
  padding: 40px 0 32px;
}

.footer-col-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-dark);
}

.footer-col li {
  margin-bottom: 8px;
}

.footer-col li a {
  color: var(--text-light);
  font-size: 15px;
  line-height: 1.6;
  transition: color 200ms var(--ease);
}

.footer-col li a:hover {
  color: var(--accent-lime);
}

.footer-col-about {
  padding-right: 12px;
}

.footer-about-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.footer-email {
  font-size: 13px;
  color: var(--accent-moss);
  word-break: break-all;
}

.footer-col-contact li {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  word-break: break-all;
}

.footer-contact-note {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-dark);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 0;
  border-top: 1px solid var(--line-dark);
  background: var(--bg-deep);
  font-size: 13px;
  color: var(--text-muted);
}

.footer-bottom span {
  font-size: 13px;
}

/* ========== FLOAT RETURN ========== */
.float-return {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: var(--z-float);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  background: var(--accent-lime);
  border-radius: 999px;
  box-shadow: 0 4px 18px rgba(183, 225, 74, 0.28);
  font-size: 14px;
  font-weight: 700;
  color: var(--bg-main);
  letter-spacing: 0.05em;
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease), background 200ms var(--ease);
}

.float-return:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(183, 225, 74, 0.38);
  background: var(--accent-yellow);
  color: var(--bg-main);
}

.float-return-icon {
  display: block;
  transition: transform 200ms var(--ease);
}

.float-return:hover .float-return-icon {
  transform: translateX(2px);
}

/* ========== BREADCRUMB ========== */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.breadcrumb a {
  color: var(--text-muted);
  transition: color 200ms var(--ease);
}

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

.breadcrumb-sep {
  color: var(--line-dark);
  margin-inline: 2px;
}

.breadcrumb-current {
  color: var(--text-light);
}

/* ========== GRID ========== */
.grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(12, 1fr);
}

.grid-col-3 { grid-column: span 3; }
.grid-col-4 { grid-column: span 4; }
.grid-col-6 { grid-column: span 6; }
.grid-col-8 { grid-column: span 8; }
.grid-col-9 { grid-column: span 9; }

/* ========== CARD ========== */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  padding: 24px;
  transition: background 200ms var(--ease), transform 200ms var(--ease), box-shadow 200ms var(--ease);
}

.card:hover {
  background: #24342c;
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(11, 14, 17, 0.55);
}

.card-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  line-height: 1.4;
  color: var(--text-light);
  margin-bottom: 8px;
}

.card-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-muted);
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-lime);
}

.card-link:hover {
  color: var(--accent-yellow);
}

/* ========== SECTION ========== */
.section {
  padding: 48px 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.3;
  color: var(--text-light);
  letter-spacing: 0.02em;
}

.section-title-index {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 400;
  color: var(--accent-terra);
}

.section-desc {
  margin-top: 8px;
  font-size: 15px;
  color: var(--text-muted);
  max-width: 520px;
}

/* ========== TAG ========== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border: 1px solid var(--accent-moss);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-moss);
  letter-spacing: 0.04em;
}

.tag-terra {
  border-color: var(--accent-terra);
  color: var(--accent-terra);
}

.tag-yellow {
  border-color: var(--accent-yellow);
  color: var(--accent-yellow);
}

/* ========== IMG FRAME ========== */
.img-frame {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line-dark);
  background: var(--bg-deep);
  min-height: 120px;
}

.img-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 300ms var(--ease);
}

.img-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(11, 14, 17, 0.55) 100%);
  pointer-events: none;
  border-radius: var(--radius);
}

.img-frame:hover img {
  transform: scale(1.03);
}

/* ========== RESPONSIVE ========== */
@media (min-width: 1248px) {
  .header-topbar {
    padding-left: calc((100vw - var(--container)) / 2);
    padding-right: calc((100vw - var(--container)) / 2);
  }
}

@media (max-width: 1024px) {
  .footer-links {
    grid-template-columns: 1fr 1fr;
    gap: 32px 24px;
  }

  .grid-col-3,
  .grid-col-4,
  .grid-col-6,
  .grid-col-8,
  .grid-col-9 {
    grid-column: span 6;
  }
}

@media (max-width: 860px) {
  .header-topbar {
    padding: 4px 16px;
  }

  .header-main {
    padding: 10px 16px;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    flex-basis: 100%;
    order: 4;
    display: none;
    margin-inline: 0;
  }

  .site-nav[data-open] {
    display: block;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 0;
    border-top: 1px solid var(--line-dark);
  }

  .nav-item {
    border-bottom: 1px solid rgba(58, 43, 34, 0.6);
  }

  .nav-link {
    padding: 13px 8px;
    font-size: 15px;
  }

  .nav-link[aria-current="page"]::after {
    left: 0;
    right: auto;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    border-radius: 0 2px 2px 0;
  }

  .header-version {
    display: none;
  }

  .header-main {
    flex-wrap: wrap;
  }

  .brand-text {
    font-size: 19px;
  }
}

@media (max-width: 640px) {
  .topbar-live {
    display: none;
  }

  .topbar-meta {
    font-size: 11px;
  }

  .btn-return {
    padding: 5px 12px;
    font-size: 12px;
  }

  .float-return {
    right: 16px;
    bottom: 16px;
    padding: 10px 16px;
    font-size: 13px;
  }

  .footer-head {
    padding-top: 36px;
  }

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

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

  .grid {
    gap: 16px;
  }

  .grid-col-3,
  .grid-col-4,
  .grid-col-6,
  .grid-col-8,
  .grid-col-9 {
    grid-column: span 12;
  }

  .section {
    padding: 32px 0;
  }

  .card {
    padding: 18px;
  }
}

@media (max-width: 400px) {
  .brand-text {
    font-size: 17px;
  }

  .brand-mark {
    width: 32px;
    height: 30px;
    font-size: 17px;
  }

  .btn-search {
    width: 30px;
    height: 30px;
  }
}

/* ========== REDUCED MOTION ========== */
@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;
  }

  .live-dot {
    animation: none;
  }
}
