/* =========================================================
   QMH 球盟会中文官方站 — Shared Site CSS
   File: /assets/site.css
   ========================================================= */

/* ---------- 1. Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd, ul, ol,
pre, fieldset, legend, textarea {
  margin: 0;
}

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

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

input, button, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

/* ---------- 2. Variables & base ---------- */
:root {
  --teal: #0E4F5C;
  --teal-2: #1B9AAA;
  --orange: #F77B22;
  --orange-light: #FFB067;
  --cream: #F5F0E0;
  --brown: #2D1F14;
  --teal-dark: #0A3B45;
  --white: #FFFFFF;
  --teal-trans: rgba(14, 79, 92, 0.2);

  --font-head: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Source Sans 3", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --sidebar-w: 280px;
  --header-h: 62px;
  --content-w: 1160px;

  --shadow-soft: 4px 4px 0 rgba(14, 79, 92, 0.08);
}

html {
  background: var(--cream);
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--brown);
  background-color: transparent;
  min-height: 100vh;
  overflow-x: hidden;
}

@media (min-width: 1024px) {
  body {
    padding-left: var(--sidebar-w);
  }
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 900;
  line-height: 1.25;
  color: var(--teal);
}

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

.content a {
  color: var(--teal-2);
  text-decoration: underline;
  text-decoration-color: rgba(27, 154, 170, 0.4);
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

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

.content h2 {
  font-size: 1.6rem;
  margin: 36px 0 14px;
}

.content h3 {
  font-size: 1.2rem;
  margin: 28px 0 10px;
}

.content p {
  margin-bottom: 16px;
  max-width: 70ch;
}

.content ul,
.content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.content ul {
  list-style: disc;
}

.content ol {
  list-style: decimal;
}

.content li {
  margin-bottom: 6px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--teal-trans);
  padding: 2px 5px;
  color: var(--teal);
}

::selection {
  background: var(--orange);
  color: var(--brown);
}

:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

/* ---------- 3. Decorative fixed layers ---------- */
body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: -1;
}

body::before {
  content: "QMH·ZONE";
  right: 24px;
  bottom: -14px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(90px, 16vw, 200px);
  letter-spacing: -0.05em;
  line-height: 1;
  color: rgba(14, 79, 92, 0.055);
}

body::after {
  right: 0;
  bottom: 0;
  width: 44vw;
  height: 30vh;
  background: linear-gradient(105deg, rgba(27, 154, 170, 0.045) 30%, rgba(247, 123, 34, 0.03) 100%);
  clip-path: polygon(0 100%, 9% 74%, 19% 84%, 33% 50%, 47% 76%, 61% 34%, 74% 68%, 88% 24%, 100% 46%, 100% 100%);
}

/* ---------- 4. Skip link ---------- */
.skip-link {
  position: fixed;
  top: 8px;
  left: calc(var(--sidebar-w) + 16px);
  z-index: 2000;
  background: var(--orange);
  color: var(--brown);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 16px;
  border: 2px solid var(--brown);
  box-shadow: 2px 2px 0 rgba(45, 31, 20, 0.3);
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

@media (max-width: 1023px) {
  .skip-link {
    left: 8px;
  }
}

/* ---------- 5. Header / brand track ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: var(--teal);
  color: var(--cream);
  border-right: 1px solid rgba(245, 240, 224, 0.16);
}

.scroll-progress {
  position: absolute;
  top: 0;
  right: 0;
  width: 3px;
  height: 100%;
  background: rgba(245, 240, 224, 0.13);
  z-index: 2;
}

.scroll-progress-bar {
  width: 100%;
  height: 0%;
  background: var(--orange);
}

.brand-block {
  padding: 30px 24px 22px;
  border-bottom: 1px solid rgba(245, 240, 224, 0.13);
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
}

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

.brand-slash {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--orange);
}

.brand-name {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.brand-tagline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(245, 240, 224, 0.22);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal-2);
}

.brand-en {
  color: var(--orange-light);
  letter-spacing: 0.08em;
}

.nav-trigger {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(245, 240, 224, 0.55);
  color: var(--cream);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.nav-trigger:hover {
  border-color: var(--orange);
}

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

.nav-trigger-icon i {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--cream);
  transition: transform 0.25s ease, opacity 0.25s ease, background-color 0.25s ease;
}

.nav-trigger[aria-expanded="true"] .nav-trigger-icon i:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
  background: var(--orange);
}

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

.nav-trigger[aria-expanded="true"] .nav-trigger-icon i:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
  background: var(--orange);
}

.site-nav {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  padding: 18px 0;
  overflow-y: auto;
}

.nav-list {
  width: 100%;
}

.nav-item {
  border-bottom: 1px solid rgba(245, 240, 224, 0.1);
}

.nav-item:first-child {
  border-top: 1px solid rgba(245, 240, 224, 0.1);
}

.nav-link {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 15px 24px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.95rem;
  color: rgba(245, 240, 224, 0.82);
  letter-spacing: 0.04em;
  border-left: 3px solid transparent;
  transition: background-color 0.18s ease, color 0.18s ease, padding-left 0.18s ease;
}

.nav-link::before {
  content: attr(data-index);
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--orange);
  letter-spacing: 0.05em;
  min-width: 24px;
}

.nav-link:hover {
  color: var(--white);
  background: rgba(27, 154, 170, 0.16);
  padding-left: 28px;
}

.nav-link[aria-current="page"] {
  color: var(--brown);
  background: var(--orange);
  border-left-color: var(--brown);
  padding-left: 28px;
}

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

.header-update {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 24px;
  border-top: 1px solid rgba(245, 240, 224, 0.13);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(245, 240, 224, 0.8);
  line-height: 1.5;
}

.update-pulse {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  background: var(--orange);
  animation: pulse 1.8s ease-in-out infinite;
}

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

/* ---------- 6. Footer ---------- */
.site-footer {
  background: var(--teal-dark);
  color: rgba(245, 240, 224, 0.76);
  padding: 48px 24px 22px;
  border-top: 4px solid var(--orange);
}

.footer-wrap {
  max-width: calc(var(--content-w) + 80px);
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.2fr;
  gap: 36px;
  align-items: start;
}

.footer-trust {
  margin-top: 14px;
  max-width: 44ch;
  font-size: 0.88rem;
  line-height: 1.7;
  color: rgba(245, 240, 224, 0.72);
}

.footer-address {
  margin-top: 12px;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: rgba(245, 240, 224, 0.5);
}

.footer-heading {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 14px;
}

.footer-links li {
  margin-bottom: 6px;
}

.footer-links a {
  display: inline-block;
  color: rgba(245, 240, 224, 0.85);
  font-weight: 600;
  font-size: 0.92rem;
  transition: color 0.15s ease, transform 0.15s ease;
}

.footer-links a::before {
  content: "› ";
  color: var(--orange);
}

.footer-links a:hover {
  color: var(--orange-light);
  transform: translateX(2px);
}

.footer-contact li {
  padding: 4px 0;
  font-size: 0.9rem;
  color: rgba(245, 240, 224, 0.85);
}

.footer-contact li::before {
  content: "▪";
  color: var(--orange);
  margin-right: 8px;
  font-size: 0.6rem;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid rgba(245, 240, 224, 0.13);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: rgba(245, 240, 224, 0.5);
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

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

  .footer-meta {
    flex-direction: column;
  }
}

/* ---------- 7. Layout utilities ---------- */
.container {
  max-width: var(--content-w);
  margin: 0 auto;
  padding-inline: 28px;
}

@media (max-width: 767px) {
  .container {
    padding-inline: 16px;
  }
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 22px;
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--teal-trans);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  color: var(--teal-2);
}

.breadcrumb a {
  color: var(--teal);
  font-weight: 600;
  transition: color 0.15s ease;
}

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

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

.rule {
  height: 1px;
  background: var(--teal-trans);
  border: 0;
  margin: 28px 0;
}

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

.upper {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---------- 8. Reusable components ---------- */
.section-block {
  position: relative;
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 16px;
  align-items: start;
  padding: 34px 0;
  border-bottom: 1px solid var(--teal-trans);
}

.section-num {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 1.05;
  color: var(--orange);
  letter-spacing: 0.08em;
  justify-self: start;
}

.section-title {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.75rem;
  line-height: 1.25;
  color: var(--teal);
}

.section-title::after {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  margin-top: 10px;
  background: var(--orange);
}

.section-desc {
  margin-top: 10px;
  font-size: 0.92rem;
  color: var(--brown);
  opacity: 0.74;
  max-width: 64ch;
}

@media (max-width: 767px) {
  .section-block {
    grid-template-columns: 44px 1fr;
    gap: 10px;
  }

  .section-num {
    font-size: 1.6rem;
  }

  .section-title {
    font-size: 1.4rem;
  }
}

.btn {
  display: inline-block;
  padding: 11px 20px;
  border: 2px solid var(--teal);
  background: transparent;
  color: var(--teal);
  font-weight: 700;
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-align: center;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.btn:hover {
  background: var(--teal);
  color: var(--cream);
}

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

.btn-primary:hover {
  background: var(--orange-light);
  border-color: var(--orange-light);
  color: var(--brown);
}

.btn-outline {
  border-color: var(--teal-2);
  color: var(--teal-2);
}

.btn-outline:hover {
  background: var(--teal-2);
  border-color: var(--teal-2);
  color: var(--cream);
}

.panel {
  background: var(--cream);
  border: 1px solid rgba(14, 79, 92, 0.16);
  border-left: 4px solid var(--teal-2);
  padding: 20px 22px;
  transition: box-shadow 0.16s ease, transform 0.16s ease;
}

.panel:hover {
  box-shadow: var(--shadow-soft);
  transform: translateY(-2px);
}

.panel-head {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.12rem;
  color: var(--teal);
  margin-bottom: 6px;
}

.panel-desc {
  font-size: 0.9rem;
  color: var(--brown);
  opacity: 0.78;
  line-height: 1.65;
}

.data-card {
  position: relative;
  background: var(--cream);
  border: 1px solid rgba(14, 79, 92, 0.16);
  box-shadow: 3px 3px 0 rgba(14, 79, 92, 0.1);
  padding: 20px 18px 18px;
  font-family: var(--font-mono);
}

.data-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--teal-2);
}

.data-card--hot::before {
  background: var(--orange);
}

.data-card-num {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.05;
  color: var(--teal);
}

.data-card--hot .data-card-num {
  color: var(--orange);
}

.data-card-label {
  display: block;
  margin-top: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: rgba(45, 31, 20, 0.75);
}

.data-card-desc {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--teal-2);
}

.tag-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  background: var(--teal-trans);
  border: 1px solid rgba(14, 79, 92, 0.25);
  color: var(--teal);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tag-label::before {
  content: "▪";
  color: var(--orange);
  font-size: 0.6rem;
}

.tag-label--orange {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--white);
}

.tag-label--orange::before {
  color: var(--brown);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border: 1px solid var(--teal);
  background: transparent;
  color: var(--teal);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.filter-btn::before {
  content: "▪";
  font-size: 0.55rem;
  color: var(--orange);
  transition: color 0.15s ease;
}

.filter-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.filter-btn[aria-pressed="true"] {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--cream);
}

.filter-btn[aria-pressed="true"]::before {
  color: var(--orange-light);
}

.chapter-preview {
  display: grid;
  gap: 16px;
}

@media (min-width: 768px) {
  .chapter-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.chapter-preview-item {
  position: relative;
  background: var(--cream);
  border: 1px solid rgba(14, 79, 92, 0.16);
  border-top: 4px solid var(--teal);
  padding: 20px 20px 18px;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.chapter-preview-item:hover {
  transform: translateY(-3px);
  box-shadow: 4px 5px 0 rgba(14, 79, 92, 0.14);
}

.chapter-preview-num {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--orange);
  letter-spacing: 0.1em;
}

.chapter-preview-title {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.18rem;
  color: var(--teal);
  margin-top: 6px;
}

.chapter-preview-desc {
  margin-top: 6px;
  font-size: 0.86rem;
  color: var(--brown);
  opacity: 0.76;
  line-height: 1.6;
}

.image-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 120px;
  background:
    repeating-linear-gradient(135deg, rgba(14, 79, 92, 0.045) 0 8px, rgba(14, 79, 92, 0) 8px 16px),
    var(--cream);
  border: 1px solid rgba(14, 79, 92, 0.2);
  color: var(--teal);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-align: center;
  padding: 14px 8px;
  overflow: hidden;
}

.image-frame::before {
  content: attr(data-caption);
}

.image-frame--16x9 {
  aspect-ratio: 16 / 9;
}

.image-frame--21x9 {
  aspect-ratio: 21 / 9;
}

.image-frame--3x4 {
  aspect-ratio: 3 / 4;
}

.image-frame--diag {
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 28px), 0 100%);
}

/* ---------- 9. Mobile navigation & breakpoints ---------- */
@media (max-width: 1023px) {
  body {
    padding-left: 0;
  }

  .site-header {
    top: auto;
    right: 0;
    bottom: auto;
    width: 100%;
    height: var(--header-h);
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 16px;
    border-right: 0;
    border-bottom: 3px solid var(--orange);
  }

  .brand-block {
    padding: 0;
    border-bottom: 0;
    flex-shrink: 0;
  }

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

  .brand-slash {
    font-size: 0.95rem;
  }

  .brand-tagline {
    display: none;
  }

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

  .scroll-progress,
  .header-update {
    display: none;
  }

  .site-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex: none;
    justify-content: flex-start;
    max-height: calc(100vh - var(--header-h));
    padding: 12px 0 24px;
    overflow-y: auto;
    background: var(--teal-dark);
    border-bottom: 3px solid var(--orange);
    box-shadow: 0 18px 34px rgba(10, 59, 69, 0.28);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-16px);
    transition: transform 0.28s ease, opacity 0.28s ease, visibility 0.28s ease;
  }

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

  .nav-link {
    padding: 15px 20px;
    font-size: 0.98rem;
  }

  .nav-link:hover,
  .nav-link[aria-current="page"] {
    padding-left: 24px;
  }
}

@media (max-width: 480px) {
  .brand-name {
    font-size: 1.1rem;
  }

  .nav-trigger-word {
    display: none;
  }

  .nav-trigger {
    padding: 10px;
  }
}

/* ---------- 10. Scrollbar & reduced motion ---------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--cream);
}

::-webkit-scrollbar-thumb {
  background: var(--teal-2);
  border: 2px solid var(--cream);
}

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

  .chapter-preview-item:hover,
  .panel:hover,
  .footer-links a:hover {
    transform: none;
  }
}
