@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

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

:root {
  --paper: #fdfbf7;
  --paper-mid: #f5f5f5;
  --ink: #1a1a1a;
  --ink-light: #444444;
  --ink-muted: #777777;
  --border: #d0ccc4;
  --border-light: #e8e4de;
  --accent: #1a1a1a;
  --card-radius: 28px;
  --font-main: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --max-w: 860px;
  --max-w-wide: 1100px;
}

html {
  font-size: 17px;
  line-height: 1.65;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-main);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: auto;
}

body {
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  position: relative;
}

/* Paper texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-size: 300px 300px;
}

/* ===== PAGE WRAP ===== */
.page-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== HEADER & NAV ===== */
.site-header {
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 1.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.brand-link {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.brand-tagline {
  font-size: 0.78rem;
  color: var(--ink-muted);
  font-weight: 400;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* nav: header > nav > a×n */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  padding: 0 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.65rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  border-right: 1px solid var(--border-light);
  min-height: 44px;
  transition: none;
}

.nav-link:hover,
.nav-link--active {
  background: var(--ink);
  color: var(--paper);
}

.nav-search {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 0;
}

.nav-search input[type="search"] {
  border: 1px solid var(--border);
  border-right: none;
  background: var(--paper-mid);
  color: var(--ink);
  font-family: var(--font-main);
  font-size: 0.82rem;
  padding: 0.4rem 0.75rem;
  height: 40px;
  outline: none;
  min-width: 120px;
  border-radius: 0;
}

.nav-search input[type="search"]:focus {
  border-color: var(--ink);
  background: var(--paper);
}

.nav-search button {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0 0.85rem;
  height: 40px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: none;
}

.nav-search button:hover {
  background: var(--paper);
  color: var(--ink);
}

/* ===== PAGE BODY ===== */
.page-body {
  flex: 1;
  padding: 2rem 1.5rem;
}

/* div > main > article structure */
.main-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
}

.content-article {
  width: 100%;
}

/* ===== HERO (HOME) ===== */
.hero-block {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 2rem;
  min-height: 45vh;
  padding: 2.5rem 0 2rem;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 2.5rem;
  position: relative;
}

.hero-text {
  text-align: right;
  max-width: 580px;
  margin-left: auto;
}

.hero-eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  display: inline-block;
  padding: 0.2rem 0.6rem;
}

.hero-h1 {
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hero-desc {
  font-size: 1rem;
  color: var(--ink-light);
  line-height: 1.6;
  max-width: 480px;
  margin-left: auto;
}

.hero-media {
  flex-shrink: 0;
  width: 180px;
  align-self: center;
}

.hero-dot-grid {
  width: 160px;
  height: 160px;
  background-image: radial-gradient(circle, var(--ink) 1.2px, transparent 1.2px);
  background-size: 14px 14px;
  opacity: 0.18;
  border-radius: 4px;
}

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

/* ===== ARTICLE HEADER ===== */
.article-header {
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 2rem;
}

.article-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.65rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.article-eyebrow::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  vertical-align: middle;
}

.article-h1 {
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.article-meta-desc {
  font-size: 0.95rem;
  color: var(--ink-light);
  line-height: 1.6;
  max-width: 640px;
}

.article-dates {
  margin-top: 0.75rem;
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.article-date,
.article-date-mod {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  font-style: normal;
}

.article-hero {
  margin-bottom: 2rem;
  border: 1px solid var(--border);
}

.article-hero-img {
  width: 100%;
  height: auto;
  display: block;
}

/* ranking header accent */
.ranking-header {
  background: var(--paper-mid);
  padding: 1.5rem;
  border-left: 4px solid var(--ink);
  margin-bottom: 0;
}

/* about header accent */
.about-header {
  border-left: 6px double var(--ink);
  padding-left: 1.25rem;
}

/* privacy header */
.privacy-header {
  border-top: 4px solid var(--ink);
  padding-top: 1.5rem;
}

/* ===== CONTENT BODY ===== */
.content-body {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink);
}

.content-body h2 {
  font-size: 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 2rem 0 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.content-body h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.5rem 0 0.6rem;
  letter-spacing: 0.02em;
}

.content-body p {
  margin-bottom: 1rem;
}

.content-body a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}

.content-body a:hover {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

.content-body ul,
.content-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.content-body li {
  margin-bottom: 0.35rem;
}

.content-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.92rem;
}

.content-body th,
.content-body td {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  text-align: left;
}

.content-body th {
  background: var(--paper-mid);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.content-body blockquote {
  border-left: 3px solid var(--ink);
  padding-left: 1.25rem;
  margin: 1.25rem 0;
  color: var(--ink-light);
  font-style: italic;
}

.content-body code {
  font-family: 'Courier New', monospace;
  font-size: 0.88em;
  background: var(--paper-mid);
  padding: 0.1em 0.4em;
  border: 1px solid var(--border);
}

.content-body pre {
  background: var(--paper-mid);
  border: 1px solid var(--border);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 1.25rem 0;
}

.content-body--legal {
  font-size: 0.93rem;
}

/* ===== EYEBROW + SECTION HEADING ===== */
/* h2 前有 <small> 眉题 */
.eyebrow-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.3rem;
}

.section-heading {
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1.25rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--ink);
}

/* ===== CARDS TABLE (HOME) ===== */
/* 子页列表：table > tbody > tr > td */
.cards-section {
  margin-top: 2.5rem;
}

.cards-table {
  width: 100%;
  border-spacing: 0 0.85rem;
  border-collapse: separate;
}

.cards-table tbody tr td {
  padding: 0;
}

.card {
  background: var(--paper-mid);
  border-radius: var(--card-radius);
  overflow: hidden;
}

.card-inner {
  padding: 1.5rem 1.75rem;
  position: relative;
}

.card-type {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  margin-bottom: 0.5rem;
}

.card-date {
  font-size: 0.75rem;
  color: var(--ink-muted);
  font-weight: 500;
  margin-left: 0.75rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0.5rem 0 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.25;
}

.card-title a {
  color: var(--ink);
  text-decoration: none;
}

.card-title a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--ink-light);
  line-height: 1.55;
  margin-bottom: 0.85rem;
}

.card-cta {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 1px;
}

.card-cta:hover {
  background: var(--ink);
  color: var(--paper);
  padding: 0.1rem 0.35rem;
  border-bottom: none;
}

/* ===== SIBLING TABLE ===== */
.related-section {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.sib-table {
  width: 100%;
  border-collapse: collapse;
}

.sib-cell {
  padding: 0;
  border-bottom: 1px solid var(--border-light);
}

.sib-link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem 0.5rem;
  text-decoration: none;
  color: var(--ink);
}

.sib-link:hover {
  background: var(--paper-mid);
  padding-left: 1rem;
}

.sib-title {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.sib-desc {
  font-size: 0.82rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

.sib-meta {
  font-size: 0.75rem;
  color: var(--ink-muted);
}

/* ===== BACK NAV ===== */
.back-nav {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.back-link {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 0.25rem;
  border-bottom: 2px solid transparent;
}

.back-link:hover {
  border-bottom-color: var(--ink);
}

/* ===== ABOUT LINKS ===== */
.about-links {
  margin-top: 2rem;
}

/* ===== FOOTER ===== */
/* footer 三列 dl */
.site-footer {
  background: var(--ink);
  color: var(--paper);
  display: flex;
  gap: 0;
  padding: 2.5rem 2rem;
  margin-top: auto;
  border-top: 3px solid var(--ink);
}

.footer-col {
  flex: 1;
  padding: 0 1.25rem;
  border-right: 1px solid rgba(253,251,247,0.12);
}

.footer-col:first-child {
  padding-left: 0;
}

.footer-col--right {
  border-right: none;
  text-align: right;
}

.site-footer dt {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(253,251,247,0.5);
  margin-bottom: 0.75rem;
}

.site-footer dd {
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 0.3rem;
}

.site-footer a {
  color: var(--paper);
  text-decoration: none;
  opacity: 0.8;
}

.site-footer a:hover {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-copy {
  font-size: 0.75rem;
  opacity: 0.5;
  margin-top: 0.5rem;
  display: block;
}

/* ===== PARALLAX / CAROUSEL (prefers-reduced-motion aware) ===== */
@media (prefers-reduced-motion: no-preference) {
  .cards-table {
    /* subtle stagger via scroll-driven if supported, fallback graceful */
  }
  .card {
    will-change: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .header-brand-row {
    padding: 0.6rem 1rem 0.4rem;
    flex-wrap: wrap;
  }

  .brand-tagline {
    display: none;
  }

  .site-nav {
    padding: 0 0.5rem;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .nav-link {
    padding: 0.6rem 0.6rem;
    font-size: 0.75rem;
    min-height: 44px;
    flex-shrink: 0;
  }

  .nav-search {
    flex-shrink: 0;
  }

  .nav-search input[type="search"] {
    min-width: 80px;
    width: 90px;
  }

  .page-body {
    padding: 1.25rem 1rem;
  }

  .hero-block {
    flex-direction: column-reverse;
    align-items: flex-end;
    min-height: auto;
    padding: 1.5rem 0 1.5rem;
    gap: 1.25rem;
  }

  .hero-text {
    max-width: 100%;
  }

  .hero-h1 {
    font-size: clamp(1.45rem, 7vw, 2rem);
  }

  .hero-media {
    width: 100px;
  }

  .hero-dot-grid {
    width: 100px;
    height: 100px;
  }

  .article-h1 {
    font-size: clamp(1.3rem, 6vw, 1.9rem);
  }

  .card-inner {
    padding: 1.1rem 1.25rem;
  }

  .site-footer {
    flex-direction: column;
    padding: 1.75rem 1.25rem;
    gap: 1.5rem;
  }

  .footer-col {
    padding: 0;
    border-right: none;
    border-bottom: 1px solid rgba(253,251,247,0.12);
    padding-bottom: 1.25rem;
  }

  .footer-col--right {
    text-align: left;
    border-bottom: none;
  }

  .back-nav {
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .nav-link {
    font-size: 0.7rem;
    padding: 0.55rem 0.5rem;
  }

  .section-heading {
    font-size: 1rem;
  }

  .cards-table {
    border-spacing: 0 0.65rem;
  }

  .article-dates {
    flex-direction: column;
    gap: 0.3rem;
  }

  .content-body table {
    font-size: 0.82rem;
    display: block;
    overflow-x: auto;
  }
}

/* ===== DOT MATRIX DECORATION ===== */
.dot-matrix-bg {
  background-image: radial-gradient(circle, var(--ink) 1px, transparent 1px);
  background-size: 12px 12px;
  opacity: 0.06;
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* ===== CAROUSEL (home cards auto-rotation) ===== */
@media (min-width: 769px) and (prefers-reduced-motion: no-preference) {
  .cards-table tbody tr td .card {
    transition: box-shadow 0.15s;
  }
  .cards-table tbody tr td .card:hover {
    box-shadow: 4px 4px 0 var(--ink);
  }
}

/* ===== PRINT ===== */
@media print {
  .site-header,
  .site-footer,
  .nav-search,
  .back-nav {
    display: none;
  }
  body {
    font-size: 12pt;
  }
}
